1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<template>
  <el-container class="layout-container">
    <!-- 顶部栏 -->
    <el-header class="layout-header">
      <div class="header-content">
        <div class="title-container">
          <img src="/logo.jpg" alt="蓉易创" class="logo-icon" />
          <span class="system-title">蓉易创比赛管理</span>
        </div>
        <el-dropdown @command="handleCommand">
          <span class="el-dropdown-link">
            {{ currentUserName }}
            <el-icon class="el-icon--right">
              <arrow-down />
            </el-icon>
          </span>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item command="profile">个人信息</el-dropdown-item>
              <el-dropdown-item command="logout">退出登录</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </div>
    </el-header>
    
    <!-- 下方容器:左侧菜单 + 右侧内容 -->
    <el-container class="main-container">
      <el-aside width="200px" class="layout-aside">
        <el-menu
          :default-active="$route.path"
          router
          background-color="transparent"
          text-color="#666666"
          active-text-color="#1E3A8A"
        >
        >
          <el-menu-item index="/dashboard">
            <el-icon><House /></el-icon>
            <span>工作台</span>
          </el-menu-item>
 
          <el-menu-item index="/activity">
            <el-icon><Calendar /></el-icon>
            <span>比赛信息</span>
          </el-menu-item>
          <el-menu-item index="/judge">
            <el-icon><User /></el-icon>
            <span>评委管理</span>
          </el-menu-item>
          <el-menu-item index="/rating-scheme">
            <el-icon><Document /></el-icon>
            <span>评分模板</span>
          </el-menu-item>
          <el-menu-item index="/player">
            <el-icon><UserFilled /></el-icon>
            <span>报名审核</span>
          </el-menu-item>
          <el-menu-item index="/project-review">
            <el-icon><Files /></el-icon>
            <span>项目评审</span>
          </el-menu-item>
          <el-menu-item index="/competition-promotion">
            <el-icon><TrendCharts /></el-icon>
            <span>比赛晋级</span>
          </el-menu-item>
          <el-menu-item index="/carousel">
            <el-icon><Picture /></el-icon>
            <span>新闻与推广</span>
          </el-menu-item>
          <el-menu-item index="/region">
            <el-icon><Location /></el-icon>
            <span>区域管理</span>
          </el-menu-item>
          <el-menu-item index="/employee">
            <el-icon><Avatar /></el-icon>
            <span>员工管理</span>
          </el-menu-item>
        </el-menu>
      </el-aside>
      
      <el-main class="layout-main">
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>
 
<script setup lang="ts">
import { computed } from 'vue'
import { useRouter } from 'vue-router'
import { House, Calendar, User, Document, UserFilled, Files, TrendCharts, Picture, Location, Avatar, ArrowDown } from '@element-plus/icons-vue'
 
const router = useRouter()
 
const userInfo = computed(() => ({
  name: '管理员'
}))
 
const currentUserName = computed(() => userInfo.value.name || '用户')
 
const handleCommand = (command: string) => {
  switch (command) {
    case 'profile':
      router.push('/profile')
      break
    case 'logout':
      localStorage.removeItem('token')
      router.push('/login')
      break
  }
}
</script>
 
<style scoped>
/* 整体布局容器 */
.layout-container {
  height: 100vh;
  width: 100vw;
}
 
/* 顶部栏样式 */
.layout-header {
  background-color: #FFFFFF;
  color: #333;
  line-height: 60px;
  padding: 0 20px;
  border-bottom: 1px solid #E5E7EB;
}
 
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}
 
.title-container {
  display: flex;
  align-items: center;
  gap: 8px;
}
 
.logo-icon {
  width: 48px;
  height: 48px;
}
 
.system-title {
  font-size: 20px;
  font-weight: bold;
  color: #333;
}
 
/* 主要容器 */
.main-container {
  height: calc(100vh - 60px);
}
 
/* 侧边栏样式 */
.layout-aside {
  background-color: #FFFFFF;
  height: 100%;
  border-right: 1px solid #E5E7EB;
}
 
.sidebar-menu {
  height: 100%;
  border-right: none;
}
 
/* 菜单项样式 */
.el-menu-item.is-active {
  background-color: #3B82F6 !important;
  color: #FFFFFF !important;
  border-radius: 6px;
  margin: 2px 8px;
}
 
.el-menu-item:hover {
  background-color: #EBF4FF !important;
  color: #1E3A8A !important;
  border-radius: 6px;
  margin: 2px 8px;
}
 
/* 主内容区域 */
.layout-main {
  background-color: #FFFFFF;
  padding: 20px;
}
 
/* 下拉菜单样式 */
.el-dropdown-link {
  cursor: pointer;
  color: #333;
  display: flex;
  align-items: center;
}
 
.el-dropdown-link:hover {
  color: #409eff;
}
</style>