提交 a21e80be 作者: 毛细亚

更新代码

上级 9df0713c
<template>
<div id="app" class="mobile-app-wrapper">
<div class="mobile-menu-bar" v-if="token && external_userid">
<div class="mobile-menu-bar" v-if="token && external_userid && showMemberId">
<!-- 临时调试信息 -->
<div style="font-size: 12px; color: #666; padding: 5px;">
Token: {{ token ? '✓' : '✗' }} | ExternalUserId: {{ external_userid ? '✓' : '✗' }}
</div>
<el-menu
:default-active="selectedPath"
mode="horizontal"
......@@ -58,18 +62,37 @@ export default {
// path: '/addressBook'
// },
],
selectedPath: '/userInfo',
selectedPath: '',
showMemberId:false,
token:getToken()
}
},
watch: {
// 监听 external_userid 的变化,确保界面及时更新
external_userid: {
handler(newVal) {
if (newVal) {
this.showMemberId = true
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
// }
},
methods:{
handleSelect(key, keyPath) {
......
......@@ -154,6 +154,7 @@ export default {
if (res.status_code === 1) {
// this.cacheWx_userinfo(res.data)
this.cacheuserid(res.data.userid)
this.initDingTalkLogin(); // 初始化钉钉扫码
} else {
console.log('获取useid失败',res)
// 错误处理
......@@ -184,7 +185,11 @@ export default {
if (res.err_msg === "getCurExternalContact:ok") {
console.log(res,'重新进入获取企微外部联系人')
this.set_external_userid(res.userId)
this.$router.push('/userInfo')
// 确保 Vuex 状态更新后再跳转
this.$nextTick(() => {
this.$router.replace('/')
console.log(window.location.href,'window.location.hrefuserInfo')
})
}
},
fail: (err) => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论