| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <template>
- <el-container class="layout-container">
- <el-aside width="200px" class="el-aside">
- <div class="logo">爱伴·AI之旅</div>
- <el-scrollbar wrap-class="sidebar-scrollbar-wrap">
- <el-menu
- :default-active="activeMenu"
- class="sidebar-menu"
- background-color="transparent"
- text-color="#64748B"
- active-text-color="#6366F1"
- @select="handleMenuSelect"
- >
- <el-menu-item index="/dashboard">
- <i class="el-icon-s-home"></i>
- <span slot="title">概览</span>
- </el-menu-item>
- <el-menu-item index="/classes">
- <i class="el-icon-s-grid"></i>
- <span slot="title">班级管理</span>
- </el-menu-item>
- <el-menu-item index="/enrollments">
- <i class="el-icon-tickets"></i>
- <span slot="title">报名管理</span>
- </el-menu-item>
- <el-menu-item index="/orders">
- <i class="el-icon-wallet"></i>
- <span slot="title">订单管理</span>
- </el-menu-item>
- <el-menu-item index="/invites">
- <i class="el-icon-share"></i>
- <span slot="title">转介绍漏斗</span>
- </el-menu-item>
- <el-menu-item index="/groups">
- <i class="el-icon-s-group"></i>
- <span slot="title">分组管理</span>
- </el-menu-item>
- <el-menu-item index="/users">
- <i class="el-icon-user"></i>
- <span slot="title">学员管理</span>
- </el-menu-item>
- <el-submenu index="review">
- <template slot="title">
- <i class="el-icon-s-check"></i>
- <span>审核与评分</span>
- </template>
- <el-menu-item index="/review/submissions">成果审核</el-menu-item>
- <el-menu-item index="/review/cards">教学卡评分</el-menu-item>
- <el-menu-item index="/review/roadmaps">路演评审</el-menu-item>
- </el-submenu>
- <el-menu-item index="/scoreboard">
- <i class="el-icon-trophy"></i>
- <span slot="title">积分榜</span>
- </el-menu-item>
- <el-menu-item index="/manual-score">
- <i class="el-icon-edit-outline"></i>
- <span slot="title">人工加减分</span>
- </el-menu-item>
- <el-menu-item index="/stats">
- <i class="el-icon-data-analysis"></i>
- <span slot="title">统计</span>
- </el-menu-item>
- </el-menu>
- </el-scrollbar>
- </el-aside>
- <el-container>
- <el-header>
- <div class="header-right">
- <el-dropdown trigger="click" @command="handleCommand">
- <span class="el-dropdown-link username">
- {{ displayName }}<i class="el-icon-arrow-down el-icon--right"></i>
- </span>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item command="logout" icon="el-icon-switch-button" divided>退出登录</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- </el-header>
- <el-main>
- <div class="main-wrapper">
- <router-view />
- </div>
- </el-main>
- </el-container>
- </el-container>
- </template>
- <script>
- export default {
- name: 'Layout',
- computed: {
- activeMenu: function () {
- return this.$route.path
- },
- displayName: function () {
- var name = this.$store.state.adminInfo.name || this.$store.state.adminInfo.username
- var role = this.$store.state.adminInfo.role
- var roleLabel = { admin: '管理员', lecturer: '讲师', assistant: '助教' }
- return name + ' (' + (roleLabel[role] || role) + ')'
- }
- },
- methods: {
- handleMenuSelect: function (index) {
- if (index && index.startsWith('/')) {
- this.$router.push(index)
- }
- },
- handleCommand: function (command) {
- if (command === 'logout') {
- this.handleLogout()
- }
- },
- handleLogout: function () {
- var self = this
- this.$confirm('确定要退出登录吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(function () {
- self.$store.dispatch('logout')
- self.$router.push('/login')
- }).catch(function () {})
- }
- }
- }
- </script>
- <style>
- .layout-container {
- height: 100vh;
- }
- .el-aside {
- background-color: #304156;
- overflow: visible;
- display: flex;
- flex-direction: column;
- }
- .logo {
- height: 60px;
- line-height: 60px;
- text-align: center;
- color: #fff;
- font-size: 18px;
- font-weight: bold;
- background-color: #2b3a4a;
- flex-shrink: 0;
- letter-spacing: 2px;
- }
- .sidebar-scrollbar-wrap {
- height: calc(100vh - 60px) !important;
- overflow-x: hidden !important;
- overflow-y: auto !important;
- }
- .sidebar-scrollbar-wrap::-webkit-scrollbar {
- width: 6px;
- }
- .sidebar-scrollbar-wrap::-webkit-scrollbar-track {
- background: #304156;
- }
- .sidebar-scrollbar-wrap::-webkit-scrollbar-thumb {
- background: #4a5568;
- border-radius: 3px;
- }
- .sidebar-menu {
- border-right: none !important;
- }
- .el-header {
- background-color: #fff;
- box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
- display: flex;
- justify-content: flex-end;
- align-items: center;
- padding: 0 20px;
- }
- .header-right {
- display: flex;
- align-items: center;
- }
- .username {
- color: #606266;
- cursor: pointer;
- }
- .el-main {
- background-color: #f0f2f5;
- padding: 20px;
- position: relative;
- z-index: 1;
- display: flex;
- flex-direction: column;
- min-height: 0;
- overflow-y: auto;
- }
- .main-wrapper {
- flex: 1;
- display: flex;
- flex-direction: column;
- min-height: 0;
- }
- </style>
|