Files
sgxt_web/src/App.vue
2025-12-18 18:24:09 +08:00

183 lines
4.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<router-view v-slot="{ Component }" v-if="isRouterAlive">
<keep-alive :include="store.getters.keepLiiveRoute">
<Watermark :text="content" :color="'rgba(0, 0, 0, .15)'">
<Component :is="Component"></Component>
</Watermark>
</keep-alive>
</router-view>
<Fzq />
</template>
<script setup>
import Watermark from "@/components/Watermark.vue";
import { ref, reactive, nextTick, provide, onMounted, getCurrentInstance, onBeforeUnmount } from "vue";
import { useStore } from "vuex";
import { queryXxTj } from '@/api/commit.js'
import { getItem, setItem } from "@/utils/storage";
import { generateNewStyle, writeNewStyle } from "@/utils/theme";
import { timeValidate } from "@/utils/tools";
import Fzq from '@/components/fzq/index.vue'
import * as ocr from "@paddlejs-models/ocr";
const { proxy } = getCurrentInstance();
const store = useStore();
// 只在首次加载时调用一次避免多次创建style元素
if (!document.getElementById('dynamic-theme-style')) {
generateNewStyle(store.getters.mainColor).then((newStyle) => {
writeNewStyle(newStyle);
});
}
const isRouterAlive = ref(true);
const reload = () => {
isRouterAlive.value = false;
nextTick(() => {
isRouterAlive.value = true;
});
};
provide("reload", reload);
onMounted(() => {
document.title = "林芝哨岗系统";
frashJs()
// initPage()
});
/**
*@Descripttion:图片页面初始化
*@Author: PengShuai
*/
const initPage = async () => {
try {
await ocr.init();// 模型初始化
imgIsLoad = true;
proxy.$message({ type: "success", message: "加载成功" });
} catch (err) {
proxy.$message({ type: "error", message: "加载失败,请刷新页面" });
imgIsLoad = false;
}
}
const content = ref([])
// 获取初始水印内容
const getWatermarkContent = () => {
const sfzh = getItem("idEntityCard") || ''
const userName = getItem("USERNAME") || ''
const time = timeValidate()
return [userName, sfzh, time, "林芝哨岗系统", "禁止泄露公民个人信息和警务工作秘密"]
}
// 初始化水印内容
content.value = getWatermarkContent()
// 只在需要时调用,避免频繁更新导致重新渲染
const frashJs = () => {
content.value = getWatermarkContent()
}
// 监听标签页切换
</script>
<style lang="scss">
@import "./styles/index.scss";
body {
margin: 0px;
padding: 0px;
font-size: 14px;
}
ul {
margin: 0px;
padding: 0px;
}
li {
list-style-type: none;
}
#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;
// background: #263445;
background: #fff;
}
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;
}
@font-face {
font-family: "HANYILINGXINTIJIAN";
src: url("~@/assets/font/HANYILINGXINTIJIAN-1.TTF");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "YSBTH";
src: url("~@/assets/font/YSBTH.ttf");
font-weight: normal;
font-style: normal;
}
.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;
margin-bottom: 0;
height: 40px;
}
}
::v-deep .badge-top-left .el-badge__content {
top: 0;
right: auto;
left: -10px;
transform: translateY(-50%) translateX(-50%);
}
.popupCustomBox{
position: relative;
padding: 4px 10px;
box-sizing: border-box;
background: #06254282;
color: #fff;
border-radius: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
.popupCustomTitle_title{
font-size: 12px;
line-height: 24px;
text-transform: none;
margin-bottom: 0;
border-bottom: 1px dashed #ececec;
margin-bottom: 2px;
}
&::after{
content: '';
position: absolute;
bottom: -10px;
left: 50%;
transform: translateX(-50%);
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #06254282;
}
}
</style>