ll
liukangdong
2024-12-10 a8c03746e6bd8ac1d46dc48c1b10bceff543664f
h5/pages/login/login.vue
@@ -1,6 +1,6 @@
<template>
   <view class="main_app">
      <image class="login_bg" src="@/static/login_bg@2x.png" mode="widthFix" />
      <image class="login_bg" src="@/static/staff/shenfen_bg@2x.png" mode="widthFix" />
      <view class="h1">安泰物流智慧园区</view>
      <view class="placeholder6 place">请选择您的身份</view>
      <view class="item" @click="userAuth(1)">
@@ -41,18 +41,17 @@
   export default {
      data() {
         return {
            code: '091RVIkl2SZXDe4WySll2pAL8D1RVIkb'
            code: ''
         }
      },
      onLoad() {
      onShow() {
         var that = this
         let url = window.location.href
         let url = 'https://atwl.ahzyssl.com/zhyq_h5/#/'
         let code = ''
         if (url.indexOf('code=') !== -1) {
         if (window.location.href.indexOf('code=') !== -1 || this.code) {
         } else {
            return
            let url = window.location.href
            // let url = window.location.href
            const appID = 'wx173e6caf5abc718a'
            let uri = encodeURIComponent(url)
            let authURL =
@@ -98,13 +97,13 @@
            let url = window.location.href
            let code = ''
            if (url.indexOf('code=') !== -1 || this.code) {
               // const query = url.split('?')
               // for (const q of query) {
               //    if (q.indexOf('code=') !== -1) {
               //       let statusIndex = q.indexOf('&state') - 1
               //       code = q.substring(q.indexOf('code=') + 5, statusIndex)
               //    }
               // }
               const query = url.split('?')
               for (const q of query) {
                  if (q.indexOf('code=') !== -1) {
                     let statusIndex = q.indexOf('&state')
                     code = q.substring(q.indexOf('code=') + 5, statusIndex)
                  }
               }
               wxAuthorizea({
                  code: code || this.code,
                  source: source
@@ -114,17 +113,23 @@
                     if (res.data.member) {
                        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)
                        })
                     }
                     let flag = res.data.member && res.data.member.id
                     setTimeout(() => {
                        if (source == 0) {
                           this.driverLogin(flag)
                        } else if (source == 2) {
                           this.staffLogin(flag)
                        } else {
                           this.jump('/pages/index/index')
@@ -133,15 +138,6 @@
                  }
               })
            }
            // }
            // 刷新token
            // setTimeout(() => {
            //    refreshToken().then(res => {
            //       if (res.code && res.code === 200) {
            //          this.$store.commit('setToken', res.data)
            //       }
            //    })
            // }, 3000)
         }
      }
   }