吉安感知网项目-前端
罗广辉
2026-02-09 f757aad8de3ab1a8c524f0fed35da82a703dac14
feat: 免密登陆-工单
6 files modified
79 ■■■■ changed files
applications/drone-command/src/axios.js 20 ●●●●● patch | view | raw | blame | history
applications/drone-command/src/permission.js 10 ●●●● patch | view | raw | blame | history
applications/drone-command/src/store/modules/user.js 1 ●●●● patch | view | raw | blame | history
applications/task-work-order/src/axios.js 35 ●●●●● patch | view | raw | blame | history
applications/task-work-order/src/permission.js 11 ●●●●● patch | view | raw | blame | history
applications/task-work-order/src/store/modules/user.js 2 ●●●●● patch | view | raw | blame | history
applications/drone-command/src/axios.js
@@ -30,6 +30,16 @@
//跨域请求,允许保存cookie
axios.defaults.withCredentials = true
function logOutFun() {
    store.dispatch('FedLogOut').then(() =>{
        const {VITE_APP_PARENT_SYSTEM,VITE_APP_ENV} = import.meta.env
        const isDev = VITE_APP_ENV === 'development'
        isDev
            ? router.push({ path: '/login' })
            : window.location.replace(`${VITE_APP_PARENT_SYSTEM}/#/login`)
    })
}
//http request拦截
axios.interceptors.request.use(
  config => {
@@ -150,10 +160,7 @@
          removeRefreshToken()
          const env = import.meta.env.VITE_APP_ENV
          // 重定向到登录页
          store.dispatch('FedLogOut').then(() => router.push({
            path: '/login'
          }))
                    logOutFun()
          return Promise.reject(new Error(message))
        })
    }
@@ -171,10 +178,7 @@
      removeToken()
      removeRefreshToken()
      // 重定向到登录页
      store.dispatch('FedLogOut').then(() => router.push({
        path: '/login'
      }))
            logOutFun()
      return Promise.reject(new Error(message))
    }
    // 如果请求为oauth2错误码则首次报错时提示
applications/drone-command/src/permission.js
@@ -91,9 +91,13 @@
    } else {
      const systemToken = store.getters.token || urlParams?.token
      if (systemToken === 0) {
        store.dispatch('FedLogOut').then(() => {
          next({ path: '/login' })
        })
                store.dispatch('FedLogOut').then(() =>{
                    const {VITE_APP_PARENT_SYSTEM,VITE_APP_ENV} = import.meta.env
                    const isDev = VITE_APP_ENV === 'development'
                    isDev
                        ? router.push({ path: '/login' })
                        : window.location.replace(`${VITE_APP_PARENT_SYSTEM}/#/login`)
                })
      } else {
        const meta = to.meta || {}
        const query = to.query || {}
applications/drone-command/src/store/modules/user.js
@@ -260,6 +260,7 @@
        removeRefreshToken()
        removeToken()
        resolve()
                localStorage.clear()
      })
    },
    GetTopMenu () {
applications/task-work-order/src/axios.js
@@ -17,7 +17,6 @@
import { Base64 } from 'js-base64'
import { baseUrl } from '@/config/env'
import crypto from '@/utils/crypto'
const adminUrl = import.meta.env.VITE_APP_DASHBOARD_URL
// 全局未授权错误提示状态,只提示一次
let isErrorShown = false
@@ -34,6 +33,17 @@
    //跨域请求,允许保存cookie
    withCredentials: true,
})
function logOutFun() {
    store.dispatch('FedLogOut').then(() =>{
        const {VITE_APP_PARENT_SYSTEM,VITE_APP_ENV} = import.meta.env
        const isDev = VITE_APP_ENV === 'development'
        isDev
            ? router.push({ path: '/login' })
            : window.location.replace(`${VITE_APP_PARENT_SYSTEM}/#/login`)
    })
}
//http request拦截
service.interceptors.request.use(
@@ -153,16 +163,7 @@
                    removeRefreshToken()
                    const env = import.meta.env.VITE_APP_ENV
                    // 重定向到登录页
                    store.dispatch('FedLogOut').then(() => router.push({
                        path: '/login'
                    }));
                    // env === 'development'
                    //     ? store.dispatch('FedLogOut').then(() =>
                    //             router.push({
                    //                 path: '/login',
                    //             })
                    //       )
                    //     : store.dispatch('FedLogOut').then(() => window.location.replace(`${adminUrl}#/login`))
                    logOutFun()
                    return Promise.reject(new Error(message))
                })
        }
@@ -180,17 +181,7 @@
            removeToken()
            removeRefreshToken()
            // 重定向到登录页
            //   store.dispatch('FedLogOut').then(() => router.push({
            //       path: '/login'
            //   }));
            const env = import.meta.env.VITE_APP_ENV
            env === 'development'
                ? store.dispatch('FedLogOut').then(() =>
                        router.push({
                            path: '/login',
                        })
                  )
                : store.dispatch('FedLogOut').then(() => window.location.replace(`${adminUrl}#/login`))
            logOutFun()
            return Promise.reject(new Error(message))
        }
        // 如果请求为oauth2错误码则首次报错时提示
applications/task-work-order/src/permission.js
@@ -92,10 +92,13 @@
    } else {
      const systemToken = store.getters.token || urlParams?.token
      if (systemToken === 0) {
        store.dispatch('FedLogOut').then(() => {
          next({ path: '/login' })
        })
        // store.dispatch('FedLogOut').then(() =>  window.location.replace(`${adminUrl}#/login`));
                store.dispatch('FedLogOut').then(() =>{
                    const {VITE_APP_PARENT_SYSTEM,VITE_APP_ENV} = import.meta.env
                    const isDev = VITE_APP_ENV === 'development'
                    isDev
                        ? router.push({ path: '/login' })
                        : window.location.replace(`${VITE_APP_PARENT_SYSTEM}/#/login`)
                })
      } else {
        const meta = to.meta || {}
        const query = to.query || {}
applications/task-work-order/src/store/modules/user.js
@@ -228,6 +228,7 @@
                        removeToken()
                        removeRefreshToken()
                        resolve()
                        localStorage.clear()
                    })
                    .catch(error => {
                        reject(error)
@@ -247,6 +248,7 @@
                removeRefreshToken()
                removeToken()
                resolve()
                localStorage.clear()
            })
        },
        GetTopMenu() {