guanchunjie vor 3 Jahren
Ursprung
Commit
c741f2becd
2 geänderte Dateien mit 41 neuen und 179 gelöschten Zeilen
  1. 38 179
      src/components/inputModules/common/Header.vue
  2. 3 0
      src/views/login.vue

+ 38 - 179
src/components/inputModules/common/Header.vue

@@ -38,7 +38,7 @@
                 >
                   <img
                     style="position: relative; width: 24px"
-                    :src="require('../../../assets/login/' + item.img + '.png')"
+                    :src="item.icon_url_memu_default"
                     alt=""
                   />
                   <span style="margin-left: 16px">
@@ -114,11 +114,15 @@
 
 <script>
 import { mapGetters } from "vuex";
-import { getToken, removeToken } from "@/utils/auth";
+import { getToken, removeToken, getConfig } from "@/utils/auth";
 import Cookies from "js-cookie";
-import { getLearnWebContent, getStaticContent } from "@/api/ajax";
+import {
+  getLearnWebContent,
+  getStaticContent,
+  getContentFile,
+} from "@/api/ajax";
 //import { setI18nLang } from "@/utils/i18n";
-
+import { saveSession, getSession, removeSession } from "@/utils/role";
 export default {
   name: "LayoutHeader",
   props: [],
@@ -211,30 +215,8 @@ export default {
       }
 
       _this.projectName = this.projectList[command].name;
-      let id = this.projectList[command].id;
-
-      if (id == 0) {
-        // 教学管理系统
-        location.href = `/GCLS-Learn/#/EnterSys`;
-      } else if (id == 1) {
-        // 教材管理系统
-        location.href = `/GCLS-Book/#/EnterSys`;
-      } else if (id == 2) {
-        // 教培中心
-        location.href = `/GCLS-TRC/#/EnterSys`;
-      } else if (id == 3) {
-        // 教研中心
-        location.href = `/GCLS-TC/#/EnterSys`;
-      } else if (id == 4) {
-        // 考试中心
-        location.href = `/GCLS-Test/#/EnterSys`;
-      } else if (id == 5) {
-        // 学习中心
-        location.href = `/GCLS-LC/#/EnterSys`;
-      } else {
-        // 个人中心
-        location.href = `/GCLS-Personal/#/EnterSys`;
-      }
+      let relative_path = _this.projectList[command].relative_path;
+      location.href = relative_path;
     },
     gopresonal() {
       window.location.href = `/GCLS-Personal/#/EnterSys`;
@@ -245,6 +227,7 @@ export default {
     },
     QuitLogin() {
       removeToken();
+      removeSession("SysList");
       Cookies.remove("userMessage");
       Cookies.remove("session_id");
       Cookies.remove("user_code");
@@ -267,144 +250,24 @@ export default {
         }
       });
     },
