|
|
@@ -213,12 +213,7 @@ Component({
|
|
|
* 跳转到 H5 主页
|
|
|
*/
|
|
|
async navigateToHome() {
|
|
|
- console.log('===========================================');
|
|
|
- console.log('======= 小程序跳转 H5 =======');
|
|
|
- console.log('===========================================');
|
|
|
-
|
|
|
const currentUser = Parse.User.current();
|
|
|
- console.log('📱 当前用户:', currentUser);
|
|
|
const isAuth = login.loginNow()
|
|
|
|
|
|
if (!currentUser || !isAuth) {
|
|
|
@@ -235,9 +230,6 @@ Component({
|
|
|
}
|
|
|
|
|
|
let token = currentUser.getSessionToken();
|
|
|
- console.log('🔑 当前 Session Token:', token);
|
|
|
- console.log(' - Token 长度:', token ? token.length : 0);
|
|
|
- console.log(' - Token 前20个字符:', token ? token.substring(0, 20) : 'null');
|
|
|
|
|
|
if (!token) {
|
|
|
console.error('❌ 无法获取 Session Token!');
|
|
|
@@ -249,11 +241,9 @@ Component({
|
|
|
}
|
|
|
|
|
|
// 验证 token 是否有效
|
|
|
- console.log('🔍 验证 token 有效性...');
|
|
|
const isValid = await this.validateToken(token);
|
|
|
|
|
|
if (!isValid) {
|
|
|
- console.log('⚠️ Token 已失效,尝试刷新...');
|
|
|
wx.showLoading({
|
|
|
title: '正在刷新登录...'
|
|
|
});
|
|
|
@@ -265,7 +255,6 @@ Component({
|
|
|
|
|
|
if (newToken) {
|
|
|
token = newToken;
|
|
|
- console.log('✅ 使用新的 token:', token.substring(0, 20));
|
|
|
} else {
|
|
|
console.error('❌ Token 刷新失败,需要重新登录');
|
|
|
wx.showModal({
|
|
|
@@ -281,7 +270,7 @@ Component({
|
|
|
return;
|
|
|
}
|
|
|
} else {
|
|
|
- console.log('✅ Token 验证通过');
|
|
|
+ // token 验证通过
|
|
|
}
|
|
|
|
|
|
// 获取店铺信息
|
|
|
@@ -457,16 +446,8 @@ Component({
|
|
|
|
|
|
h5Url += `token=${token}`;
|
|
|
|
|
|
- console.log('🌐 H5 URL:', h5Url);
|
|
|
- console.log(' - URL 长度:', h5Url.length);
|
|
|
- console.log(' - 页面路径:', pagePath);
|
|
|
- if (storeId) {
|
|
|
- console.log(' - 店铺 ID:', storeId);
|
|
|
- }
|
|
|
-
|
|
|
// 编码后的 URL
|
|
|
const encodedUrl = encodeURIComponent(h5Url);
|
|
|
- console.log('📦 编码后的 URL:', encodedUrl.substring(0, 100) + '...');
|
|
|
|
|
|
// 最终的小程序页面路径
|
|
|
// 传递店铺信息给 web-view 页面,优先用于设置标题
|
|
|
@@ -477,14 +458,10 @@ Component({
|
|
|
if (storeName) {
|
|
|
webViewPath += `&storeName=${encodeURIComponent(storeName)}`;
|
|
|
}
|
|
|
- console.log('📄 web-view 页面路径:', webViewPath.substring(0, 100) + '...');
|
|
|
- console.log('===========================================');
|
|
|
|
|
|
wx.navigateTo({
|
|
|
url: webViewPath,
|
|
|
- success: () => {
|
|
|
- console.log('✅ 跳转成功');
|
|
|
- },
|
|
|
+ success: () => {},
|
|
|
fail: (err) => {
|
|
|
console.error('❌ 跳转失败:', err);
|
|
|
wx.showToast({
|