import { ApiModel } from "../../utils/api"; const _Http = new ApiModel(); Page({ /** * 页面的初始数据 */ data: { tabsList: ['已读', '未读', '回复'], tabsSelect: "已读", list: {}, showList: [], //显示列表 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { _Http.basic({ "accesstoken": wx.getStorageSync('userData').token, "classname": "system.im.imdialog.imdialog", "method": "querySubjectAnalysis", "content": { "timsubjectid": options.timsubjectid, "timdialogid": options.timdialogid } }).then(res => { if (res.msg != '成功') return wx.showToast({ title: res.data, icon: "none" }) this.setData({ list: res.data }) this.tabsChange(options.type); }) }, tabsCallBack({ detail }) { if (this.data.tabsSelect == detail) return; this.tabsChange(detail); this.setData({ tabsSelect: detail }) }, tabsChange(value) { let showList = [], list = this.data.list; switch (value) { case "已读": showList = list.readlist break; case "未读": showList = list.unreadlist break; case "回复": showList = list.answerlist break; default: showList = list.unanswerlist break; }; for (let i = 0; i < showList.length; i++) { if (typeof (showList[i].ffirstreadtime) != undefined && showList[i].ffirstreadtime != null) { let time = showList[i].ffirstreadtime.split('.'); showList[i].ffirstreadtime = time[0]; } else { showList[i].ffirstreadtime = '' } } this.setData({ showList }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })