|
@@ -68,7 +68,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<text class="article-title">{{ item.title }}</text>
|
|
<text class="article-title">{{ item.title }}</text>
|
|
|
- <text class="article-summary">{{ item.summary || item.content }}</text>
|
|
|
|
|
|
|
+ <text class="article-summary" v-if="item.summary">{{ item.summary }}</text>
|
|
|
<view class="article-footer">
|
|
<view class="article-footer">
|
|
|
<text class="article-author">{{ item.author || '浠艾福' }}</text>
|
|
<text class="article-author">{{ item.author || '浠艾福' }}</text>
|
|
|
<text class="article-read-count">阅读 {{ item.readCount || 0 }}</text>
|
|
<text class="article-read-count">阅读 {{ item.readCount || 0 }}</text>
|
|
@@ -190,6 +190,7 @@ export default {
|
|
|
async loadArticles() {
|
|
async loadArticles() {
|
|
|
if (this.loading) return
|
|
if (this.loading) return
|
|
|
this.loading = true
|
|
this.loading = true
|
|
|
|
|
+ var self = this
|
|
|
try {
|
|
try {
|
|
|
var params = { page: this.page, size: this.size }
|
|
var params = { page: this.page, size: this.size }
|
|
|
if (this.currentCategory) {
|
|
if (this.currentCategory) {
|
|
@@ -206,8 +207,7 @@ export default {
|
|
|
return {
|
|
return {
|
|
|
id: item.id,
|
|
id: item.id,
|
|
|
title: item.title || '',
|
|
title: item.title || '',
|
|
|
- summary: item.summary || '',
|
|
|
|
|
- content: item.content || '',
|
|
|
|
|
|
|
+ summary: self.stripHtml(item.summary || item.content),
|
|
|
coverImage: item.coverImage || '',
|
|
coverImage: item.coverImage || '',
|
|
|
author: item.author || '浠艾福',
|
|
author: item.author || '浠艾福',
|
|
|
categoryName: item.categoryName || item.category || '',
|
|
categoryName: item.categoryName || item.category || '',
|
|
@@ -243,6 +243,20 @@ export default {
|
|
|
goDetail(id) {
|
|
goDetail(id) {
|
|
|
uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
|
|
uni.navigateTo({ url: '/pages/article-center/article-detail?id=' + id })
|
|
|
},
|
|
},
|
|
|
|
|
+ stripHtml: function(html) {
|
|
|
|
|
+ if (!html) return ''
|
|
|
|
|
+ return html
|
|
|
|
|
+ .replace(/<style[\s\S]*?<\/style>/gi, ' ')
|
|
|
|
|
+ .replace(/<script[\s\S]*?<\/script>/gi, ' ')
|
|
|
|
|
+ .replace(/<[^>]+>/g, ' ')
|
|
|
|
|
+ .replace(/ /gi, ' ')
|
|
|
|
|
+ .replace(/</gi, '<')
|
|
|
|
|
+ .replace(/>/gi, '>')
|
|
|
|
|
+ .replace(/&/gi, '&')
|
|
|
|
|
+ .replace(/"/gi, '"')
|
|
|
|
|
+ .replace(/\s+/g, ' ')
|
|
|
|
|
+ .trim()
|
|
|
|
|
+ },
|
|
|
getImageUrl: function(path) {
|
|
getImageUrl: function(path) {
|
|
|
return config.API_BASE_URL + path
|
|
return config.API_BASE_URL + path
|
|
|
}
|
|
}
|