提交 7b9700d4 作者: 毛细亚

123

上级 a21e80be
<template> <template>
<div id="app" class="mobile-app-wrapper"> <div id="app" class="mobile-app-wrapper">
<!-- 详细的调试信息 -->
<div style="background: #f0f0f0; padding: 10px; font-size: 12px; border-bottom: 1px solid #ccc;">
<div>Token: {{ token }} ({{ typeof token }})</div>
<div>External User ID: {{ external_userid }} ({{ typeof external_userid }})</div>
<div>Show Member ID: {{ showMemberId }} ({{ typeof showMemberId }})</div>
<div>Selected Path: {{ selectedPath }}</div>
<div>Current Route: {{ $route.path }}</div>
<div>Condition Result: {{ !!(token && external_userid && showMemberId) }}</div>
</div>
<div class="mobile-menu-bar" v-if="token && external_userid && showMemberId"> <div class="mobile-menu-bar" v-if="token && external_userid && showMemberId">
<!-- 临时调试信息 --> <!-- 临时调试信息 -->
<div style="font-size: 12px; color: #666; padding: 5px;"> <div style="font-size: 12px; color: #666; padding: 5px;">
...@@ -41,10 +51,10 @@ export default { ...@@ -41,10 +51,10 @@ export default {
label: '客户信息', label: '客户信息',
path: '/userInfo' path: '/userInfo'
}, },
// { {
// label: '快捷回复', label: '快捷回复',
// path: '/quickReply' path: '/quickReply'
// }, },
// { // {
// label: '礼包记录', // label: '礼包记录',
// path: '/giftRecord' // path: '/giftRecord'
...@@ -62,41 +72,52 @@ export default { ...@@ -62,41 +72,52 @@ export default {
// path: '/addressBook' // path: '/addressBook'
// }, // },
], ],
selectedPath: '', selectedPath: '/userInfo',
showMemberId:false, showMemberId: false,
token:getToken() token: getToken()
} }
}, },
computed:{
...mapState('user',['external_userid'])
},
watch: { watch: {
'$route.path'(val) {
// 处理各种可能的路径情况
if (val === '/' || val === '/index.html') {
this.selectedPath = '/userInfo'
} else {
this.selectedPath = val
}
console.log('路由变化:', val, '选中路径:', this.selectedPath)
},
// 监听 external_userid 的变化,确保界面及时更新 // 监听 external_userid 的变化,确保界面及时更新
external_userid: { external_userid: {
handler(newVal) { handler(newVal) {
if (newVal) { if (newVal) {
this.$nextTick(() => {
this.showMemberId = true this.showMemberId = true
console.log('external_userid 已设置:', newVal,window.location.href,this.token) console.log('external_userid 已设置:', newVal, window.location.href, this.token)
// 强制更新组件 // 强制更新组件
this.$forceUpdate() this.$forceUpdate()
})
} }
}, },
immediate: true immediate: true
} }
}, },
computed:{
...mapState('user',['external_userid'])
},
created() { created() {
// // 初始化时处理路径 // 初始化时处理路径
// const currentPath = this.$route.path const currentPath = this.$route.path
// if (currentPath === '/' || currentPath === '' || currentPath === '/index.html') { if (currentPath === '/' || currentPath === '' || currentPath === '/index.html') {
// this.selectedPath = '/userInfo' this.selectedPath = '/userInfo'
// // 移除重定向逻辑,让路由配置处理 } else {
// } else { this.selectedPath = currentPath
// this.selectedPath = currentPath }
// } console.log('创建时路径:', currentPath, '选中路径:', this.selectedPath)
}, },
methods:{ methods:{
handleSelect(key, keyPath) { handleSelect(key, keyPath) {
console.log(key, keyPath,window.location.href) console.log('菜单选择:', key, keyPath, window.location.href)
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论