|
@@ -2103,11 +2103,11 @@ title: '添加家庭成员',
|
|
|
self._checkSplashReady()
|
|
self._checkSplashReady()
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- // 热门商品:从后台取 3 个,后台按 sort_order 升序、createdAt 倒序返回。
|
|
|
|
|
|
|
+ // 热门商品:从后台取 3 个,按实际销量(sales_count)降序返回。
|
|
|
// 接口异常或无数据时保留兜底项,避免区块空白。
|
|
// 接口异常或无数据时保留兜底项,避免区块空白。
|
|
|
loadDiscoverProducts: function() {
|
|
loadDiscoverProducts: function() {
|
|
|
var self = this
|
|
var self = this
|
|
|
- productList({ page: 1, size: 3 }).then(function(res) {
|
|
|
|
|
|
|
+ productList({ page: 1, size: 3, sort: [{ column: 'salesCount', order: 'desc' }] }).then(function(res) {
|
|
|
if (res && res.code === 200 && res.data) {
|
|
if (res && res.code === 200 && res.data) {
|
|
|
var records = res.data.records || []
|
|
var records = res.data.records || []
|
|
|
if (records.length) {
|
|
if (records.length) {
|
|
@@ -2116,7 +2116,8 @@ title: '添加家庭成员',
|
|
|
id: item.id,
|
|
id: item.id,
|
|
|
name: item.name || '',
|
|
name: item.name || '',
|
|
|
coverImage: item.coverImage || item.image || '',
|
|
coverImage: item.coverImage || item.image || '',
|
|
|
- desc: item.description || item.summary || '',
|
|
|
|
|
|
|
+ // 商品简介:优先 intro(详细介绍/简介),回退 description;统一剥离 HTML 标签与实体,避免展示源码
|
|
|
|
|
+ desc: self.plainText(item.intro || item.description || ''),
|
|
|
price: (item.price != null && Number(item.price) > 0) ? (Number(item.price) / 100) : null
|
|
price: (item.price != null && Number(item.price) > 0) ? (Number(item.price) / 100) : null
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -2124,6 +2125,21 @@ title: '添加家庭成员',
|
|
|
}
|
|
}
|
|
|
}).catch(function() {})
|
|
}).catch(function() {})
|
|
|
},
|
|
},
|
|
|
|
|
+ // 富文本(HTML)→ 纯文本:去 style/script 标签与 HTML 标签、解码常见实体、压缩空白
|
|
|
|
|
+ plainText: function(html) {
|
|
|
|
|
+ if (!html) return ''
|
|
|
|
|
+ return String(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()
|
|
|
|
|
+ },
|
|
|
loadFeaturedArticles: function() {
|
|
loadFeaturedArticles: function() {
|
|
|
var self = this
|
|
var self = this
|
|
|
this.articlesLoading = true
|
|
this.articlesLoading = true
|