|
|
@@ -73,14 +73,35 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
- this.setData({
|
|
|
- publisherId: options.id,
|
|
|
- questions: [{
|
|
|
- title: "我是标题",
|
|
|
- question: "我是问题?",
|
|
|
- answer: "我是回答"
|
|
|
- }]
|
|
|
+ wx.showNavigationBarLoading()
|
|
|
+ wx.cloud.callFunction({
|
|
|
+ name: 'listQuestions',
|
|
|
+ data: {
|
|
|
+ page_token: 0,
|
|
|
+ page_size: 20
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ wx.hideNavigationBarLoading()
|
|
|
+ if (res.result.status !== 'OK') {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.result.errMsg,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ questions: res.result.list
|
|
|
+ })
|
|
|
})
|
|
|
+
|
|
|
+ // this.setData({
|
|
|
+ // publisherId: options.id,
|
|
|
+ // questions: [{
|
|
|
+ // title: "我是标题",
|
|
|
+ // question: "我是问题?",
|
|
|
+ // answer: "我是回答"
|
|
|
+ // }]
|
|
|
+ // })
|
|
|
// const db = wx.cloud.database()
|
|
|
// db.collection("qaData").where({
|
|
|
// publisherId: this.data.publisherId,
|