diff --git a/App.vue b/App.vue index 0978c03..6c53ee3 100644 --- a/App.vue +++ b/App.vue @@ -108,7 +108,7 @@ // #endif // #ifdef MP // 小程序静默授权 - console.log('[auth-flow] App onLaunch: isLogin=' + this.$store.getters.isLogin + ', expired=' + this.getExpired()); + console.log('[auth-flow] App onLaunch: isLogin=' + this.$store.getters.isLogin); if (!this.$store.getters.isLogin) { Routine.getCode().then(code => { console.log('[auth-flow] App onLaunch: wx.login 拿到 code=' + (code ? code.substring(0, 10) + '...' : '(空)')); diff --git a/pages.json b/pages.json index 5d90dd1..064799b 100644 --- a/pages.json +++ b/pages.json @@ -392,14 +392,12 @@ } }, { - "path": "user_spread_user/index", "style": { "navigationStyle": "custom", "navigationBarTitleText": "我的推广" } }, { - "path": "user_spread_code/index", "style": { "navigationBarTitleText": "分销海报", "app-plus": { @@ -412,7 +410,6 @@ } }, { - "path": "user_spread_money/index", "style": { "navigationBarTitleText": "佣金记录", "navigationBarTextStyle": "black", @@ -427,7 +424,6 @@ } }, { - "path": "user_spread_money/receiving", "style": { "navigationBarTitleText": "收款", "navigationBarTextStyle": "black", @@ -457,7 +453,6 @@ } }, { - "path": "user_cash/index", "style": { "navigationBarTitleText": "提现", // #ifndef APP-PLUS @@ -477,7 +472,6 @@ } }, { - "path": "user_cash/status", "style": { "navigationBarTitleText": "提现审核", "app-plus": { @@ -634,7 +628,6 @@ } }, { - "path": "promoter-list/index", "style": { "navigationBarTitleText": "我的团队" // #ifdef MP @@ -653,7 +646,6 @@ } }, { - "path": "promoter-order/index", "style": { "navigationBarTitleText": "分销订单" @@ -673,7 +665,6 @@ } }, { - "path": "promoter_rank/index", "style": { "navigationStyle": "custom", "navigationBarTextStyle": "black", @@ -688,7 +679,6 @@ } }, { - "path": "commission_rank/index", "style": { "navigationStyle": "custom", // #ifdef APP-PLUS @@ -771,14 +761,12 @@ } } }, { - "path": "distributor/apply", "style": { "navigationBarTitleText": "分销员申请", "navigationStyle": "custom", "enablePullDownRefresh": false } },{ - "path": "distributor/index", "style": { "navigationBarTitleText": "", "navigationStyle": "custom", @@ -871,7 +859,6 @@ } }, { - "path" : "spreadData/index", "style" : { "navigationBarTitleText" : "", @@ -886,7 +873,6 @@ } }, { - "path" : "spreadData/contributionRank", "style" : { "navigationBarTitleText" : "", diff --git a/pages/annex/web_view/index.vue b/pages/annex/web_view/index.vue index abb722e..fa95460 100644 --- a/pages/annex/web_view/index.vue +++ b/pages/annex/web_view/index.vue @@ -1,14 +1,9 @@ - - - diff --git a/pages/goods/lottery/grids/record.vue b/pages/goods/lottery/grids/record.vue index e4052e6..ce991de 100644 --- a/pages/goods/lottery/grids/record.vue +++ b/pages/goods/lottery/grids/record.vue @@ -107,11 +107,13 @@ url: '/pages/users/user_money/index' }) } else if (type == 4) { - if(item.wechat_state == 'WAIT_USER_CONFIRM'){ - uni.navigateTo({ - url: '/pages/users/user_spread_money/receiving?type=2&id=' + item.order_id - }) - } + // 微信红包/佣金奖品:原跳 user_spread_money/receiving(页面已移除,审核要求,待恢复) + // if(item.wechat_state == 'WAIT_USER_CONFIRM'){ + // uni.navigateTo({ + // url: '/pages/users/user_spread_money/receiving?type=2&id=' + item.order_id + // }) + // } + uni.showToast({ title: '请联系客服领取奖品', icon: 'none' }) } else if (type == 5) { uni.navigateTo({ url: '/pages/users/user_coupon/index' diff --git a/pages/user/components/member/template4.vue b/pages/user/components/member/template4.vue index 9aa603c..8b0b9c8 100644 --- a/pages/user/components/member/template4.vue +++ b/pages/user/components/member/template4.vue @@ -60,6 +60,7 @@ export default { {{ userInfo.service_num >= 100 ? '99+' : userInfo.service_num }} + diff --git a/utils/util.js b/utils/util.js index 221aa22..ac8562a 100644 --- a/utils/util.js +++ b/utils/util.js @@ -219,21 +219,15 @@ export default { // #endif // #ifdef MP || APP-PLUS let openUrl = url; - let token = store.state.app.token; - if (token && url.indexOf('token=') === -1 && (url.indexOf(HTTP_REQUEST_URL) === 0 || (TRUSTED_DOMAINS || []).some(d => url.indexOf(d) === 0))) { - // 从 JWT payload 中提取 openid 和 unionid + const isTrusted = url.indexOf(HTTP_REQUEST_URL) === 0 || (TRUSTED_DOMAINS || []).some(d => url.indexOf(d) === 0); + if (isTrusted && url.indexOf('token=') === -1) { + // 即使没有 token(用户已退出),只要缓存里有 openid 仍注入身份 + // 微信匿名标识同小程序内永久稳定,退出后跳 H5 不应丢失 let openid = store.state.app.openid; let unionid = store.state.app.unionid || ''; - console.log('[GoUrl] store中 unionid=' + (store.state.app.unionid || '(空)')); - if (!openid) { - try { openid = uni.getStorageSync('OPENID'); } catch (e) {} - } - if (!unionid) { - try { - unionid = uni.getStorageSync('UNIONID'); - console.log('[GoUrl] 缓存中 unionid=' + (unionid || '(空)')); - } catch (e) {} - } + if (!openid) { try { openid = uni.getStorageSync('OPENID'); } catch (e) {} } + if (!unionid) { try { unionid = uni.getStorageSync('UNIONID'); } catch (e) {} } + const token = store.state.app.token; if ((!openid || !unionid) && token) { try { let parts = token.split('.'); @@ -245,38 +239,32 @@ export default { const data = JSON.parse(base64Decode(payload)); if (!openid) openid = data.openid || ''; if (!unionid) unionid = data.unionid || ''; - console.log('[GoUrl] JWT中 unionid=' + (data.unionid || '(空)')); } } catch (e) {} } - // 最后兜底:从用户信息缓存中读 unionid if (!unionid) { try { const userInfo = uni.getStorageSync('user_info'); if (userInfo) { const info = typeof userInfo === 'string' ? JSON.parse(userInfo) : userInfo; unionid = info.unionid || ''; - console.log('[GoUrl] userInfo中 unionid=' + (info.unionid || '(空)')); } } catch (e) {} } - console.log('[GoUrl] 最终参数: openid=' + (openid || '(空)') + ', unionid=' + (unionid || '(空)') + ', t=' + Math.floor(Date.now() / 1000)); - if (!openid) { - // 无 openid:不拦截,匿名进入 H5(需要身份时由 H5 调 bridge.requireAuth() 再授权) - console.log('[auth-flow] JumpPath: 🔓 无 openid,匿名跳转 H5(不弹授权,按需授权由 H5 requireAuth 触发)'); - uni.navigateTo({ - url: `/pages/annex/web_view/index?url=${encodeURIComponent(openUrl)}` - }); - return; + if (openid) { + const joiner = url.indexOf('?') !== -1 ? '&' : '?'; + const t = Math.floor(Date.now() / 1000); + openUrl = url + joiner + 'openid=' + encodeURIComponent(openid); + if (unionid) { + openUrl += '&unionid=' + encodeURIComponent(unionid); + } + openUrl += '&t=' + t; + console.log('[auth-flow] JumpPath: ✅ 有 openid (token=' + (token ? '有' : '无') + '),注入身份跳转 web_view (unionid ' + (unionid ? '已携带' : '为空') + ')'); + } else { + // 无 openid:调 silenceAuthNoLogin 拿 openid + // 走 web_view 让 _initWebView 用 _fetchOpenidAndLoad 拿 openid + console.log('[auth-flow] JumpPath: 🔑 无 openid,跳转 web_view 由 _fetchOpenidAndLoad 处理'); } - const joiner = url.indexOf('?') !== -1 ? '&' : '?'; - const t = Math.floor(Date.now() / 1000); - openUrl = url + joiner + 'openid=' + encodeURIComponent(openid); - if (unionid) { - openUrl += '&unionid=' + encodeURIComponent(unionid); - } - openUrl += '&t=' + t; - console.log('[auth-flow] JumpPath: ✅ 有 openid,注入身份跳转 web_view (unionid ' + (unionid ? '已携带' : '为空') + ')'); } uni.navigateTo({ url: `/pages/annex/web_view/index?url=${encodeURIComponent(openUrl)}`