提交 a127a227 作者: 毛细亚

修改授权

上级 f222901a
<template> <template>
<div id="app" class="mobile-app-wrapper"> <div id="app" class="mobile-app-wrapper">
<div class="mobile-menu-bar"> <div class="mobile-menu-bar" v-if="token">
<el-menu <el-menu
:default-active="selectedPath" :default-active="selectedPath"
mode="horizontal" mode="horizontal"
class="mobile-el-menu" class="mobile-el-menu"
background-color="#fff" background-color="#fff"
router router
@select="handleSelect"
> >
<el-menu-item v-for="item in menuList" :key="item.path" :index="item.path" class="mobile-menu-item"> <el-menu-item v-for="item in menuList" :key="item.path" :index="item.path" class="mobile-menu-item">
{{ item.label }} {{ item.label }}
</el-menu-item> </el-menu-item>
</el-menu> </el-menu>
<!-- 绑定的 w 账号 --> <!-- 绑定的 w 账号 -->
<bindUserList v-if="token" /> <bindUserList />
</div> </div>
<div class="mobile-content"> <div class="mobile-content">
<router-view></router-view> <router-view></router-view>
...@@ -23,6 +24,7 @@ ...@@ -23,6 +24,7 @@
<script> <script>
import bindUserList from '@/views/components/bindGameAccount/bindUserList.vue' import bindUserList from '@/views/components/bindGameAccount/bindUserList.vue'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { mapState } from 'vuex'
export default { export default {
name: 'App', name: 'App',
components: { components: {
...@@ -35,10 +37,10 @@ export default { ...@@ -35,10 +37,10 @@ export default {
label: '客户信息', label: '客户信息',
path: '/userInfo' path: '/userInfo'
}, },
// { {
// label: '快捷回复', label: '快捷回复',
// path: '/quickReply' path: '/quickReply'
// }, },
// { // {
// label: '礼包记录', // label: '礼包记录',
// path: '/giftRecord' // path: '/giftRecord'
...@@ -61,17 +63,36 @@ export default { ...@@ -61,17 +63,36 @@ export default {
} }
}, },
watch: { watch: {
// '$route.path'(val) { '$route.path'(val) {
// this.selectedPath = val // 处理各种可能的路径情况
// } if (val === '/' || val === '/index.html') {
this.selectedPath = '/userInfo'
} else {
this.selectedPath = val
}
}
},
computed:{
...mapState('user',['external_userid'])
}, },
created() { created() {
// if (this.$route.path === '/' || this.$route.path === '') { // 初始化时处理路径
// this.$router.replace('/userInfo') const currentPath = this.$route.path
// } else { if (currentPath === '/' || currentPath === '' || currentPath === '/index.html') {
// this.selectedPath = this.$route.path this.selectedPath = '/userInfo'
// } // 如果当前路径是根路径或 index.html,重定向到 userInfo
if (currentPath === '/' || currentPath === '/index.html') {
this.$router.replace('/userInfo')
}
} else {
this.selectedPath = currentPath
}
}, },
methods:{
handleSelect(key, keyPath) {
console.log(key, keyPath,window.location.href)
}
}
} }
</script> </script>
......
...@@ -15,6 +15,10 @@ const routes = [ ...@@ -15,6 +15,10 @@ const routes = [
redirect: '/userInfo' redirect: '/userInfo'
}, },
{ {
path: '/index.html',
redirect: '/userInfo'
},
{
path: '/userInfo', path: '/userInfo',
name: 'userInfo', name: 'userInfo',
component: userInfo component: userInfo
...@@ -78,10 +82,9 @@ router.beforeEach((to, from, next) => { ...@@ -78,10 +82,9 @@ router.beforeEach((to, from, next) => {
const wecomUserId = Cookies.get('userid') const wecomUserId = Cookies.get('userid')
const cser_id = Cookies.get('cser_id') const cser_id = Cookies.get('cser_id')
const token = Cookies.get('token') const token = Cookies.get('token')
const external_userid = Cookies.get('external_userid')
const urlParams = getParams(); const urlParams = getParams();
if (needAuth) { if (needAuth) {
if (wecomUserId && token && external_userid) { if (wecomUserId && token) {
// 登录信息齐全,允许进入 // 登录信息齐全,允许进入
next() next()
} else { } else {
......
...@@ -43,8 +43,6 @@ ...@@ -43,8 +43,6 @@
</li> </li>
</ul> </ul>
</el-dialog> </el-dialog>
<div v-if="dingUserInfo">钉钉用户:{{ dingUserInfo.name }}</div>
<div v-if="external_userid">企微外部联系人ID:{{ external_userid }}</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -62,7 +60,6 @@ export default { ...@@ -62,7 +60,6 @@ export default {
return { return {
wecomUserInfo: null, // 企微用户信息 wecomUserInfo: null, // 企微用户信息
dingUserInfo: null, // 钉钉用户信息 dingUserInfo: null, // 钉钉用户信息
external_userid: null, // 企微外部联系人ID
signData: null, // 企微签名数据 signData: null, // 企微签名数据
orgList: [], orgList: [],
urlParams:{}, urlParams:{},
...@@ -100,7 +97,7 @@ export default { ...@@ -100,7 +97,7 @@ export default {
...mapState('user',['corp_id']) ...mapState('user',['corp_id'])
}, },
methods: { methods: {
...mapMutations('user',['set_corp_id','set_userid','set_external_userid','set_userInfo','set_token','set_cser_info','set_signData','set_cser_id','set_cser_name']), ...mapMutations('user',['set_corp_id','set_userid','set_userInfo','set_token','set_cser_info','set_signData','set_cser_id','set_cser_name']),
// 设置缓存 // 设置缓存
cacheCorp_id(corp_id){ cacheCorp_id(corp_id){
Cookies.set('corp_id',corp_id, { expires: 7 }) Cookies.set('corp_id',corp_id, { expires: 7 })
...@@ -124,10 +121,6 @@ export default { ...@@ -124,10 +121,6 @@ export default {
this.set_cser_id(cser_id) this.set_cser_id(cser_id)
this.set_cser_name(cser_name) this.set_cser_name(cser_name)
}, },
cacheExternal_userid(external_userid){
Cookies.set('external_userid',external_userid, { expires: 7 })
this.set_external_userid(external_userid)
},
cacheSignData(signData){ cacheSignData(signData){
Cookies.set('signData',JSON.stringify(signData), { expires: 7 }) Cookies.set('signData',JSON.stringify(signData), { expires: 7 })
this.set_signData(signData) this.set_signData(signData)
...@@ -174,7 +167,6 @@ export default { ...@@ -174,7 +167,6 @@ export default {
window.location.href = window.location.origin +'/company_app/index.html?corp_id='+corp_id+'&msg=signerror' window.location.href = window.location.origin +'/company_app/index.html?corp_id='+corp_id+'&msg=signerror'
} }
}, },
// 2. 注册企微JS-SDK // 2. 注册企微JS-SDK
registerWeComSDK() { registerWeComSDK() {
console.log('删除企业签名',1231) console.log('删除企业签名',1231)
...@@ -196,7 +188,7 @@ export default { ...@@ -196,7 +188,7 @@ export default {
onAgentConfigSuccess: (res) => { onAgentConfigSuccess: (res) => {
console.log('注册成功可以调用企微 js-sdk',res) console.log('注册成功可以调用企微 js-sdk',res)
// 注册成功后不立即获取外部联系人,等钉钉扫码后再获取 // 注册成功后不立即获取外部联系人,等钉钉扫码后再获取
this.getCurExternalContact() this.$router.push('/')
}, },
onAgentConfigFail: (err) => { onAgentConfigFail: (err) => {
console.log('注册失败不能使用企微js-sdk',err) console.log('注册失败不能使用企微js-sdk',err)
...@@ -300,23 +292,6 @@ export default { ...@@ -300,23 +292,6 @@ export default {
} }
}, },
// 8. 获取企微外部联系人
getCurExternalContact() {
ww.getCurExternalContact({
success: (res) => {
if (res.err_msg === "getCurExternalContact:ok") {
this.external_userid = res.userId;
this.cacheExternal_userid(this.external_userid)
console.log(this.external_userid,'获取企微外部联系人')
this.$router.push('/')// 一切准备工作就绪 所有信息都已获取到
}
},
fail: (err) => {
console.log(err,'获取企微外部联系人失败')
// 错误处理
}
});
},
refreshDingTalkQRCode() { refreshDingTalkQRCode() {
this.initDingTalkLogin(); this.initDingTalkLogin();
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论