没有权限或者退出登录跳转到登录页面时当前页面url的query未设置
This commit is contained in:
		@@ -76,7 +76,8 @@ export default {
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    async logout() {
 | 
					    async logout() {
 | 
				
			||||||
      await this.$store.dispatch('user/logout')
 | 
					      await this.$store.dispatch('user/logout')
 | 
				
			||||||
      this.$router.push(`/login?redirect=${this.$route.fullPath}`)
 | 
					      const { path, query } = this.$route
 | 
				
			||||||
 | 
					      this.$router.push({ path: '/login', query: { redirect: path, ...query }})
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,7 +49,7 @@ router.beforeEach(async(to, from, next) => {
 | 
				
			|||||||
          // remove token and go to login page to re-login
 | 
					          // remove token and go to login page to re-login
 | 
				
			||||||
          await store.dispatch('user/resetToken')
 | 
					          await store.dispatch('user/resetToken')
 | 
				
			||||||
          Message.error(error || 'Has Error')
 | 
					          Message.error(error || 'Has Error')
 | 
				
			||||||
          next(`/login?redirect=${to.path}`)
 | 
					          next({ path: '/login', query: { redirect: to.path, ...to.query }})
 | 
				
			||||||
          NProgress.done()
 | 
					          NProgress.done()
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@@ -62,7 +62,7 @@ router.beforeEach(async(to, from, next) => {
 | 
				
			|||||||
      next()
 | 
					      next()
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      // other pages that do not have permission to access are redirected to the login page.
 | 
					      // other pages that do not have permission to access are redirected to the login page.
 | 
				
			||||||
      next(`/login?redirect=${to.path}`)
 | 
					      next({ path: '/login', query: { redirect: to.path, ...to.query }})
 | 
				
			||||||
      NProgress.done()
 | 
					      NProgress.done()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user