Browse Source

新增标题跳转

asd123a20 1 year ago
parent
commit
6943d5a57b

BIN
src/assets/ztjytop.jpg


+ 2 - 3
src/views/templates/ztjy/details.vue

@@ -2,7 +2,7 @@
   <div class="details">
     <img src="../../../assets/ztjytop.jpg" class="topimg" />
     <div class="listBox">
-      <div class="listtitle">{{ menu.name }}</div>
+      <div class="listtitle" v-if="menu.name">{{ menu.name }}</div>
       <div class="title">{{ contentsItem.title }}</div>
       <div class="timeBox">
         <div class="time">时间:{{ contentsItem.createAt | dates }}</div>
@@ -34,8 +34,7 @@ export default {
     // 所有菜单
     await this.menusQueryAll();
     // 获取一例菜单
-    this.menu = this.menusall.find(e => e.parentCode == this.$route.query.code);
-    console.log(this.menu, this.menu);
+    if(this.$route.query.code) this.menu = this.menusall.find(e => e.parentCode == this.$route.query.code);
   },
   async mounted() {
     this.id = this.$route.params.id;

+ 6 - 1
src/views/templates/ztjy/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="list">
     <img src="../../../assets/ztjytop.jpg" class="topimg">
-    <div class="title">习近平:在学习贯彻习近平新时代中国特色社会主义思想主题教育工作会议上的讲话</div>
+    <div class="title" @click="titleClick">习近平:在学习贯彻习近平新时代中国特色社会主义思想主题教育工作会议上的讲话</div>
     <div class="listBox" v-for="item in menu" :key="item.code">
       <div class="ListHedir">
         <div class="listtitle">{{ item.name }}</div>
@@ -52,6 +52,11 @@ export default {
       const res = await this.contentsList({ filter: { bind }, paging: { page: 0, size: 10 } });
       return res?.data;
     },
+    // 标题点击
+    titleClick() {
+      const routeUrl = this.$router.resolve(`/templates/ztjy/details/649cd0ae43f8327dc3544357`);
+      window.open(routeUrl.href, '_blank');
+    },
     // 列表点击
     detailsClick(e) {
       const routeUrl = this.$router.resolve(`/templates/ztjy/details/${e._id}?code=${this.code}`);