MrShi
4 天以前 05aec1e9986fbe3e907259bb1a1396f129bd0fa1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<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>