Ver Fonte

首页调整

zhangjie há 2 anos atrás
pai
commit
ba0ef0d5ed

BIN
src/assets/images/icon-exam-task.png


BIN
src/assets/images/icon-marker-leader-login.png


BIN
src/assets/images/icon-marker-login.png


BIN
src/assets/images/icon-print-plan.png


BIN
src/assets/images/icon-report-office-teacher.png


BIN
src/assets/images/icon-report-president.png


BIN
src/assets/images/icon-report-teacher.png


BIN
src/assets/images/icon-score-archive.png


BIN
src/assets/images/icon-task-apply.png


BIN
src/assets/images/icon-task-paper.png


BIN
src/assets/images/icon-task-review.png


+ 9 - 0
src/assets/styles/home.scss

@@ -80,6 +80,10 @@
       display: block;
       padding: 30px 0;
       border-bottom: 1px solid #eff0f5;
+      cursor: pointer;
+      &:hover {
+        opacity: 0.8;
+      }
     }
     img {
       display: block;
@@ -471,6 +475,11 @@
     padding: 10px 0;
     width: 100px;
     text-align: center;
+    cursor: pointer;
+
+    &:hover {
+      opacity: 0.8;
+    }
   }
   .shortcut-icon {
     width: 40px;

+ 56 - 0
src/assets/styles/icons.scss

@@ -89,4 +89,60 @@
     width: 14px;
     height: 12px;
   }
+  // home-page
+  &-exam-task {
+    background-image: url(../images/icon-exam-task.png);
+    width: 20px;
+    height: 20px;
+  }
+  &-marker-login {
+    background-image: url(../images/icon-marker-login.png);
+    width: 20px;
+    height: 20px;
+  }
+  &-marker-leader-login {
+    background-image: url(../images/icon-marker-leader-login.png);
+    width: 20px;
+    height: 20px;
+  }
+  &-print-plan {
+    background-image: url(../images/icon-print-plan.png);
+    width: 20px;
+    height: 20px;
+  }
+  &-report-teacher {
+    background-image: url(../images/icon-report-teacher.png);
+    width: 20px;
+    height: 20px;
+  }
+  &-report-office-teacher {
+    background-image: url(../images/icon-report-office-teacher.png);
+    width: 20px;
+    height: 20px;
+  }
+  &-report-president {
+    background-image: url(../images/icon-report-president.png);
+    width: 20px;
+    height: 20px;
+  }
+  &-score-archive {
+    background-image: url(../images/icon-score-archive.png);
+    width: 20px;
+    height: 20px;
+  }
+  &-task-apply {
+    background-image: url(../images/icon-task-apply.png);
+    width: 20px;
+    height: 20px;
+  }
+  &-task-paper {
+    background-image: url(../images/icon-task-paper.png);
+    width: 20px;
+    height: 20px;
+  }
+  &-task-review {
+    background-image: url(../images/icon-task-review.png);
+    width: 20px;
+    height: 20px;
+  }
 }

+ 11 - 11
src/constants/shortcutData.js

