吉安感知网项目-前端
shuishen
6 days ago 6e88705bd5b443a259b24c17c8a299765d059d96
applications/drone-command/src/utils/util.js
@@ -1,6 +1,8 @@
import { validatenull } from './validate'
import sha256 from 'crypto-js/sha256'
import Base64 from 'crypto-js/enc-base64'
import { useRoute } from 'vue-router'
//表单序列化
export const serialize = data => {
  let list = []
@@ -500,19 +502,26 @@
   a = null
}
// 统一退出登录
export async function logOutFun(next) {
export async function logOutFun() {
   // 延迟导入 store 和 router,避免循环依赖:
   // auth.js → router → store → user.js → auth.js
   const { default: store } = await import('@/store')
   const { default: router } = await import('@/router')
   const { VITE_APP_PARENT_SYSTEM, VITE_APP_ENV } = import.meta.env
   store.dispatch('LogOut').then(() => {
   const jumpFun = () => {
      const urlParams = new URLSearchParams(window.location.search);
      const openDev = urlParams.get('openDev');
      const isDev = VITE_APP_ENV === 'development'
      if (isDev) {
         next ? next() : router.push({ path: '/login' })
         setTimeout(() => location.reload())
      if (isDev || openDev) {
         router.push({ path: '/login' })
         // setTimeout(() => location.reload())
      } else {
         window.location.replace(`${VITE_APP_PARENT_SYSTEM}/#/login`)
      }
   }
   store.dispatch('LogOut').then(() => {
      jumpFun()
   })
}