| | |
| | | // pages/notice/notice.js |
| | | const notificationservice = require("../../service/notificationservice") |
| | | const moment = require('../../utils/moment.min') |
| | | const util = require("../../utils/util.js") |
| | | const app = getApp() |
| | | |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | } |
| | | ], |
| | | pageList: [ |
| | | { |
| | | url: "/res/icons/notice_3.png" |
| | | }, |
| | | { |
| | | url: "/res/icons/notice_1.png" |
| | | }, |
| | | { |
| | | url: "/res/icons/notice_2.png" |
| | | }, |
| | | |
| | | [], |
| | | [], |
| | | [] |
| | | ] |
| | | }, |
| | | |
| | |
| | | */ |
| | | onLoad: function (options) { |
| | | this.tabsHeight('.page0'); |
| | | this.getNotice() |
| | | }, |
| | | |
| | | onReachBottom () { |
| | | if (this.cPage && this.tPage) { |
| | | if (this.cPage < this.tPage) { |
| | | this.getNotice(this.cPage + 1) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | getNotice(cPage = 1) { |
| | | var that = this |
| | | notificationservice.getNotification(app.globalData.accessToken.userId, cPage, { |
| | | onHead(header) { |
| | | that.cPage = parseInt(header.currentPage) |
| | | that.tPage = parseInt(header.totalPage) |
| | | console.log(`cPage:${that.cPage}, tPage:${that.tPage}`); |
| | | }, |
| | | success(res) { |
| | | res.forEach(r => { |
| | | r.updateTime = util.formatTime(r.updateTime) |
| | | }); |
| | | let notices = that.data.pageList[0].concat(res) |
| | | that.setData({ |
| | | ['pageList[0]']: notices |
| | | }) |
| | | |
| | | that.tabsHeight('.page0'); //刷新高度 |
| | | } |
| | | }, 5) |
| | | }, |
| | | }) |