Files
sgxt_web/src/App.vue

155 lines
3.6 KiB
Vue
Raw Normal View History

2025-04-12 14:54:02 +08:00
<template>
2025-04-12 23:51:24 +08:00
<router-view v-slot="{ Component }" v-if="isRouterAlive">
<keep-alive :include="store.getters.keepLiiveRoute">
2025-09-04 13:55:33 +08:00
<Watermark :text="content" :color="'rgba(0, 0, 0, .15)'">
<Component :is="Component"></Component>
</Watermark>
2025-04-12 23:51:24 +08:00
</keep-alive>
</router-view>
2025-11-22 21:59:58 +08:00
<Fzq />
2025-10-26 12:25:50 +08:00
2025-04-12 14:54:02 +08:00
</template>
<script setup>
2025-09-04 13:55:33 +08:00
import Watermark from "@/components/Watermark.vue";
2025-10-26 12:25:50 +08:00
import { ref, reactive, nextTick, provide, onMounted, getCurrentInstance, onBeforeUnmount } from "vue";
2025-04-12 14:54:02 +08:00
import { useStore } from "vuex";
2025-10-26 12:25:50 +08:00
import { queryXxTj } from '@/api/commit.js'
import { getItem, setItem } from "@/utils/storage";
2025-04-12 14:54:02 +08:00
import { generateNewStyle, writeNewStyle } from "@/utils/theme";
2025-10-26 12:25:50 +08:00
import { timeValidate } from "@/utils/tools";
2025-11-22 21:59:58 +08:00
import Fzq from '@/components/fzq/index.vue'
2025-12-05 21:36:34 +08:00
import * as ocr from "@paddlejs-models/ocr";
2025-07-18 15:41:15 +08:00
const { proxy } = getCurrentInstance();
2025-04-12 14:54:02 +08:00
const store = useStore();
2025-12-05 21:36:34 +08:00
// 只在首次加载时调用一次避免多次创建style元素
if (!document.getElementById('dynamic-theme-style')) {
generateNewStyle(store.getters.mainColor).then((newStyle) => {
writeNewStyle(newStyle);
});
}
2025-04-12 14:54:02 +08:00
const isRouterAlive = ref(true);
const reload = () => {
isRouterAlive.value = false;
nextTick(() => {
isRouterAlive.value = true;
});
};
provide("reload", reload);
onMounted(() => {
2025-11-22 21:59:58 +08:00
document.title = "林芝哨岗系统";
2025-09-04 13:55:33 +08:00
frashJs()
2025-07-23 15:14:50 +08:00
// initPage()
2025-04-12 14:54:02 +08:00
});
2025-07-18 15:41:15 +08:00
2025-11-22 21:59:58 +08:00
2025-10-26 12:25:50 +08:00
2025-07-18 15:41:15 +08:00
/**
*@Descripttion:图片页面初始化
*@Author: PengShuai
*/
const initPage = async () => {
try {
await ocr.init();// 模型初始化
imgIsLoad = true;
2025-10-26 12:25:50 +08:00
proxy.$message({ type: "success", message: "加载成功" });
2025-07-18 15:41:15 +08:00
} catch (err) {
2025-10-26 12:25:50 +08:00
proxy.$message({ type: "error", message: "加载失败,请刷新页面" });
2025-07-18 15:41:15 +08:00
imgIsLoad = false;
}
}
2025-10-26 12:25:50 +08:00
const content = ref([])
2025-12-05 21:36:34 +08:00
// 获取初始水印内容
const getWatermarkContent = () => {
const sfzh = getItem("idEntityCard") || ''
const userName = getItem("USERNAME") || ''
2025-09-04 13:55:33 +08:00
const time = timeValidate()
2025-12-05 21:36:34 +08:00
return [userName, sfzh, time, "林芝哨岗系统", "禁止泄露公民个人信息和警务工作秘密"]
}
// 初始化水印内容
content.value = getWatermarkContent()
// 只在需要时调用,避免频繁更新导致重新渲染
const frashJs = () => {
content.value = getWatermarkContent()
2025-09-04 13:55:33 +08:00
}
2025-10-26 12:25:50 +08:00
// 监听标签页切换
2025-09-20 14:11:30 +08:00
2025-04-12 14:54:02 +08:00
</script>
<style lang="scss">
@import "./styles/index.scss";
2025-10-26 12:25:50 +08:00
2025-04-12 14:54:02 +08:00
body {
margin: 0px;
padding: 0px;
font-size: 14px;
}
2025-10-26 12:25:50 +08:00
2025-04-12 14:54:02 +08:00
ul {
margin: 0px;
padding: 0px;
}
2025-10-26 12:25:50 +08:00
2025-04-12 14:54:02 +08:00
li {
list-style-type: none;
}
2025-10-26 12:25:50 +08:00
2025-04-12 14:54:02 +08:00
#app {
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
Microsoft YaHei, SimSun, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #fff;
overflow-x: auto;
2025-04-15 18:22:42 +08:00
// background: #263445;
background: #fff;
2025-04-12 14:54:02 +08:00
}
v-deep .el-loading-mask {
background: rgba(0, 0, 0, 0.5) !important;
}
@font-face {
font-family: "DigifaceWide";
src: url("~@/assets/font/DigifaceWide.ttf");
font-weight: normal;
font-style: normal;
}
2025-10-26 12:25:50 +08:00
2025-04-12 14:54:02 +08:00
@font-face {
font-family: "HANYILINGXINTIJIAN";
src: url("~@/assets/font/HANYILINGXINTIJIAN-1.TTF");
font-weight: normal;
font-style: normal;
}
2025-10-26 12:25:50 +08:00
2025-04-12 14:54:02 +08:00
@font-face {
font-family: "YSBTH";
src: url("~@/assets/font/YSBTH.ttf");
font-weight: normal;
font-style: normal;
}
2025-10-26 12:25:50 +08:00
2025-04-12 23:51:24 +08:00
.bk_drawer_box {
.el-drawer__header {
background: #fff !important;
font-weight: 400;
font-size: 20px;
color: #000000;
line-height: 22px;
text-align: left;
text-transform: none;
2025-10-26 12:25:50 +08:00
margin-bottom: 0;
height: 40px;
2025-04-12 23:51:24 +08:00
}
}
2025-10-26 12:25:50 +08:00
::v-deep .badge-top-left .el-badge__content {
top: 0;
right: auto;
left: -10px;
transform: translateY(-50%) translateX(-50%);
}
2025-04-12 14:54:02 +08:00
</style>