绚火健康
This commit is contained in:
50
pages/mall/article/article.js
Normal file
50
pages/mall/article/article.js
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
articleId : '', //文章id
|
||||
indexShow : '', //内容
|
||||
mallContent : '', //简介
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
articleId : options.id
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 获取详情数据
|
||||
this.indexInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 详情数据
|
||||
*/
|
||||
indexInfo () {
|
||||
wx.$api.mall.articlesSee(this.data.articleId).then(res => {
|
||||
console.log(res)
|
||||
this.setData({
|
||||
indexShow : res.data,
|
||||
favoritesSee : res.data.isFavorite,
|
||||
subscribesSee : res.data.isSubscribed,
|
||||
favoritesNumber : res.data.favorites,
|
||||
subscribesNumber: res.data.subscribes,
|
||||
mallContent : res.data.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
|
||||
})
|
||||
|
||||
}).catch(err => {})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user