|
@@ -1,85 +1,175 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { RouterLink, RouterView } from 'vue-router'
|
|
|
-import HelloWorld from './components/HelloWorld.vue'
|
|
|
+import { RouterView } from 'vue-router'
|
|
|
+import { ref } from 'vue'
|
|
|
+import { fi } from 'element-plus/es/locales.mjs'
|
|
|
+
|
|
|
+const isCollapse = ref(false)
|
|
|
+const menuList = [
|
|
|
+ {
|
|
|
+ title: '数据总览',
|
|
|
+ icon: 'PieChart',
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ pathName: 'OverView',
|
|
|
+ title: '工作台'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '信息管理',
|
|
|
+ icon: 'Histogram',
|
|
|
+ children: [
|
|
|
+ {
|
|
|
+ pathName: 'GameManageView',
|
|
|
+ title: '游戏管理'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ pathName: 'PlayerManageView',
|
|
|
+ title: '玩家管理'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+]
|
|
|
+
|
|
|
+const changeCollapse = () => {
|
|
|
+ isCollapse.value = !isCollapse.value
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <header>
|
|
|
- <img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
|
|
|
-
|
|
|
- <div class="wrapper">
|
|
|
- <HelloWorld msg="You did it!" />
|
|
|
-
|
|
|
- <nav>
|
|
|
- <RouterLink to="/">Home</RouterLink>
|
|
|
- <RouterLink to="/about">About</RouterLink>
|
|
|
- </nav>
|
|
|
+ <div class="body">
|
|
|
+ <div class="sideBarBox">
|
|
|
+ <el-menu :router="true" :default-active="$route.name" class="sideBar" :collapse="isCollapse">
|
|
|
+ <el-menu-item index="/" class="logoBox">
|
|
|
+ <el-image :fit="'fill'" class="logoImg" src="/src/assets/logo.svg"></el-image>
|
|
|
+ <template #title><span class="logoText">淳皓科技</span></template>
|
|
|
+ </el-menu-item>
|
|
|
+ <el-sub-menu v-for="item in menuList" :index="item.title">
|
|
|
+ <template #title>
|
|
|
+ <el-icon><component :is="item.icon" /></el-icon>
|
|
|
+ <span class="menuTitle">{{ item.title }}</span>
|
|
|
+ </template>
|
|
|
+ <el-menu-item v-for="v in item.children" :index="v.pathName">{{ v.title }}</el-menu-item>
|
|
|
+ </el-sub-menu>
|
|
|
+ <div class="sideBarFold" @click="changeCollapse">
|
|
|
+ <el-icon :size="25"><Fold /></el-icon>
|
|
|
+ </div>
|
|
|
+ </el-menu>
|
|
|
</div>
|
|
|
- </header>
|
|
|
-
|
|
|
- <RouterView />
|
|
|
+ <div class="navBarBox">
|
|
|
+ <div class="headPortraitBox">
|
|
|
+ <!-- <el-avatar :size="40" src="/src/assets/default/defaultHead.png" /> -->
|
|
|
+ <el-image class="headPortrait" src="/src/assets/default/defaultHead.png"></el-image>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="content">
|
|
|
+ <RouterView />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<style scoped>
|
|
|
-header {
|
|
|
- line-height: 1.5;
|
|
|
- max-height: 100vh;
|
|
|
+.body {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ height: 100vh;
|
|
|
}
|
|
|
|
|
|
-.logo {
|
|
|
- display: block;
|
|
|
- margin: 0 auto 2rem;
|
|
|
+/* 设置宽度后,content无法适应宽度,只能去间接的调整内部元素的宽度 */
|
|
|
+.sideBarBox {
|
|
|
+ position: relative;
|
|
|
+ /* width: 12%; */
|
|
|
+ z-index: 2;
|
|
|
+ height: 100vh;
|
|
|
+ top: 0;
|
|
|
}
|
|
|
|
|
|
-nav {
|
|
|
- width: 100%;
|
|
|
- font-size: 12px;
|
|
|
- text-align: center;
|
|
|
- margin-top: 2rem;
|
|
|
+.sideBar {
|
|
|
+ /* width: 12vw; */
|
|
|
+ height: 100vh;
|
|
|
+ position: relative;
|
|
|
+ overflow: scroll;
|
|
|
}
|
|
|
|
|
|
-nav a.router-link-exact-active {
|
|
|
- color: var(--color-text);
|
|
|
+/* 设置弹出层的样式 */
|
|
|
+.el-popper > .logoText {
|
|
|
+ width: 100px;
|
|
|
+ font-size: 16px;
|
|
|
+ /* color: red; */
|
|
|
}
|
|
|
|
|
|
-nav a.router-link-exact-active:hover {
|
|
|
- background-color: transparent;
|
|
|
+/* 调整LOGO */
|
|
|
+.logoBox {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
}
|
|
|
|
|
|
-nav a {
|
|
|
- display: inline-block;
|
|
|
- padding: 0 1rem;
|
|
|
- border-left: 1px solid var(--color-border);
|
|
|
+.logoImg {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ width: 33px;
|
|
|
+ /* margin-right: 20px; */
|
|
|
+ /* height: 50px; */
|
|
|
}
|
|
|
|
|
|
-nav a:first-of-type {
|
|
|
- border: 0;
|
|
|
+.logoText {
|
|
|
+ width: 80%;
|
|
|
+ height: 100%;
|
|
|
+ margin-left: 15%;
|
|
|
+ display: flex;
|
|
|
+ font-size: 18px;
|
|
|
+ align-items: center;
|
|
|
+ /* background-color: lightcoral; */
|
|
|
}
|
|
|
|
|
|
-@media (min-width: 1024px) {
|
|
|
- header {
|
|
|
- display: flex;
|
|
|
- place-items: center;
|
|
|
- padding-right: calc(var(--section-gap) / 2);
|
|
|
- }
|
|
|
+/* 主要用来调整整个menu的宽度 */
|
|
|
+.menuTitle {
|
|
|
+ margin-right: 40px;
|
|
|
+}
|
|
|
|
|
|
- .logo {
|
|
|
- margin: 0 2rem 0 0;
|
|
|
- }
|
|
|
+.sideBarFold {
|
|
|
+ width: 5%;
|
|
|
+ height: 3%;
|
|
|
+ position: absolute;
|
|
|
+ right: 40px;
|
|
|
+ bottom: 20px;
|
|
|
+}
|
|
|
|
|
|
- header .wrapper {
|
|
|
- display: flex;
|
|
|
- place-items: flex-start;
|
|
|
- flex-wrap: wrap;
|
|
|
- }
|
|
|
+.navBarBox {
|
|
|
+ position: fixed;
|
|
|
+ width: 100vw;
|
|
|
+ z-index: 1;
|
|
|
+ height: 7vh;
|
|
|
+ top: 0;
|
|
|
+ background-color: white;
|
|
|
+ right: 0;
|
|
|
+ border-bottom: 1px solid gainsboro;
|
|
|
+}
|
|
|
|
|
|
- nav {
|
|
|
- text-align: left;
|
|
|
- margin-left: -1rem;
|
|
|
- font-size: 1rem;
|
|
|
+.headPortraitBox {
|
|
|
+ /* width: 5vw; */
|
|
|
+ /* height: 5vh; */
|
|
|
+ position: absolute;
|
|
|
+ right: 3%;
|
|
|
+ top: 50%;
|
|
|
+ transform: translateY(-50%);
|
|
|
+}
|
|
|
|
|
|
- padding: 1rem 0;
|
|
|
- margin-top: 1rem;
|
|
|
- }
|
|
|
+.headPortrait {
|
|
|
+ cursor: pointer;
|
|
|
+ width: 50px;
|
|
|
+}
|
|
|
+
|
|
|
+.content {
|
|
|
+ /* flex-grow: 1; */
|
|
|
+ /* position: absolute; */
|
|
|
+
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ overflow: scroll;
|
|
|
+ background-color: lightcoral;
|
|
|
+ right: 0vw;
|
|
|
+ top: 0vh;
|
|
|
}
|
|
|
</style>
|