提交 1e40c1d0 作者: 毛细亚

更新代码

上级 bcc40a83
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
<span class="loading-spinner"></span> <span class="loading-spinner"></span>
</div> </div>
</div> </div>
<el-button type="primary" @click='goDingding'>钉钉跳转</el-button>
<!-- 组织切换弹窗 --> <!-- 组织切换弹窗 -->
<el-dialog :visible.sync="showOrgDialog" width="300px" title="选择组织"> <el-dialog :visible.sync="showOrgDialog" width="300px" title="选择组织">
<ul style="list-style:none;padding:0;margin-top: -20px;"> <ul style="list-style:none;padding:0;margin-top: -20px;">
...@@ -102,9 +101,6 @@ export default { ...@@ -102,9 +101,6 @@ export default {
}, },
methods: { methods: {
...mapMutations('user',['set_corp_id','set_userid','set_external_userid','set_userInfo','set_token','set_cser_info','set_signData']), ...mapMutations('user',['set_corp_id','set_userid','set_external_userid','set_userInfo','set_token','set_cser_info','set_signData']),
goDingding(){
window.location.href = this.DDTestUrl
},
// 设置缓存 // 设置缓存
cacheCorp_id(corp_id){ cacheCorp_id(corp_id){
Cookies.set('corp_id',corp_id, { expires: 7 }) Cookies.set('corp_id',corp_id, { expires: 7 })
...@@ -126,6 +122,10 @@ export default { ...@@ -126,6 +122,10 @@ export default {
cser_name:cser_name 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)
...@@ -156,16 +156,20 @@ export default { ...@@ -156,16 +156,20 @@ export default {
async getSignature(){ async getSignature(){
console.log('获取签名',window.location.href) console.log('获取签名',window.location.href)
const corp_id = Cookies.get('corp_id') const corp_id = Cookies.get('corp_id')
const res = await getSignature({ corp_id: corp_id, path: window.location.href }); try{
if(res.status_code === 1){ const res = await getSignature({ corp_id: corp_id, path: window.location.href });
this.signData = res.data if(res.status_code === 1){
this.cacheSignData(res.data) this.signData = res.data
try{ this.cacheSignData(res.data)
this.registerWeComSDK(); try{
// this.$router.push('/')// 一切准备工作就绪 this.registerWeComSDK();
}catch(err){ }catch(err){
console.log(err,'初始化sdk 失败') console.log(err,'初始化sdk 失败')
}
} }
}catch(err){
console.log(err,'获取签名失败')
window.location.href = window.location.origin +'/company_app/index.html?corp_id='+corp_id+'&msg=signerror'
} }
}, },
...@@ -300,8 +304,9 @@ export default { ...@@ -300,8 +304,9 @@ export default {
success: (res) => { success: (res) => {
if (res.err_msg === "getCurExternalContact:ok") { if (res.err_msg === "getCurExternalContact:ok") {
this.external_userid = res.userId; this.external_userid = res.userId;
this.set_external_userid(this.external_userid) this.cacheExternal_userid(this.external_userid)
console.log(this.external_userid,'获取企微外部联系人') console.log(this.external_userid,'获取企微外部联系人')
this.$router.push('/')// 一切准备工作就绪
} }
}, },
fail: (err) => { fail: (err) => {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论