Files
kelfy-mini/pages/notification/notification.js

145 lines
2.9 KiB
JavaScript
Raw Normal View History

2025-11-13 13:38:59 +08:00
// pages/notification/notification.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
msgList: [],
show: ''
},
naviTo(e) {
console.log(e.currentTarget.dataset.item.ID)
let id = e.currentTarget.dataset.item.ID
let content = e.currentTarget.dataset.item.CONTENT
wx.request({
url:'https://fy.btlsoln.com:8443/setMessageNoticeRead?id',
// url:'http://sayetest.f3322.org:5000/setMessageNoticeRead?id',
method: "GET",
data: {
id: id
},
header: {
'content-type': 'application/json'
},
success: (res) => {
console.log(res, "读取消息")
}
})
let state = 0
wx.navigateTo({
url: '/pages/message/message?content=' + content + '&state=' + state,
})
},
getList() {
wx.request({
url:'https://fy.btlsoln.com:8443/findAllMessageNotice?openid= ',
// url:'http://sayetest.f3322.org:5000/findMessageNotice?openid',
method: "GET",
data: {
openid: app.globalData.openId
},
header: {
'content-type': 'application/json'
},
success: (res) => {
console.log(res, "消息通知")
if (res.data == '') {
this.setData({
show: true
})
} else {
this.setData({
msgList: res.data,
show: false
})
}
}
})
},
clickRead() {
wx.request({
url: 'https://fy.btlsoln.com:8443/setMessageNoticeAllRead?openid= ',
// url:'http://sayetest.f3322.org:5000/findMessageNotice?openid',
method: "GET",
data: {
openid: app.globalData.openId
},
header: {
'content-type': 'application/json'
},
success: (res) => {
console.log(res, "全部已读")
this.getList()
// if(res.data == ''){
// this.setData({
// show:true
// })
// }else{
// this.setData({
// msgList:res.data,
// show:false
// })
// }
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
wx.setNavigationBarTitle({
title: '消息通知'
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getList()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})