From 58a86c50b0d49be9b4ea713d08bf2d1754c9420e Mon Sep 17 00:00:00 2001 From: bestlee Date: Wed, 18 Nov 2026 14:03:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=B7=A5=E5=86=B5=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E8=AF=A6=E6=83=85=E5=AD=97=E6=AE=B5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/request.js | 7 +++++-- src/router/index.js | 16 ++++++++-------- src/views/abnormal/index.vue | 9 +++++---- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/api/request.js b/src/api/request.js index e015011..f52e64d 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -42,8 +42,11 @@ axios.interceptors.response.use( }, (error) => { if (error.response.status === 401) { - showNotify({ message: '账号已过期,请重新登录!', background: '#ff7d00' }); - router.push({ path: '/login' }); + // 异常工况推送页为免登录页面,401 时不跳转登录页 + if (router.currentRoute.value.path !== '/abnormal') { + showNotify({ message: '账号已过期,请重新登录!', background: '#ff7d00' }); + router.push({ path: '/login' }); + } } else { showNotify({ message: error.response.data.message || '服务错误', background: '#ff7d00' }); } diff --git a/src/router/index.js b/src/router/index.js index a9dadad..4a0ff70 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -18,6 +18,13 @@ const constantRoutes = [ component: () => import('../views/error/404.vue'), meta: { title: '页面不存在' }, }, + // 异常工况模块:异常工况推送(免登录,token 通过 URL 参数携带) + { + path: '/abnormal', + name: 'abnormal', + component: () => import('../views/abnormal/index.vue'), + meta: { title: '异常工况推送' }, + }, ]; const router = createRouter({ @@ -56,13 +63,6 @@ const asyncRoutes = [ component: () => import('../views/applyList/waitList.vue'), meta: { title: '待审批列表' }, }, - // 异常工况模块:异常工况推送 - { - path: '/abnormal', - name: 'abnormal', - component: () => import('../views/abnormal/index.vue'), - meta: { title: '异常工况推送' }, - }, ] // 标志位:是否已添加动态路由 @@ -86,7 +86,7 @@ router.beforeEach((to, from, next) => { next() } } else { - if (to.path === '/login' || to.path === '/404') { + if (to.path === '/login' || to.path === '/404' || to.path === '/abnormal') { next() } else { next({ path: '/login' }) diff --git a/src/views/abnormal/index.vue b/src/views/abnormal/index.vue index 56b5ee1..bb4a0cc 100644 --- a/src/views/abnormal/index.vue +++ b/src/views/abnormal/index.vue @@ -29,10 +29,10 @@ const getInfo = async () => { messageInfo.value = { card: res?.data?.title || '', type: res?.data?.card_snapshot?.severity || '', - org: res.data?.org_id, + org: res.data?.org_name, triggerTime: res?.data?.occurred_at || '', name: res?.data?.rule_snapshot?.name || '', - condition: '液位正常控制25~205cm,HH=210cm;压力<1.3MPa;液位/压力趋势异常或出现报警。', + condition: res?.data?.condition_summary || '', reason: res?.data?.card_snapshot?.causes?.map(item => item.cause).join(';') || '', result: res?.data?.card_snapshot?.consequence || '', feedback: !res?.data?.can_confirm, @@ -72,10 +72,11 @@ const onFeedback = async (type) => { } } -onMounted(() => { +onMounted(async () => { const { id,token } = router.currentRoute.value.query; if(id && token){ - // localStorage.setItem('token', token); + console.log(token) + await localStorage.setItem('token', token); currentId.value = id; getInfo() }