|
|
@ -5,7 +5,8 @@ import { constantRouterMap } from './router.config.js' |
|
|
|
import { checkWxmpRegister, login } from '@/api/user' |
|
|
|
import { title } from '@/config' |
|
|
|
|
|
|
|
const whiteList = ['/login','/goldenIdea','/mySuggestions','/topicList','/topicListDetail','/goldenIdeaDetail','/SpecialsolicitationFill','/specialTopicList','/register', '/errorPage','/selectAgency','/houseQR','/event','/peoSuggestion','/peoSuggestionexplain','/solicitationDaily'] |
|
|
|
const whiteList = ['/login','/goldenIdea','/mySuggestions'] |
|
|
|
const specialList = ['/topicList','/topicListDetail','/goldenIdeaDetail','/SpecialsolicitationFill','/specialTopicList','/register', '/errorPage','/selectAgency','/houseQR','/event','/peoSuggestion','/peoSuggestionexplain','/solicitationDaily'] |
|
|
|
const originalPush = Router.prototype.push |
|
|
|
Router.prototype.push = function push(location, onResolve, onReject) { |
|
|
|
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject) |
|
|
@ -80,7 +81,7 @@ router.beforeEach((to, from, next) => { |
|
|
|
} else { |
|
|
|
document.title = to.meta.title ? to.meta.title : title |
|
|
|
} |
|
|
|
if (localStorage.getItem('token') && (to.path != '/houseQR' && to.path != '/peoSuggestion'&& to.path != '/solicitationDaily' && to.path != '/peoSuggestionexplain')) { |
|
|
|
if (localStorage.getItem('token') && (to.path != '/houseQR' && !specialList.includes(to.path))) { |
|
|
|
store.dispatch('getUserInfo').then((res) => { |
|
|
|
if (res.agencyId) { |
|
|
|
next() |
|
|
@ -96,7 +97,7 @@ router.beforeEach((to, from, next) => { |
|
|
|
next({ path: '/login'}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
if (getQueryStringByName('code') && (to.path != '/houseQR' && to.path != '/peoSuggestion'&& to.path != '/solicitationDaily' && to.path != '/peoSuggestionexplain')) { |
|
|
|
if (getQueryStringByName('code') && (to.path != '/houseQR' && !specialList.includes(to.path))) { |
|
|
|
login({ wxCode: getQueryStringByName('code'),appId:'wxce2db0866b0698f8'}).then(res => { |
|
|
|
localStorage.setItem('token', res.data.token) |
|
|
|
localStorage.setItem('userId', res.data.userH5DTO.id) |
|
|
|