From c4d0466cec9c334d9f0e74fe44576364a019aed3 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期二, 16 七月 2024 09:20:46 +0800
Subject: [PATCH] 教师端隐藏管理员列表和教师列表

---
 src/store/modules/router.js |   27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/store/modules/router.js b/src/store/modules/router.js
index 747a715..6391a38 100644
--- a/src/store/modules/router.js
+++ b/src/store/modules/router.js
@@ -1,4 +1,5 @@
 import { constantRoutes } from '@/router'
+import Cookies from 'js-cookie'
 
 let state = {
   routes: constantRoutes
@@ -7,11 +8,33 @@
 const mutations = {
   initRoutes: (state) => {
     state.routes = constantRoutes
+    var adminUserInfoString = Cookies.get('adminUserInfo');
+    if (adminUserInfoString && JSON.parse(adminUserInfoString).role !== 3) {
+      state.routes.forEach(item => {
+        if (item.name === 'UserPage') {
+          item.children.forEach(child => {
+            if (child.name === 'UserTeacherPageList' || child.name === 'UserAdminPageList') {
+              child.hidden = true
+            }
+          })
+        }
+      })
+    }
+    if (adminUserInfoString && JSON.parse(adminUserInfoString).role === 3) {
+      state.routes.forEach(item => {
+        if (item.name === 'UserPage') {
+          item.children.forEach(child => {
+            if (child.name === 'UserTeacherPageList' || child.name === 'UserAdminPageList') {
+              child.hidden = false
+            }
+          })
+        }
+      })
+    }
   }
 }
 
-const actions = {
-}
+const actions = {}
 
 export default {
   namespaced: true,

--
Gitblit v1.8.0