From edd35a251b58b1fad17015deda92324f74458434 Mon Sep 17 00:00:00 2001
From: unknown <unknown@example.com>
Date: 星期三, 17 八月 2022 00:05:30 +0800
Subject: [PATCH] 台账模块、智能咨询模块
---
pages/notice/notice.js | 49 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 39 insertions(+), 10 deletions(-)
diff --git a/pages/notice/notice.js b/pages/notice/notice.js
index 64c5dd3..3b778c8 100644
--- a/pages/notice/notice.js
+++ b/pages/notice/notice.js
@@ -1,4 +1,9 @@
// 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({
/**
@@ -17,16 +22,9 @@
}
],
pageList: [
- {
- url: "/res/icons/notice_3.png"
- },
- {
- url: "/res/icons/notice_1.png"
- },
- {
- url: "/res/icons/notice_2.png"
- },
-
+ [],
+ [],
+ []
]
},
@@ -66,5 +64,36 @@
*/
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)
},
})
\ No newline at end of file
--
Gitblit v1.9.3