1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- const getHeight = require("../../utils/getRheRemainingHeight");
- const _Http = getApp().globalData.http;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- scrollHeight: 0,
- list: [],
- "content": {
- nocache: true,
- "pageNumber": 1,
- "pageSize": 20,
- "pageTotal": 1,
- "where": {
- "condition": ""
- }
- },
- unreadNum: 0
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- if (options.auth) {
- let authList = [];
- JSON.parse(options.auth)[0].meta.auth.forEach(v => authList.push(v.optionname));
- this.setData({
- authList
- })
- }
- this.getList();
- },
- 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": "saletool.notice.notice",
- "method": "queryNoticeList",
- content: this.data.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, authList = this.data.authList;
- wx.navigateTo({
- url: `./details?id=${item.sat_noticeid}&feedback=${authList.includes('反馈')}&auth=${authList}`
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- getHeight.getHeight('.top', this).then(res => {
- this.setData({
- scrollHeight: res
- })
- })
- },
- })
|