Bladeren bron

修复无法切换站点bug

xiaohaizhao 1 jaar geleden
bovenliggende
commit
33f0c072ba

+ 8 - 2
src/components/newLayout/modules/header.vue

@@ -39,7 +39,7 @@
       </el-dropdown-menu>
     </el-dropdown>-->
       <!--    <el-divider direction="vertical"></el-divider>-->
-<!--      <el-button size="mint" type="primary"  style="background-color:rgb(52 106 145);margin-right: 20px;color: #FFFFFF" v-if="usertype == 1 || usertype == 0" @click="$router.push('/serviceDataScreen')">{{$t(`业务数据大屏`)}}</el-button>-->
+      <!--      <el-button size="mint" type="primary"  style="background-color:rgb(52 106 145);margin-right: 20px;color: #FFFFFF" v-if="usertype == 1 || usertype == 0" @click="$router.push('/serviceDataScreen')">{{$t(`业务数据大屏`)}}</el-button>-->
       <svg
         t="1725853431060"
         class="icon"
@@ -139,7 +139,7 @@ export default {
       langusge: [],
       nowType: "ZH",
       languagename: "",
-      usertype : JSON.parse(sessionStorage.getItem('active_account')).usertype
+      usertype: JSON.parse(sessionStorage.getItem("active_account")).usertype,
     };
   },
   props: ["onRender"],
@@ -161,6 +161,12 @@ export default {
         sessionStorage.removeItem(key);
       });
       sessionStorage.setItem("active_account", JSON.stringify(item));
+      await this.basicData.query_userauth(() => {
+        setTimeout(() => {
+          console.log("33333");
+          this.$router.go(0);
+        }, 1000);
+      });
       this.siteInfos();
       this.accountInfo = JSON.parse(sessionStorage.getItem("active_account"));
       this.accountList = JSON.parse(

+ 16 - 8
src/components/newLayout/modules/menu.vue

@@ -72,14 +72,22 @@ export default {
       sessionStorage.setItem("active_modules", JSON.stringify(mod));
     },
     setDefaultData(mod) {
-      let active_modules = JSON.parse(sessionStorage.getItem("active_modules"));
-      let sys_modules = JSON.parse(sessionStorage.getItem("module_info"));
-      let arr = sys_modules.filter((e) => {
-        if (e.systemid === active_modules.systemid) {
-          return e;
-        }
-      });
-      this.$store.dispatch("getModules", { mod: arr[0].modules });
+      try {
+        let active_modules = JSON.parse(
+          sessionStorage.getItem("active_modules")
+        );
+        let sys_modules = JSON.parse(sessionStorage.getItem("module_info"));
+        let arr = sys_modules.filter((e) => {
+          if (e.systemid === active_modules.systemid) {
+            return e;
+          }
+        });
+        this.$store.dispatch("getModules", { mod: arr[0].modules });
+      } catch (error) {
+        setTimeout(() => {
+          this.setDefaultData();
+        }, 100);
+      }
     },
     handleSelect(key, keyPath) {
       this.activeIndex = key;

+ 3 - 0
src/views/login/login.vue

@@ -360,6 +360,9 @@ export default {
         this.$i18n.locale = type;
         // location.reload();
       });
+      this.languagename =
+        this.langusge.find((v) => v.languagecode == this.nowType)
+          .languagename || "简体中文";
     },
   },
 };

+ 1 - 0
src/views/message/index.vue

@@ -288,6 +288,7 @@ export default {
     },
 
     isCategory(data) {
+      console.log("sessionStorage.getItem('module_info')",sessionStorage.getItem('module_info'))
       JSON.parse(sessionStorage.getItem('module_info')).forEach(item1 => {
         item1.modules.forEach(item2 => {
           item2.apps.forEach(item3 => {