|
@@ -2,7 +2,7 @@
|
|
|
* @Author: fxs bjnsfxs@163.com
|
|
* @Author: fxs bjnsfxs@163.com
|
|
|
* @Date: 2024-08-20 14:06:49
|
|
* @Date: 2024-08-20 14:06:49
|
|
|
* @LastEditors: fxs bjnsfxs@163.com
|
|
* @LastEditors: fxs bjnsfxs@163.com
|
|
|
- * @LastEditTime: 2024-09-03 18:22:47
|
|
|
|
|
|
|
+ * @LastEditTime: 2024-09-04 10:19:43
|
|
|
* @FilePath: \Game-Backstage-Management-System\src\App.vue
|
|
* @FilePath: \Game-Backstage-Management-System\src\App.vue
|
|
|
* @Description:
|
|
* @Description:
|
|
|
*
|
|
*
|
|
@@ -10,7 +10,8 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { zhCn } from 'element-plus/es/locales.mjs'
|
|
import { zhCn } from 'element-plus/es/locales.mjs'
|
|
|
import { RouterView } from 'vue-router'
|
|
import { RouterView } from 'vue-router'
|
|
|
-import { onMounted, reactive, ref, nextTick } from 'vue'
|
|
|
|
|
|
|
+import { onMounted, reactive, ref, computed } from 'vue'
|
|
|
|
|
+import { useRoute } from 'vue-router'
|
|
|
import { ElMessage } from 'element-plus'
|
|
import { ElMessage } from 'element-plus'
|
|
|
import { getAllGameInfo } from '@/utils/table/table'
|
|
import { getAllGameInfo } from '@/utils/table/table'
|
|
|
import router from '@/router'
|
|
import router from '@/router'
|
|
@@ -19,13 +20,22 @@ import DropDownSelection from '@/components/dataAnalysis/DropDownSelection.vue'
|
|
|
import { useCommonStore } from '@/stores/useCommon'
|
|
import { useCommonStore } from '@/stores/useCommon'
|
|
|
import { initLoadResouce } from '@/utils/resource'
|
|
import { initLoadResouce } from '@/utils/resource'
|
|
|
|
|
|
|
|
|
|
+const route = useRoute()
|
|
|
const { selectInfo } = useCommonStore()
|
|
const { selectInfo } = useCommonStore()
|
|
|
const isCollapse = ref(false)
|
|
const isCollapse = ref(false)
|
|
|
const navBarSelect = ref<string>('Home')
|
|
const navBarSelect = ref<string>('Home')
|
|
|
const siderBarOpened = ref<Array<string>>(['数据总览'])
|
|
const siderBarOpened = ref<Array<string>>(['数据总览'])
|
|
|
const siderBar = ref()
|
|
const siderBar = ref()
|
|
|
|
|
+
|
|
|
|
|
+// 路由信息,同时也是侧边栏生成的依据信息
|
|
|
const menuList = reactive<Array<any>>([])
|
|
const menuList = reactive<Array<any>>([])
|
|
|
-const defaultActive = ref<string>('0')
|
|
|
|
|
|
|
+
|
|
|
|
|
+// 默认选中
|
|
|
|
|
+const defaultActive = computed(() => {
|
|
|
|
|
+ return route.meta.activeMenu
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+// 顶部导航栏信息
|
|
|
const navBarMenuList = [
|
|
const navBarMenuList = [
|
|
|
{
|
|
{
|
|
|
name: 'Home',
|
|
name: 'Home',
|
|
@@ -87,7 +97,7 @@ const changeNavBar = (val: string) => {
|
|
|
|
|
|
|
|
router.push(`/${val}`)
|
|
router.push(`/${val}`)
|
|
|
createdMenuList()
|
|
createdMenuList()
|
|
|
-
|
|
|
|
|
|
|
+ console.log(menuList)
|
|
|
let title = navBarMenuList.find((item) => item.name === val)?.title
|
|
let title = navBarMenuList.find((item) => item.name === val)?.title
|
|
|
if (title) {
|
|
if (title) {
|
|
|
siderBarOpened.value.splice(0, 1, title)
|
|
siderBarOpened.value.splice(0, 1, title)
|
|
@@ -119,21 +129,20 @@ const resourceInfo: Record<string, string> = {
|
|
|
// 使用blob的资源路径信息
|
|
// 使用blob的资源路径信息
|
|
|
const blobUrlInfo = reactive<Record<string, string>>({})
|
|
const blobUrlInfo = reactive<Record<string, string>>({})
|
|
|
|
|
|
|
|
|
|
+// 侧边栏跳转路由的基本路由
|
|
|
const basePath = ref<string | undefined>()
|
|
const basePath = ref<string | undefined>()
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @description: 创建侧边栏menu
|
|
* @description: 创建侧边栏menu
|
|
|
- * @param {*} let
|
|
|
|
|
* @return {*}
|
|
* @return {*}
|
|
|
*/
|
|
*/
|
|
|
const createdMenuList = () => {
|
|
const createdMenuList = () => {
|
|
|
- let routes = router.options.routes
|
|
|
|
|
|
|
+ let routes = router.options.routes // 获取路由信息
|
|
|
let activeMenu = routes.find((item) => {
|
|
let activeMenu = routes.find((item) => {
|
|
|
- return item.name === navBarSelect.value
|
|
|
|
|
|
|
+ return item.name === navBarSelect.value // 根据顶部导航栏的选中情况来选择选中哪个具体的路由信息,可以打印自己看一下
|
|
|
})
|
|
})
|
|
|
- basePath.value = activeMenu?.path
|
|
|
|
|
- menuList.splice(0, menuList.length, ...(activeMenu?.children as Array<any>))
|
|
|
|
|
- defaultActive.value = '0' // 仍有问题
|
|
|
|
|
|
|
+ basePath.value = activeMenu?.path // 找到需要激活的菜单的路由,后续用来拼接需要跳转的路由
|
|
|
|
|
+ menuList.splice(0, menuList.length, ...(activeMenu?.children as Array<any>)) // 清空原来的路由信息,并且加入新选中的
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
@@ -166,6 +175,7 @@ onMounted(() => {
|
|
|
@change-select="changeGame"
|
|
@change-select="changeGame"
|
|
|
></DropDownSelection>
|
|
></DropDownSelection>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <!-- 顶部导航栏 -->
|
|
|
<div class="navBarMenu">
|
|
<div class="navBarMenu">
|
|
|
<el-menu
|
|
<el-menu
|
|
|
:default-active="navBarSelect"
|
|
:default-active="navBarSelect"
|
|
@@ -195,7 +205,7 @@ onMounted(() => {
|
|
|
</el-popover>
|
|
</el-popover>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
-
|
|
|
|
|
|
|
+ <!-- 侧边栏 -->
|
|
|
<div class="sideBarBox">
|
|
<div class="sideBarBox">
|
|
|
<el-menu
|
|
<el-menu
|
|
|
:default-active="defaultActive"
|
|
:default-active="defaultActive"
|
|
@@ -209,14 +219,13 @@ onMounted(() => {
|
|
|
<el-icon><component :is="item.icon"></component></el-icon>
|
|
<el-icon><component :is="item.icon"></component></el-icon>
|
|
|
<span>{{ item.cnName }}</span>
|
|
<span>{{ item.cnName }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
- <!-- :to="{ name: val.name }" -->
|
|
|
|
|
<router-link
|
|
<router-link
|
|
|
style="text-decoration: none"
|
|
style="text-decoration: none"
|
|
|
- v-for="(val, subIndex) in item.children"
|
|
|
|
|
|
|
+ v-for="val in item.children"
|
|
|
:to="{ path: basePath + '/' + item.path + '/' + val.path }"
|
|
:to="{ path: basePath + '/' + item.path + '/' + val.path }"
|
|
|
:key="index"
|
|
:key="index"
|
|
|
>
|
|
>
|
|
|
- <el-menu-item :index="index + '-' + subIndex">{{ val.cnName }}</el-menu-item>
|
|
|
|
|
|
|
+ <el-menu-item :index="val.path">{{ val.cnName }}</el-menu-item>
|
|
|
</router-link>
|
|
</router-link>
|
|
|
</el-sub-menu>
|
|
</el-sub-menu>
|
|
|
|
|
|
|
@@ -226,7 +235,7 @@ onMounted(() => {
|
|
|
:to="{ path: basePath + '/' + item.path }"
|
|
:to="{ path: basePath + '/' + item.path }"
|
|
|
:key="index"
|
|
:key="index"
|
|
|
>
|
|
>
|
|
|
- <el-menu-item :index="`${index}`">
|
|
|
|
|
|
|
+ <el-menu-item :index="item.path">
|
|
|
<template #title>
|
|
<template #title>
|
|
|
<el-icon><component :is="item.icon" /></el-icon>
|
|
<el-icon><component :is="item.icon" /></el-icon>
|
|
|
<span class="menuTitle">{{ item.cnName }}</span>
|
|
<span class="menuTitle">{{ item.cnName }}</span>
|
|
@@ -240,36 +249,6 @@ onMounted(() => {
|
|
|
</el-menu>
|
|
</el-menu>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <!-- <div class="sideBarBox">
|
|
|
|
|
- <el-menu
|
|
|
|
|
- :router="true"
|
|
|
|
|
- :default-active="$route.name"
|
|
|
|
|
- class="sideBar"
|
|
|
|
|
- :collapse="isCollapse"
|
|
|
|
|
- ref="siderBar"
|
|
|
|
|
- >
|
|
|
|
|
- <template v-for="item in menuInfo[navBarSelect]">
|
|
|
|
|
- <el-sub-menu v-if="item.children" :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>
|
|
|
|
|
- <el-menu-item v-else :index="item.pathName">
|
|
|
|
|
- <template #title>
|
|
|
|
|
- <el-icon><component :is="item.icon" /></el-icon>
|
|
|
|
|
- <span class="menuTitle">{{ item.title }}</span>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-menu-item>
|
|
|
|
|
- </template>
|
|
|
|
|
- <div class="sideBarFold" @click="changeCollapse">
|
|
|
|
|
- <el-icon :size="25"><Fold /></el-icon>
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-menu>
|
|
|
|
|
- </div> -->
|
|
|
|
|
<div class="content">
|
|
<div class="content">
|
|
|
<router-view v-slot="{ Component, route }">
|
|
<router-view v-slot="{ Component, route }">
|
|
|
<keep-alive>
|
|
<keep-alive>
|