<script>
|
export default {
|
onLaunch: function() {
|
var that = this
|
let href = window.location.href;
|
if (this.$dd.env.platform !== 'notInDingTalk') {
|
console.log('钉钉授权登录')
|
let corpId = href.substring(href.lastIndexOf('?corpid=') + 8, href.lastIndexOf('#'))
|
// dingy7xdyzffnegiaszo 正式
|
// dingulzemj5bynjciapg 测试
|
this.$dd.requestAuthCode({
|
corpId: corpId,
|
clientId: 'dingy7xdyzffnegiaszo',
|
onSuccess: function(result) {
|
that.$u.api.ddLogin({
|
code: result.code,
|
corpId: corpId
|
}).then(res => {
|
if (res.code === 200) {
|
that.$store.commit('setToken', res.data.token)
|
that.$isResolve()
|
}
|
})
|
}
|
});
|
} else if (href.indexOf('?token') !== -1) {
|
console.log('token免登')
|
let token = href.substring(href.lastIndexOf('?token=') + 7, href.lastIndexOf('#'))
|
that.$store.commit('setToken', token)
|
that.$isResolve()
|
} else {
|
that.$isResolve()
|
}
|
},
|
onShow: function() {
|
console.log('App Show')
|
},
|
onHide: function() {
|
console.log('App Hide')
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
@import "uview-ui/index.scss";
|
</style>
|