无人机管理后台前端(已迁走)
张含笑
2025-07-03 e77cdd81559afcd17005fcab35fcfd030b4a24fc
feat:点击登录跳转到指挥调度大屏登录页面
3 files modified
32 ■■■■■ changed files
src/axios.js 16 ●●●●● patch | view | raw | blame | history
src/page/index/top/index.vue 4 ●●● patch | view | raw | blame | history
src/permission.js 12 ●●●●● patch | view | raw | blame | history
src/axios.js
@@ -34,7 +34,7 @@
    baseUrl
} from '@/config/env';
import crypto from '@/utils/crypto';
const adminUrl = import.meta.env.VITE_APP_DASHBOARD_URL
// 全局未授权错误提示状态,只提示一次
let isErrorShown = false;
@@ -170,9 +170,10 @@
                    removeToken();
                    removeRefreshToken();
                    // 重定向到登录页
                    store.dispatch('FedLogOut').then(() => router.push({
                        path: '/login'
                    }));
                    // store.dispatch('FedLogOut').then(() => router.push({
                    //     path: '/login'
                    // }));
                    store.dispatch('FedLogOut').then(() =>  window.location.replace(`${adminUrl}#/login`));
                    return Promise.reject(new Error(message));
                });
        }
@@ -190,9 +191,10 @@
            removeToken();
            removeRefreshToken();
            // 重定向到登录页
            store.dispatch('FedLogOut').then(() => router.push({
                path: '/login'
            }));
            // store.dispatch('FedLogOut').then(() => router.push({
            //     path: '/login'
            // }));
            store.dispatch('FedLogOut').then(() =>  window.location.replace(`${adminUrl}#/login`));
            return Promise.reject(new Error(message));
        }
        // 如果请求为oauth2错误码则首次报错时提示
src/page/index/top/index.vue
@@ -102,7 +102,9 @@
        type: 'warning',
      }).then(() => {
        this.$store.dispatch('LogOut').then(() => {
          this.$router.push({ path: '/login' })
          // this.$router.push({ path: '/login' })
          const adminUrl = import.meta.env.VITE_APP_DASHBOARD_URL
          window.location.replace(`${adminUrl}#/login`)
        })
      })
    },
src/permission.js
@@ -18,7 +18,7 @@
NProgress.configure({ showSpinner: false })
const lockPage = '/lock' //锁屏页
const urlParams = getUrlParams(window.location.href)
const adminUrl = import.meta.env.VITE_APP_DASHBOARD_URL
function findRouteByPath (routes, targetPath) {
  // 遍历数组中的每个路由对象
  for (const route of routes) {
@@ -93,9 +93,10 @@
    } else {
      const systemToken = store.getters.token || urlParams?.token
      if (systemToken === 0) {
        store.dispatch('FedLogOut').then(() => {
          next({ path: '/login' })
        })
        // store.dispatch('FedLogOut').then(() => {
        //   next({ path: '/login' })
        // })
        store.dispatch('FedLogOut').then(() =>  window.location.replace(`${adminUrl}#/login`));
      } else {
        const meta = to.meta || {}
        const query = to.query || {}
@@ -120,7 +121,8 @@
    if (meta.isAuth === false) {
      next()
    } else {
      next('/login')
      // next('/login')
      window.location.replace(`${adminUrl}#/login`)
    }
  }
})