Commit 184da175 authored by “yiyousong”'s avatar “yiyousong”

perf: 优化页面

parent 5387cdbf
...@@ -11,25 +11,27 @@ ...@@ -11,25 +11,27 @@
</template> </template>
<script> <script>
import Vue from "vue"; import Vue from 'vue';
export default { export default {
data() { data() {
return { return {
percentage: 1, percentage: 1,
loading: false, loading: false,
title: "文件导出中", title: '文件导出中'
}; };
}, },
beforeCreate() { beforeCreate() {
Vue.prototype.$app = this; Vue.prototype.$app = this;
}, },
created() {}, created() {},
methods: {}, methods: {}
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.app { .app {
max-width: 2560px;
margin: auto;
background-color: #eff0f4; background-color: #eff0f4;
// font-family: Source Han Sans CN; // font-family: Source Han Sans CN;
.loading { .loading {
......
...@@ -10,8 +10,7 @@ ...@@ -10,8 +10,7 @@
<h1 class="title cursor-pointer" @click="handleGoHome"> <h1 class="title cursor-pointer" @click="handleGoHome">
{{ sysName ? sysName : systemName }} {{ sysName ? sysName : systemName }}
</h1> </h1>
<HeaderSite class="ml-10"></HeaderSite> <HeaderSite class="ml-10 mr-[120px]"></HeaderSite>
</div>
<!-- 导航 --> <!-- 导航 -->
<el-menu :default-active="activeMenu" mode="horizontal" router @select="selectMenu"> <el-menu :default-active="activeMenu" mode="horizontal" router @select="selectMenu">
<template v-for="v in menus"> <template v-for="v in menus">
...@@ -35,6 +34,7 @@ ...@@ -35,6 +34,7 @@
</el-menu-item> </el-menu-item>
</template> </template>
</el-menu> </el-menu>
</div>
<div class="flex gap-5"> <div class="flex gap-5">
<div class="page-home" @click="handleGoHome">首页</div> <div class="page-home" @click="handleGoHome">首页</div>
<!-- 返回门户 --> <!-- 返回门户 -->
...@@ -60,11 +60,13 @@ export default { ...@@ -60,11 +60,13 @@ export default {
computed: { computed: {
activeMenu() { activeMenu() {
const route = this.$route; const route = this.$route;
const { meta, path } = route; const { meta, matched } = route;
if (meta.activeMenu) { if (meta.activeMenu) {
return meta.activeMenu; return meta.activeMenu;
} else {
let curMatched = matched.filter((v) => v.path);
return curMatched[0].path;
} }
return path;
}, },
...mapState('user', ['sysName', 'sysLogo', 'path', 'menus']) ...mapState('user', ['sysName', 'sysLogo', 'path', 'menus'])
}, },
......
...@@ -99,7 +99,8 @@ export default { ...@@ -99,7 +99,8 @@ export default {
'SET_userInfo', 'SET_userInfo',
'SET_permissions', 'SET_permissions',
'SET_routes', 'SET_routes',
'SET_menusList' 'SET_menusList',
'SET_secondaryRoutes'
]), ]),
// 获取验证码 // 获取验证码
...@@ -169,6 +170,7 @@ export default { ...@@ -169,6 +170,7 @@ export default {
calcMenu(); calcMenu();
if (routes.length) { if (routes.length) {
let path = routes[0].path; let path = routes[0].path;
this.SET_secondaryRoutes(path);
this.$router.push(path); this.$router.push(path);
} else { } else {
this.$message.warning('暂无权限,请联系管理员!'); this.$message.warning('暂无权限,请联系管理员!');
......
...@@ -28,7 +28,8 @@ export default { ...@@ -28,7 +28,8 @@ export default {
'SET_userInfo', 'SET_userInfo',
'SET_permissions', 'SET_permissions',
'SET_routes', 'SET_routes',
'SET_menusList' 'SET_menusList',
'SET_secondaryRoutes'
]), ]),
// 获取token // 获取token
async getToken() { async getToken() {
...@@ -65,6 +66,7 @@ export default { ...@@ -65,6 +66,7 @@ export default {
calcMenu(); calcMenu();
if (routes.length) { if (routes.length) {
let path = routes[0].path; let path = routes[0].path;
this.SET_secondaryRoutes(path);
this.$router.push(path); this.$router.push(path);
} else { } else {
this.$message.warning('暂无页面权限,请联系管理员!'); this.$message.warning('暂无页面权限,请联系管理员!');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment