lrj
昨天 dc643ba44fd2a426263015491268a0f0d6b4671d
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
<template>
  <el-container class="layout-container">
    <!-- 顶部栏 -->
    <el-header class="layout-header">
      <div class="header-content">
        <span class="system-title">蓉易创管理系统</span>
        <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"
          class="sidebar-menu"
          router
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b"
        >
          <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: #B3C0D1;
  color: #333;
  line-height: 60px;
  padding: 0 20px;
  border-bottom: 1px solid #dcdfe6;
}
 
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}
 
.system-title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
}
 
/* 主要容器 */
.main-container {
  height: calc(100vh - 60px);
}
 
/* 侧边栏样式 */
.layout-aside {
  background-color: #545c64;
  height: 100%;
}
 
.sidebar-menu {
  height: 100%;
  border-right: none;
}
 
/* 主内容区域 */
.layout-main {
  background-color: #f5f5f5;
  padding: 20px;
}
 
/* 下拉菜单样式 */
.el-dropdown-link {
  cursor: pointer;
  color: #333;
  display: flex;
  align-items: center;
}
 
.el-dropdown-link:hover {
  color: #409eff;
}
</style>