敖欣乐 před 12 hodinami
rodič
revize
d4ec7db607

+ 16 - 3
common-page/pages/web-view/index.js

@@ -126,6 +126,21 @@ Page({
             return;
         }
 
+        // 若与当前标题一致则跳过,避免频繁触发
+        if (title === this.data.currentTitle) {
+            return;
+        }
+
+        // 简单节流:500ms 内重复更新跳过
+        if (!this._lastTitleUpdateTs) {
+            this._lastTitleUpdateTs = 0;
+        }
+        const now = Date.now();
+        if (now - this._lastTitleUpdateTs < 500) {
+            return;
+        }
+        this._lastTitleUpdateTs = now;
+
         // 更新当前标题记录
         this.setData({
             currentTitle: title
@@ -134,9 +149,7 @@ Page({
         // 调用微信 API 设置标题
         wx.setNavigationBarTitle({
             title: title,
-            success: () => {
-                console.log('✅ 标题已更新:', title);
-            },
+            success: () => {},
             fail: (err) => {
                 console.error('❌ 标题设置失败:', err);
             }

+ 2 - 25
nova-pbf/components/home/index.js

@@ -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({

+ 1 - 28
nova-pbf/pages/index/index.js

@@ -111,58 +111,31 @@ Page({
    */
   loadAndSetStoreTitle: async function () {
     try {
-      console.log('===========================================');
-      console.log('======= 引导页:开始设置页面标题 =======');
-      console.log('===========================================');
-      
       // 计算当前有效的店铺 ID
       const defaultStoreId = 'Zr65KGWXHx';
       const effectiveStoreId = wx.getStorageSync('storeId') || getApp().globalData.storeId || defaultStoreId;
-      console.log('🏪 使用店铺 ID:', effectiveStoreId);
       
       // 查询指定的店铺
       const storeQuery = new Parse.Query('ShopStore');
       storeQuery.equalTo('objectId', effectiveStoreId);
-      
-      console.log('🔍 正在查询 ShopStore 表...');
       const store = await storeQuery.first();
       
       if (store) {
         const storeName = store.get('storeName');
-        console.log('🏪 查询到店铺信息:', {
-          storeId: store.id,
-          storeName: storeName
-        });
         
         if (storeName) {
           // ✅ 立即同步设置导航栏标题
-          console.log('🎯 立即设置标题为:', storeName);
           wx.setNavigationBarTitle({
             title: storeName,
-            success: () => {
-              console.log('✅✅✅ 引导页标题设置成功:', storeName);
-              console.log('===========================================');
-            },
+            success: () => {},
             fail: (err) => {
               console.error('❌❌❌ 引导页标题设置失败:', err);
-              console.log('===========================================');
             }
           });
-        } else {
-          console.warn('⚠️ 店铺信息中没有 storeName 字段');
-          console.log('📋 店铺所有字段:', store.attributes);
-          console.log('===========================================');
         }
-      } else {
-        console.warn('⚠️ 未找到指定店铺信息 (ID:', effectiveStoreId, ')');
-        console.log('💡 请检查:');
-        console.log('   1. ShopStore 表中是否存在该店铺');
-        console.log('   2. 店铺 ID 是否正确:', effectiveStoreId);
-        console.log('===========================================');
       }
     } catch (error) {
       console.error('❌ 加载店铺信息失败:', error);
-      console.log('===========================================');
     }
   }
 })