|
@@ -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">
|
|
|
|
|
|
+ <div class="head-logo-content" @click="toHomePage">
|
|
<img v-if="schoolLogo" :src="schoolLogo" alt="知学知考" />
|
|
<img v-if="schoolLogo" :src="schoolLogo" alt="知学知考" />
|
|
<h1 v-else>知学知考</h1>
|
|
<h1 v-else>知学知考</h1>
|
|
</div>
|
|
</div>
|
|
@@ -145,7 +145,6 @@ export default {
|
|
return {
|
|
return {
|
|
MENU_ICONS,
|
|
MENU_ICONS,
|
|
privileges: [],
|
|
privileges: [],
|
|
- homePageMenu: null,
|
|
|
|
menus: [],
|
|
menus: [],
|
|
curMenu: { url: "", children: [] },
|
|
curMenu: { url: "", children: [] },
|
|
curRouteName: "",
|
|
curRouteName: "",
|
|
@@ -167,6 +166,11 @@ 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: [] };
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
this.routerChange();
|
|
this.routerChange();
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -186,19 +190,14 @@ export default {
|
|
// 开发阶段专用
|
|
// 开发阶段专用
|
|
this.initPrivilegeMap(localMenus);
|
|
this.initPrivilegeMap(localMenus);
|
|
this.privileges = this.transformMenu(localMenus);
|
|
this.privileges = this.transformMenu(localMenus);
|
|
- this.homePageMenu = localMenus.find(item => item.url === "HomePage");
|
|
|
|
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.homePageMenu) {
|
|
|
|
- this.$router.replace({
|
|
|
|
- name: this.homePageMenu.url
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- this.toMenu(this.menus[0]);
|
|
|
|
- }
|
|
|
|
|
|
+ this.$router.replace({
|
|
|
|
+ name: "HomePage"
|
|
|
|
+ });
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -225,19 +224,14 @@ export default {
|
|
const data = await sysMenu();
|
|
const data = await sysMenu();
|
|
this.initPrivilegeMap(data.privileges);
|
|
this.initPrivilegeMap(data.privileges);
|
|
this.privileges = this.transformMenu(data.privileges);
|
|
this.privileges = this.transformMenu(data.privileges);
|
|
- this.homePageMenu = data.privileges.find(item => item.url === "HomePage");
|
|
|
|
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.homePageMenu) {
|
|
|
|
- this.$router.replace({
|
|
|
|
- name: this.homePageMenu.url
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- this.toMenu(this.menus[0]);
|
|
|
|
- }
|
|
|
|
|
|
+ this.$router.replace({
|
|
|
|
+ name: "HomePage"
|
|
|
|
+ });
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -262,17 +256,15 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
transformMenu(list) {
|
|
transformMenu(list) {
|
|
- return list
|
|
|
|
- .filter(item => item.url !== "HomePage")
|
|
|
|
- .map(item => {
|
|
|
|
- return {
|
|
|
|
- id: item.id,
|
|
|
|
- parentId: item.parentId,
|
|
|
|
- name: item.name,
|
|
|
|
- type: item.type,
|
|
|
|
- url: item.url
|
|
|
|
- };
|
|
|
|
- });
|
|
|
|
|
|
+ return list.map(item => {
|
|
|
|
+ return {
|
|
|
|
+ id: item.id,
|
|
|
|
+ parentId: item.parentId,
|
|
|
|
+ name: item.name,
|
|
|
|
+ type: item.type,
|
|
|
|
+ url: item.url
|
|
|
|
+ };
|
|
|
|
+ });
|
|
},
|
|
},
|
|
getMenu() {
|
|
getMenu() {
|
|
const getChildren = id => {
|
|
const getChildren = id => {
|
|
@@ -316,7 +308,7 @@ 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.some(
|
|
|
|
|
|
+ const isPage = [...pageSetTypes, "urls"].some(
|
|
type => item[type] && item[type].length
|
|
type => item[type] && item[type].length
|
|
);
|
|
);
|
|
if (!isPage) return;
|
|
if (!isPage) return;
|
|
@@ -368,6 +360,13 @@ export default {
|
|
},
|
|
},
|
|
routerChange() {
|
|
routerChange() {
|
|
this.updateBreadcrumbs();
|
|
this.updateBreadcrumbs();
|
|
|
|
+ if (!this.curMenu.url) {
|
|
|
|
+ // 从HomePage快捷菜单跳转过来的
|
|
|
|
+ const curMenu = this.menus.find(
|
|
|
|
+ menu => menu.url === this.breadcrumbs[0].url
|
|
|
|
+ );
|
|
|
|
+ this.menuChange(curMenu);
|
|
|
|
+ }
|
|
|
|
|
|
if (
|
|
if (
|
|
this.validRoutes.includes("WaitTask") &&
|
|
this.validRoutes.includes("WaitTask") &&
|
|
@@ -390,6 +389,9 @@ export default {
|
|
this.$ls.clear();
|
|
this.$ls.clear();
|
|
this.$router.push({ name: "Login" });
|
|
this.$router.push({ name: "Login" });
|
|
},
|
|
},
|
|
|
|
+ toHomePage() {
|
|
|
|
+ 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" });
|
|
},
|
|
},
|