Browse Source

兼容默认模板列表格式

asd123a20 1 year ago
parent
commit
661ab34161
3 changed files with 4 additions and 4 deletions
  1. 3 2
      src/components/heads/nav/index.vue
  2. 1 1
      src/views/Home.vue
  3. 0 1
      src/views/list.vue

+ 3 - 2
src/components/heads/nav/index.vue

@@ -45,8 +45,9 @@ export default {
       // 获取最后一级菜单
       const last = await this.setactiveIndex(env);
       console.log(env, 'env');
+      console.log(last, 'last');
       // 赋值当前选选个
-      this.activeIndex = (last?.code == 'ztjy' && env.children) ? env.children[1].code : last?.code;
+      this.activeIndex = (env?.code.includes('ztjy')) ? env.code : last?.code;
       // 缓存写入当前一例菜单
       this.$setParentsetSession({ menus: this.menusalls, iscode: last });
       // 写入当前菜单编码
@@ -81,7 +82,7 @@ export default {
           this.$router.push(`/list/${this.activeIndex}?parentCode=${parentCode}`);
           return;
         }
-        const routeUrl = this.$router.resolve(`/templates/${env.template}/${this.activeIndex}`);
+        const routeUrl = this.activeIndex == 'ztjy' ? this.$router.resolve(`/templates/${env.template}/${this.activeIndex}`) : this.$router.resolve(`/templates/${env.template}/list/${this.activeIndex}`);
         window.open(routeUrl.href, '_blank');
       }
       // 类型为2(单页)进入单页页面

+ 1 - 1
src/views/Home.vue

@@ -24,7 +24,7 @@
     </el-carousel>
     <div class="listBox">
       <banner class="lists"></banner>
-      <threeList parentCode="02" class="listItem" :imgUrl="newsImgUrl" :data="news" :isImg="false" title="社科要闻" code="skxw"></threeList>
+      <threeList parentCode="02" class="listItem" :imgUrl="newsImgUrl" :data="news" :isImg="false" title="社科要闻" code="ztjy1"></threeList>
       <threeList parentCode="10" :imgUrl="threeImggg" :data="threeDatagg" :isImg="false" title="通知公告" code="101"></threeList>
     </div>
     <div class="listBox">

+ 0 - 1
src/views/list.vue

@@ -70,7 +70,6 @@ export default {
     if (topahes) {
       // 获取一例菜单
       this.menu = this.$setChildrenSession({ menus: this.menusall, iscode: this.parentCode });
-      if (this.menu.children) this.menu.children = this.menu.children.filter(e => e.code !== 'ztjy');
       // 控制左侧菜单当前选项
       this.$refs.letnav.setIndex();
       if (this.code == '033' || this.code == '0441' || this.code == '0442' || this.code == '0443') {