|
@@ -11,7 +11,11 @@ import {stringifyQuery,parseQuery} from '@/utils/query'
|
|
|
Vue.use(VueRouter)
|
|
|
|
|
|
const originalPush = VueRouter.prototype.push
|
|
|
-VueRouter.prototype.push = function push(location) {
|
|
|
+// VueRouter.prototype.push = function push(location) {
|
|
|
+// return originalPush.call(this, location).catch(err => err)
|
|
|
+// }
|
|
|
+VueRouter.prototype.push = function push(location, onResolve, onReject) {
|
|
|
+ if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
|
|
|
return originalPush.call(this, location).catch(err => err)
|
|
|
}
|
|
|
const routes = [
|
|
@@ -338,9 +342,12 @@ router.beforeEach((to, from, next) => {
|
|
|
document.title = to.meta.title;
|
|
|
}
|
|
|
if (to.path == '/administrator/login'|| routeExists(routes,to.path) || to.meta.notLogin) {
|
|
|
- Cookies.remove("token")
|
|
|
- localStorage.removeItem('vuex')
|
|
|
- localStorage.removeItem('showMessage')
|
|
|
+ if(to.path == '/administrator/login'){
|
|
|
+ Cookies.remove("token")
|
|
|
+ Store.commit('SET_PERMISSION',null)
|
|
|
+ localStorage.removeItem('vuex')
|
|
|
+ localStorage.removeItem('showMessage')
|
|
|
+ }
|
|
|
next()
|
|
|
}
|
|
|
else {
|
|
@@ -353,7 +360,7 @@ router.beforeEach((to, from, next) => {
|
|
|
next({ name: 'Administrator_login' })
|
|
|
break;
|
|
|
default:
|
|
|
- if(Store.getters.permission === null){
|
|
|
+ if(Store.getters.permission === null && from.path == '/administrator/login'){
|
|
|
Store.dispatch('getPersonPermission').then(response=>{
|
|
|
var permission = response.data
|
|
|
// if(permission.length>0){}
|