| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 | const _Http = getApp().globalData.http;Component({  properties: {  },  options: {    addGlobalClass: true  },  data: {    height: 0,    list: [],    content: {      nocache: true,      pageNumber: 1,      pageSize: 20,      pageTotal: 1,      type: "应用",      where: {}    },    total: 0,    tabshow: false  },  methods: {    init() {      this.setData({        tabshow: true      })      this.getlist(true);      return true;    },    getlist(init = false) {      if (init.detail != undefined) init = init.detail;      if (init) this.setData({        ['content.pageNumber']: 1      })      if (this.data.content.pageNumber > this.data.content.pageTotal) return;      _Http.basic({        "classname": "system.message.Message",        "method": "queryMessage",        content: this.data.content      }).then(res => {        console.log("xiaox", res)        this.selectComponent("#ListBox").setHeight("#tabs", this);        this.selectComponent('#ListBox').RefreshToComplete();        if (res.msg != '成功') return wx.showToast({          title: res.msg,          icon: "none"        })        this.setData({          total: res.total,          list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),          ['content.pageNumber']: res.pageNumber + 1,          ['content.pageTotal']: res.pageTotal        })      })    },    //切换tab选项    tabChange({      detail    }) {      this.setData({        "content.type": detail.name      })      this.getlist(true);    },    onAllRead() {      wx.showModal({        title: '提示',        content: '是否确定阅读所有消息',        complete: (res) => {          if (res.confirm) {            console.log("s")            _Http.basic({              "classname": "system.message.Message",              "method": "readAllMessage",              content: {}            }).then(res => {              console.log("一键阅读", res)              wx.showToast({                title: res.msg != '成功' ? res.msg : "操作成功",                icon: "none"              });              getApp().globalData.socketCallback()              this.setData({                list: this.data.list.map(v => {                  v.isread = 1;                  return v                })              })            })          }        }      })    },    callback({      detail    }) {      let i = this.data.list.findIndex(v => v.messageid == detail);      this.setData({        [`list[${i}].isread`]: 1      })    }  }})
 |