// miniprogram/pages/publisherQuestion/publisherQuestion.js Page({ /** * 页面的初始数据 */ data: { questions: [], }, removeQuestion: function (e) { wx.showModal({ content: "确认删除?", confirmColor: "#009195", success: function (res) { if (res.confirm) { // const db = wx.cloud.database() // db.collection("qaData").doc(e.target.dataset.id).remove({ // success: function () { // this.onLoad({ // id: this.data.publisherId // }) // wx.showToast({ // title: "删除成功", // }) // }.bind(this) // }) } }.bind(this) }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { 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 }) }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })