|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div :class="['home', { 'home-page-main': IS_HOME_PAGE }]">
|
|
|
+ <div class="home">
|
|
|
<div class="home-header">
|
|
|
<div class="head-menu menu-list">
|
|
|
<ul>
|
|
@@ -12,14 +12,6 @@
|
|
|
]"
|
|
|
@click="toMenu(menu)"
|
|
|
>
|
|
|
- <!-- <i
|
|
|
- :class="[
|
|
|
- 'icon',
|
|
|
- MENU_ICONS[menu.url]
|
|
|
- ? `icon-${MENU_ICONS[menu.url]}`
|
|
|
- : 'icon-workspace'
|
|
|
- ]"
|
|
|
- ></i> -->
|
|
|
<span>{{ menu.name }}</span>
|
|
|
</li>
|
|
|
</ul>
|
|
@@ -45,7 +37,7 @@
|
|
|
<div class="head-logo">
|
|
|
<div class="head-logo-content">
|
|
|
<img v-if="schoolLogo" :src="schoolLogo" :alt="APP_TITLE" />
|
|
|
- <h1 v-else>{{APP_TITLE}}</h1>
|
|
|
+ <h1 v-else>{{ APP_TITLE }}</h1>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -122,22 +114,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { mapState, mapActions } from "vuex";
|
|
|
import localMenus from "@/constants/menus-data";
|
|
|
import { sysMenu, logout } from "../modules/login/api";
|
|
|
import ResetPwd from "../modules/base/components/ResetPwd";
|
|
|
import { SYS_ADMIN_NAME } from "@/constants/enumerate";
|
|
|
-import staticMenu from "../constants/staticMenu";
|
|
|
import { APP_TITLE } from "@/constants/app";
|
|
|
|
|
|
-const MENU_ICONS = {
|
|
|
- base: "base",
|
|
|
- exam: "exam",
|
|
|
- customer: "customer",
|
|
|
- stmms: "book"
|
|
|
-};
|
|
|
-const HOME_PAGE_ROUTE = "HomePage";
|
|
|
-
|
|
|
export default {
|
|
|
name: "home",
|
|
|
components: { ResetPwd },
|
|
@@ -146,7 +128,7 @@ export default {
|
|
|
const IS_SUPER_ADMIN = user.loginName === SYS_ADMIN_NAME;
|
|
|
|
|
|
return {
|
|
|
- MENU_ICONS,APP_TITLE,
|
|
|
+ APP_TITLE,
|
|
|
privileges: [],
|
|
|
menus: [],
|
|
|
curMenu: { url: "", children: [] },
|
|
@@ -169,37 +151,23 @@ export default {
|
|
|
watch: {
|
|
|
$route(val) {
|
|
|
if (val.name === "Home") return;
|
|
|
- if (this.$route.name === HOME_PAGE_ROUTE) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
this.routerChange();
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapState("exam", ["waitTaskCount"]),
|
|
|
- IS_HOME_PAGE() {
|
|
|
- return this.$route.name === HOME_PAGE_ROUTE;
|
|
|
- }
|
|
|
- },
|
|
|
+ computed: {},
|
|
|
created() {
|
|
|
- // this.initData1();
|
|
|
- this.initData();
|
|
|
+ this.initData1();
|
|
|
+ // this.initData();
|
|
|
},
|
|
|
methods: {
|
|
|
- ...mapActions("exam", ["updateWaitTaskCount"]),
|
|
|
initData1() {
|
|
|
// 开发阶段专用
|
|
|
this.initPrivilegeMap(localMenus);
|
|
|
this.privileges = this.transformMenu(localMenus);
|
|
|
this.menus = this.getMenu();
|
|
|
|
|
|
- if (this.IS_HOME_PAGE) return;
|
|
|
-
|
|
|
if (this.$route.name === "Home") {
|
|
|
- this.$router.replace({
|
|
|
- name: HOME_PAGE_ROUTE
|
|
|
- });
|
|
|
+ this.toMenu(this.menus[0]);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -215,31 +183,15 @@ export default {
|
|
|
menu => menu.url === this.breadcrumbs[0].url
|
|
|
);
|
|
|
this.menuChange(curMenu);
|
|
|
- if (
|
|
|
- this.validRoutes.includes("WaitTask") &&
|
|
|
- this.curMenu.url === "exam"
|
|
|
- ) {
|
|
|
- this.updateWaitTaskCount();
|
|
|
- }
|
|
|
},
|
|
|
async initData() {
|
|
|
const data = await sysMenu();
|
|
|
- const privileges = [...staticMenu, ...data.privileges];
|
|
|
- this.initPrivilegeMap(privileges);
|
|
|
- this.privileges = this.transformMenu(privileges);
|
|
|
+ this.initPrivilegeMap(data.privileges);
|
|
|
+ this.privileges = this.transformMenu(data.privileges);
|
|
|
this.menus = this.getMenu();
|
|
|
|
|
|
- if (this.IS_HOME_PAGE) return;
|
|
|
-
|
|
|
if (this.$route.name === "Home") {
|
|
|
this.toMenu(this.menus[0]);
|
|
|
- // if (this.IS_SUPER_ADMIN) {
|
|
|
- // this.toMenu(this.menus[0]);
|
|
|
- // } else {
|
|
|
- // this.$router.replace({
|
|
|
- // name: HOME_PAGE_ROUTE
|
|
|
- // });
|
|
|
- // }
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -255,13 +207,6 @@ export default {
|
|
|
menu => menu.url === this.breadcrumbs[0].url
|
|
|
);
|
|
|
this.menuChange(curMenu);
|
|
|
-
|
|
|
- if (
|
|
|
- this.validRoutes.includes("WaitTask") &&
|
|
|
- this.curMenu.url === "exam"
|
|
|
- ) {
|
|
|
- this.updateWaitTaskCount();
|
|
|
- }
|
|
|
},
|
|
|
transformMenu(list) {
|
|
|
return list.map(item => {
|
|
@@ -338,15 +283,6 @@ export default {
|
|
|
.map(item => item.url);
|
|
|
},
|
|
|
toMenu(menu) {
|
|
|
- if (menu.url === HOME_PAGE_ROUTE) {
|
|
|
- if (this.$route.name !== HOME_PAGE_ROUTE) {
|
|
|
- this.curMenu = menu;
|
|
|
- this.$router.push({
|
|
|
- name: HOME_PAGE_ROUTE
|
|
|
- });
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
if (this.curMenu.url === menu.url) return;
|
|
|
this.menuChange(menu);
|
|
|
const firstRouteName = this.getCurMenuFirstRouter();
|
|
@@ -373,20 +309,6 @@ export default {
|
|
|
},
|
|
|
routerChange() {
|
|
|
this.updateBreadcrumbs();
|
|
|
- if (!this.curMenu.url) {
|
|
|
- // 从HomePage快捷菜单跳转过来的
|
|
|
- const curMenu = this.menus.find(
|
|
|
- menu => menu.url === this.breadcrumbs[0].url
|
|
|
- );
|
|
|
- this.menuChange(curMenu);
|
|
|
- }
|
|
|
-
|
|
|
- if (
|
|
|
- this.validRoutes.includes("WaitTask") &&
|
|
|
- this.curMenu.url === "exam"
|
|
|
- ) {
|
|
|
- this.updateWaitTaskCount();
|
|
|
- }
|
|
|
},
|
|
|
toLogout() {
|
|
|
this.$confirm("确定要退出登录吗?", "提示", {
|
|
@@ -411,24 +333,6 @@ export default {
|
|
|
},
|
|
|
resetPwdModified() {
|
|
|
this.logoutAction();
|
|
|
- },
|
|
|
- // other
|
|
|
- getSubMenus(menu) {
|
|
|
- return this.privileges.filter(
|
|
|
- m => m.parentId === menu.id && m.type === "MENU"
|
|
|
- );
|
|
|
- },
|
|
|
- getFirstRouter() {
|
|
|
- let childNavs = this.privileges;
|
|
|
- let firstRouteName = "";
|
|
|
- while (childNavs.length) {
|
|
|
- firstRouteName = childNavs[0].url;
|
|
|
- childNavs = this.privileges.filter(
|
|
|
- item => item.parentId === childNavs[0].id
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- return firstRouteName;
|
|
|
}
|
|
|
}
|
|
|
};
|