123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- // 通知列表页面的JS文件
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- noticeList: [
- {
- id: '1',
- title: '缴费通知',
- content: '由于您没有缴费,为保证正常用水,请您看到通知后到小程序主页进行充值缴费...',
- date: '2025-03-10',
- type: 'payment',
- source: '智慧水务'
- },
- {
- id: '2',
- title: '停水通知',
- content: '因管道维修,您所在区域将于2025年3月15日8:00-18:00停水,请提前做好准备...',
- date: '2025-03-08',
- type: 'notice',
- source: '智慧水务'
- },
- {
- id: '3',
- title: '停水通知',
- content: '因管道维修,您所在区域将于2025年3月15日8:00-18:00停水,请提前做好准备...',
- date: '2025-03-08',
- type: 'notice',
- source: '智慧水务'
- },
- {
- id: '4',
- title: '停水通知',
- content: '因管道维修,您所在区域将于2025年3月15日8:00-18:00停水,请提前做好准备...',
- date: '2025-03-08',
- type: 'notice',
- source: '智慧水务'
- },
- {
- id: '5',
- title: '停水通知',
- content: '因管道维修,您所在区域将于2025年3月15日8:00-18:00停水,请提前做好准备...',
- date: '2025-03-08',
- type: 'notice',
- source: '智慧水务'
- },
- {
- id: '6',
- title: '停水通知',
- content: '因管道维修,您所在区域将于2025年3月15日8:00-18:00停水,请提前做好准备...',
- date: '2025-03-08',
- type: 'notice',
- icon: '/static_file/water_drop_icon.png',
- source: '智慧水务'
- },
- {
- id: '7',
- title: '停水通知',
- content: '因管道维修,您所在区域将于2025年3月15日8:00-18:00停水,请提前做好准备...',
- date: '2025-03-08',
- type: 'notice',
- source: '智慧水务'
- },
- {
- id: '8',
- title: '停水通知',
- content: '因管道维修,您所在区域将于2025年3月15日8:00-18:00停水,请提前做好准备...',
- date: '2025-03-08',
- type: 'notice',
- source: '智慧水务'
- }
- ]
- },
- // onLoad: function (options) {
- // this.getNoticeList();
- // },
- // getNoticeList: function() {
- // wx.request({
- // url: 'API地址/notice/list',
- // success: (res) => {
- // if (res.data && res.data.code === 200) {
- // this.setData({
- // noticeList: res.data.data
- // });
- // }
- // },
- // fail: () => {
- // // 网络请求失败时使用默认数据
- // console.log('获取通知列表失败,使用默认数据');
- // }
- // });
- // },
- /**
- * 跳转到通知详情页
- */
- goToDetail: function (e) {
- const id = e.currentTarget.dataset.id;
- const notice = this.data.noticeList.find(item => item.id === id);
-
- if (notice) {
- // 将通知数据转换为JSON字符串
- const noticeStr = JSON.stringify(notice);
- // 跳转到详情页并传递完整数据
- wx.navigateTo({
- url: '/pages/tzxq/tzxq?noticeData=' + encodeURIComponent(noticeStr)
- });
- } else {
- wx.showToast({
- title: '未找到通知详情',
- icon: 'none'
- });
- }
- },
- /**
- * 返回上一页
- */
- goBack: function() {
- wx.navigateBack();
- },
- })
|