|
@@ -43,7 +43,7 @@
|
|
|
|
|
|
<div class="home-navs">
|
|
<div class="home-navs">
|
|
<div class="head-logo">
|
|
<div class="head-logo">
|
|
- <div class="head-logo-content" @click="toHomePage">
|
|
|
|
|
|
+ <div class="head-logo-content">
|
|
<img v-if="schoolLogo" :src="schoolLogo" alt="知学知考" />
|
|
<img v-if="schoolLogo" :src="schoolLogo" alt="知学知考" />
|
|
<h1 v-else>知学知考</h1>
|
|
<h1 v-else>知学知考</h1>
|
|
</div>
|
|
</div>
|
|
@@ -127,6 +127,7 @@ import localMenus from "@/constants/menus-data";
|
|
import { sysMenu, logout } from "../modules/login/api";
|
|
import { sysMenu, logout } from "../modules/login/api";
|
|
import ResetPwd from "../modules/base/components/ResetPwd";
|
|
import ResetPwd from "../modules/base/components/ResetPwd";
|
|
import { SYS_ADMIN_NAME } from "@/constants/enumerate";
|
|
import { SYS_ADMIN_NAME } from "@/constants/enumerate";
|
|
|
|
+import staticMenu from "../constants/staticMenu";
|
|
|
|
|
|
const MENU_ICONS = {
|
|
const MENU_ICONS = {
|
|
base: "base",
|
|
base: "base",
|
|
@@ -134,6 +135,7 @@ const MENU_ICONS = {
|
|
customer: "customer",
|
|
customer: "customer",
|
|
stmms: "book"
|
|
stmms: "book"
|
|
};
|
|
};
|
|
|
|
+const HOME_PAGE_ROUTE = "HomePage";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "home",
|
|
name: "home",
|
|
@@ -166,8 +168,7 @@ export default {
|
|
watch: {
|
|
watch: {
|
|
$route(val) {
|
|
$route(val) {
|
|
if (val.name === "Home") return;
|
|
if (val.name === "Home") return;
|
|
- if (this.$route.name === "HomePage") {
|
|
|
|
- this.curMenu = { url: "", children: [] };
|
|
|
|
|
|
+ if (this.$route.name === HOME_PAGE_ROUTE) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -177,7 +178,7 @@ export default {
|
|
computed: {
|
|
computed: {
|
|
...mapState("exam", ["waitTaskCount"]),
|
|
...mapState("exam", ["waitTaskCount"]),
|
|
IS_HOME_PAGE() {
|
|
IS_HOME_PAGE() {
|
|
- return this.$route.name === "HomePage";
|
|
|
|
|
|
+ return this.$route.name === HOME_PAGE_ROUTE;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -196,7 +197,7 @@ export default {
|
|
|
|
|
|
if (this.$route.name === "Home") {
|
|
if (this.$route.name === "Home") {
|
|
this.$router.replace({
|
|
this.$router.replace({
|
|
- name: "HomePage"
|
|
|
|
|
|
+ name: HOME_PAGE_ROUTE
|
|
});
|
|
});
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -222,20 +223,22 @@ export default {
|
|
},
|
|
},
|
|
async initData() {
|
|
async initData() {
|
|
const data = await sysMenu();
|
|
const data = await sysMenu();
|
|
- this.initPrivilegeMap(data.privileges);
|
|
|
|
- this.privileges = this.transformMenu(data.privileges);
|
|
|
|
|
|
+ const privileges = [...staticMenu, ...data.privileges];
|
|
|
|
+ this.initPrivilegeMap(privileges);
|
|
|
|
+ this.privileges = this.transformMenu(privileges);
|
|
this.menus = this.getMenu();
|
|
this.menus = this.getMenu();
|
|
|
|
|
|
if (this.IS_HOME_PAGE) return;
|
|
if (this.IS_HOME_PAGE) return;
|
|
|
|
|
|
if (this.$route.name === "Home") {
|
|
if (this.$route.name === "Home") {
|
|
- if (this.IS_SUPER_ADMIN) {
|
|
|
|
- this.toMenu(this.menus[0]);
|
|
|
|
- } else {
|
|
|
|
- this.$router.replace({
|
|
|
|
- name: "HomePage"
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ this.toMenu(this.menus[0]);
|
|
|
|
+ // if (this.IS_SUPER_ADMIN) {
|
|
|
|
+ // this.toMenu(this.menus[0]);
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$router.replace({
|
|
|
|
+ // name: HOME_PAGE_ROUTE
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -312,10 +315,6 @@ export default {
|
|
let privilegeMap = {};
|
|
let privilegeMap = {};
|
|
const pageSetTypes = ["conditions", "buttons", "lists", "links"];
|
|
const pageSetTypes = ["conditions", "buttons", "lists", "links"];
|
|
data.forEach(item => {
|
|
data.forEach(item => {
|
|
- // const isPage = [...pageSetTypes, "urls"].some(
|
|
|
|
- // type => item[type] && item[type].length
|
|
|
|
- // );
|
|
|
|
- // if (!isPage) return;
|
|
|
|
privilegeMap[item.url] = [];
|
|
privilegeMap[item.url] = [];
|
|
pageSetTypes.forEach((type, index) => {
|
|
pageSetTypes.forEach((type, index) => {
|
|
if (item[type] && item[type].length) {
|
|
if (item[type] && item[type].length) {
|
|
@@ -338,6 +337,15 @@ export default {
|
|
.map(item => item.url);
|
|
.map(item => item.url);
|
|
},
|
|
},
|
|
toMenu(menu) {
|
|
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;
|
|
if (this.curMenu.url === menu.url) return;
|
|
this.menuChange(menu);
|
|
this.menuChange(menu);
|
|
const firstRouteName = this.getCurMenuFirstRouter();
|
|
const firstRouteName = this.getCurMenuFirstRouter();
|
|
@@ -393,10 +401,6 @@ export default {
|
|
this.$ls.clear();
|
|
this.$ls.clear();
|
|
this.$router.push({ name: "Login" });
|
|
this.$router.push({ name: "Login" });
|
|
},
|
|
},
|
|
- toHomePage() {
|
|
|
|
- if (this.IS_SUPER_ADMIN) return;
|
|
|
|
- this.$router.push({ name: "HomePage" });
|
|
|
|
- },
|
|
|
|
toSelectSchool() {
|
|
toSelectSchool() {
|
|
if (this.IS_SUPER_ADMIN) this.$router.push({ name: "SelectSchool" });
|
|
if (this.IS_SUPER_ADMIN) this.$router.push({ name: "SelectSchool" });
|
|
},
|
|
},
|