From 9df7d609632f5b8f65287fdf5e9f4aa57874c751 Mon Sep 17 00:00:00 2001 From: kun <1422840143@qq.com> Date: Mon, 30 Oct 2023 17:07:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20BUG=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.production | 4 +-- src/config/config.ts | 8 ++++- src/routers/index.ts | 33 ++++++++++++++++++- .../siteSupervision/videoMonitoring/index.vue | 5 --- 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/.env.production b/.env.production index e7f45d8..9147f20 100644 --- a/.env.production +++ b/.env.production @@ -5,8 +5,8 @@ NODE_ENV = "production" # VITE_API_URL = "http://139.9.66.234:6688" # VITE_API_URL = "http://jxjzw.zhgdyun.com:6688" # VITE_API_URL = 'http://192.168.34.155:6688' -VITE_API_URL = 'http://10.75.253.12:6090' -# VITE_API_URL = "http://jxjzw.zhgdyun.com:9013" +# VITE_API_URL = 'http://10.75.253.12:6090' +VITE_API_URL = "http://jxjzw.zhgdyun.com:9013" VITE_WPAPI_URL = "http://jxjzw.zhgdyun.com:8081" # VITE_API_URL = "http://101.43.164.214:6688" # VITE_API_URL = "https://wx.antjg.com:6081/" diff --git a/src/config/config.ts b/src/config/config.ts index bfb9137..a9cf987 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -12,7 +12,13 @@ export const LOGIN_URL: string = "/login"; export const DEFAULT_PRIMARY: string = "#008BFF"; // * 路由白名单地址(必须是本地存在的路由 staticRouter.ts) -export const ROUTER_WHITE_LIST: string[] = ["/500", "/projectlogon", "/compLogon", "/load"]; +export const ROUTER_WHITE_LIST: string[] = [ + "/500", + "/projectlogon", + "/compLogon", + "/load", + "/goverment/huizhou/siteSupervision/videoMonitoring/index" +]; // * 高德地图 key export const AMAP_MAP_KEY: string = "142e51d55274a0140e838245345cf9ad"; diff --git a/src/routers/index.ts b/src/routers/index.ts index 8290013..5f13250 100644 --- a/src/routers/index.ts +++ b/src/routers/index.ts @@ -7,6 +7,8 @@ import { staticRouter, errorRouter } from "@/routers/modules/staticRouter"; import NProgress from "@/config/nprogress"; import { HOME_URL } from "@/enums/Home"; import { getButtonAuth } from "@/api/modules/auth"; +import { userAnalysis } from "@/api/modules/huizhou"; +import { getHomePage } from "@/api/modules/goverment"; // import path from "path"; /** @@ -55,7 +57,36 @@ router.beforeEach(async (to, from, next) => { } // 4.判断访问页面是否在路由白名单地址中,如果存在直接放行 - if (ROUTER_WHITE_LIST.includes(to.path)) return next(); + if (ROUTER_WHITE_LIST.includes(to.path)) { + if (to.query.token) { + const res = await userAnalysis({ + ssoToken: to.query.token + }); + console.log(res); + if (res.result) { + let responseData: any = res.result; + globalStore.setToken(responseData.token); + globalStore.setAccount(responseData.account); + globalStore.setAccountType(responseData.accountType); + globalStore.setProjectDateAuth(responseData.projectDateAuth); + globalStore.setIsManager(responseData.isManager); //我已知晓 + // 获取module + const res1 = await getHomePage(); + let data: any = {}; + data = res1.result || {}; + // tabsStore.closeMultipleTab(); + // keepAlive.setKeepAliveName(); + // await sendMessage({ isSuccess: true }, 2); + globalStore.setPath(to.path); + await initDynamicRouter(); + // globalStore.moduleId = data["惠州项目"][0].moduleId; + } else { + // ElMessage.error("登录信息异常,请刷新或重新登录!"); + return; + } + } + return next(); + } // 5.判断是否有 Token,没有重定向到 login // if (!globalStore.token) return next({ path: LOGIN_URL, replace: true }); diff --git a/src/views/goverment/huizhou/siteSupervision/videoMonitoring/index.vue b/src/views/goverment/huizhou/siteSupervision/videoMonitoring/index.vue index 50d00c6..e68f6f8 100644 --- a/src/views/goverment/huizhou/siteSupervision/videoMonitoring/index.vue +++ b/src/views/goverment/huizhou/siteSupervision/videoMonitoring/index.vue @@ -165,10 +165,6 @@ import TreeFilter from "@/components/TreeFilter/index.vue"; import { GlobalStore } from "@/stores"; import Pagination from "@/components/ProTable/components/Pagination.vue"; import type { UploadProps, FormInstance, FormRules } from "element-plus"; -import { format } from "date-fns"; -import { useRouter } from "vue-router"; - -const router = useRouter(); const store = GlobalStore(); interface rightFormList { @@ -624,7 +620,6 @@ onMounted(async () => { // console.log(item); }); }); - onBeforeUnmount(() => { if (oWebControl.value === undefined) { // 先让窗口隐藏,规避可能的插件窗口滞后于浏览器消失问题