Selaa lähdekoodia

Merge branch 'main' into hotfix/v1.0.34.4

lianbingjie 1 vuosi sitten
vanhempi
commit
20537206fc

+ 17 - 7
apps/bigmember_pc/src/components/article-item/ArticleItem.vue

@@ -32,7 +32,11 @@
         </div>
       </div>
     </div>
-    <div v-if="config.push && article.detail" class="a-i-detail ellipsis" v-html="calcDetail"></div>
+    <div
+      v-if="config.push && article.detail && calcDetail"
+      class="a-i-detail ellipsis"
+      v-html="calcDetail"
+    ></div>
     <div class="a-i-right">
       <div class="tags">
         <span
@@ -336,14 +340,20 @@ export default {
         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>']
+      const extractDetail = extractKeywords(
+        this.article.detail,
+        this.article.matchKeys
       )
+      if (extractDetail) {
+        return replaceKeyword(extractDetail, this.article.matchKeys, [
+          '<span class="highlight-text">',
+          '</span>'
+        ])
+      } else {
+        return ''
+      }
     },
     // 处理关键词在附件中
     calcFileText() {

+ 2 - 2
apps/bigmember_pc/src/utils/globalFunctions.js

@@ -781,10 +781,10 @@ export function getAssetsFile(url) {
  */
 export function  extractKeywords(text, keywords, n = 10) {
   if (!text) return
-  if (!keywords || !keywords.length) return text
+  if (!keywords || !keywords.length) return ''
   const value = Array.isArray(keywords) ? keywords[0] : keywords
   const regex = new RegExp("(.{0," + n + "}" + value + ".*)")
   const result = text.match(regex)
   // 输出结果
-  return result && result[1] ? result[1] : text
+  return result && result[1] ? result[1] : ''
 }

+ 9 - 4
apps/mobile/src/ui/project-cell/index.vue

@@ -72,7 +72,7 @@
     </div>
     <div
       class="detail"
-      v-if="detail"
+      v-if="detail && getDetail"
       :class="{ 'van-ellipsis': ellipsis }"
       v-html="getDetail"
     ></div>
@@ -299,7 +299,12 @@ export default {
       return replaceKeyword(this.title, this.keys)
     },
     getDetail() {
-      return replaceKeyword(this.setDetailText, this.keys)
+      // 有匹配词且匹配上才显示正文
+      if (this.setDetailText) {
+        return replaceKeyword(this.setDetailText, this.keys)
+      } else {
+        return ''
+      }
     },
     // 正文开头和高亮词之间,最多保留10个字符
     setDetailText() {
@@ -310,10 +315,10 @@ export default {
         if (postion - 10 > 0) {
           return detail.substring(postion - 10)
         } else {
-          return detail
+          return ''
         }
       } else {
-        return detail
+        return ''
       }
     },
     getTime() {

+ 2 - 2
apps/mobile/src/views/search/result/bidding/index.vue

@@ -1911,8 +1911,8 @@ export default {
       //           --> 选择区域-关键词列表
       //    --> 新用户-未选择区域-订阅页面
       //           --> 选择区域-关键词列表
-      const { inWX } = this.$envs
-      const superUser = inWX ? this.isSuper : this.isSuper || this.isMember
+      // const { inWX } = this.$envs
+      const superUser = this.isSuper || this.isMember
       if (superUser) {
         const params = {
           pageType: 'keyWords',