@@ -2,37 +2,37 @@ export default [
   {
     router: "ExamTaskManage",
     name: "命题任务管理",
-    icon: "",
+    icon: "icon-exam-task",
     params: {}
   },
   {
     router: "TaskApplyManage",
     name: "入库申请",
-    icon: "",
+    icon: "icon-task-apply",
     params: {}
   },
   {
     router: "TaskReviewManage",
     name: "入库审核",
-    icon: "",
+    icon: "icon-task-review",
     params: {}
   },
   {
     router: "TaskPaperManage",
     name: "卷库查询",
-    icon: "",
+    icon: "icon-task-paper",
     params: {}
   },
   {
     router: "PrintPlanManage",
     name: "印刷计划管理",
-    icon: "",
+    icon: "icon-print-plan",
     params: {}
   },
   {
     router: "MarkerLogin",
     name: "评卷员阅卷",
-    icon: "",
+    icon: "icon-marker-login",
     params: {
       trigger: "MARKER"
     }
@@ -40,7 +40,7 @@ export default [
   {
     router: "MarkerLogin",
     name: "科组长阅卷",
-    icon: "",
+    icon: "icon-marker-leader-login",
     params: {
       trigger: "MARK_LEADER"
     }
@@ -48,13 +48,13 @@ export default [
   {
     router: "ScoreArchive",
     name: "成绩管理",
-    icon: "",
+    icon: "icon-score-archive",
     params: {}
   },
   {
     router: "AnalysisReportView",
     name: "教务处看板",
-    icon: "",
+    icon: "icon-report-office-teacher",
     params: {
       trigger: "OFFICE_TEACHER"
     }
@@ -62,7 +62,7 @@ export default [
   {
     router: "AnalysisReportView",
     name: "学院分析报告",
-    icon: "",
+    icon: "icon-report-president",
     params: {
       trigger: "PRESIDENT"
     }
@@ -70,7 +70,7 @@ export default [
   {
     router: "AnalysisReportView",
     name: "任课老师报告",
-    icon: "",
+    icon: "icon-report-teacher",
     params: {
       trigger: "TEACHER"
     }

+ 3 - 0
src/modules/analysis/views/AnalysisReportView.vue

@@ -37,6 +37,9 @@ export default {
     this.roles = this.user.roleSource.filter(
       item => item.roleSource === "ANALYSIS"
     );
+    if (this.$route.query.trigger) {
+      this.toAuth({ roleCode: this.$route.query.trigger });
+    }
   },
   methods: {
     async toAuth(item) {

+ 3 - 0
src/modules/stmms/views/MarkerLogin.vue

@@ -32,6 +32,9 @@ export default {
   },
   mounted() {
     this.getRoles();
+    if (this.$route.query.trigger) {
+      this.toAuth({ type: this.$route.query.trigger });
+    }
   },
   methods: {
     async getRoles() {

+ 32 - 30
src/views/Home.vue

@@ -43,7 +43,7 @@
 
     <div class="home-navs">
       <div class="head-logo">
-        <div class="head-logo-content">
+        <div class="head-logo-content" @click="toHomePage">
           <img v-if="schoolLogo" :src="schoolLogo" alt="知学知考" />
           <h1 v-else>知学知考</h1>
         </div>
@@ -145,7 +145,6 @@ export default {
     return {
       MENU_ICONS,
       privileges: [],
-      homePageMenu: null,
       menus: [],
       curMenu: { url: "", children: [] },
       curRouteName: "",
@@ -167,6 +166,11 @@ export default {
   watch: {
     $route(val) {
       if (val.name === "Home") return;
+      if (this.$route.name === "HomePage") {
+        this.curMenu = { url: "", children: [] };
+        return;
+      }
+
       this.routerChange();
     }
   },
@@ -186,19 +190,14 @@ export default {
       // 开发阶段专用
       this.initPrivilegeMap(localMenus);
       this.privileges = this.transformMenu(localMenus);
-      this.homePageMenu = localMenus.find(item => item.url === "HomePage");
       this.menus = this.getMenu();
 
       if (this.IS_HOME_PAGE) return;
 
       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;
       }
 
@@ -225,19 +224,14 @@ export default {
       const data = await sysMenu();
       this.initPrivilegeMap(data.privileges);
       this.privileges = this.transformMenu(data.privileges);
-      this.homePageMenu = data.privileges.find(item => item.url === "HomePage");
       this.menus = this.getMenu();
 
       if (this.IS_HOME_PAGE) return;
 
       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;
       }
 
@@ -262,17 +256,15 @@ export default {
       }
     },
     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() {
       const getChildren = id => {
@@ -316,7 +308,7 @@ export default {
       let privilegeMap = {};
       const pageSetTypes = ["conditions", "buttons", "lists", "links"];
       data.forEach(item => {
-        const isPage = pageSetTypes.some(
+        const isPage = [...pageSetTypes, "urls"].some(
           type => item[type] && item[type].length
         );
         if (!isPage) return;
@@ -368,6 +360,13 @@ 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") &&
@@ -390,6 +389,9 @@ export default {
       this.$ls.clear();
       this.$router.push({ name: "Login" });
     },
+    toHomePage() {
+      this.$router.push({ name: "HomePage" });
+    },
     toSelectSchool() {
       if (this.IS_SUPER_ADMIN) this.$router.push({ name: "SelectSchool" });
     },

+ 9 - 6
src/views/HomePage.vue

@@ -13,13 +13,14 @@
         <p class="tab-summary-cont">{{ summary.doneTaskCount }}</p>
       </div>
     </div>
-    <div class="tab-box tab-shortcut">
+    <div v-if="shortcutList.length" class="tab-box tab-shortcut">
       <h2 class="tab-box-title">快捷入口</h2>
       <div class="tab-box-body shortcut-list">
         <div
           v-for="(item, ind) in shortcutList"
           :key="ind"
           class="shortcut-item"
+          @click="toMenu(item)"
         >
           <div class="shortcut-icon"><i :class="['icon', item.icon]"></i></div>
           <div class="shortcut-name">{{ item.name }}</div>
@@ -103,8 +104,9 @@ export default {
         const markerRoles = await userSysRoles();
         validShortcutData = validShortcutData.filter(
           item =>
-            item.url === "MarkerLogin" &&
-            markerRoles.includes(item.params.trigger)
+            item.router !== "MarkerLogin" ||
+            (item.router === "MarkerLogin" &&
+              !markerRoles.includes(item.params.trigger))
         );
       }
 
@@ -115,8 +117,9 @@ export default {
         );
         validShortcutData = validShortcutData.filter(
           item =>
-            item.url === "AnalysisReportView" &&
-            analysisRoles.includes(item.params.trigger)
+            item.router !== "AnalysisReportView" ||
+            (item.router === "AnalysisReportView" &&
+              !analysisRoles.includes(item.params.trigger))
         );
       }
 
@@ -156,7 +159,7 @@ export default {
     toMenu(item) {
       this.$router.push({
         name: item.router,
-        params: item.params
+        query: item.params
       });
     },
     toDo(item) {