铜陵经侦
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.

831 lines
21 KiB

1 month ago
<template>
<div class="layout-wrapper sub-page-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 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 clickable-back group" @click="goBack">
<ArrowLeft class="back-arrow group-hover:-translate-x-1 transition-transform" :size="28" />
<div class="title-bar"></div>
<h2 class="section-title">{{ moduleTitle }}</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="scroll-container">
<!-- 加载中状态 -->
<div v-if="!loading && currentSubMenus.length > 0" class="vertical-grid">
<div
v-for="(item, index) in currentSubMenus"
:key="index"
class="vertical-card group"
@click="navigateToOperation(item)"
>
<!-- 顶部装饰线 -->
<div class="card-top-line"></div>
<div class="card-icon-wrapper">
<component :is="item.icon" class="item-icon" :size="32" :stroke-width="1.5" />
</div>
<div class="card-title-area">
<h3 class="vertical-text" :class="{ 'long-text': item.title.length > 5 }">
{{ item.title }}
</h3>
</div>
<div class="card-action-area">
<div class="circle-action-btn">
<ChevronRight :size="20" class="chevron-move" />
</div>
</div>
<!-- 底部环境光 -->
<div class="card-bottom-glow"></div>
</div>
</div>
<!-- 无数据提示 (功能开发中) -->
<div v-else-if="!loading" class="empty-state-container">
<div class="empty-glass-card">
<div class="empty-icon-box">
<Construction :size="64" stroke-width="1" class="text-blue-400 opacity-60" />
</div>
<p class="empty-text">功能模块正在开发中</p>
<button class="back-home-btn" @click="goBack">返回首页</button>
</div>
</div>
</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" />
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, onUnmounted, computed } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import dayjs from 'dayjs'
import {
Clock, Bell, User, LogOut, ArrowLeft, ChevronRight,
Radar, Cctv, LocateFixed, Mic, ClipboardList,
FileEdit, Repeat, BarChart3, TrendingUp,
AlertCircle, Mail, PieChart, LayoutDashboard,
SearchCheck, UserCheck, Users, Map, Database,
Search, LineChart, FileText, Settings, ShieldAlert,
Activity, Telescope, Microscope, FolderOpen,
RotateCw, Monitor, Layers, Cable,
MonitorPlay, FileSearch, MailWarning, MapPinned, Gavel, BrainCircuit, Blocks,
Construction
} from 'lucide-vue-next'
import { ElMessageBox } from 'element-plus'
import { 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 { usePortalMessageRemind } from '@/composables/usePortalMessageRemind'
const router = useRouter()
const route = useRoute()
const userName = ref('系统管理员')
const currentTime = ref('')
const messageRemindVisible = ref(false)
const { hasUnread: hasUnreadRemind, fetchPortalMessageRemind } = usePortalMessageRemind()
const moduleTitle = computed(() => (route.query.title as string) || '二级菜单')
const moduleId = computed(() => route.query.id as string)
// 图标组件映射(供接口返回的图标名使用)
const iconComponents: Record<string, any> = {
Radar, Cctv, LocateFixed, Mic, ClipboardList,
FileEdit, Repeat, BarChart3, TrendingUp,
AlertCircle, Mail, PieChart, LayoutDashboard,
SearchCheck, UserCheck, Users, Map, Database,
LineChart, FileText, Settings, ShieldAlert,
Activity, Telescope, Microscope, FolderOpen,
RotateCw, Monitor, Layers, Cable,
MonitorPlay, FileSearch, MailWarning, MapPinned, Gavel, BrainCircuit, Blocks
}
// 中文标题到图标的映射
const titleToIcon: Record<string, any> = {
'全流程闭环管理': LayoutDashboard,
'灵敏感知': Activity,
'视频督察': Cctv,
'定位督察': LocateFixed,
'语音督察': Mic,
'执法报备': ClipboardList,
'数字督察': MonitorPlay,
'审计管理': FileSearch,
'新事信访投诉': MailWarning,
'民意感知': Users,
'现场督察': MapPinned,
'执法维权': Gavel,
'综合研判': BrainCircuit,
'系统服务': Blocks,
'基础支撑': Blocks,
'知识库': FolderOpen
}
const apiSubMenus = ref<any[]>([])
const loading = ref(true)
const loadSubMenus = async () => {
if (!moduleId.value) {
loading.value = false
return
}
loading.value = true
try {
const res = await getUserMenu(moduleId.value)
if (res.data && res.data.length > 0) {
// 仅保留 openmode 为 1 的项
const menuData = res.data.filter((item: any) => item.openmode == 1)
// 动态注入获取到的路由
const accessRoutes = generateRoutes(menuData)
console.log('[SubMenuPage] Adding dynamic routes:', accessRoutes.map(r => r.path))
accessRoutes.forEach(route => {
if (!router.hasRoute(route.name!)) {
router.addRoute(route)
}
})
apiSubMenus.value = menuData.map((item: any) => {
const rawIcon = (item.icon || '').replace(/^(el-icon-|lucide-)/i, '')
// 查找匹配的图标,忽略大小写
const matchedIconKey = Object.keys(iconComponents).find(k => k.toLowerCase() === rawIcon.toLowerCase())
return {
title: item.title || item.name,
// 优先使用接口返回的图标名,其次使用中文标题映射,最后使用默认图标
icon: (matchedIconKey ? iconComponents[matchedIconKey] : null) || titleToIcon[item.title] || Blocks,
jump: item.jump,
list: item.list,
originalItem: item
}
})
}
} catch (error) {
console.error('获取二级菜单失败:', error)
} finally {
loading.value = false
}
}
const currentSubMenus = computed(() => apiSubMenus.value)
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()
loadSubMenus()
fetchPortalMessageRemind()
})
onUnmounted(() => {
if (timer) clearInterval(timer)
})
const goBack = () => router.push('/portal')
const navigateToOperation = (item: any) => {
// 1. 设置菜单上下文,以便业务页面的侧边栏和权限正常工作
if (item.originalItem) {
setPortalMenuContext(item.originalItem)
} else {
// 针对 mock 数据的处理
setPortalMenuContext({
id: item.title,
title: item.title,
icon: item.title,
list: []
})
}
// 2. 决定跳转路径
let targetPath = ''
if (item.jump) {
targetPath = getStandardRoutePath(item.jump)
} else if (item.list && item.list.length > 0) {
targetPath = findFirstLeafRoute(item.list)
}
if (targetPath) {
router.push(targetPath)
} else {
console.warn('该模块未配置跳转路径:', item.title)
}
}
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;
}
.sub-page-bg {
background-color: #2C649C;
}
/* 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;
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;
}
.header-left {
display: flex;
align-items: center;
gap: 16px;
}
.logo-img {
height: 52px;
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;
}
.header-right {
display: flex;
align-items: center;
gap: 28px;
font-size: 15px;
}
.time-box {
display: flex;
align-items: center;
gap: 8px;
background: rgba(255, 255, 255, 0.05);
padding: 6px 14px;
border-radius: 2px;
border: 1px solid rgba(255, 255, 255, 0.1);
}
.icon-blue { color: #4A90E2; }
.header-item {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
color: rgba(255, 255, 255, 0.9);
}
.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); }
}
.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);
}
.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.04; }
.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;
}
.clickable-back { cursor: pointer; }
.back-arrow {
position: absolute;
left: -40px;
color: #CBD5E1;
}
.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;
}
.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; }
/* 滚动容器 */
.scroll-container {
max-height: calc(100vh - 280px);
overflow-y: auto;
padding: 20px;
margin: -20px;
/* 隐藏滚动条但保留功能 */
scrollbar-width: thin;
scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}
.scroll-container::-webkit-scrollbar {
width: 6px;
}
.scroll-container::-webkit-scrollbar-track {
background: transparent;
}
.scroll-container::-webkit-scrollbar-thumb {
background-color: rgba(255, 255, 255, 0.1);
border-radius: 10px;
}
.vertical-grid {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: flex-start;
gap: 32px 24px;
padding: 20px 0 60px;
}
.vertical-card {
position: relative;
width: 140px;
height: 400px;
background: linear-gradient(to bottom right, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06));
backdrop-filter: blur(20px);
border-radius: 24px;
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);
display: flex;
flex-direction: column;
align-items: center;
padding: 32px 0;
cursor: pointer;
transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
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.5), transparent);
transition: 0.7s;
}
.card-icon-wrapper {
width: 64px; height: 64px;
background: rgba(255, 255, 255, 0.15);
border-radius: 18px;
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);
margin-bottom: 16px;
transition: all 0.7s;
}
.item-icon { color: white; transition: color 0.3s; }
.card-title-area {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
}
.vertical-text {
writing-mode: vertical-rl;
text-orientation: upright;
font-size: 26px;
font-weight: 700;
color: white;
letter-spacing: 0.3em;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
transition: all 0.7s;
max-height: 260px;
line-height: 1.2;
}
.long-text {
font-size: 20px;
letter-spacing: 0.15em;
}
.card-action-area {
margin-top: auto;
opacity: 0;
transform: translateY(16px);
transition: all 0.5s;
}
.circle-action-btn {
width: 40px; height: 40px;
border-radius: 50%;
border: 1px solid rgba(255, 255, 255, 0.15);
background: rgba(255, 255, 255, 0.05);
display: flex;
align-items: center;
justify-content: center;
color: rgba(255, 255, 255, 0.7);
transition: all 0.3s;
}
.card-bottom-glow {
position: absolute;
bottom: -40px; right: -40px;
width: 128px; height: 128px;
background: rgba(255, 255, 255, 0.1);
border-radius: 50%;
filter: blur(32px);
transition: all 0.7s;
}
/* Vertical Card Hover */
.vertical-card:hover {
width: 180px;
background: rgba(255, 255, 255, 0.9);
border-color: rgba(255, 255, 255, 0.4);
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.7);
}
.vertical-card:hover .card-icon-wrapper {
transform: scale(1.1);
background: rgba(40, 109, 179, 0.05);
border-color: rgba(40, 109, 179, 0.2);
}
.vertical-card:hover .item-icon { color: #286DB3; }
.vertical-card:hover .vertical-text {
color: #286DB3;
letter-spacing: 0.5em;
text-shadow: none;
}
.vertical-card:hover .card-action-area {
opacity: 1;
transform: translateY(0);
}
.vertical-card:hover .circle-action-btn {
background: rgba(40, 109, 179, 0.05);
color: #286DB3;
border-color: #286DB3;
}
.vertical-card:hover .chevron-move { animation: chevron-slide 1s infinite; }
@keyframes chevron-slide {
0%, 100% { transform: translateX(0); }
50% { transform: translateX(3px); }
}
.vertical-card:hover .card-bottom-glow { background: rgba(26, 78, 129, 0.1); }
/* Footer 样式 */
.footer {
height: 58px;
background: rgba(22, 58, 99, 0.9);
backdrop-filter: blur(12px);
border-top: 1px solid rgba(255, 255, 255, 0.1);
display: flex;
align-items: center;
}
.footer-container {
max-width: 1400px;
width: 100%;
margin: 0 auto;
padding: 0 24px;
display: flex;
justify-content: flex-end;
}
.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;
}
/* 空状态样式 */
.empty-state-container {
display: flex;
justify-content: center;
align-items: center;
min-height: 400px;
}
.empty-glass-card {
background: rgba(255, 255, 255, 0.08);
backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 32px;
padding: 60px 80px;
text-align: center;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}
.empty-icon-box {
margin-bottom: 24px;
animation: float 4s ease-in-out infinite;
}
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-10px); }
}
.empty-text {
font-size: 24px;
font-weight: 600;
color: white;
margin-bottom: 12px;
}
.empty-sub-text {
color: rgba(255, 255, 255, 0.5);
margin-bottom: 32px;
}
.back-home-btn {
background: rgba(74, 144, 226, 0.15);
border: 1px solid rgba(74, 144, 226, 0.3);
color: #4A90E2;
padding: 10px 32px;
border-radius: 100px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
}
.back-home-btn:hover {
background: #4A90E2;
color: white;
transform: scale(1.05);
}
/* 加载中样式 */
.loading-state-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 400px;
}
.loading-spinner {
width: 40px;
height: 40px;
border: 3px solid rgba(255, 255, 255, 0.1);
border-top-color: #4A90E2;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-bottom: 16px;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.loading-text {
color: rgba(255, 255, 255, 0.5);
font-size: 14px;
letter-spacing: 0.1em;
}
</style>