Files
sgxt_web/src/App.vue

385 lines
9.3 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">
2025-10-26 12:25:50 +08:00
2025-04-12 23:51:24 +08:00
<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-10-26 12:25:50 +08:00
<Fxq :initial-position="{ x: position.x, y: position.y }">
<el-badge value="0" class="item badge-top-left">
<div class="badge-container">
<!-- :class="{ 'expanded': isExpanded }" -->
<div class="badge-content expanded">
<div class='fxq fxq1' @click.stop="opneMsg('xtxx')">
<div class="title"> <img src="@/assets/images/xtxx.png" /> 系统消息</div>
</div>
<!-- <div class='fxq fxq2'>
<div class="title" @click.stop="opneMsg('tztg')"> <img src="@/assets/images/tztg.png" /> 通知通报</div>
</div>
<div class='fxq fxq3'>
<div class="title"> <img src="@/assets/images/xxxt.png" /> 消息协同</div>
</div> -->
<div style="margin-bottom: 8px;" title="蜂群"
@click.stop="skipIframe('https://fqxt.lz.dsj.xz:9020/index.html?source=other')">
<img src="@/assets/images/logo-1.png" alt="" srcset="">
</div>
<div title="林小警"
@click.stop="skipIframe(`https://tyyy.lz.dsj.xz/embed/home?userId=${userId}&clientKey=${clientKey}&avatar=''`)">
<img src="@/assets/images/lxj.png" alt="" srcset="" style="width: 34px;height: 38px">
</div>
<div title="三视图" @click.stop="SwitchSysDialogShow = true">
<img src="@/assets/images/sst.png" alt="" srcset="" style="width: 34px;height: 38px">
</div>
</div>
</div>
</el-badge>
</Fxq>
<Iframe v-model='showIframe' :src='src' />
<Information v-model='showDialog' :title='title'>
<systemMessages :dict="{ BD_D_XXLX, BD_D_XXLY }" :idEntityCard='idEntityCard' :xxlx="showMsgLx" />
</Information>
<SwitchSysDialog v-model="SwitchSysDialogShow"/>
2025-04-12 14:54:02 +08:00
</template>
<script setup>
2025-07-18 15:41:15 +08:00
import * as ocr from "@paddlejs-models/ocr";
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";
import Information from '@/views/home/model/information.vue'
import SwitchSysDialog from '@/components/SwitchSysDialog.vue'
import systemMessages from '@/views/home/model/mesgSwitch/systemMessages.vue'
import Fxq from '@/views/home/model/fxq.vue'
import Iframe from '@/views/home/model/iframe.vue'
import { getCookie } from '@/utils/cookie'
2025-07-18 15:41:15 +08:00
const { proxy } = getCurrentInstance();
2025-10-26 12:25:50 +08:00
const idEntityCard = getItem('idEntityCard')
const { BD_D_XXLX, BD_D_XXLY } = proxy.$dict('BD_D_XXLX', 'BD_D_XXLY'); //获取字典数据
const SwitchSysDialogShow=ref(false)
const userId = getItem('USERID')
const clientKey = getCookie('clientKey')
const showMsgLx = ref('')
const showDialog = ref(false)
//消息
const position = reactive({
x: window.innerWidth - 120,
y: window.innerHeight - 140
})
const title = ref('系统消息')
const opneMsg = (val) => {
showDialog.value = true
showMsgLx.value = val
switch (val) {
case 'xtxx':
title.value = '系统消息'
break;
case 'tztg':
title.value = '通知通告'
break;
case 'xxxt':
title.value = '消息协同'
break;
}
}
const src = ref()
const showIframe = ref(false)
const skipIframe = (val) => {
src.value = val
showIframe.value = true
}
// 展开收缩状态
const isExpanded = ref(false)
const toggleExpand = () => {
isExpanded.value = !isExpanded.value
}
const queryXxTjList = () => {
queryXxTj({}).then((res) => {
console.log(res);
}).catch((err) => {
});
}
queryXxTjList()
2025-08-16 16:54:03 +08:00
2025-04-12 14:54:02 +08:00
const store = useStore();
generateNewStyle(store.getters.mainColor).then((newStyle) => {
writeNewStyle(newStyle);
});
const isRouterAlive = ref(true);
const reload = () => {
isRouterAlive.value = false;
nextTick(() => {
isRouterAlive.value = true;
});
};
provide("reload", reload);
2025-10-26 12:25:50 +08:00
// 处理页面可见性变化的函数
const handleVisibilityChange = () => {
// 只在页面变得可见时触发
if (document.visibilityState === 'visible') {
// 获取会话信息 - 带上所有cookies
fetch('https://pcs.lz.dsj.xz:9020/getSession', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
// 确保发送所有cookies包括跨域cookies
credentials: 'include',
})
.then((response) => {
// 检查响应状态
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.json();
})
.then((data) => {
console.log('会话信息:', data);
// 这里可以根据返回的数据进行后续处理
})
.catch((error) => {
console.error('获取会话信息失败:', error);
// 可以添加错误通知或重试逻辑
})
}
};
2025-04-12 14:54:02 +08:00
onMounted(() => {
2025-10-26 12:25:50 +08:00
window.addEventListener("visibilitychange", handleVisibilityChange);
2025-04-12 14:54:02 +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-10-26 12:25:50 +08:00
// 在组件卸载前移除事件监听器
onBeforeUnmount(() => {
window.removeEventListener("visibilitychange", handleVisibilityChange);
})
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-09-04 13:55:33 +08:00
const frashJs = () => {
2025-10-26 12:25:50 +08:00
const sfzh = getItem("idEntityCard")
const userName = getItem("USERNAME")
2025-09-04 13:55:33 +08:00
const time = timeValidate()
2025-10-26 12:25:50 +08:00
content.value = [userName, sfzh, time, "林芝哨岗系统", "禁止泄露公民个人信息和警务工作秘密"]
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
}
//只显示一排内容
.one_text_detail {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
overflow: hidden;
text-overflow: ellipsis;
}
2025-10-26 12:25:50 +08:00
2025-04-12 14:54:02 +08:00
//只显示二排内容
.two_text_detail {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
}
2025-10-26 12:25:50 +08:00
2025-04-12 14:54:02 +08:00
//只显示三排内容
.text_detail {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
text-overflow: ellipsis;
}
// 不显示滚动条
.noScollLine::-webkit-scrollbar {
width: 0 !important;
}
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
.fxq {
border-radius: 35px;
width: 35px;
transition: transform 0.5s ease, width 0.5s ease;
background-color: rgb(1, 127, 245);
transform-origin: left center;
overflow: hidden;
margin-bottom: 10px;
.icon {
display: flex;
align-items: center;
width: 35px;
height: 35px;
justify-content: center;
line-height: 35px;
font-size: 30px;
}
.title {
height: 35px;
line-height: 35px;
img {
margin-left: 9.5px;
width: 16px;
margin-right: 10px;
margin-top: -3px;
vertical-align: middle;
height: 16px;
}
}
}
.fxq2 {
background-color: #9d88f9;
}
.fxq1:hover {
width: 120px;
}
.fxq2:hover {
width: 120px;
// background-color: red;
}
.fxq3:hover {
width: 120px;
}
::v-deep .badge-top-left .el-badge__content {
top: 0;
right: auto;
left: -10px;
transform: translateY(-50%) translateX(-50%);
}
.badge-content {
display: flex;
flex-direction: column;
overflow: hidden;
transition: all 0.3s ease;
max-height: 200px;
/* 默认展开的最大高度 */
min-height: 45px;
/* 确保收缩时有足够空间显示第一个图标 */
}
.badge-content:not(.expanded) {
max-height: 45px;
}
/* 收缩时只显示第一个图标,隐藏其他内容 */
.badge-content:not(.expanded)> :not(:first-child) {
opacity: 0;
max-height: 0;
margin: 0;
padding: 0;
overflow: hidden;
}
.badge-container {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
}
2025-04-12 14:54:02 +08:00
</style>