浏览代码

站点切换

qymljy 8 月之前
父节点
当前提交
9fe5bf3237
共有 4 个文件被更改,包括 21 次插入18 次删除
  1. 16 15
      src/App.vue
  2. 1 1
      src/components/newLayout/modules/aside.vue
  3. 3 1
      src/components/newLayout/modules/header.vue
  4. 1 1
      src/store/index.js

+ 16 - 15
src/App.vue

@@ -26,22 +26,23 @@ export default {
   watch: {
     $route(val) {
       this.system = JSON.parse(sessionStorage.getItem("module_info"));
-      this.system
-        ? this.system.forEach((sys) => {
-            sys.modules.forEach((md) => {
-              md.apps.forEach((app) => {
-                if (val.name == app.name) {
-                  sessionStorage.setItem("active_modules", JSON.stringify(md));
-                  this.$store.dispatch("setActiveApp", {
-                    app: app,
-                    val: this.searchValue,
-                  });
-                  this.$store.dispatch("setSSystemModules", sys.modules);
-                }
-              });
+      if (this.system) {
+        // 假设 this.system 是一个数组,每个元素有 modules 属性,每个 module 有 apps 属性
+        this.system.forEach(sys => {
+          const md = sys.modules.find(module =>
+              module.apps.some(app => app.name === val.name)
+          );
+
+          if (md) {
+            sessionStorage.setItem("active_modules", JSON.stringify(md));
+            this.$store.dispatch("setActiveApp", {
+              app: md.apps.find(app => app.name === val.name),
+              val: this.searchValue,
             });
-          })
-        : "";
+            this.$store.dispatch("setSSystemModules", sys.modules);
+          }
+        });
+      }
     },
   },
 };

+ 1 - 1
src/components/newLayout/modules/aside.vue

@@ -30,7 +30,7 @@
       </div>
       <div>
         <el-divider class="divider"></el-divider>
-        <el-menu-item index="99" style="font-size:12px;margin-top:20px"  @click="handelMenuClick(item,'system')" @mouseenter.native="debounce(selectStyle,100)()" @mouseleave.native="outStyle">
+        <el-menu-item index="99" style="font-size:12px;margin-top:20px"  @click="handelMenuClick(item,'system')" @mouseenter.native="debounce(selectStyle,100)()" @mouseleave.native="outStyle" >
           <i v-if="collapse" class="el-icon-aim"  style="font-size:12px;color:#fff"></i>
           <span slot="title"><b>{{$t('网站地图')}}</b></span>
         </el-menu-item>

+ 3 - 1
src/components/newLayout/modules/header.vue

@@ -174,7 +174,7 @@ export default {
       ).filter((e) => {
         return e.siteid !== this.accountInfo.siteid;
       });
-      
+
     },
     async getWeather() {
       const res = await axios.get(this.url);
@@ -219,6 +219,7 @@ export default {
     },
     //跳转到应用,并设设置激活模块
     handelMenuAppClick(app, type) {
+
       let system = JSON.parse(sessionStorage.getItem("module_info"));
 
       let mod = system
@@ -292,6 +293,7 @@ export default {
       this.languagename = this.langusge.filter(
         (e) => e.languagecode == this.nowType
       )[0].languagename;
+      console.log(this.languagename,'语言名称')
     },
   },
 

+ 1 - 1
src/store/index.js

@@ -89,7 +89,7 @@ export default new Vuex.Store({
     },
 
     setActiveApp (state,data) {
-      console.log(state,data,'-')
+      console.log(state,data,'-*******')
       //头部区域搜索所传入的数值
       state.searchValue = data.val