吉安感知网项目-前端
shuishen
2026-02-12 ff67f84b2526067cb8cdb32d3b384c23d5ff0692
applications/task-work-order/src/axiosXT.js
@@ -1,7 +1,11 @@
import axios from 'axios'
import store from '@/store/'
import router from '@/router/'
import { serialize } from '@/utils/util'
import { getToken, removeToken, removeRefreshToken } from '@/utils/auth'
import { ElMessage } from 'element-plus'
let isErrorShown = false
let _retry = false
// 全局未授权错误提示状态,只提示一次
const { VITE_APP_API_XT, VITE_APP_ENV, VITE_APP_URL_XT } = import.meta.env
@@ -16,6 +20,10 @@
   store.dispatch('FedLogOut').then(() => {
      const { VITE_APP_PARENT_SYSTEM, VITE_APP_ENV } = import.meta.env
      const isDev = VITE_APP_ENV === 'development'
      isErrorShown = false
      _retry = false
      isDev
         ? router.push({ path: '/login' })
         : window.location.replace(`${VITE_APP_PARENT_SYSTEM}/#/login`)
@@ -54,6 +62,7 @@
      // 如果是401并且已经重试过,直接跳转到登录页面
      if ((status === 500 || status === 401) && !_retry) {
         _retry = true
         // 首次报错时提示
         if (!isErrorShown) {
            isErrorShown = true