|
@@ -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
|
|
|
-})()
|
|
|
+})()
|