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.
central-control/src/views/Menu/index.vue

328 lines
8.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div class="smart-control-app">
<!-- 主要内容 -->
<div class="main-content">
<!-- 时间显示 -->
<div class="time-display">
{{ currentTime }}
</div>
<!-- 主标题 -->
<div class="main-title">
<div class="title-decoration left"></div>
<h1>智能中控装置</h1>
<div class="title-decoration right"></div>
</div>
<!-- 功能卡片 -->
<div class="function-cards">
<el-card v-for="(card, index) in functionCards" :key="index" class="function-card" @click="handleCardClick(card.key)">
<div class="card-content">
<div class="card-icon">
<component :is="card.icon" />
</div>
<div class="card-title">{{ card.title }}</div>
</div>
</el-card>
</div>
<!-- 底部状态栏 -->
<div class="status-bar">
<div class="status-item">
设备号:{{ commit_uid }}
</div>
<div class="status-item">
设备名称:{{ device_name }}
</div>
<div class="status-item">
版本号1.0.0
</div>
<div class="status-item">
系统状态:<span class="status-online"></span>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
import {
Camera,
Operation,
Setting,
VideoPlay,
Bell
} from '@element-plus/icons-vue'
const currentTime = ref('')
const router = useRouter()
const route = useRoute()
// console.log(route.query.comm_uid)
if (route.query.comm_uid) {
localStorage.setItem('central_control_comm_uid', route.query.comm_uid)
}
if (route.query.deviceName) {
localStorage.setItem('central_control_device_name', route.query.deviceName)
}
const commit_uid = localStorage.getItem('central_control_comm_uid')
const device_name = localStorage.getItem('central_control_device_name')
const functionCards = [
{ key: 'monitor', title: '实时监控', icon: Camera, route: '/monitoring' },
{ key: 'control', title: '手动控制', icon: Operation, route: '/handle-control' },
{ key: 'setting', title: '参数设置', icon: Setting, route: '/params-config' },
{ key: 'auto', title: '自动模式', icon: VideoPlay, route: '/automatic-mode' },
{ key: 'alarm', title: '报警浏览', icon: Bell, route: '/alarm-information' }
]
const updateTime = () => {
const now = new Date()
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0')
const day = String(now.getDate()).padStart(2, '0')
const hours = String(now.getHours()).padStart(2, '0')
const minutes = String(now.getMinutes()).padStart(2, '0')
const seconds = String(now.getSeconds()).padStart(2, '0')
currentTime.value = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
}
const handleCardClick = (key) => {
const card = functionCards.find(c => c.key === key)
if (card) {
console.log(`点击了${card.title}功能`)
if (card.route) {
router.push(card.route)
} else {
ElMessage.info(`${card.title}功能开发中...`)
}
}
}
let timeInterval = null
onMounted(() => {
updateTime()
timeInterval = setInterval(updateTime, 1000)
})
onUnmounted(() => {
if (timeInterval) {
clearInterval(timeInterval)
}
})
</script>
<style scoped>
.smart-control-app {
width: 100vw;
height: 100vh;
position: relative;
overflow: hidden;
background: center / cover url('@/assets/images/backgroundImg.png') no-repeat;
}
.main-content {
position: relative;
z-index: 2;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
padding: 40px;
box-sizing: border-box;
justify-content: center;
}
.time-display {
color: rgba(255, 255, 255, 0.9);
font-size: 24px;
font-weight: 300;
letter-spacing: 1px;
position: absolute;
top: 20px;
}
.main-title {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 80px;
position: relative;
}
.main-title h1 {
color: #ffffff;
font-size: 64px;
font-weight: bold;
margin: 0 40px;
text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
letter-spacing: 4px;
}
.title-decoration {
width: 80px;
height: 6px;
background: linear-gradient(90deg, transparent, #64b5f6, #42a5f5, #64b5f6, transparent);
position: relative;
animation: titleGlow 2s ease-in-out infinite alternate;
}
.title-decoration::before {
content: '';
position: absolute;
top: -3px;
left: 50%;
transform: translateX(-50%);
width: 12px;
height: 12px;
background: radial-gradient(circle, #64b5f6 0%, #42a5f5 70%, transparent 100%);
border-radius: 50%;
box-shadow:
0 0 15px #64b5f6,
0 0 30px rgba(100, 181, 246, 0.5);
animation: centerPulse 2s ease-in-out infinite alternate;
}
@keyframes titleGlow {
0% {
opacity: 0.8;
transform: scaleX(1);
}
100% {
opacity: 1;
transform: scaleX(1.1);
}
}
@keyframes centerPulse {
0% {
transform: translateX(-50%) scale(1);
opacity: 0.8;
}
100% {
transform: translateX(-50%) scale(1.2);
opacity: 1;
}
}
.function-cards {
display: flex;
justify-content: center;
gap: 40px;
}
.function-card {
width: 15%;
height: 200px;
box-sizing: border-box;
background:
linear-gradient(145deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%),
rgba(33, 150, 243, 0.1);
border: 1px solid rgba(100, 181, 246, 0.3);
border-radius: 16px;
cursor: pointer;
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
backdrop-filter: blur(15px);
box-shadow:
0 8px 32px rgba(0, 0, 0, 0.3),
inset 0 1px 0 rgba(255, 255, 255, 0.2);
position: relative;
overflow: hidden;
}
/* .function-card::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
transition: left 0.6s ease;
}
.function-card:hover::before {
left: 100%;
} */
/* .function-card:hover {
background:
linear-gradient(145deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%),
rgba(33, 150, 243, 0.15);
border-color: rgba(100, 181, 246, 0.6);
transform: translateY(-8px) scale(1.02);
box-shadow:
0 20px 40px rgba(33, 150, 243, 0.4),
0 0 20px rgba(100, 181, 246, 0.3),
inset 0 1px 0 rgba(255, 255, 255, 0.3);
} */
.card-content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100%;
padding: 20px;
box-sizing: border-box;
}
.card-icon {
width: 60px;
height: 60px;
font-size: 48px;
color: rgba(255, 255, 255, 0.9);
margin-bottom: 20px;
}
.card-title {
color: rgba(255, 255, 255, 0.9);
font-size: 18px;
font-weight: 500;
text-align: center;
letter-spacing: 1px;
}
.status-bar {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: auto;
padding: 10px 30px;
box-sizing: border-box;
color: rgba(255, 255, 255, 0.7);
font-size: 16px;
background-color: rgba(0, 0, 0, 0.3);
position: fixed;
bottom: 0;
left: 0;
width: 100vw;
}
.status-item {
display: flex;
align-items: center;
gap: 10px;
}
.status-online {
color: #4caf50;
font-weight: bold;
}
/* Element Plus 卡片样式重写 */
:deep(.el-card) {
background: transparent !important;
border: none !important;
}
:deep(.el-card__body) {
padding: 0 !important;
height: 100%;
}
</style>