Explorar o código

集成登录权限

natasha hai 8 meses
pai
achega
c2bb0ac3ad
Modificáronse 2 ficheiros con 48 adicións e 21 borrados
  1. 12 1
      src/components/common/Header.vue
  2. 36 20
      src/views/Personalcenter.vue

+ 12 - 1
src/components/common/Header.vue

@@ -90,6 +90,7 @@ import { getToken, setToken, removeToken, getConfig } from "@/utils/auth";
 import { getContent, getStaticContent, getLearnWebContent } from "@/api/ajax";
 import { getContent, getStaticContent, getLearnWebContent } from "@/api/ajax";
 import { setI18nLang } from "@/utils/i18n";
 import { setI18nLang } from "@/utils/i18n";
 import { saveSession, getSession, removeSession } from "@/utils/role";
 import { saveSession, getSession, removeSession } from "@/utils/role";
+import Cookies from "js-cookie";
 
 
 export default {
 export default {
   name: "LayoutHeader",
   name: "LayoutHeader",
@@ -205,6 +206,7 @@ export default {
     QuitLogin() {
     QuitLogin() {
       removeToken();
       removeToken();
       sessionStorage.removeItem("useragent_root_close");
       sessionStorage.removeItem("useragent_root_close");
+      Cookies.remove("GCLSCode");
       this.userShow = false;
       this.userShow = false;
       this.userMessage = null;
       this.userMessage = null;
       window.location.href = "/";
       window.location.href = "/";
@@ -235,7 +237,16 @@ export default {
       getContent(MethodName, {})
       getContent(MethodName, {})
         .then((res) => {
         .then((res) => {
           if (res.child_sys_list && res.child_sys_list.length > 0) {
           if (res.child_sys_list && res.child_sys_list.length > 0) {
-            _this.projectList = res.child_sys_list;
+            if (Cookies.get("GCLSCode")) {
+              _this.projectList = [];
+              res.child_sys_list.forEach((item) => {
+                if (item.key === "GCLS-LC" || item.key === "GCLS-Personal") {
+                  _this.projectList.push(item);
+                }
+              });
+            } else {
+              _this.projectList = res.child_sys_list;
+            }
             _this.projectList.forEach((item, index) => {
             _this.projectList.forEach((item, index) => {
               if (item.key == "GCLS-Personal") {
               if (item.key == "GCLS-Personal") {
                 _this.LoginNavIndex = index;
                 _this.LoginNavIndex = index;

+ 36 - 20
src/views/Personalcenter.vue

@@ -111,6 +111,7 @@ import myUpload from "@/components/vue-image-crop-upload/upload-2.vue";
 import { getContent, getLearnWebContent } from "@/api/ajax";
 import { getContent, getLearnWebContent } from "@/api/ajax";
 
 
 import { updateWordPack } from "@/utils/i18n";
 import { updateWordPack } from "@/utils/i18n";
+import Cookies from "js-cookie";
 
 
 export default {
 export default {
   name: "Personalcenter",
   name: "Personalcenter",
@@ -133,7 +134,7 @@ export default {
       isData: false,
       isData: false,
       userInfor: null,
       userInfor: null,
       userMessage: null, //登录信息
       userMessage: null, //登录信息
-      SeleNavId: 0,
+      SeleNavId: Cookies.get("GCLSCode") ? 7 : 0,
       navList: [],
       navList: [],
       teachList: [
       teachList: [
         //普通老师
         //普通老师
@@ -579,7 +580,7 @@ export default {
           "Key751",
           "Key751",
           "Key752",
           "Key752",
           "Key784",
           "Key784",
-          "Key802"
+          "Key802",
         ],
         ],
       });
       });
       this.isData = true;
       this.isData = true;
@@ -685,26 +686,37 @@ export default {
           selectSrc: "nav8-1",
           selectSrc: "nav8-1",
         },
         },
       ];
       ];
-      let MethodName = "org_manager-GetMyOrgList";
-      let data = {
-        audited_status: 1, //已审核通过的机构列表
-      };
-      getContent(MethodName, data).then((res) => {
-        let myOrgList = res.org_list;
-        if (myOrgList.length > 0) {
-          if (user.user_type == "TEACHER") {
-            if (user.popedom_code_list.indexOf(2000001) > -1) {
-              this.navList = this.teachList;
+      if (Cookies.get("GCLSCode")) {
+        this.navList = [
+          {
+            id: 7,
+            name: this.$t("Key67"), //"账户设置",
+            imgSrc: "nav8",
+            selectSrc: "nav8-1",
+          },
+        ];
+      } else {
+        let MethodName = "org_manager-GetMyOrgList";
+        let data = {
+          audited_status: 1, //已审核通过的机构列表
+        };
+        getContent(MethodName, data).then((res) => {
+          let myOrgList = res.org_list;
+          if (myOrgList.length > 0) {
+            if (user.user_type == "TEACHER") {
+              if (user.popedom_code_list.indexOf(2000001) > -1) {
+                this.navList = this.teachList;
+              } else {
+                this.navList = this.menuList;
+              }
             } else {
             } else {
-              this.navList = this.menuList;
+              this.navList = this.stuList;
             }
             }
           } else {
           } else {
-            this.navList = this.stuList;
+            this.navList = this.menuList;
           }
           }
-        } else {
-          this.navList = this.menuList;
-        }
-      });
+        });
+      }
     }
     }
   },
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   //生命周期 - 挂载完成(可以访问DOM元素)
@@ -753,7 +765,11 @@ export default {
             position: absolute;
             position: absolute;
             width: 100%;
             width: 100%;
             height: 100%;
             height: 100%;
-            background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.4) 100%);
+            background: linear-gradient(
+              180deg,
+              rgba(0, 0, 0, 0.1) 0%,
+              rgba(0, 0, 0, 0.4) 100%
+            );
             padding-top: 46px;
             padding-top: 46px;
           }
           }
           .photo {
           .photo {
@@ -830,4 +846,4 @@ export default {
     }
     }
   }
   }
 }
 }
-</style>
+</style>