113 lines
1.9 KiB
JavaScript
113 lines
1.9 KiB
JavaScript
|
|
// pages/msg/index/index.js
|
||
|
|
const app = getApp();
|
||
|
|
|
||
|
|
Page({
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面的初始数据
|
||
|
|
*/
|
||
|
|
data: {
|
||
|
|
topBarH: app.globalData.CustomBar,
|
||
|
|
TypeData: ['检查', '任务', '政策', '学习', '预警', '系统'],
|
||
|
|
|
||
|
|
page: 1,
|
||
|
|
pageSize: 10,
|
||
|
|
list: []
|
||
|
|
},
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 刷新
|
||
|
|
*/
|
||
|
|
refresh: function () {
|
||
|
|
this.data.page = 1;
|
||
|
|
this.getList();
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取消息列表
|
||
|
|
*/
|
||
|
|
getList: function () {
|
||
|
|
const params = {
|
||
|
|
userId: app.globalData.userInfo.userId,
|
||
|
|
page: this.data.page,
|
||
|
|
pageSize: this.data.pageSize
|
||
|
|
}
|
||
|
|
app.axios('GET', 'app', '/notice/getGovNoticeUserPage', params, false).then(res => {
|
||
|
|
this.data.freshIng = false;
|
||
|
|
if (res.code == 1) {
|
||
|
|
const list = res.data.rows;
|
||
|
|
if (this.data.page == 1) this.data.list = list;
|
||
|
|
else this.data.list = [...this.data.list, ...list]
|
||
|
|
if (list.length > 0) this.data.page = res.data.pageNum + 1
|
||
|
|
this.setData(this.data)
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 消息详情
|
||
|
|
*/
|
||
|
|
toDetail: function (params) {
|
||
|
|
const item = params.currentTarget.dataset.item;
|
||
|
|
wx.navigateTo({
|
||
|
|
url: `/pages/msg/push/index?uuid=${item.govNoticeId}&user=true`,
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面加载
|
||
|
|
*/
|
||
|
|
onLoad(options) {
|
||
|
|
this.refresh();
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
|
*/
|
||
|
|
onReady() {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面显示
|
||
|
|
*/
|
||
|
|
onShow() {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面隐藏
|
||
|
|
*/
|
||
|
|
onHide() {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面卸载
|
||
|
|
*/
|
||
|
|
onUnload() {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
|
*/
|
||
|
|
onPullDownRefresh() {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面上拉触底事件的处理函数
|
||
|
|
*/
|
||
|
|
onReachBottom() {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 用户点击右上角分享
|
||
|
|
*/
|
||
|
|
onShareAppMessage() {
|
||
|
|
|
||
|
|
}
|
||
|
|
})
|