|
@@ -26,16 +26,21 @@ router.beforeEach(async(to, from, next) => {
|
|
|
if (hasToken) {
|
|
|
if (to.path === '/login') {
|
|
|
const userInfo = await getInfo();
|
|
|
- // console.log("User Info:", userInfo);
|
|
|
- if (userInfo.status === 200) {
|
|
|
+ console.log("User Info:", userInfo);
|
|
|
+ if (userInfo.code === 200) {
|
|
|
+ console.log("####")
|
|
|
setUseType(userInfo.data.userType, 86400)
|
|
|
setWebSiteId(userInfo.data.siteId, 86400)
|
|
|
setUserUrl(URL.webUrl, 86400)
|
|
|
+ next({ path: '/' })
|
|
|
+ NProgress.done() // hack: https://github.com/PanJiaChen/vue-element-admin/pull/2939
|
|
|
+ }else{
|
|
|
+ next({ path: '/' })
|
|
|
+ NProgress.done() // hack: https://github.com/PanJiaChen/vue-element-admin/pull/2939
|
|
|
}
|
|
|
// if is logged in, redirect to the home page
|
|
|
|
|
|
- next({ path: '/' })
|
|
|
- NProgress.done() // hack: https://github.com/PanJiaChen/vue-element-admin/pull/2939
|
|
|
+
|
|
|
} else {
|
|
|
// determine whether the user has obtained his permission roles through getInfo
|
|
|
const hasRoles = store.getters.roles && store.getters.roles.length > 0
|