forked from EastWorld/wechat-app-mall
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.js
49 lines (48 loc) · 1.05 KB
/
list.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const WXAPI = require('apifm-wxapi')
Page({
data: {
categoryId: undefined, // 分类id
},
onLoad (options) {
this.data.categoryId = options.categoryId
this.cmsCategoryDetail()
this.articles()
},
onShow: function () {
},
async cmsCategoryDetail() {
const res = await WXAPI.cmsCategoryDetail(this.data.categoryId)
if (res.code == 0) {
this.setData({
category: res.data
})
wx.setNavigationBarTitle({
title: res.data.info.name,
})
}
},
async articles() {
wx.showLoading({
title: '',
})
const res = await WXAPI.cmsArticles({
categoryId: this.data.categoryId
})
wx.hideLoading()
if (res.code == 0) {
this.setData({
cmsArticles: res.data
})
} else {
this.setData({
cmsArticles: null
})
}
},
onShareAppMessage: function() {
return {
title: this.data.category.info.name,
path: '/pages/cms/list?categoryId='+ this.data.categoryId +'&inviter_id=' + wx.getStorageSync('uid')
}
},
})