提交 9df0713c 作者: 毛细亚

更新代码

上级 703957ab
......@@ -37,10 +37,10 @@ export default {
label: '客户信息',
path: '/userInfo'
},
{
label: '快捷回复',
path: '/quickReply'
},
// {
// label: '快捷回复',
// path: '/quickReply'
// },
// {
// label: '礼包记录',
// path: '/giftRecord'
......@@ -63,27 +63,13 @@ export default {
}
},
watch: {
'$route.path'(val) {
// 处理各种可能的路径情况
if (val === '/' || val === '/index.html') {
this.selectedPath = '/userInfo'
} else {
this.selectedPath = val
}
}
},
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) {
......@@ -140,7 +126,6 @@ export default {
background: #fff;
border-radius: 8px;
min-height: 60vh;
box-shadow: 0 2px 8px #f0f1f2;
padding: 10px;
}
.el-menu--horizontal>.el-menu-item{
......
......@@ -64,6 +64,7 @@ export default {
}
},
async mounted() {
console.log(this.external_userid,'external_userid')
this.bindUserList()
this.requestDetails()
},
......
......@@ -74,32 +74,41 @@ export default {
}
},
async mounted() {
await this.initOrganization();
const urlParams = getParams();
// 如果是钉钉扫码回调页面
if ( urlParams.type && urlParams.type === 'ding') {// 钉钉回调
this.handleDingCallback();
}else if(this.token){ // 已经钉钉扫码过 重新获取授权 获取签名 注册企微js-sdk
await this.getSignature();
}else {
if(!userid){ //没有企微授权过 并且 钉钉扫码成功 开始微信授权
await this.startWeComSilentAuth();
}else{
this.initDingTalkLogin(); // 始化钉钉扫码
}
}
// 每次进入页面都缓存corp_id
if(urlParams.corp_id){
this.cacheCorp_id(urlParams.corp_id) // 缓存 corp_id
}
this.$nextTick(() => {
this.initLogin()
})
},
computed:{
...mapState('user',['corp_id'])
},
methods: {
...mapMutations('user',['set_corp_id','set_userid','set_userInfo','set_token','set_cser_info','set_signData','set_cser_id','set_cser_name','set_external_userid']),
async initLogin(){
await this.initOrganization();
const urlParams = getParams();
const userid = Cookies.get('userid');
// 如果是钉钉扫码回调页面
if ( urlParams.type && urlParams.type === 'ding') {// 钉钉回调
console.log(1)
this.handleDingCallback();
}else if(this.token){ // 已经钉钉扫码过 重新获取授权 获取签名 注册企微js-sdk
console.log(2)
await this.getSignature();
}else {
console.log(3)
if(!userid){ //没有企微授权过 并且 钉钉扫码成功 开始微信授权
console.log(4)
await this.startWeComSilentAuth();
}else{
console.log(5)
this.initDingTalkLogin(); // 始化钉钉扫码
}
}
// 每次进入页面都缓存corp_id
if(urlParams.corp_id){
this.cacheCorp_id(urlParams.corp_id) // 缓存 corp_id
}
},
// 设置缓存
cacheCorp_id(corp_id){
Cookies.set('corp_id',corp_id, { expires: 7 })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论