فهرست منبع

fix:流调表更新为本地取数据

magic v 4 سال پیش
والد
کامیت
fb3ff43583
3فایلهای تغییر یافته به همراه34 افزوده شده و 9 حذف شده
  1. 1 1
      src/pages/FormResult/index.vue
  2. 28 8
      src/pages/FormResult/mixins/index.js
  3. 5 0
      src/pages/FormVolume/mixins/index.js

+ 1 - 1
src/pages/FormResult/index.vue

@@ -24,7 +24,7 @@
     </div>
   </div>
   <div w100 padding-lg>
-    <div class="btn primary" @click="btnBack()">回到首页</div>
+    <div class="btn primary" @click="btnLinkBack()">回到首页</div>
   </div>
 </div>
 </template>

+ 28 - 8
src/pages/FormResult/mixins/index.js

@@ -1,4 +1,6 @@
 import * as api from '@/api'
+import Storage from '@/utils/storage'
+const lStorage = new Storage('localStorage')
 export default {
   data() {
     return {
@@ -30,20 +32,38 @@ export default {
     async inData() {
       this.loading.data = true
       try {
-        let { result_id } = this.$route.query
-        let res = await api.apiGetVolumeResult({ result_id })
-        let data = res.data
+        // let { result_id } = this.$route.query
+        // let res = await api.apiGetVolumeResult({ result_id })
+        // let data = res.data
+        let data = lStorage.getItem('FormResultAbnormal')
         this.$set(this, 'data', data)
       } catch (error) {
         console.log(error)
       }
       this.loading.data = false
     },
-    btnBack () {
-      let { go, replace } = this.$route.query
-      replace
-        ? this.$router.replace({ name: replace })
-        : this.$router.go(go || -1)
+    btnLinkBack() {
+      var ua = navigator.userAgent.toLowerCase();
+      let { go, replace, to } = this.$route.query
+      if (replace) {
+        location.replace(decodeURIComponent(replace))
+      } else if (to) {
+        location.href = decodeURIComponent(to)
+      } else if (go) {
+        this.$router.go(go)
+      }
+      else if (ua.match(/MicroMessenger/i) == "micromessenger") {
+        //ios的ua中无miniProgram,但都有MicroMessenger(表示是微信浏览器)
+        wx.miniProgram.getEnv((res) => {
+          if (res.miniprogram) {
+            // 在小程序里
+            console.log('miniprogram')
+            wx.miniProgram.switchTab({ url: '/pages/index/index' })
+          }
+        })
+      } else {
+        this.$router.go(-1)
+      }
     }
   }
 }

+ 5 - 0
src/pages/FormVolume/mixins/index.js

@@ -3,6 +3,8 @@ import Custom from '../js/custom'
 import Layout1 from '../Layout1'
 import Layout2 from '../Layout2'
 import Layoutileads1 from '../Layoutileads1'
+import Storage from '@/utils/storage'
+const lStorage = new Storage('localStorage')
 require('@/utils/jweixin-1.3.2.js')
 export default {
   props: {
@@ -199,6 +201,9 @@ export default {
         if (pms.length === 1 && this.$route.query.topic_id == 1) {
           let res = arrRes[0]
           let { result_id } = res.data
+          let dt = edatas[0]
+          dt.created = new Date().toString('yyyy-MM-dd HH:mm:ss')
+          lStorage.setItem('FormResultAbnormal', dt)
           this.$router.replace({ name: 'FormResult', query: { ...this.$route.query, result_id } })
         } else {
           this.btnOpenSuccess(() => this.btnLinkBack())