diff --git a/index.html b/index.html index dde16aa..8f61c06 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Vite + Vue + TS + 高赛通
diff --git a/src/Layout/tabbar/index.vue b/src/Layout/tabbar/index.vue index 978f492..2a7cf98 100644 --- a/src/Layout/tabbar/index.vue +++ b/src/Layout/tabbar/index.vue @@ -23,7 +23,7 @@
-
注册
+
注册
登录
diff --git a/src/permissions.ts b/src/permissions.ts index cee1648..b1cb509 100644 --- a/src/permissions.ts +++ b/src/permissions.ts @@ -13,7 +13,7 @@ const asyncRouter = (path: string) => { } router.beforeEach(async (to, form, next) => { const useuserStore = userStore() - + document.title = to.meta.title ? '高赛通-' + to.meta.title : '高赛通' if (useuserStore.token) { if (to.path === '/login') { next({ path: '/' }) diff --git a/src/utils/requset.ts b/src/utils/requset.ts index 8140ca0..f64c8e3 100644 --- a/src/utils/requset.ts +++ b/src/utils/requset.ts @@ -5,23 +5,29 @@ import pinia from '@/store' import userStore from '@/store/module/user' // 创建axios实例 const server = axios.create({ - baseURL: import.meta.env.VITE_APP_BASE_API, - timeout:30000, + baseURL: import.meta.env.VITE_APP_BASE_API, + timeout: 30000, }) // 创建请求拦截器 + server.interceptors.request.use((config) => { -const useuserStore = userStore(pinia) + const useuserStore = userStore(pinia) - config.headers.Authorization = useuserStore.token - config.headers['x-access-token'] = useuserStore.token - return config - + config.headers.Authorization = useuserStore.token + config.headers['x-access-token'] = useuserStore.token + return config }) // 创建相应拦截器 server.interceptors.response.use((response) => { - return response.data + const useuserStore = userStore(pinia) + + if (response.data.code === 401) { + useuserStore.logout() + return + } + return response.data }) // 暴露axios实例 -export default server \ No newline at end of file +export default server diff --git a/src/views/raceInfo/index.vue b/src/views/raceInfo/index.vue index a4b5035..2e8253c 100644 --- a/src/views/raceInfo/index.vue +++ b/src/views/raceInfo/index.vue @@ -56,10 +56,10 @@
@@ -106,7 +106,7 @@
附件:
- fhsuihfiaosdufasiu.pdf + {{ raceInfo.compFile }}
@@ -174,6 +174,11 @@ getraceInfoEvent() const goToCompetition = (id:any) => { Router.push({ path: '/competition', query: { id } }) } + +const doLoadFile = (url:any) => { + // console.log( import.meta.env.VITE_APP_BASE_API + "/sys/common/static/" + url) + window.open( import.meta.env.VITE_APP_BASE_API + "/sys/common/static/" + url) +}