|
|
@@ -1,4 +1,5 @@
|
|
|
const _Http = getApp().globalData.http;
|
|
|
+let DataCarousel = null;
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
|
@@ -10,6 +11,8 @@ Page({
|
|
|
gridList: [],
|
|
|
showAnnunciate: false, //显示最新通告
|
|
|
unreadNum: 0, //通告未读
|
|
|
+ notice: "",
|
|
|
+ msgCount: 1,
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -98,12 +101,46 @@ Page({
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ /* 获取最新信息 */
|
|
|
+ queryMessage(i) {
|
|
|
+ if (i == 5) return;
|
|
|
+ _Http.basic({
|
|
|
+ "classname": "system.message.Message",
|
|
|
+ "method": "queryMessage",
|
|
|
+ content: {
|
|
|
+ nocache: true,
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 3,
|
|
|
+ pageTotal: 1,
|
|
|
+ type: "系统"
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ if (res.msg != '成功') return this.queryMessage(i + 1);
|
|
|
+ this.setData({
|
|
|
+ msgList: res.data,
|
|
|
+ notice: res.data[0]
|
|
|
+ })
|
|
|
+ this.startDataCarousel();
|
|
|
+ })
|
|
|
+ },
|
|
|
+ startDataCarousel() {
|
|
|
+ clearInterval(DataCarousel);
|
|
|
+ DataCarousel = setInterval(() => {
|
|
|
+ let count = this.data.msgCount < this.data.msgList.length ? this.data.msgCount : 0;
|
|
|
+ console.log(count)
|
|
|
+ this.setData({
|
|
|
+ msgCount: count + 1,
|
|
|
+ notice: this.data.msgList[count]
|
|
|
+ })
|
|
|
+ }, 5000)
|
|
|
+ },
|
|
|
/* 更新站点信息 */
|
|
|
refreshData(item) {
|
|
|
this.setData({
|
|
|
user: item
|
|
|
})
|
|
|
this.queryNoticeList(0); //获取通告列表
|
|
|
+ this.queryMessage(0)
|
|
|
},
|
|
|
/* 宫格区域应用程序 */
|
|
|
applications(e) {
|
|
|
@@ -114,6 +151,15 @@ Page({
|
|
|
url: `${item.path}?auth=${JSON.stringify(item.apps)}`,
|
|
|
});
|
|
|
},
|
|
|
+ /* 去消息详情 */
|
|
|
+ toMsg(e) {
|
|
|
+ const {
|
|
|
+ item
|
|
|
+ } = e.currentTarget.dataset;
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/tabbar/message/details?id=' + item.objectid,
|
|
|
+ })
|
|
|
+ },
|
|
|
/* 去通告 */
|
|
|
toAnnunciate() {
|
|
|
this.applications({
|
|
|
@@ -124,52 +170,18 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
- */
|
|
|
- onReady() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow() {
|
|
|
this.getTabBar().init();
|
|
|
+ this.startDataCarousel();
|
|
|
},
|
|
|
-
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面卸载
|
|
|
- */
|
|
|
- onUnload() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面相关事件处理函数--监听用户下拉动作
|
|
|
- */
|
|
|
- onPullDownRefresh() {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面上拉触底事件的处理函数
|
|
|
- */
|
|
|
- onReachBottom() {
|
|
|
-
|
|
|
+ clearInterval(DataCarousel);
|
|
|
},
|
|
|
|
|
|
- /**
|
|
|
- * 用户点击右上角分享
|
|
|
- */
|
|
|
- onShareAppMessage() {
|
|
|
-
|
|
|
- }
|
|
|
})
|