renkang
2025-02-07 a80fcaaf130286f215a35aa62450421b480b4d5a
h5/pages/login.vue
@@ -29,8 +29,8 @@
      loginPost,
      getUserInfo,
      sendSMsPost,
      ywWxAuthorize,
      ywWxAuthorize,
      getRecordByUserPoint
   } from '@/api'
   import {
@@ -45,7 +45,7 @@
            form: {
               phone: '',
               code: ''
            },
            },
            ywinfo: {},
            downTime: 0,
            code: ''
@@ -53,11 +53,11 @@
      },
      onLoad(option) {
         console.log('onLoad');
         // https://zhcg.fnwtzx.com/#/pages/login?type=0&ywid=ywid
         const ywinfo = uni.getStorageSync('ywinfo') || {}
         if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) {
            this.ywinfo = ywinfo
            uni.setStorageSync('ywinfo', {})
         // https://zhcg.fnwtzx.com/#/pages/login?type=0&ywid=ywid
         const ywinfo = uni.getStorageSync('ywinfo') || {}
         if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) {
            this.ywinfo = ywinfo
            uni.setStorageSync('ywinfo', {})
         }
         if (option.ywid || option.ywid == 0) {
            uni.setStorageSync('ywinfo', {
@@ -83,7 +83,7 @@
               code: code || this.code
            }).then(res => {
               if (res.code === 200) {
                  console.log('res', res);
                  // console.log('res', res);
                  that.$store.commit('setOpenId', res.data.openid)
                  if (res.data.token && res.data.token != '') {
                     that.$store.commit('setToken', res.data.token)
@@ -91,13 +91,19 @@
                        that.$store.commit('setUserInfo', ress.data)
                     })
                     const ywinfo = this.ywinfo
                     if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) {
                        getRecordByUserPoint({pointCode: ywinfo.ywid}).then(res => {
                           if(res.data && res.data.id){
                              uni.redirectTo({
                                 url: "/pages/polling/point?id=" + res.data.id
                              })
                           }
                     if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) {
                        getRecordByUserPoint({
                           pointCode: ywinfo.ywid
                        }).then(res => {
                           if (res.data && res.data.id) {
                              uni.redirectTo({
                                 url: "/pages/polling/point?id=" + res.data.id
                              })
                           } else {
                              uni.redirectTo({
                                 url: "/pages/polling/empty"
                              })
                           }
                        })
                     } else {
                        setTimeout(() => {
@@ -111,8 +117,8 @@
            })
         } else {
            // let url = 'https://zhcg.fnwtzx.com/yunwei_h5'
            // const appID = 'wx95ac1efb67f0330d'
            let url = 'https://dmtest.ahapp.net/yunwei_h5'
            // const appID = 'wx95ac1efb67f0330d'
            let url = 'https://dmtest.ahapp.net/yunwei_h5'
            const appID = 'wx4d7c10bdec51942b'
            let uri = encodeURIComponent(url)
            let authURL =
@@ -145,22 +151,28 @@
                  this.setToken(res.data)
                  this.showToast('登录成功')
                  getUserInfo().then(ress => {
                     this.setUserInfo(ress.data)
                     const ywinfo = this.ywinfo
                     if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) {
                     getRecordByUserPoint({pointCode: ywinfo.ywid}).then(res => {
                        getRecordByUserPoint({pointCode: ywinfo.ywid}).then(res => {
                           if(res.data && res.data.id){
                              uni.redirectTo({
                                 url: "/pages/polling/point?id=" + res.data.id
                              })
                           }
                        })
                     })
                     } else {
                        uni.redirectTo({
                           url: "/pages/index"
                        })
                     this.setUserInfo(ress.data)
                     const ywinfo = this.ywinfo
                     if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) {
                        // getRecordByUserPoint({pointCode: ywinfo.ywid}).then(res => {
                        getRecordByUserPoint({
                           pointCode: ywinfo.ywid
                        }).then(res => {
                           if (res.data && res.data.id) {
                              uni.redirectTo({
                                 url: "/pages/polling/point?id=" + res.data.id
                              })
                           } else {
                              uni.redirectTo({
                                 url: "/pages/polling/empty"
                              })
                           }
                        })
                        // })
                     } else {
                        uni.redirectTo({
                           url: "/pages/index"
                        })
                     }
                  })
               }