jiangping
2025-04-18 015b4f31cebbecf6f6da760ed2f8af3da721e802
h5/App.vue
@@ -11,15 +11,18 @@
      },
      methods: {
         async init() {
            // if (!this.$store.state.userInfo) {
            //    let res = await this.$u.api.login({ code: 'ShiXuHui' })
            //    if (res.code === 200) {
            //       this.$store.commit('setUserInfo', res.data)
            //    }
            // }
            // return
            if (!this.$store.state.userInfo) {
               let res = await this.$u.api.login({ code: 'ShiXuHui' })
               if (res.code === 200) {
                  this.$store.commit('setUserInfo', res.data)
               }
            }
            return
            let code = this.getQueryVariable('code')
            if (code) {
               if (!uni.getStorageSync('code')) {
                  uni.setStorageSync('code', code);
               let res = await this.$u.api.login({ code: code })
               if (res.code === 200) {
                  this.$store.commit('setUserInfo', res.data)
@@ -30,14 +33,14 @@
                  if (url.indexOf('state=') !== -1 && url.indexOf('#') !== -1) {
                     let value = url.substring(url.indexOf('state=') + 6, url.indexOf('#')).split('_')
                     console.log(value)
                     if (value.length > 0) {
                        if (value[0] !== '') {
                        if (value[0] == 0) {
                           uni.navigateTo({
                              url: `/pages/details_she/details_she?id=${value[1]}`
                           })
                        } else if (value[0] == 1) {
                           uni.navigateTo({
                              url: `/pages/workOrder_dca/workOrder_dca?id=${value[1]}`
                                 url: `/pages/details_dca/details_dca?id=${value[1]}&isShow=true`
                           })
                        } else if (value[0] == 3) {
                           uni.navigateTo({
@@ -46,6 +49,48 @@
                        }
                     }
                  }
                  }
               } else if (uni.getStorageSync('code') !== code) {
                  uni.setStorageSync('code', code);
                  let res = await this.$u.api.login({ code: code })
                  if (res.code === 200) {
                     this.$store.commit('setUserInfo', res.data)
                     this.initRegister()
                     // 判断是否跳转详情
                     let url = window.location.href
                     if (url.indexOf('state=') !== -1 && url.indexOf('#') !== -1) {
                        let value = url.substring(url.indexOf('state=') + 6, url.indexOf('#')).split('_')
                        console.log(value)
                        if (value[0] !== '') {
                           if (value[0] == 0) {
                              uni.navigateTo({
                                 url: `/pages/details_she/details_she?id=${value[1]}`
                              })
                           } else if (value[0] == 1) {
                              uni.navigateTo({
                                 url: `/pages/details_dca/details_dca?id=${value[1]}&isShow=true`
                              })
                           } else if (value[0] == 3) {
                              uni.navigateTo({
                                 url: `/pages/workOrder_she/workOrder_she?id=${value[1]}`
                              })
                           }
                        }
                     }
                  }
               } else {
                  let loc_href = encodeURIComponent("https://dmtest.ahapp.net/lianhelihua_web/")
                  let corpId = 'wweea8f71b54e3b835';
                  let agentId = '1000095';
                  let wxUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${corpId}&redirect_uri=${loc_href}&response_type=code&scope=snsapi_base&state=#wechat_redirect`
                  location.href = wxUrl;
               }
            } else {
               let loc_href = encodeURIComponent("https://dmtest.ahapp.net/lianhelihua_web/")
@@ -57,6 +102,53 @@
               
               location.href = wxUrl;
            }
            // ShiXuHui
            // if (!this.$store.state.userInfo) {
            //    let res = await this.$u.api.login({ code: 'GuoJiWenWu' })
            //    if (res.code === 200) {
            //       this.$store.commit('setUserInfo', res.data)
            //    }
            // }
            // return
         //    let code = this.getQueryVariable('code')
         //    if (code) {
         //       let res = await this.$u.api.login({ code: code })
         //       if (res.code === 200) {
         //          this.$store.commit('setUserInfo', res.data)
         //          this.initRegister()
         //          // 判断是否跳转详情
         //          let url = window.location.href
         //          if (url.indexOf('state=') !== -1 && url.indexOf('#') !== -1) {
         //             let value = url.substring(url.indexOf('state=') + 6, url.indexOf('#')).split('_')
         //             console.log(value)
         //             if (value[0] !== '') {
         //                if (value[0] == 0) {
         //                   uni.navigateTo({
         //                      url: `/pages/details_she/details_she?id=${value[1]}`
         //                   })
         //                } else if (value[0] == 1) {
         //                   uni.navigateTo({
         //                      url: `/pages/workOrder_dca/workOrder_dca?id=${value[1]}`
         //                   })
         //                } else if (value[0] == 3) {
         //                   uni.navigateTo({
         //                      url: `/pages/workOrder_she/workOrder_she?id=${value[1]}`
         //                   })
         //                }
         //             }
         //          }
         //       }
         //    } else {
         //       let loc_href = encodeURIComponent("https://dmtest.ahapp.net/lianhelihua_web/")
         //       let corpId = 'wweea8f71b54e3b835';
         //       let agentId = '1000095';
         //       let wxUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${corpId}&redirect_uri=${loc_href}&response_type=code&scope=snsapi_base&state=#wechat_redirect`
         //       location.href = wxUrl;
         //    }
         },
         // 获取url参数
         getQueryVariable(variable) {