dedsudiyu 1 месяц назад
Родитель
Сommit
2236c209e6
2 измененных файлов с 42 добавлено и 43 удалено
  1. 1 1
      src/components/newSubVideoComponent.vue
  2. 41 42
      src/views/login.vue

+ 1 - 1
src/components/newSubVideoComponent.vue

@@ -49,7 +49,7 @@
         queryParams: {
           page: 1,
           pageSize: 2,
-          deptId: localStorage.getItem('deptId')
+          deptId: localStorage.getItem('deptId')=='1'?'':localStorage.getItem('deptId'),
         },
         total: 0,//总数
         videoList: [],

+ 41 - 42
src/views/login.vue

@@ -100,6 +100,7 @@
         timer: null,
         codeButtonType: true,
         showType: false,
+        deptList:[],
       };
     },
     watch: {
@@ -112,23 +113,15 @@
     },
     created() {
       let self = this;
-      if (getToken()) {
-        this.$set(this, 'showType', false);
-        Promise.all([
-          this.getExploitConfig(),
-          this.authGetAllToken(),
-          this.getInfo(),
-          this.fullScreen(),
-        ]).then((result) => {
-          setTimeout(function () {
-            self.$router.push({path: '/home'});
-          }, 300);
-        }).catch((error) => {
-        })
-      } else {
-        this.$set(this, 'showType', true);
-        this.getCode();
-      }
+      // if (getToken()) {
+      //   this.$set(this, 'showType', false);
+      //   this.getExploitConfig();
+      // } else {
+      //   this.$set(this, 'showType', true);
+      //   this.getCode();
+      // }
+      this.$set(this, 'showType', true);
+      this.getCode();
     },
     mounted() {
       this.configInfo();
@@ -155,7 +148,7 @@
         });
       },
       //获取开发配置
-      getExploitConfig() {
+      getExploitConfig(token) {
         getConfigByType({category: 2, configType: 5}).then(response => {
           let obj = JSON.parse(response.data.configValue);
           //判定http或者https
@@ -184,6 +177,7 @@
             localStorage.setItem('fileBrowseEnvironment', urlText + Decrypt(obj.fileBrowseEnvironment))
             localStorage.setItem('fileBrowseEnvironmentExtranet', urlText + Decrypt(obj.fileBrowseEnvironmentExtranet))
           }
+          this.authGetAllToken(token);
         });
       },
       getCode() {
@@ -195,30 +189,45 @@
           }
         });
       },
-      authGetAllToken() {
+      authGetAllToken(token) {
         authGetAllToken().then(res => {
           let list = [];
           for(let i=0;i<res.data.length;i++){
             if(i<4){
               list.push(res.data[i]);
             }
-            if(res.data[i].level == 1){
-              setToken(res.data[i].token);
-              if(res.data[i].level == 1){
-                localStorage.setItem('deptId','');
-              }else{
-                localStorage.setItem('deptId',res.data[i].deptId);
-              }
-            }
+            // if(res.data[i].level == 1){
+            //   setToken(res.data[i].token);
+            //   if(res.data[i].level == 1){
+            //     localStorage.setItem('deptId','');
+            //   }else{
+            //     localStorage.setItem('deptId',res.data[i].deptId);
+            //   }
+            // }
           }
-          localStorage.setItem('deptList', JSON.stringify(list));
           localStorage.setItem('setCheckIndex', 0);
+          this.getInfo(list,token);
         });
       },
-      getInfo() {
+      getInfo(list,token) {
+        let self = this;
         getInfo().then(res => {
+          let newList = [
+            {
+              deptId: res.data.userInfo.deptId,
+              name: '数据汇总',
+              level: 1,
+              token: token
+            }
+          ];
+          newList = newList.concat(list);
+          localStorage.setItem('deptList', JSON.stringify(newList));
           localStorage.setItem('deptName', res.data.userInfo.deptName)
           localStorage.setItem('deptId', res.data.userInfo.deptId)
+          this.fullScreen()
+          setTimeout(function () {
+            self.$router.push({path: '/home'});
+          }, 300);
         });
       },
       handleLogin() {
@@ -265,8 +274,8 @@
         const userType = userInfo.userType
         login(account, password, code, uuid, userType).then(res => {
           if (res.code == 200) {
-            if (res.data.userType == 0 || res.data.userType == 1 || res.data.userType == 2) {
-              this.text = "* 非级大屏账号,无权登录本系统.";
+            if (res.data.userType == 0 || res.data.userType == 1 || res.data.userType == 2 || res.data.userType == 3) {
+              this.text = "* 非级大屏账号,无权登录本系统.";
               this.loading = false;
               this.getCode();
             } else {
@@ -276,17 +285,7 @@
               //身份字段规则转义 原定11老师 22学生  新版本后0系统1老师2学生,这里身份字段转义为旧版本规则
               localStorage.setItem('userType', res.data.userType)
               //等待配置与字段获取到后跳转
-              Promise.all([
-                this.getExploitConfig(),
-                this.authGetAllToken(),
-                this.getInfo(),
-                this.fullScreen(),
-              ]).then((result) => {
-                setTimeout(function () {
-                  self.$router.push({path: '/home'});
-                }, 300);
-              }).catch((error) => {
-              })
+              this.getExploitConfig(res.data.token);
             }
           } else {
             if (res.code == 5007) {