1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- import { spread } from "@/api/user";
- import Cache from "@/utils/cache";
- export function silenceBindingSpread()
- {
-
-
-
- let puid = Cache.get('spid'),code = 0;
-
-
-
- let puid = getApp().globalData.spid,code = getApp().globalData.code;
-
-
- puid = parseInt(puid);
- if(Number.isNaN(puid)){
- puid = 0;
- }
- if(puid){
- spread({puid,code}).then(res=>{
-
- Cache.clear('spid');
-
-
-
- getApp().globalData.spid = 0;
- getApp().globalData.code = 0;
-
-
- }).catch(res=>{
- });
- }
- }
- export function isWeixin() {
- return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
- }
- export function parseQuery() {
- const res = {};
- const query = (location.href.split("?")[1] || "")
- .trim()
- .replace(/^(\?|#|&)/, "");
- if (!query) {
- return res;
- }
- query.split("&").forEach(param => {
- const parts = param.replace(/\+/g, " ").split("=");
- const key = decodeURIComponent(parts.shift());
- const val = parts.length > 0 ? decodeURIComponent(parts.join("=")) : null;
- if (res[key] === undefined) {
- res[key] = val;
- } else if (Array.isArray(res[key])) {
- res[key].push(val);
- } else {
- res[key] = [res[key], val];
- }
- });
- return res;
- }
- const VUE_APP_WS_URL = process.env.VUE_APP_WS_URL || `ws://${location.hostname}`;
- export {VUE_APP_WS_URL}
- export default parseQuery;
|