|  |  | 
 |  |  | 
 | 
 |  |  | <script>
 | 
 |  |  |    import {
 | 
 |  |  |       sendSms, | 
 |  |  |       sendSms,
 | 
 |  |  |       wxAuthorizea,
 | 
 |  |  |       loginDriverWithCode, | 
 |  |  |       loginDriverWithCode,
 | 
 |  |  |       getUserInfo
 | 
 |  |  |    } from '@/api'
 | 
 |  |  |    export default {
 | 
 |  |  | 
 |  |  |             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
 | 
 |  |  |             window.location.href = authURL
 | 
 |  |  |          }
 | 
 |  |  |       },
 | 
 |  |  |       methods: {
 | 
 |  |  | 
 |  |  |             if (!code) return this.showToast('验证码不能为空')
 | 
 |  |  |             loginDriverWithCode({
 | 
 |  |  |                phone,
 | 
 |  |  |                code, | 
 |  |  |                openid: this.$store.state.openId || '000'
 | 
 |  |  |                code,
 | 
 |  |  |                openid: this.$store.state.openId || '111'
 | 
 |  |  |             }).then(res => {
 | 
 |  |  |                if (res && res.code == 200) { | 
 |  |  |                   if (res.data) { | 
 |  |  |                      this.$store.commit('setToken', res.data) | 
 |  |  |                      getUserInfo().then(ress => { | 
 |  |  |                         this.$store.commit('setDriverInfo', ress.data) | 
 |  |  |                      }) | 
 |  |  |                      uni.navigateTo({ | 
 |  |  |                         url: '/pages/wdata/list' | 
 |  |  |                      }) | 
 |  |  |                if (res && res.code == 200) {
 | 
 |  |  |                   if (res.data) {
 | 
 |  |  |                      this.$store.commit('setToken', res.data)
 | 
 |  |  |                      getUserInfo().then(ress => {
 | 
 |  |  |                         this.$store.commit('setDriverInfo', ress.data)
 | 
 |  |  |                         setTimeout(() => {
 | 
 |  |  |                            uni.navigateTo({
 | 
 |  |  |                               url: '/pages/wdata/list'
 | 
 |  |  |                            })
 | 
 |  |  |                         }, 100)
 | 
 |  |  |                      })
 | 
 |  |  |                   }
 | 
 |  |  |                }
 | 
 |  |  |             })
 | 
 |  |  | 
 |  |  |             sendSms({
 | 
 |  |  |                phone: this.form.phone
 | 
 |  |  |             }).then(res => {
 | 
 |  |  |                this.countDown = 60
 | 
 |  |  |                setInterval(() => {
 | 
 |  |  |                   if (this.countDown == 0) return
 | 
 |  |  |                   this.countDown--
 | 
 |  |  |                }, 1000)
 | 
 |  |  |                if (res.code === 200) {
 | 
 |  |  |                   this.countDown = 60
 | 
 |  |  |                   setInterval(() => {
 | 
 |  |  |                      if (this.countDown == 0) return
 | 
 |  |  |                      this.countDown--
 | 
 |  |  |                   }, 1000)
 | 
 |  |  |                }
 | 
 |  |  |             })
 | 
 |  |  |          },
 | 
 |  |  |          userAuth(source) {
 | 
 |  |  | 
 |  |  |                }).then(res => {
 | 
 |  |  |                   if (res.code === 200) {
 | 
 |  |  |                      that.$store.commit('setOpenId', res.data.openid)
 | 
 |  |  |                      if (res.data.token) { | 
 |  |  |                         that.$store.commit('setToken', res.data.token) | 
 |  |  |                         getUserInfo().then(ress => { | 
 |  |  |                            that.$store.commit('setDriverInfo', ress.data) | 
 |  |  |                         }) | 
 |  |  |                         uni.navigateTo({ | 
 |  |  |                            url: '/pages/wdata/list' | 
 |  |  |                         }) | 
 |  |  |                      if (res.data.token) {
 | 
 |  |  |                         that.$store.commit('setToken', res.data.token)
 | 
 |  |  |                         getUserInfo().then(ress => {
 | 
 |  |  |                            that.$store.commit('setDriverInfo', ress.data)
 | 
 |  |  |                            uni.navigateTo({
 | 
 |  |  |                               url: '/pages/wdata/list'
 | 
 |  |  |                            })
 | 
 |  |  |                         })
 | 
 |  |  |                      }
 | 
 |  |  |                   }
 | 
 |  |  |                })
 |