rk
2025-09-28 a8fb7ae2dbb61a94141ed5e73d3bb2632b7b84df
h5/pages/login/login.vue
@@ -44,20 +44,39 @@
            code: ''
         }
      },
      onLoad(option) {
         console.log('onLoad');
         if (option.ywid) {
            uni.setStorageSync('ywinfo', {
               type: option.type,
               yw: option.yw,
               ywid: option.ywid
            })
         }
         // https://atwl.ahzyssl.com/zhyq_h5/#/pages/login/login?type=2&yw=5&ywid=b3db2072-a453-470d-8c0d-ba3b8b256530
      },
      onShow() {
         var that = this
         let url = 'https://atwl.ahzyssl.com/zhyq_h5/#/'
         let code = ''
         if (window.location.href.indexOf('code=') !== -1 || this.code) {
         } else {
            // let url = window.location.href
            const appID = 'wx173e6caf5abc718a'
            let uri = encodeURIComponent(url)
            let authURL =
               `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appID}&redirect_uri=${uri}&response_type=code&scope=snsapi_base#wechat_redirect`
            window.location.href = authURL
         }
         // var that = this
         // let url = 'https://atwl.ahzyssl.com/zhyq_h5/#/'
         // let code = ''
         // if (window.location.href.indexOf('code=') !== -1 || this.code) {
         //    // if(window.location.href.indexOf('wdata') !== -1){
         //    //    uni.redirectTo({
         //    //       url: '/pages/wdata/home?code=' +
         //    //    })
         //    // }
         //    const ywinfo = uni.getStorageSync('ywinfo') || {}
         //    if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) {
         //       this.userAuth(ywinfo.type)
         //    }
         // } else {
         //    // let url = window.location.href
         //    const appID = 'wx173e6caf5abc718a'
         //    let uri = encodeURIComponent(url)
         //    let authURL =
         //       `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appID}&redirect_uri=${uri}&response_type=code&scope=snsapi_base#wechat_redirect`
         //    window.location.href = authURL
         // }
      },
      methods: {
@@ -114,27 +133,29 @@
                        that.$store.commit('setMember', res.data.member)
                     }
                     let flag = res.data.member && res.data.member.id
                     setTimeout(() => {
                        if (source == 0) {
                           if (res.data.token) {
                              that.$store.commit('setToken', res.data.token)
                              getUserInfo().then(ress => {
                                 that.$store.commit('setDriverInfo', ress.data)
                              })
                           }
                           this.driverLogin(flag)
                        } else if (source == 2) {
                           if (res.data.token) {
                              that.$store.commit('setToken', res.data.token)
                              getUserInfo().then(ress => {
                                 that.$store.commit('setUserInfo', ress.data)
                              })
                           }
                           this.staffLogin(flag)
                        } else {
                           this.jump('/pages/index/index')
                     if (source == 0) {
                        if (res.data.token) {
                           that.$store.commit('setToken', res.data.token)
                           getUserInfo().then(ress => {
                              that.$store.commit('setDriverInfo', ress.data)
                           })
                        }
                        setTimeout(() => {
                           that.driverLogin(flag)
                        }, 200)
                     } else if (source == 2) {
                        if (res.data.token) {
                           that.$store.commit('setToken', res.data.token)
                           getUserInfo().then(ress => {
                              that.$store.commit('setUserInfo', ress.data)
                           })
                        }
                     }, 300)
                        setTimeout(() => {
                           that.staffLogin(flag)
                        }, 200)
                     } else {
                        this.jump('/pages/index/index')
                     }
                  }
               })
            }