const _Http = getApp().globalData.http; Page({ data: { list: [], filtrate: false, "content": { nocache: true, "pageNumber": 1, "pageSize": 20, "pageTotal": 1, "where": { "condition": "" } }, unreadNum: 0, filtratelist: [{ label: "板块", index: null, showName: "classname", //显示字段 valueKey: "sat_notice_classid", //返回Key selectKey: "sat_notice_classid", //传参 代表选着字段 不传参返回整个选择对象 value: "", //选中值 list: null }] }, onLoad(options) { this.getList(true); }, getList(init = false) { if (init.detail != undefined) init = init.detail; let content = this.data.content; if (init) content.pageNumber = 1; if (content.pageNumber > content.pageTotal) return; _Http.basic({ id: 20221111090904, content: content }).then(res => { console.log("通告列表", res) 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, unreadNum: res.total - res.tips.readNum }) }) }, /* 查看详情 */ toDetails(e) { const { item } = e.currentTarget.dataset; wx.navigateTo({ url: `./details?id=${item.sat_noticeid}` }) }, onReady() { this.selectComponent("#ListBox").setHeight(".top", this); }, startSearch({ detail }) { if (detail == this.data.content.where.condition) return; this.data.content.where.condition = detail; this.getList(true); }, /* 取消搜索 */ onClear() { this.data.content.where.condition = ""; this.getList(true); }, openFiltrate() { console.log(123123) if (this.data.filtratelist[0].list == null) { _Http.basic({ id: 20221101094603, "content": { nocache: true, "pageNumber": 1, "pageSize": 999, "where": { "condition": "" } } }).then(res => { console.log("通告板块", res) this.setData({ "filtratelist[0].list": res.data, filtrate: true }) }) } else { this.setData({ filtrate: true }) } }, /* 处理筛选 */ handleFilter(e) { this.data.content.where.sat_notice_classid = e.detail.sat_notice_classid || ""; this.getList(true) }, })