diff --git a/src/config/piniaPersist.ts b/src/config/piniaPersist.ts index 502b5de..9dc6f4e 100644 --- a/src/config/piniaPersist.ts +++ b/src/config/piniaPersist.ts @@ -9,8 +9,8 @@ import { PersistedStateOptions } from "pinia-plugin-persistedstate"; const piniaPersistConfig = (key: string, paths?: string[]) => { const persist: PersistedStateOptions = { key, - storage: localStorage, - // storage: sessionStorage, + // storage: localStorage, + storage: sessionStorage, paths }; return persist; diff --git a/src/routers/index.ts b/src/routers/index.ts index 3721f92..84eacac 100644 --- a/src/routers/index.ts +++ b/src/routers/index.ts @@ -47,7 +47,11 @@ router.beforeEach(async (to, from, next) => { globalStore.setUserId(window.location.href.split("userId=")[1].split("&")[0]); } if (freeSn) { - globalStore.setSN(window.location.href.split("sn=")[1]); + let sn = window.location.href.split("sn=")[1]; + console.log("进来了", sn); + sn.includes("&") && (sn = sn.split("&")[0]); + + globalStore.setSN(sn); } // let urlParams = new URLSearchParams(window.location.href.split('?')[1]); // let params = {} as any; diff --git a/src/stores/index.ts b/src/stores/index.ts index f8cfde5..32ff13f 100644 --- a/src/stores/index.ts +++ b/src/stores/index.ts @@ -32,6 +32,7 @@ export const GlobalStore = defineStore({ // language language: "", path: null, + isIframe: false, // themeConfig themeConfig: { // 当前页面是否全屏 @@ -83,6 +84,10 @@ export const GlobalStore = defineStore({ setProjectDateAuth(projectDateAuth: number | null) { this.projectDateAuth = projectDateAuth; }, + // 是否为iframe模式 + setIsIframe(isIframe: boolean | null) { + this.isIframe = isIframe; + }, // 判断所属工程有没有校验 setIsManager(isManager: string | null) { this.isManager = isManager; diff --git a/src/stores/interface/index.ts b/src/stores/interface/index.ts index 4dd6d34..62740aa 100644 --- a/src/stores/interface/index.ts +++ b/src/stores/interface/index.ts @@ -17,6 +17,8 @@ export interface GlobalState { openDropdown: boolean | null; path: string | null; isManager: string | null; + isIframe: boolean | null; + userId: string | null; } /* themeConfigProp */ diff --git a/src/views/sevenLargeScreen/homeworkControlProcess/components/iscPlayer.vue b/src/views/sevenLargeScreen/homeworkControlProcess/components/iscPlayer.vue index 12ecf9b..ed60b0c 100644 --- a/src/views/sevenLargeScreen/homeworkControlProcess/components/iscPlayer.vue +++ b/src/views/sevenLargeScreen/homeworkControlProcess/components/iscPlayer.vue @@ -61,7 +61,7 @@ import { getVideoItemInfoPoliceCameraItemApi } from "@/api/modules/workTicket"; import { Close } from "@element-plus/icons-vue"; import moment from "moment"; import dayjs from "dayjs"; -import { reactive, watch, onMounted, computed, nextTick } from "vue"; +import { reactive, watch, onMounted, computed, nextTick, onBeforeUnmount } from "vue"; import { ElMessage } from "element-plus"; import loadingGif from "@/assets/images/iscImage/loading.gif"; import errorPng from "@/assets/images/iscImage/text-to-image.png"; @@ -576,6 +576,19 @@ onMounted(() => { // 页面加载初始化` initPlayer(); }); +onBeforeUnmount(() => { + videoInfo.player.JS_Stop(0).then( + () => { + console.info("JS_Stop success"); + // do you want... + }, + (err) => { + console.info("JS_Stop failed:", err); + // do you want... + } + ); + videoInfo.player = null; +});