Эх сурвалжийг харах

feat:PC订阅推送列表增加正文、附件提示等

yangfeng 1 жил өмнө
parent
commit
4072f9c560

+ 73 - 8
apps/bigmember_pc/src/components/article-item/ArticleItem.vue

@@ -1,9 +1,9 @@
 <template>
   <div
     class="article-item"
-    :class="{ 'style-for-gray': config.gray, 'style-for-table': config.table }"
+    :class="{ 'style-for-gray': config.gray, 'style-for-table': config.table, 'style-for-push': config.push }"
   >
-    <div class="flex-center">
+    <div :class="{'flex-center': !config.push}">
       <input
         v-if="config.collect"
         @change="changeCheck($event)"
@@ -17,7 +17,8 @@
         <div class="content-item">
           <div
             v-html="calcTitle"
-            class="a-i-left ellipsis visited-hd"
+            class="a-i-left visited-hd"
+            :class="config.push ? 'ellipsis-3' : 'ellipsis'"
             @click="onClick"
           ></div>
         </div>
@@ -31,6 +32,7 @@
         </div>
       </div>
     </div>
+    <div v-if="config.push && article.detail" class="a-i-detail ellipsis" v-html="calcDetail"></div>
     <div class="a-i-right">
       <div class="tags">
         <span
@@ -237,7 +239,7 @@
 
 <script>
 import { Tag, Popover, Table, TableColumn } from 'element-ui'
-import { moneyUnit, dateFromNow, replaceKeyword } from '@/utils/'
+import { moneyUnit, dateFromNow, replaceKeyword, extractKeywords } from '@/utils/'
 import { mapGetters, mapState } from 'vuex'
 import { getPowerUrl } from '@/utils/power/redirect'
 export default {
@@ -271,7 +273,8 @@ export default {
         return {
           gray: false,
           table: false,
-          collect: false
+          collect: false,
+          push: false
         }
       }
     },
@@ -286,7 +289,9 @@ export default {
           budget: '', // 金额
           publishTime: 0, // 时间
           matchKeys: [], // 高亮的关键词
-          ca_fileExists: false
+          ca_fileExists: false,
+          detail: '', // 正文
+          filetext_search: false // 关键词在附件中
         }
       }
     },
@@ -325,8 +330,46 @@ export default {
         this.article.matchKeys,
         ['<span class="highlight-text">', '</span>']
       )
-      return `${this.index}. ${hightLightedTitle}`
+      if (this.article.filetext_search) {
+        return `${this.index}. ${hightLightedTitle}${this.calcFileText}`
+      } else {
+        return `${this.index}. ${hightLightedTitle}`
+      }
+    },
+    // 处理正文显示
+    calcDetail() {
+      const extractDetail = extractKeywords(this.article.detail, this.article.matchKeys)
+      return replaceKeyword(
+        extractDetail,
+        this.article.matchKeys,
+        ['<span class="highlight-text">', '</span>']
+      )
+    },
+    // 处理关键词在附件中
+    calcFileText() {
+      const inFile = this.article.filetext_search
+      const keywords = this.article.matchKeys
+      if (inFile) {
+        const keyword = keywords[0]
+        if (keywords.length > 3) {
+          return `(<span class="highlight-text">${keyword.substring(0,3)}</span>...在附件中)`
+        } else {
+          return `(<span class="highlight-text">${keyword}</span>在附件中)`
+        }
+      } else {
+        return ''
+      }
+    },
+    // 处理关键词在附件中
+    calcFiletext_search() {
+      const extractFiletext = extractKeywords(this.article.filetext_search, this.article.matchKeys,)
+      return replaceKeyword(
+        extractFiletext,
+        this.article.matchKeys,
+        ['<span class="highlight-text">', '</span>']
+      )
     },
+    // 处理关键词在附件中
     showDetailModel() {
       const isOldVip = this.isVipBefore
       const isMember = this.bigmember
@@ -550,7 +593,8 @@ $border-color: #ececec;
     line-height: 24px;
   }
   .a-i-left {
-    display: inline-block;
+    // display: inline-block;
+    font-size: 16px;
     margin-right: 60px;
     cursor: pointer;
     // max-width: 650px;
@@ -568,6 +612,13 @@ $border-color: #ececec;
   .a-i-right {
     padding: 8px 0 0 30px;
   }
+  .a-i-detail{
+    width: calc(100% - 84px);
+    padding: 6px 0 0 30px;
+    font-size: 14px;
+    line-height: 22px;
+    color: #686868;
+  }
   .time-container {
     flex-shrink: 0;
   }
@@ -617,6 +668,20 @@ $border-color: #ececec;
     line-height: 18px;
     flex-shrink: 0;
   }
+  &.style-for-push{
+    .custom-checkbox {
+      margin-top: 5px;
+    }
+    .a-i-left{
+      font-size: 15px;
+    }
+    .time-container{
+      align-items: unset;
+    }
+    .time-text{
+      line-height: 24px;
+    }
+  }
 }
 .right-actions {
   display: flex;

+ 9 - 5
apps/bigmember_pc/src/components/push-list/PushList.vue

@@ -390,7 +390,8 @@ export default {
         return {
           gray: false,
           table: false,
-          collect: false
+          collect: false,
+          push: false
         }
       }
     },
@@ -910,6 +911,9 @@ export default {
           if (!pushIdInfoIdRelationshipMap[item._id]) {
             pushIdInfoIdRelationshipMap[item._id] = item['ca_index']
           }
+          if (item.detail) {
+            item.detail = item.detail.replace(/<[^>]+>/g, '')
+          }
         })
       }
       if (query.pageNum === 1 && query.pageSize === 50) {
@@ -1518,8 +1522,8 @@ export default {
 }
 .info-list-card .custom-checkbox {
   float: left;
-  width: 14px;
-  height: 14px;
+  width: 16px;
+  height: 16px;
   border: 1px solid #e0e0e0;
   border-radius: 3px;
   background-color: #fff;
@@ -1528,8 +1532,8 @@ export default {
 }
 
 .custom-checkbox:checked {
-  width: 14px;
-  height: 14px;
+  width: 16px;
+  height: 16px;
   background: url(https://cdn-ali.jianyu360.com/images/biddingSearch/icon-checked.png)
     no-repeat center;
   background-size: contain;

+ 2 - 1
apps/bigmember_pc/src/views/SubPush.vue

@@ -543,7 +543,8 @@ export default {
       config: {
         gray: true,
         table: true,
-        collect: true
+        collect: true,
+        push: true
       },
       withFileList: [
         {