rk
4 天以前 fea8e0742ee241a94c5bbd4f452d6ad82cf4dd9c
mini-program/App.vue
@@ -1,7 +1,34 @@
<script>
   export default {
      onLaunch: function() {
         console.log('App Launch')
         var that = this
         let href = window.location.href;
         if (this.$dd.env.platform !== 'notInDingTalk') {
            console.log(href)
            let corpId = href.substring(href.lastIndexOf('?corpid=') + 8, href.lastIndexOf('#'))
            console.log(corpId)
            this.$dd.requestAuthCode({
               corpId: corpId,
               clientId: 'dingulzemj5bynjciapg',
               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) {
            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')
@@ -14,4 +41,4 @@
<style lang="scss">
   @import "uview-ui/index.scss";
</style>
</style>