提交 7b9700d4 作者: 毛细亚

123

上级 a21e80be
<template>
<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 style="font-size: 12px; color: #666; padding: 5px;">
......@@ -41,10 +51,10 @@ export default {
label: '客户信息',
path: '/userInfo'
},
// {
// label: '快捷回复',
// path: '/quickReply'
// },
{
label: '快捷回复',
path: '/quickReply'
},
// {
// label: '礼包记录',
// path: '/giftRecord'
......@@ -62,41 +72,52 @@ export default {
// path: '/addressBook'
// },
],
selectedPath: '',
showMemberId:false,
token:getToken()
selectedPath: '/userInfo',
showMemberId: false,
token: getToken()
}
},
computed:{
...mapState('user',['external_userid'])
},
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: {
handler(newVal) {
if (newVal) {
this.$nextTick(() => {
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()
})
}
},
immediate: true
}
},
computed:{
...mapState('user',['external_userid'])
},
created() {
// // 初始化时处理路径
// const currentPath = this.$route.path
// if (currentPath === '/' || currentPath === '' || currentPath === '/index.html') {
// this.selectedPath = '/userInfo'
// // 移除重定向逻辑,让路由配置处理
// } else {
// this.selectedPath = currentPath
// }
// 初始化时处理路径
const currentPath = this.$route.path
if (currentPath === '/' || currentPath === '' || currentPath === '/index.html') {
this.selectedPath = '/userInfo'
} else {
this.selectedPath = currentPath
}
console.log('创建时路径:', currentPath, '选中路径:', this.selectedPath)
},
methods:{
handleSelect(key, keyPath) {
console.log(key, keyPath,window.location.href)
console.log('菜单选择:', key, keyPath, window.location.href)
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论