-    handleProList(list) {
-      let projectList = [];
-      if (list.length == 0) {
-        let arr = [
-          {
-            id: 2,
-            name: "教培中心",
-            img: "project3",
-          },
-          {
-            id: 3,
-            name: "教研中心",
-            img: "project4",
-          },
-          {
-            id: 5,
-            name: "学习中心",
-            img: "project6",
-          },
-          {
-            id: 6,
-            name: "个人中心",
-            img: "project7",
-          },
-        ];
-        projectList = arr;
-      } else {
-        if (list.includes(2000001)) {
-          projectList = JSON.parse(JSON.stringify(this.teacherProList));
-          for (let i = 0; i < list.length; i++) {
-            let code = list[i];
-            if (code == 2000003) {
-              projectList.push({
-                id: 1,
-                name: "教材管理系统",
-                img: "project2",
-              });
-            }
-          }
-        } else {
-          for (let i = 0; i < list.length; i++) {
-            let code = list[i];
-            if (code == 2000002) {
-              projectList.push({
-                id: 0,
-                name: "教学管理系统",
-                img: "project1",
-              });
-            } else if (code == 2000003) {
-              projectList.push({
-                id: 1,
-                name: "教材管理系统",
-                img: "project2",
-              });
-            } else if (code == 2000004) {
-              projectList.push({
-                id: 2,
-                name: "教师培训中心",
-                img: "project3",
-              });
-            } else if (code == 2000005) {
-              projectList.push({
-                id: 4,
-                name: "考试中心",
-                img: "project5",
-              });
-            } else if (code == 2000006) {
-              projectList.push({
-                id: 3,
-                name: "教研中心",
-                img: "project4",
-              });
-            }
-          }
-          projectList.push({
-            id: 6,
-            name: "个人中心",
-            img: "project7",
-          });
-        }
-      }
-      // 排序
-      for (var i = 0; i < projectList.length - 1; i++) {
-        for (var j = 0; j < projectList.length - 1 - i; j++) {
-          // 相邻元素两两对比,元素交换,大的元素交换到后面
-          if (projectList[j].id > projectList[j + 1].id) {
-            var temp = projectList[j];
-            projectList[j] = projectList[j + 1];
-            projectList[j + 1] = temp;
-          }
-        }
-      }
-      return projectList;
-    },
-    handleProList2(list) {
-      let projectList = [];
-
-      if (list.includes(2000001)) {
-        projectList = this.teacherProList;
-      } else {
-        for (let i = 0; i < list.length; i++) {
-          let code = list[i];
-
-          if (code == 2000002) {
-            projectList.push({
-              id: 0,
-              name: "教学管理系统",
-              img: "project1",
-            });
-          } else if (code == 2000003) {
-            projectList.push({
-              id: 1,
-              name: "教材管理系统",
-              img: "project2",
-            });
-          } else if (code == 2000004) {
-            projectList.push({
-              id: 2,
-              name: "教师培训中心",
-              img: "project3",
-            });
-          } else if (code == 2000005) {
-            projectList.push({
-              id: 4,
-              name: "考试中心",
-              img: "project5",
-            });
-          } else if (code == 2000006) {
-            projectList.push({
-              id: 3,
-              name: "教研中心",
-              img: "project4",
+    getChildSysList() {
+      let _this = this;
+      let MethodName = "login_control-GetChildSysList_CanEnter_PC";
+      getContentFile(MethodName, {})
+        .then((res) => {
+          if (res.child_sys_list && res.child_sys_list.length > 0) {
+            _this.projectList = res.child_sys_list;
+            _this.projectList.forEach((item, index) => {
+              if (item.key == "GCLS-Book") {
+                _this.LoginNavIndex = index;
+              }
             });
+            saveSession("SysList", this.projectList);
           }
-        }
-      }
-      console.log(projectList);
-      return projectList;
+        })
+        .catch((err) => {
+          console.log(err);
+        });
     },
     //是否存在我未阅读的消息
     getNotReadMessage() {
@@ -421,6 +284,17 @@ export default {
     if (config) {
       _this.configInfor = JSON.parse(config);
     }
+    let SysList = getSession("SysList");
+    if (!SysList) {
+      _this.getChildSysList();
+    } else {
+      _this.projectList = SysList;
+      _this.projectList.forEach((item, index) => {
+        if (item.key == "GCLS-Book") {
+          _this.LoginNavIndex = index;
+        }
+      });
+    }
   },
   mounted() {
     let _this = this;
@@ -428,26 +302,11 @@ export default {
     if (user) {
       _this.userMessage = JSON.parse(user);
       let popedom_code_list = _this.userMessage.popedom_code_list;
-      let id = 0;
       if (popedom_code_list.indexOf(2000003) > -1) {
         _this.projectName = "教材管理系统";
-        id = 1;
       } else {
         _this.projectName = "学习中心";
-        id = 5;
-      }
-
-      if (_this.userMessage.user_type == "TEACHER") {
-        _this.projectList = _this.handleProList(popedom_code_list);
-      } else if (_this.userMessage.user_type == "STUDENT") {
-        _this.projectList = _this.stuProList;
       }
-      _this.projectList.forEach((item, index) => {
-        if (item.id == id) {
-          _this.LoginNavIndex = index;
-        }
-      });
-
       _this.getNotReadMessage();
       _this.headTimer = setInterval(() => {
         _this.getNotReadMessage();

+ 3 - 0
src/views/login.vue

@@ -87,6 +87,7 @@ import { getContent, getLogin } from "@/api/ajax";
 import { getObjArr, saveObjArr } from "@/utils/role";
 import Cookies from "js-cookie";
 import { setToken } from "@/utils/auth";
+import { removeSession } from "@/utils/role";
 import { getConfigInfor } from "@/utils/index";
 export default {
   name: "Login",
@@ -153,6 +154,7 @@ export default {
     },
     //登录
     handleLogin() {
+      removeSession("SysList");
       this.$refs.loginForm.validate((valid) => {
         if (valid) {
           this.loading = true;
@@ -181,6 +183,7 @@ export default {
     },
   },
   mounted() {
+    removeSession("SysList");
     this._getConfig();
   },
 };