This commit is contained in:
zoujiandong
2025-07-22 17:15:07 +08:00
parent e40f72db16
commit c44d30294c
14 changed files with 104 additions and 64 deletions
+14 -6
View File
@@ -26,9 +26,9 @@
</view>
</view>
<view class="list">
<view class="cell" v-for="item in most_read_articles" :key="item.exchange_id" @click="goDetail(item.exchange_id)">
<view class="cell" v-for="item in most_read_articles.slice(0,3)" :key="item.exchange_id" @click="goDetail(item.exchange_id)">
<view class="circle"></view>
<view class="title ellipsis-two-lines">{{ item.exchange_title }}</view>
<view class="title ellipsis-one-lines">{{ item.exchange_title }}</view>
</view>
</view>
</view>
@@ -62,7 +62,7 @@
>{{ item.user_name }}{{ item.hospital_name }}</view
>
</view>
<view class="content" @click="goDetail(item.exchange_id)"> {{ item.exchange_content }} </view>
<view class="content" @click="goDetail(item.exchange_id)"> {{ htmlToText(item.exchange_content) }} </view>
<view
class="imgbox"
@click="goDetail(item.exchange_id)"
@@ -86,9 +86,10 @@
</up--image>
</view>
</view>
<view class="videocon">
<view class="videocon" @click="goDetail(item.exchange_id)">
<view
class="imgbox"
@click="goDetail(item.exchange_id)"
v-if="
item.exchange_content_video &&
item.exchange_content_video.length > 0
@@ -119,7 +120,7 @@
<up-icon name="eye" color="#4B5563" size="28rpx"></up-icon>
<view class="num">{{ item.read_num }}</view>
</view>
<view class="collect item">
<view class="collect item" v-if="item.collect_num>0">
<up-icon
name="heart"
color="#4B5563"
@@ -127,7 +128,7 @@
></up-icon>
<view class="num">{{ item.collect_num }}</view>
</view>
<view class="chat item">
<view class="chat item" v-if="item.comment_num>0">
<up-icon name="chat" color="#4B5563" size="28rpx"></up-icon>
<view class="num">{{ item.comment_num }}</view>
</view>
@@ -216,6 +217,13 @@ const goDetail = (id) => {
});
};
const htmlToText=(html)=>{
return html
.replace(/<[^>]*>/g, '') // 移除所有HTML标签
.replace(/&nbsp;/gi, ' ') // 将HTML实体转换为字符
.replace(/<br\s*\/?>/gi, '\n').replace(/<img\s[^>]*>/gi, '') // 移除<img>标签及其内容
.replace(/<video[^>]*>[\s\S]*?/gi, ''); // 将换行符替换为实际的换行符
}
const goodList=()=>{
api.searchExchageGood({
is_selected:1,