You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
1.8 KiB
112 lines
1.8 KiB
// pages/user/subpage/system/system.js
|
|
import {
|
|
http
|
|
} from '../../../../utils/util'
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
list: [],
|
|
page: 1,
|
|
max: 0
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
wx.setNavigationBarTitle({
|
|
title: '系统消息',
|
|
})
|
|
},
|
|
getdata() {
|
|
http("/userMessage/list", "post", {
|
|
pageNum: 0,
|
|
pageSzie: 10
|
|
}).then(res => {
|
|
let array = res.data.records
|
|
for (let index = 0; index < array.length; index++) {
|
|
array[index].createDate = array[index].createDate.replace('T', ' ')
|
|
}
|
|
this.setData({
|
|
list: res.data.records,
|
|
max: res.data.pages
|
|
})
|
|
})
|
|
},
|
|
to(e) {
|
|
http("/userMessage/read", "post", {
|
|
id: e.currentTarget.dataset.id
|
|
}).then(res => {
|
|
wx.navigateTo({
|
|
url: '/' + e.currentTarget.dataset.url,
|
|
})
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
this.setData({
|
|
list: [],
|
|
page: 1,
|
|
max: 0
|
|
})
|
|
this.getdata()
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
if (this.data.page === this.data.max) {
|
|
wx.showToast({
|
|
title: '到底啦~',
|
|
icon: 'none',
|
|
duration: 2000
|
|
})
|
|
} else {
|
|
this.setData({
|
|
'page': this.data.page + 1
|
|
})
|
|
this.getdata()
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
}) |