Jelajahi Sumber

feat:修改

linwenxin 1 tahun lalu
induk
melakukan
c5061219f8
3 mengubah file dengan 28 tambahan dan 10 penghapusan
  1. 26 4
      src/common/utils/navPag.js
  2. 2 2
      src/mixins/index.js
  3. 0 4
      src/pages/message/msgView.vue

+ 26 - 4
src/common/utils/navPag.js

@@ -3,13 +3,17 @@ import wx from 'weixin-js-sdk'
 // #endif
 import store from '@/store/index.js'
 import {
-  isWeixin
+  isWeixin,
+  getQueryVariable
 } from "./common.js"
 import {
   delayPerform
 } from "js-perform-lock";
 
 import md5 from "md5"
+import {
+  object
+} from '@dcloudio/vue-cli-plugin-uni/packages/postcss/tags';
 
 export function webViewHref(url, pam = {}, crossPagePam = {}) {
   var defaultPam = {
@@ -120,15 +124,29 @@ export const crossPage = (function() {
     datacd.map(function([name, val]) {
       data[name] = val
     })
-    uni.setStorageSync("$crossPageTs", JSON.stringify(data));
+    uni.setStorageSync("crossPageTs", encodeURIComponent(JSON.stringify(data)));
     store.commit("user/setcrossPagePam", (new Date().getTime()));
     setTimeout(function() {
-      uni.removeStorageSync("$crossPageTs")
+      uni.removeStorageSync("crossPageTs")
     }, 350)
     datacd = []
   });
   // #endif
 
+  // #ifdef H5
+  var delaydepartFun = (new delayPerform(250)).refactor(function() {
+    var data = getQueryVariable("crossPageTs")
+    if (data) {
+      data = JSON.parse(decodeURIComponent(data))
+      Object.keys(data).map(name => {
+        Object.keys(funs[name]).map(key => {
+          funs[name][key](data[name])
+        })
+      })
+    }
+  });
+  // #endif
+
   var funco = {
     $emit(name, data) {
       if (funs[name]) {
@@ -168,6 +186,10 @@ export const crossPage = (function() {
         funs[name] = {}
       }
       funs[name][md5(fun.toString())] = fun
+
+      // #ifdef H5
+      delaydepartFun()
+      // #endif
     },
 
     $off(name, fun) {
@@ -215,4 +237,4 @@ export const crossPage = (function() {
   // #endif
 
   return funco
-})()
+})()

+ 2 - 2
src/mixins/index.js

@@ -85,10 +85,10 @@ export default {
   computed: {
     crossPagePam() {
       var num = this.$store.state.user.crossPagePam || 0
-      var data = uni.getStorageSync("$crossPageTs")
+      var data = uni.getStorageSync("crossPageTs")
       if (data) {
         return {
-          $crossPageTs: data,
+          crossPageTs: data,
           timestamp: num
         }
       }

+ 0 - 4
src/pages/message/msgView.vue

@@ -133,10 +133,6 @@
     },
     onLoad(pam) {
       this.pam = pam
-      this.crossPage.$emit("aaaaa", {
-        a: 1,
-        n: 0
-      })
     },
     onShow() {
       // #ifdef H5