|
|
|
@ -5,7 +5,7 @@ import { constantRouterMap } from './router.config.js' |
|
|
|
import { checkWxmpRegister, login } from '@/api/user' |
|
|
|
import { title } from '@/config' |
|
|
|
|
|
|
|
const whiteList = ['/login', '/register', '/errorPage','/selectAgency','/houseQR','/'] |
|
|
|
const whiteList = ['/login', '/register', '/errorPage','/selectAgency','/houseQR'] |
|
|
|
const originalPush = Router.prototype.push |
|
|
|
Router.prototype.push = function push(location, onResolve, onReject) { |
|
|
|
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject) |
|
|
|
@ -50,9 +50,9 @@ function paramsFormat(params) { |
|
|
|
} |
|
|
|
|
|
|
|
router.beforeEach((to, from, next) => { |
|
|
|
console.log(to); |
|
|
|
let urlParams = getQueryParams() |
|
|
|
if(urlParams.houseId){ |
|
|
|
console.log(urlParams); |
|
|
|
store.commit('SET_HOUSE_ID', urlParams.houseId) |
|
|
|
}else{ |
|
|
|
store.commit('SET_HOUSE_ID', null) |
|
|
|
@ -96,19 +96,18 @@ router.beforeEach((to, from, next) => { |
|
|
|
login({ wxCode: getQueryStringByName('code'),appId:'wx1078fa1e99424de9'}).then(res => { |
|
|
|
localStorage.setItem('token', res.token) |
|
|
|
localStorage.setItem('userId', res.userH5DTO.id) |
|
|
|
if(!res.userH5DTO.agencyId)next({ path: '/selectAgency'}) |
|
|
|
let state = decodeURIComponent(getQueryStringByName('state')) |
|
|
|
state = state.replace(/[\\\b\f\n\r\t]/g, '') |
|
|
|
state = state.replace(/(\s*?{\s*?|\s*?,\s*?)(['"])?([a-zA-Z0-9]+)(['"])?:/g, '$1"$3":') |
|
|
|
state = state |
|
|
|
.replace(/":/g, '":') |
|
|
|
.replace(/,"/g, ',"') |
|
|
|
.replace(/":/g, '":"') |
|
|
|
.replace(/,"/g, '","') |
|
|
|
.replace(/},/g, '"},') |
|
|
|
.replace(/}]/g, '"}]') |
|
|
|
.replace(/}}/g, '"}}') |
|
|
|
|
|
|
|
.replace(/:{"}/g, ':{}"') |
|
|
|
console.log(state) |
|
|
|
.replace(/"{/g, '{') |
|
|
|
.replace(/:{"}/g, ':{}') |
|
|
|
state = JSON.stringify({ path: '/', query: {} }); |
|
|
|
let path = `${location.origin}${location.pathname === '/' ? '' : location.pathname}` |
|
|
|
if (state && state != 'undefined') { |
|
|
|
state = JSON.parse(state) |
|
|
|
|