
<template>
  <view class="container">
    <!-- 顶部导航 -->
<!--    <view class="header">
      <view class="header-left">
        <text class="app-title">沅陵系统管理</text>
      </view>
      <view class="header-right">
        <uni-icons type="notification" size="24" color="#333" class="notification-icon"/>
        <view class="avatar"></view>
      </view>
    </view> -->

    <!-- 主要功能区域 -->
    <scroll-view class="content" scroll-y>
      <view class="main-functions">
        <!-- 事件中心卡片 -->
        <view class="function-card event-center" @click="toEventList">
          <view class="card-content">
            <image class="card-image" :src="eventCenterImage" mode="aspectFill" />
            <view class="card-info">
              <text class="card-title">事件中心</text>
              <text class="card-desc">当前有 3 个待处理事件</text>
            </view>
          </view>
          <uni-icons type="right" size="20" color="#666"/>
        </view>

        <!-- 灯杆控制卡片 -->
        <view class="function-card pole-control" @click="toPoleList">
          <view class="card-content">
            <image class="card-image" :src="poleControlImage" mode="aspectFill" />
            <view class="card-info">
              <text class="card-title">灯杆控制</text>
              <text class="card-desc">设备运行正常</text>
            </view>
          </view>
          <uni-icons type="right" size="20" color="#666"/>
        </view>
		
		<!-- 可视化菜单控制卡片 -->
		<view class="function-card viual-control" @click="toVisualControl">
		  <view class="card-content">
		    <image class="card-image" :src="VisualControl" mode="aspectFill" />
		    <view class="card-info">
		      <text class="card-title">模块控制</text>
		      <text class="card-desc">设备运行正常</text>
		    </view>
		  </view>
		  <uni-icons type="right" size="20" color="#666"/>
		</view>
      </view>
	  

      <!-- 状态概览 -->
      <view class="status-overview">
        <view class="status-item">
          <text class="status-value">358</text>
          <text class="status-label">在线设备</text>
        </view>
        <view class="status-item">
          <text class="status-value">3</text>
          <text class="status-label">待处理告警</text>
        </view>
        <view class="status-item">
          <text class="status-value">98%</text>
          <text class="status-label">设备在线率</text>
        </view>
      </view>
    </scroll-view>

  </view>
</template>

<script lang="ts" setup>
import {ref} from 'vue';

const toEventList = () => {
	uni.navigateTo({
		url:"/pages/eventList/index"
	})
}

const toPoleList = () => {
	uni.navigateTo({
		url:"/pages/poleList/index"
	})
}


const toVisualControl = () => {
	uni.navigateTo({
		url:"/pages/VisualControl/index"
	})
}

const eventCenterImage = ref('../../static/viualControlImg/sjzx.png');

const poleControlImage = ref('../../static/viualControlImg/dgkz.png');

const VisualControl = ref('../../static/viualControlImg/mkkz.png');
</script>

<style>
page {
  height: 100%;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: #F5F6FA;
	/* width: 700rpx; */
	/* width: 90vw; */
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20rpx 32rpx;
  background-color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
}

.app-title {
  font-size: 18px;
  font-weight: 600;
  color: #333333;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 24rpx;
}

.notification-icon {
  width: 24px;
  height: 24px;
}

.avatar {
  width: 64rpx;
  height: 64rpx;
  border-radius: 32rpx;
  background-color: #E0E5F2;
}

.content {
  flex: 1;
  overflow: auto;
  padding: 32rpx;
	width: 700rpx;
}

.main-functions {
  display: flex;
  flex-direction: column;
  gap: 24rpx;
  margin-bottom: 32rpx;
}

.function-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32rpx;
  background-color: #FFFFFF;
  border-radius: 16rpx;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.card-content {
  display: flex;
  align-items: center;
  gap: 24rpx;
}

.card-image {
  width: 96rpx;
  height: 96rpx;
  border-radius: 16rpx;
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 8rpx;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: #333333;
}

.card-desc {
  font-size: 14px;
  color: #666666;
}

.event-center {
  border-left: 8rpx solid #FF4D4F;
}

.pole-control {
  border-left: 8rpx solid #2B5DE0;
}

.viual-control {
  border-left: 8rpx solid #66b890;
}

.status-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24rpx;
  background-color: #FFFFFF;
  padding: 32rpx;
  border-radius: 16rpx;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.status-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8rpx;
}

.status-value {
  font-size: 24px;
  font-weight: 600;
  color: #333333;
}

.status-label {
  font-size: 14px;
  color: #666666;
}

.tab-bar {
  display: flex;
  justify-content: space-around;
  padding: 16rpx 0;
  background-color: #FFFFFF;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4rpx;
}

.tab-text {
  font-size: 12px;
  color: #666666;
}

.active .tab-text {
  color: #2B5DE0;
}
</style>

