Selaa lähdekoodia

添加tips链接(带权限)

Michael Wang 6 vuotta sitten
vanhempi
commit
9a85300422

+ 1 - 1
src/modules/portal/store/currentPaths.js

@@ -1,4 +1,4 @@
-export const UPDATE_CURRENT_PATHS = "UPDATE_CURRENT_PATHS"; //退出登录
+export const UPDATE_CURRENT_PATHS = "UPDATE_CURRENT_PATHS";
 
 export default {
   state: [],

+ 12 - 0
src/modules/portal/store/menuList.js

@@ -0,0 +1,12 @@
+export const UPDATE_MENU_LIST = "UPDATE_MENU_LIST";
+
+export default {
+  state: [],
+  mutations: {
+    [UPDATE_MENU_LIST](state, menuList) {
+      console.log(state, menuList);
+      state.length = 0;
+      state.push(...menuList);
+    }
+  }
+};

+ 3 - 1
src/modules/portal/views/home/HomeSide.vue

@@ -110,6 +110,7 @@ const routesToMenu = [
 
 import { mapMutations } from "vuex";
 import { UPDATE_CURRENT_PATHS } from "../../store/currentPaths";
+import { UPDATE_MENU_LIST } from "../../store/menuList";
 
 export default {
   name: "HomeSide",
@@ -129,7 +130,7 @@ export default {
     }
   },
   methods: {
-    ...mapMutations([UPDATE_CURRENT_PATHS]),
+    ...mapMutations([UPDATE_CURRENT_PATHS, UPDATE_MENU_LIST]),
     toggoleSidebar() {
       this.isCollapse = !this.isCollapse;
     },
@@ -170,6 +171,7 @@ export default {
     const groupCode = this.group && this.group.groupCode;
     if (groupCode) {
       this.menuList = await this.getUserPrivileges(groupCode);
+      this.UPDATE_MENU_LIST(this.menuList);
       this.updatePath();
     }
   },

+ 42 - 23
src/modules/portal/views/tips/Tips.vue

@@ -3,25 +3,15 @@
     <div class=""><img src="./tips.jpg" /></div>
     <div class="text">
       <div v-for="(menu1, index) in instructions" :key="index" class="menu1">
-        <h4>{{ menu1.menu1Name }}</h4>
+        <h4 v-if="menu1.menu2.filter(m => m.canAccess).length > 0">
+          {{ menu1.menu1Name }}
+        </h4>
         <div v-for="(menu2, index) in menu1.menu2" :key="index" class="menu1">
-          <span class="link">{{ menu2.name }}</span> {{ menu2.detail }}
+          <span v-if="menu2.canAccess">
+            <span class="link">{{ menu2.name }}</span> {{ menu2.detail }}
+          </span>
         </div>
       </div>
-      <!-- <div class="menu1">
-        <h4>学习中心查询</h4>
-        <div>
-          <span class="link">机构管理——中心列表</span>
-          查询学校下属所有学习中心编码及名称,可按学习中心设置学习中心平台权限,即A学习中心只能查询A中心的相关考试数据。
-        </div>
-      </div>
-      <div>
-        <h4>课程查询</h4>
-        <div>
-          <span class="link">课程管理——课程列表</span>
-          查看所有课程名称及代码,如一门课程即有专科又有本科,课程对应在的教材、试卷不一样时,需要建立专科课程及本科课程。
-        </div>
-      </div> -->
     </div>
   </section>
 </template>
@@ -34,7 +24,7 @@ const ALL_INSTRUCTIONS = {
       menu2: [
         {
           name: "机构管理——中心列表",
-          // link: "/basic/campus",
+          link: "/basic/campus",
           detail:
             "查询学校下属所有学习中心编码及名称,可按学习中心设置学习中心平台权限,即A学习中心只能查询A中心的相关考试数据。"
         }
@@ -45,7 +35,7 @@ const ALL_INSTRUCTIONS = {
       menu2: [
         {
           name: "课程管理——课程列表",
-          // link: "/basic/campus",
+          link: "/basic/course",
           detail:
             "查看所有课程名称及代码,如一门课程即有专科又有本科,课程对应在的教材、试卷不一样时,需要建立专科课程及本科课程。"
         }
@@ -56,7 +46,7 @@ const ALL_INSTRUCTIONS = {
       menu2: [
         {
           name: "用户管理——普通用户管理",
-          // link: "/basic/campus",
+          link: "/basic/user",
           detail:
             "添加、查询、禁用管理平台用户,并可以针对不同用户设置不同的平台模块权限。"
         }
@@ -69,7 +59,7 @@ const ALL_INSTRUCTIONS = {
       menu2: [
         {
           name: "考试管理——考试信息",
-          // link: "/basic/campus",
+          link: "/examwork/examInfo",
           detail: "安排一场在线考试,设置考试开启、结束时间。"
         }
       ]
@@ -154,9 +144,19 @@ const ALL_INSTRUCTIONS = {
       menu1Name: "考试完成进度查询",
       menu2: [
         {
-          name: "考试进度——考试概览/考试进度详情",
+          name: "考试进度——考试概览",
           // link: "/oe/campus",
-          detail: "可以查看按考试的人数、学习中心、课程数来查看考试完成的进度。"
+          detail: "可以查看按考试、学习中心、课程数来查看考试完成的进度。"
+        }
+      ]
+    },
+    {
+      menu1Name: "考试完成进度查询",
+      menu2: [
+        {
+          name: "考试进度——考试进度详情",
+          // link: "/oe/campus",
+          detail: "可以查看按考试的人数、学习中心、查看考生的完成情况。"
         }
       ]
     }
@@ -174,6 +174,9 @@ const ALL_INSTRUCTIONS = {
     }
   ]
 };
+
+import { mapState } from "vuex";
+
 export default {
   name: "Tips",
   data() {
@@ -181,10 +184,26 @@ export default {
       instructions: []
     };
   },
-  computed: {},
+  computed: { ...mapState({ menuList: state => state.menuList }) },
   methods: {},
   created() {
     this.instructions = ALL_INSTRUCTIONS[this.$route.path];
+  },
+  watch: {
+    menuList() {
+      const tipsLink = this.menuList.map(m => m.ext5);
+      this.instructions.map(menu => {
+        menu.menu2 = menu.menu2.map(m => {
+          if (tipsLink.includes(m.link)) {
+            m.canAccess = true;
+          } else {
+            m.canAccess = false;
+          }
+          return m;
+        });
+        return menu;
+      });
+    }
   }
 };
 </script>

+ 3 - 1
src/store.js

@@ -2,6 +2,7 @@ import Vue from "vue";
 import Vuex from "vuex";
 import user from "./modules/portal/store/user";
 import currentPaths from "./modules/portal/store/currentPaths";
+import menuList from "./modules/portal/store/menuList";
 
 Vue.use(Vuex);
 
@@ -11,6 +12,7 @@ export default new Vuex.Store({
   actions: {},
   modules: {
     user,
-    currentPaths
+    currentPaths,
+    menuList
   }
 });