// pages/myFaq/myFaq.js import Notify from '../../dist/notify/notify'; import Dialog from '../../dist/dialog/dialog'; var app = getApp(); Page({ /** * 页面的初始数据 */ data: { faqList:[] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getMyFaqList(); }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, //获取我的在线答疑列表 getMyFaqList() { var that = this; var config = wx.getStorageSync('config'); //获取用户消息列表 wx.request({ url: app.url + 'ajax_get_my_faq_list.php', header: { 'content-type': 'application/json' }, data: { unionId: config.unionId, }, method: 'GET', dataType: 'json', success: function (res) { console.log(res.data) if (res.statusCode == 200) { that.setData({ faqList: res.data.result.faqList }) } }, fail: function (res) { }, complete: function (res) { }, }) }, //咨询删除 delFaq(e) { var that = this; let faqId = e.currentTarget.dataset['index'] //对话框确认 Dialog.confirm({ message: '确定删除吗?' }).then(() => { var config = wx.getStorageSync('config'); //删除操作 wx.request({ url: app.url + 'ajax_delete_my_faq.php', data: { unionId: config.unionId, faqId: faqId }, header: { 'content-type': 'application/json' }, method: 'GET', dataType: 'json', success: function (res) { console.log(res) if (res.statusCode == 200) { Notify(res.data.result.message) that.getMyFaqList() } }, fail: function (res) { }, complete: function (res) { }, }) }); wx.navigateTo({ url: '../myFaqDel/myFaqDel?faqId=' + faqId, }) }, //咨询详细页面 faqDetail(e){ let faqId = e.currentTarget.dataset['index'] wx.navigateTo({ url: '../faqDetail/faqDetail?faqId=' + faqId, }) }, //立即咨询 newFaq(e) { wx.navigateTo({ url: '../newFaq/newFaq', }) } })