// packageE/video_question/video_question.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { category: [], threshold: 4, message: false, active: 0, page: 1, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, goRecord(e){ wx.navigateTo({ url: '/packageE/video_question/videoRecord/videoRecord', }); }, tapSwiper(e) { console.log(e); let url = e.currentTarget.dataset.url; try { wx.navigateTo({ url: url, }); } catch (error) { console.log(error); } }, goAnswer() { if (this.data.info.application_audit_status == 2) { wx.navigateTo({ url: "/packageE/video_question/answer/answer", }); } else { wx.navigateTo({ url: "/packageE/video_question/apply/apply", }); } }, onClickLeft() { wx.navigateBack({ delta: 1, }); }, timeOr(e) { var that = this; console.log("...sasdasdasd scroll触底触发"); if (this.data.current_page >= this.data.last_page) { return; } else { let pages = that.data.page + 1; that.setData({ page: pages, }); let urlStr = app.getNetAddresss("plugin.agent-qa.api.message.get-list"); app._postNetWork({ url: urlStr, data: { page: that.data.page, }, success: (resdata) => { var res = resdata.data; if (res.result == 1) { console.log(res); that.setData({ current_page: res.data.current_page, last_page: res.data.last_page, messageList: that.data.messageList.concat(res.data.data), }); } else { wx.showToast({ title: res.msg, icon: "none", }); } }, fail: (res) => { wx.showToast({ title: res.msg, icon: "none", }); }, }); } }, onClickRight() { var that = this; let urlStr = app.getNetAddresss("plugin.agent-qa.api.message.get-list"); app._postNetWork({ url: urlStr, success: (resdata) => { var res = resdata.data; if (res.result == 1) { console.log(res); that.setData({ message: true, current_page: res.data.current_page, last_page: res.data.last_page, messageList: res.data.data, }); } else { wx.showToast({ title: res.msg, icon: "none", }); } }, fail: (res) => { wx.showToast({ title: res.msg, icon: "none", }); }, }); }, onClose() { this.setData({ message: false, }); }, chunk(arr, n) { var result = []; for (var i = 0, len = arr.length; i < len; i += n) { result.push(arr.slice(i, i + n)); } return result; }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () {}, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getData(); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () {}, /** * 生命周期函数--监听页面卸载 */ onUnload: function () {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () {}, /** * 用户点击右上角分享 */ onShareAppMessage: function () {}, getData() { var that = this; let urlStr = app.getNetAddresss("plugin.agent-qa.api.index.index"); app._postNetWork({ url: urlStr, success: (resdata) => { var res = resdata.data; if (res.result == 1) { console.log(res); that.setData({ info: res.data, category: res.data.button_list, unread_message_count: res.data.unread_message_count, }); let category_10 = that.chunk(that.data.category, 10); that.setData({ category_10: category_10, }); wx.setNavigationBarTitle({ title: res.data.name, }); } else { wx.showToast({ title: res.msg, icon: "none", }); } }, fail: (res) => { wx.showToast({ title: res.msg, icon: "none", }); }, }); }, onClick(e) { let index = e.detail.index; let title = e.detail.title; console.log(index, title); this.setData({ active: index, }); }, toWatch(e) { console.log(e); let id = e.currentTarget.dataset.id; wx.navigateTo({ url: "/packageE/video_question/watch/watch?id=" + id, }); }, });