铜陵经侦
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

844 lines
21 KiB

1 month ago
<template>
<div class="layout-wrapper portal-bg">
<!-- Header 区域: 采用深色渐变保持公安系统严肃性 -->
<header class="header">
<div class="header-texture"></div>
<div class="header-gradient-border"></div>
<div class="header-content">
<div class="header-left">
<img src="@/assets/logo.png" alt="Police Badge" class="logo-img" />
<h1 class="system-title">安徽公安监督一体化平台</h1>
</div>
<div class="header-right">
<div class="time-box font-mono">
<Clock class="icon-blue" :size="18" :stroke-width="1.5" />
<span>{{ currentTime }}</span>
</div>
<div class="header-item message-item" @click="messageRemindVisible = true">
<Bell :size="18" :stroke-width="1.5" />
<span>消息提醒</span>
<span v-if="hasUnreadRemind" class="notification-dot"></span>
</div>
<div class="header-item one-stop-item" @click="navigateToOneStop">
<LayoutDashboard :size="18" :stroke-width="1.5" />
<span>一站式工作台</span>
</div>
<div class="header-item user-item">
<User :size="18" :stroke-width="1.5" />
<span>{{ userName }}</span>
</div>
<div class="header-item logout-item" @click="handleLogout">
<LogOut :size="18" :stroke-width="1.5" />
<span>退出</span>
</div>
</div>
</div>
</header>
<main class="main-content">
<!-- 背景装饰层 -->
<div class="bg-decor">
<div class="bg-grid"></div>
<div class="ambient-orb orb-1 animate-ambient"></div>
<div class="ambient-orb orb-2 animate-ambient-reverse"></div>
<div class="ambient-orb orb-3 animate-ambient"></div>
</div>
<div class="page-container">
<!-- 业务导航标题 -->
<div class="section-header">
<div class="title-group">
<div class="title-bar"></div>
<h2 class="section-title">业务导航</h2>
</div>
<div class="header-decoration">
<div class="dot-small"></div>
<div class="dot-small"></div>
<div class="dot-large"></div>
</div>
</div>
<!-- 模块卡片列表 -->
<div class="modules-grid">
<template v-for="(module, index) in modules" :key="index">
<div
class="module-card group"
@click="navigateToModule(module)"
>
<!-- 顶部高光 -->
<div class="card-top-line"></div>
<!-- 内部光晕 -->
<div class="card-inner-glow"></div>
<!-- 悬停大图标背景 -->
<div class="card-bg-icon-wrapper">
<component
:is="module.icon"
class="bg-icon"
:class="{ 'rotate-90': module.title === '综合研判' }"
:size="192"
:stroke-width="0.5"
/>
</div>
<div class="card-main">
<div class="icon-container">
<div class="scan-animation"></div>
<component
:is="module.icon"
class="main-icon"
:class="{ 'rotate-90': module.title === '综合研判' }"
:size="28"
:stroke-width="1.5"
/>
</div>
<div class="title-container">
<h3 class="module-title">{{ module.title }}</h3>
</div>
</div>
<div class="card-footer">
<div class="entry-link">
<span>进入模块</span>
<ChevronRight class="chevron-icon" :size="14" :stroke-width="3" />
</div>
</div>
</div>
<!-- 换行占位 -->
<div v-if="index === 3" class="grid-separator"></div>
</template>
</div>
</div>
</main>
<footer class="footer">
<div class="footer-container">
<div class="footer-info font-mono">
<span>推荐使用 奇安信 浏览器</span>
<div class="footer-divider"></div>
<span class="security-label">内部平台,严禁外传</span>
</div>
</div>
</footer>
<PortalMessageRemindDialog v-model="messageRemindVisible" />
<PortalMessageBoardEntry />
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue'
import { useRouter } from 'vue-router'
import dayjs from 'dayjs'
import {
Clock, Bell, User, LogOut, ChevronRight,
MonitorPlay, FileSearch, FileSearch2, FileSearchCorner, MailWarning, Users,
MapPinned, Gavel, BrainCircuit, Blocks,
Radar, Cctv, LocateFixed, Mic, ClipboardList,
FileEdit, Repeat, BarChart3, TrendingUp,
AlertCircle, Mail, PieChart, LayoutDashboard,
Search, LineChart, FileText, Settings, ShieldAlert,
Activity, Telescope, Microscope, FolderOpen
} from 'lucide-vue-next'
import { ElMessageBox, ElMessage } from 'element-plus'
import { getAllUserMenu, getUserMenu } from '@/service/modules/admin/Login'
import { TABLE_NAME, AUTH_USER_INFO } from '@/utils/constants'
import { setPortalMenuContext, findFirstLeafRoute } from '@/stores/menuStore'
import { getStandardRoutePath } from '@/utils/pathUtils'
import { generateRoutes } from '@/router/generator'
import PortalMessageRemindDialog from '@/components/portal/PortalMessageRemindDialog.vue'
import PortalMessageBoardEntry from '@/components/portal/PortalMessageBoardEntry.vue'
import { usePortalMessageRemind } from '@/composables/usePortalMessageRemind'
const router = useRouter()
const userName = ref('系统管理员')
const currentTime = ref('')
const messageRemindVisible = ref(false)
const { hasUnread: hasUnreadRemind, fetchPortalMessageRemind } = usePortalMessageRemind()
const modules = ref<any[]>([])
// 图标组件映射(供接口返回的图标名使用)
// 注意:不要包含 Search,避免接口返回的图标名恰好是 "Search" 导致全部显示放大镜
const iconComponents: Record<string, any> = {
MonitorPlay, FileSearch, FileSearch2, FileSearchCorner, MailWarning, Users,
MapPinned, Gavel, BrainCircuit, Blocks,
Radar, Cctv, LocateFixed, Mic, ClipboardList,
FileEdit, Repeat, BarChart3, TrendingUp,
AlertCircle, Mail, PieChart, LayoutDashboard,
LineChart, FileText, Settings, ShieldAlert,
Activity, Telescope, Microscope, FolderOpen,
}
// 中文标题到图标的映射(针对接口返回图标不规范的情况)
const titleToIcon: Record<string, any> = {
'数字督察': MonitorPlay,
'审计管理': FileSearch,
'新事信访投诉': MailWarning,
'民意感知': Users,
'现场督察': MapPinned,
'执法维权': Gavel,
'综合研判': BrainCircuit,
'系统服务': Blocks,
'基础支撑': Blocks,
'知识库': FolderOpen,
// 新增模块图标映射
'全流程闭环管理': LayoutDashboard,
'灵敏感知': Activity,
'视频督察': Cctv,
'定位督察': LocateFixed,
'语音督察': Mic,
'执法报备': ClipboardList
}
const loadModulesFromMenu = async () => {
try {
const res = await getAllUserMenu()
if (res.data && res.data.length > 0) {
// 仅保留 openmode 为 1 的项
modules.value = res.data
.filter((item: any) => item.openmode == 1)
.map((item: any) => ({
title: item.title || item.name,
desc: item.nameEn || '',
// 优先使用接口返回的图标名,其次使用中文标题映射,最后使用默认图标
icon: iconComponents[item.icon] || titleToIcon[item.title] || Blocks,
id: item.id,
hasAuth: item.hasAuth !== false // 默认为 true,显式为 false 时才拦截
}))
}
} catch (error) {
console.error('获取门户模块菜单失败:', error)
}
}
const updateTime = () => {
const now = dayjs()
const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
currentTime.value = now.format('YYYY-MM-DD HH:mm:ss ') + weekDays[now.day()]
}
let timer: any = null
const loadUserInfo = () => {
try {
const storedData = localStorage.getItem(TABLE_NAME)
if (storedData) {
const userData = JSON.parse(storedData)
const info = userData[AUTH_USER_INFO]
if (info && info.name) {
userName.value = info.name
}
}
} catch (error) {
console.error('获取用户信息失败:', error)
}
}
onMounted(() => {
updateTime()
timer = setInterval(updateTime, 1000)
loadUserInfo()
loadModulesFromMenu()
fetchPortalMessageRemind()
})
onUnmounted(() => {
if (timer) clearInterval(timer)
})
const registerMenuRoutes = (menuData: any[]) => {
const accessRoutes = generateRoutes(menuData)
accessRoutes.forEach(route => {
if (!router.hasRoute(route.name!)) {
router.addRoute(route)
}
})
}
const enterMenuItem = (item: any) => {
setPortalMenuContext(item)
let targetPath = ''
if (item.jump) {
targetPath = getStandardRoutePath(item.jump)
} else if (item.list?.length > 0) {
targetPath = findFirstLeafRoute(item.list)
}
if (targetPath) {
router.push(targetPath)
} else {
ElMessage.warning('该模块未配置跳转路径')
}
}
const navigateToModule = async (module: any) => {
if (module.hasAuth === false) {
ElMessage.warning('您暂无该业务权限')
return
}
try {
const res = await getUserMenu(module.id)
const menuData = (res.data || []).filter((item: any) => item.openmode == 1)
if (menuData.length === 0) {
ElMessage.warning('该模块暂无可用菜单')
return
}
// 仅一个二级菜单:直接进入业务页面
if (menuData.length === 1) {
registerMenuRoutes(menuData)
enterMenuItem(menuData[0])
return
}
router.push({
path: '/sub-menu',
query: {
title: module.title,
id: module.id
}
})
} catch (error) {
console.error('获取二级菜单失败:', error)
ElMessage.error('加载模块菜单失败')
}
}
const navigateToOneStop = () => {
router.push('/one-stop/portal')
}
const handleLogout = () => {
ElMessageBox.confirm('确定要退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
localStorage.removeItem('token')
localStorage.removeItem('userInfo')
router.push('/login')
})
}
</script>
<style scoped>
/* 核心布局与背景 */
.layout-wrapper {
min-height: 100vh;
display: flex;
flex-direction: column;
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
transition: background-color 0.7s;
}
.portal-bg {
background-color: #21508A;
}
/* Header 样式 */
.header {
position: relative;
height: 70px;
background: linear-gradient(to right, #0D264D, #1A4E81, #0D264D);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
z-index: 20;
overflow: hidden;
color: white;
}
.header-texture {
position: absolute;
inset: 0;
opacity: 0.02;
pointer-events: none;
background-image: linear-gradient(90deg, #ffffff 1px, transparent 1px), linear-gradient(180deg, #ffffff 1px, transparent 1px);
background-size: 24px 24px;
}
.header-gradient-border {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 1px;
background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
}
.header-content {
max-width: 1400px;
height: 100%;
margin: 0 auto;
padding: 0 24px;
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
z-index: 10;
}
.header-left {
display: flex;
align-items: center;
gap: 16px;
}
.logo-img {
height: 52px;
width: auto;
object-fit: contain;
filter: brightness(1.1) drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}
.system-title {
font-size: 33px;
font-weight: 600;
letter-spacing: 0.15em;
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.header-right {
display: flex;
align-items: center;
gap: 28px;
font-size: 15px;
}
.time-box {
display: flex;
align-items: center;
gap: 8px;
color: rgba(255, 255, 255, 0.8);
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(4px);
padding: 6px 14px;
border-radius: 2px;
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.05);
}
.icon-blue {
color: #4A90E2;
}
.header-item {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
color: rgba(255, 255, 255, 0.9);
transition: color 0.3s;
}
.header-item:hover {
color: white;
}
.message-item {
position: relative;
}
.notification-dot {
position: absolute;
top: -4px;
right: -8px;
width: 8px;
height: 8px;
background-color: #D4183D;
border-radius: 50%;
box-shadow: 0 0 8px rgba(212, 24, 61, 0.6);
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { box-shadow: 0 0 0 0 rgba(212, 24, 61, 0.6); }
70% { box-shadow: 0 0 0 10px rgba(212, 24, 61, 0); }
100% { box-shadow: 0 0 0 0 rgba(212, 24, 61, 0); }
}
.one-stop-item {
background: rgba(74, 144, 226, 0.2);
border: 1px solid rgba(74, 144, 226, 0.4);
padding: 8px 16px;
border-radius: 8px;
transition: all 0.3s ease;
}
.one-stop-item:hover {
background: rgba(74, 144, 226, 0.3);
border-color: rgba(74, 144, 226, 0.6);
box-shadow: 0 0 15px rgba(74, 144, 226, 0.3);
transform: translateY(-1px);
}
.user-item {
border-left: 1px solid rgba(255, 255, 255, 0.15);
padding-left: 28px;
}
.logout-item {
margin-left: 20px;
color: rgba(255, 255, 255, 0.6);
}
.logout-item:hover {
color: #D4183D;
}
/* Main 区域 */
.main-content {
flex: 1;
position: relative;
display: flex;
flex-direction: column;
align-items: center;
overflow: hidden;
padding-top: 64px;
padding-bottom: 48px;
}
.bg-decor {
position: absolute;
inset: 0;
z-index: 0;
pointer-events: none;
}
.bg-grid {
position: absolute;
inset: 0;
background-image:
linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
background-size: 40px 40px;
}
.ambient-orb {
position: absolute;
border-radius: 50%;
filter: blur(100px);
transition: background-color 0.7s;
}
.orb-1 { top: 10%; left: 15%; width: 480px; height: 480px; background: rgba(70, 152, 237, 0.15); }
.orb-2 { top: 30%; right: 10%; width: 560px; height: 560px; background: rgba(43, 124, 230, 0.1); }
.orb-3 { bottom: 10%; left: 35%; width: 400px; height: 400px; background: rgba(79, 209, 197, 0.1); opacity: 0.4; }
.animate-ambient { animation: ambient-flow 18s ease-in-out infinite; }
.animate-ambient-reverse { animation: ambient-flow 22s ease-in-out infinite reverse; }
@keyframes ambient-flow {
0%, 100% { transform: translate(0, 0) scale(1); }
33% { transform: translate(2%, 4%) scale(1.05); }
66% { transform: translate(-2%, 2%) scale(0.95); }
}
.page-container {
width: 100%;
max-width: 1400px;
padding: 0 24px;
position: relative;
z-index: 10;
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 40px;
}
.title-group {
position: relative;
padding-left: 20px;
display: flex;
align-items: center;
}
.title-bar {
position: absolute;
left: 0;
top: 4px;
bottom: 4px;
width: 3px;
background-color: #4A90E2;
border-radius: 100px;
box-shadow: 0 0 8px rgba(74, 144, 226, 0.6);
}
.section-title {
font-size: 28px;
font-weight: 700;
color: white;
letter-spacing: 0.05em;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.header-decoration {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 6px;
opacity: 0.5;
}
.header-decoration div {
background-color: #4A90E2;
border-radius: 100px;
}
.dot-small { width: 6px; height: 6px; }
.dot-large { width: 32px; height: 6px; }
/* 模块网格 */
.modules-grid {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 35px 20px;
}
.grid-separator {
width: 100%;
height: 0;
}
.module-card {
position: relative;
width: 310px;
height: 150px;
background: linear-gradient(to bottom right, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06));
backdrop-filter: blur(24px);
border-radius: 20px;
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.15);
padding: 20px 32px;
cursor: pointer;
transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
flex-direction: column;
justify-content: space-between;
overflow: hidden;
}
.card-top-line {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 1px;
background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4), transparent);
transition: 0.5s;
}
.card-inner-glow {
position: absolute;
inset: 0;
background: linear-gradient(to bottom right, rgba(255, 255, 255, 0.2), transparent, transparent);
opacity: 0;
transition: opacity 0.7s;
pointer-events: none;
}
.card-bg-icon-wrapper {
position: absolute;
right: -32px;
bottom: -32px;
opacity: 0;
transform: scale(0.8) rotate(0deg);
transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
pointer-events: none;
color: white;
}
.bg-icon.rotate-90 {
transform: rotate(90deg);
}
.card-main {
display: flex;
align-items: center;
gap: 24px;
position: relative;
z-index: 10;
height: 56px;
}
.icon-container {
position: relative;
width: 56px;
height: 56px;
background: rgba(255, 255, 255, 0.15);
border-radius: 16px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.15);
overflow: hidden;
transition: all 0.5s;
flex-shrink: 0;
}
.main-icon {
color: white;
transition: color 0.3s;
}
.main-icon.rotate-90 {
transform: rotate(90deg);
}
.scan-animation {
position: absolute;
inset: 0;
background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.2), transparent);
opacity: 0;
pointer-events: none;
}
.module-title {
font-size: 26px;
font-weight: 700;
color: white;
transition: color 0.3s;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
white-space: nowrap;
}
.card-footer {
position: relative;
z-index: 10;
margin-top: 16px;
border-top: 1px solid rgba(255, 255, 255, 0.1);
padding-top: 12px;
transition: border-color 0.3s;
}
.entry-link {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 4px;
font-size: 12px;
font-weight: 500;
color: rgba(255, 255, 255, 0.7);
letter-spacing: 0.2em;
transition: all 0.3s;
}
.chevron-icon {
opacity: 0;
transform: translateX(-8px);
transition: all 0.3s;
}
/* Card Hover 状态 */
.module-card:hover {
background: linear-gradient(to bottom right, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.8));
transform: translateY(-6px);
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.7);
border-color: rgba(255, 255, 255, 0.4);
}
.module-card:hover .card-inner-glow {
opacity: 1;
}
.module-card:hover .card-top-line {
background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.6), transparent);
}
.module-card:hover .card-bg-icon-wrapper {
opacity: 0.08;
transform: scale(1.1) rotate(-6deg);
color: #1A4E81;
}
.module-card:hover .icon-container {
background: rgba(40, 109, 179, 0.05);
border-color: rgba(40, 109, 179, 0.2);
box-shadow: none;
}
.module-card:hover .main-icon {
color: #286DB3;
}
.module-card:hover .scan-animation {
opacity: 1;
animation: scan 2s linear infinite;
}
@keyframes scan {
0% { transform: translateY(-100%); }
100% { transform: translateY(100%); }
}
.module-card:hover .module-title {
color: #286DB3;
text-shadow: none;
}
.module-card:hover .card-footer {
border-color: rgba(40, 109, 179, 0.1);
}
.module-card:hover .entry-link {
color: rgba(40, 109, 179, 0.7);
}
.module-card:hover .chevron-icon {
opacity: 1;
transform: translateX(0);
}
/* Footer 样式 */
.footer {
position: relative;
z-index: 20;
height: 58px;
display: flex;
align-items: center;
border-top: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(22, 58, 99, 0.9);
backdrop-filter: blur(12px);
}
.footer-container {
max-width: 1400px;
width: 100%;
margin: 0 auto;
padding: 0 24px;
display: flex;
justify-content: flex-end;
align-items: center;
}
.footer-info {
display: flex;
align-items: center;
gap: 16px;
color: rgba(255, 255, 255, 0.5);
font-size: 12px;
}
.footer-divider {
width: 1px;
height: 12px;
background-color: rgba(255, 255, 255, 0.2);
}
.security-label {
color: #4A90E2;
background: rgba(74, 144, 226, 0.1);
border: 1px solid rgba(74, 144, 226, 0.2);
padding: 2px 8px;
border-radius: 2px;
font-weight: 600;
letter-spacing: 0.1em;
}
</style>