diff --git a/src/router/index.js b/src/router/index.js index 24f9dc8..cfbf04b 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -54,7 +54,8 @@ const routes = [ path: 'competition', name: 'Competition', component: () => import('@/views/index/Competition.vue'), - meta: { requiresAuth: true, requiredPrivilege: ['lv-admin','lv-competitor'] } + // meta: { requiresAuth: true, requiredPrivilege: ['lv-admin','lv-competitor'] } + meta: { requiresAuth: true} }, { path: 'competition/add', diff --git a/src/utils/jwt.js b/src/utils/jwt.js index 26cdbde..60975b4 100644 --- a/src/utils/jwt.js +++ b/src/utils/jwt.js @@ -43,14 +43,11 @@ export const getUserInfo = async () => { throw new Error('No valid token found'); } try { - // 首先获取用户基本信息 const response = await axiosInstance.get(USER_INFO_URL); const user = response.data; - // 进一步获取临时权限信息 try { const tempResp = await axiosInstance.get(TEMP_PRIVILEGE_URL); - // 这里假设后端返回格式为 { temp_privilege: 'lv-map;lv-competitor' } if (tempResp.data) { if (tempResp.data.temp_privilege !== undefined) { user.temp_privilege = tempResp.data.temp_privilege; @@ -96,7 +93,6 @@ export const loginSuccess = (accessToken, userId) => { // localStorage.removeItem('access_token'); // localStorage.removeItem('user_id'); // sessionStorage.removeItem('currentUser'); - // 存储新的认证信息 localStorage.setItem('access_token', accessToken); if (userId) { diff --git a/src/views/index.vue b/src/views/index.vue index 8f8d1aa..98d3f7f 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -307,7 +307,8 @@ function hasInvalidTempPrivilege(user) {