diff --git a/frontend/public/images/navleft.png b/frontend/public/images/navleft.png new file mode 100644 index 0000000..cfb6b5c Binary files /dev/null and b/frontend/public/images/navleft.png differ diff --git a/frontend/public/images/navright.png b/frontend/public/images/navright.png new file mode 100644 index 0000000..3d53640 Binary files /dev/null and b/frontend/public/images/navright.png differ diff --git a/frontend/src/assets/system/navleft.png b/frontend/src/assets/system/navleft.png new file mode 100644 index 0000000..cfb6b5c Binary files /dev/null and b/frontend/src/assets/system/navleft.png differ diff --git a/frontend/src/data-public/Dashboard.vue b/frontend/src/data-public/Dashboard.vue index f1f37ee..dc2c5d2 100644 --- a/frontend/src/data-public/Dashboard.vue +++ b/frontend/src/data-public/Dashboard.vue @@ -195,7 +195,7 @@ function routerclick(path) { }else if(path == '/UserLogin'){ const route = router.resolve({ path: path, - query: { id: '1927554158852841473' ,name:'测试项目'} + // query: { id: '1927554158852841473' ,name:'测试项目'} }); window.open(route.href, '_blank'); } diff --git a/frontend/src/data-visualization/config/axios/service.ts b/frontend/src/data-visualization/config/axios/service.ts index d2666cf..91c62a1 100644 --- a/frontend/src/data-visualization/config/axios/service.ts +++ b/frontend/src/data-visualization/config/axios/service.ts @@ -21,7 +21,8 @@ type InternalAxiosRequestConfigWidthLoading = T & { loading?: boolean } -import { ElMessage, ElMessageBox } from 'element-plus-secondary' +// import { ElMessage, ElMessageBox } from 'element-plus-secondary' +import { ElMessage } from 'element-plus' import router from '@/router' const { result_code } = config @@ -132,11 +133,11 @@ service.interceptors.response.use( ( response: AxiosResponse & { config: InternalAxiosRequestConfig & { loading?: boolean } } ) => { - if (response.config.responseType === 'blob') { // 如果是文件流,直接过 return response } else if (response.data.code == result_code || response.data.code == 50002) { + return response.data } else if (response.config.url.match(/^\/map|geo\/\d{3}\/\d+\.json$/)) { // TODO 处理静态文件 @@ -158,6 +159,7 @@ service.interceptors.response.use( message: response.data.msg, showClose: true }) + if (response.data.code === 80001) { localStorage.clear() let queryRedirectPath = '/application/index' diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index a7f5d54..0260d87 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -114,7 +114,7 @@ const routes:any = [ component: () => import('@/views/system/userlogin/login_container.vue'), meta: { title: '登录', - requiresAuth: true + requiresAuth: false } }, { @@ -140,17 +140,24 @@ router.beforeEach((to, from, next) => { // 设置页面标题 document.title = to.meta.title ? `${to.meta.title} - StdProject` : 'StdProject' + debugger + console.log(userStore.isAuthenticated) // 检查是否需要认证 if (to.meta.requiresAuth) { - next() + // next() // if (userStore.isAuthenticated) { // next() // } else { // next('/login') // } + if (userStore.isAuthenticated) { + next() + } else { + next('/UserLogin') // 未认证重定向到登录页 + } } else { // 如果已登录且访问登录页,重定向到仪表板 - if (to.path === '/login' && userStore.isAuthenticated) { + if (to.path === '/UserLogin' && userStore.isAuthenticated) { next('/dashboard') } else { next() diff --git a/frontend/src/store/user.ts b/frontend/src/store/user.ts index 5ca52ee..f1e1bf8 100644 --- a/frontend/src/store/user.ts +++ b/frontend/src/store/user.ts @@ -5,6 +5,7 @@ import { ElMessage } from 'element-plus' export const useUserStore = defineStore('user', () => { // 状态 + debugger const token = ref(localStorage.getItem('token') || '') const userInfo = ref(JSON.parse(localStorage.getItem('userInfo') || 'null')) const permissions = ref(JSON.parse(localStorage.getItem('permissions') || '[]')) diff --git a/frontend/src/views/system/manage/user/userinfo.vue b/frontend/src/views/system/manage/user/userinfo.vue index b2fdb3c..0f78c8b 100644 --- a/frontend/src/views/system/manage/user/userinfo.vue +++ b/frontend/src/views/system/manage/user/userinfo.vue @@ -1,6 +1,6 @@