<template>
  <view class="content">
    <!-- 系统管理 -->
    <view class="section-header">
      <text class="section-title">系统管理</text>
    </view>
    <view class="grid-body">
      <view class="grid-wrapper">
        <view 
          v-for="(item, index) in systemGridList" 
          :key="index" 
          @click="navigateTo(item.path)"
          class="grid-item">
          <view class="item-icon" :style="{ background: item.color }">
            <u-icon :name="item.icon" size="22" color="#ffffff"></u-icon>
          </view>
          <text class="item-text">{{ item.text }}</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref } from "vue";

const systemGridList = ref([
  { path: '/pages_mine/pages/system/user/list', text: '用户管理', icon: 'account', color: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)' },
  { path: '/pages_mine/pages/system/role/list', text: '角色管理', icon: 'level', color: 'linear-gradient(135deg, #fa709a 0%, #fee140 100%)' },
  { path: '/pages_mine/pages/system/menu/list', text: '菜单管理', icon: 'list', color: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)' },
  { path: '/pages_mine/pages/system/dept/list', text: '部门管理', icon: 'home', color: 'linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)' },
  { path: '/pages_mine/pages/system/post/list', text: '岗位管理', icon: 'order', color: 'linear-gradient(135deg, #fd79a8 0%, #e84393 100%)' },
  { path: '/pages_mine/pages/system/dict/list', text: '字典管理', icon: 'file-text', color: 'linear-gradient(135deg, #f6d365 0%, #fda085 100%)' },
  { path: '/pages_mine/pages/system/config/list', text: '参数配置', icon: 'setting', color: 'linear-gradient(135deg, #5f72bd 0%, #9b23ea 100%)' },
  { path: '/pages_mine/pages/system/notice/list', text: '通知公告', icon: 'bell', color: 'linear-gradient(135deg, #0be881 0%, #0fbcf9 100%)' },
  { path: '/pages_mine/pages/system/operlog/list', text: '操作日志', icon: 'edit-pen', color: 'linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%)' },
  { path: '/pages_mine/pages/system/logininfor/list', text: '登录日志', icon: 'eye', color: 'linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%)' }
])

function navigateTo(path) {
    uni.navigateTo({
      url: path
    });
  
}
</script>

<style lang="scss">
  .container {
    min-height: 100vh;
    background-color: #f5f5f5;
  }

  /* #ifndef APP-NVUE */
  /* #endif */

  .content {
    padding: 120rpx 0 12rpx 0;
  }

  .section-header {
    padding: 12rpx 24rpx 8rpx;
  }

  .section-title {
    font-size: 28rpx;
    font-weight: 700;
    color: #333;
    position: relative;
    padding-left: 16rpx;
  }

  .section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6rpx;
    height: 28rpx;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 3rpx;
  }

  .grid-body {
    padding: 0 16rpx;
  }

  .grid-wrapper {
    display: flex;
    flex-wrap: wrap;
  }

  .grid-item {
    width: 25%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16rpx 8rpx;
    box-sizing: border-box;
  }

  .item-icon {
    width: 80rpx;
    height: 80rpx;
    border-radius: 20rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12rpx;
    box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
  }

  .grid-item:active .item-icon {
    transform: scale(0.95);
    box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.15);
  }

  .item-text {
    text-align: center;
    font-size: 22rpx;
    color: #333;
    font-weight: 500;
    line-height: 1.3;
  }
</style>
