diff --git a/miniprogram/api/repair/repair.js b/miniprogram/api/repair/repair.js index 6f5b22b..68b209e 100644 --- a/miniprogram/api/repair/repair.js +++ b/miniprogram/api/repair/repair.js @@ -113,6 +113,25 @@ export function repairEvalRq(data) { }); } + +// 消息提醒列表 +export function repairRemindListRq(data) { + return request({ + url: `/app/repairRemind/list`, + method: "get", + data + }); +} + +// 消息提醒已读 +export function repairRemindReadRq(data) { + return request({ + url: `/app/repairRemind/read`, + method: "post", + data + }); +} + // 返回订单状态 // 状态:1 待派单,3 重新派单,5 已派单,7 处理中, 9已完成 待评价, 11 已关闭 13 已评价 let statusList = [{ diff --git a/miniprogram/pages/index/index.js b/miniprogram/pages/index/index.js index 5fe6b2f..86ad85d 100644 --- a/miniprogram/pages/index/index.js +++ b/miniprogram/pages/index/index.js @@ -15,6 +15,11 @@ import { getParkRq } from "../../api/index/index.js" +import { + repairRemindListRq, + repairRemindReadRq +} from "../../api/repair/repair.js" + import { getUrlParamsObj } from "../../utils/util.js" @@ -165,6 +170,8 @@ Page({ userDetail: {}, parkName: app.parkName, qrcodeParam: null, + infoList: [], + }, onLoad(options) { @@ -211,6 +218,16 @@ Page({ bannerList }) }) + // 查询消息列表 + repairRemindListRq({ + pageNum: 1, + pageSize: 3 + }).then(res => { + console.log('repairRemindListRq', res); + _this.setData({ + infoList: res.rows + }) + }) } else { app.selfShowMsg(res.msg, '/pages/login/login') } @@ -238,6 +255,25 @@ Page({ } }, + jumpInfo() { + wx.navigateTo({ + url: '/pages/my/info/info', + }) + }, + + jumpInfoDetail(e) { + console.log('detail', e); + let id = e.currentTarget.dataset.obj.id + let repairId = e.currentTarget.dataset.obj.repairId + repairRemindReadRq({ + id + }).then(res => { + wx.navigateTo({ + url: `/pages/reportRepair/assign/detail/detail?id=${repairId}`, + }) + }) + }, + // 成功通知 showSuccessMsg(msg) { Notify({ diff --git a/miniprogram/pages/index/index.wxml b/miniprogram/pages/index/index.wxml index 1a75b0e..f542a86 100644 --- a/miniprogram/pages/index/index.wxml +++ b/miniprogram/pages/index/index.wxml @@ -28,14 +28,14 @@ 消息通知 - 更多 + 更多 - + - 工单动态 - 您的工单《空调》已受理,正在处理中正在处理中正在处理中正在处理中 - 2024-08-16 13:49:11 + 消息提醒 + {{item.content}} + {{item.createTime}} diff --git a/miniprogram/pages/my/info/info.js b/miniprogram/pages/my/info/info.js index 4b03db3..c659933 100644 --- a/miniprogram/pages/my/info/info.js +++ b/miniprogram/pages/my/info/info.js @@ -1,66 +1,158 @@ -// pages/my/info/info.js +const app = getApp() + +import { + repairRemindListRq, + repairRemindReadRq +} from "../../../api/repair/repair.js" + + + Page({ - /** - * 页面的初始数据 - */ - data: { + /** + * 页面的初始数据 + */ + data: { + IMG_NAME: app.IMG_NAME, + // info + info: { + pageNum: 1, + pageSize: 10, + dataList: [], + isDataAll: false, + }, + }, - }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + + }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad(options) { + // 获取数据 + getDataList() { + let _this = this; - }, + // 获取参数 + let pageNum = null + let pageSize = null + let type = null + let isDataAll = null - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady() { + let info = _this.data.info + // + pageNum = info.pageNum + pageSize = info.pageSize + isDataAll = info.isDataAll - }, + // 判断数据是否已全部加载 + if (isDataAll) { + return; + } + // 传递参数 + let param = { + pageNum, + pageSize, + } + // 查询数据 + repairRemindListRq(param).then(res => { + console.log('repairRemindListRq', res); + let dataList = res.rows + let isDataAll = false + if (pageNum * pageSize >= res.total) { + isDataAll = true + } + // + info.dataList = info.dataList.concat(_this.formartData(dataList)) + info.pageNum = info.pageNum + 1 + info.isDataAll = isDataAll + _this.setData({ + info + }) + }) + }, - /** - * 生命周期函数--监听页面显示 - */ - onShow() { + // 格式化数据 + formartData(dataList) { + // 格式化数据 + return dataList.map(item => { + return item; + }) + }, - }, + jumpInfoDetail(e) { + console.log('detail', e); + let id = e.currentTarget.dataset.obj.id + let repairId = e.currentTarget.dataset.obj.repairId + repairRemindReadRq({ + id + }).then(res => { + wx.navigateTo({ + url: `/pages/reportRepair/assign/detail/detail?id=${repairId}`, + }) + }) + }, - /** - * 生命周期函数--监听页面隐藏 - */ - onHide() { + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { - }, + }, - /** - * 生命周期函数--监听页面卸载 - */ - onUnload() { + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + let _this = this; + _this.setData({ + info: { + pageNum: 1, + pageSize: 10, + dataList: [], + isDataAll: false, + } + }) + // + _this.getDataList() + }, - }, + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh() { + }, - }, + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom() { + }, - }, + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { - /** - * 用户点击右上角分享 - */ - onShareAppMessage() { + }, - } + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + console.log('onReachBottom', '页面上拉触底事件的处理函数'); + let _this = this; + // 获取数据 + _this.getDataList() + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } }) \ No newline at end of file diff --git a/miniprogram/pages/my/info/info.json b/miniprogram/pages/my/info/info.json index 8835af0..aadb025 100644 --- a/miniprogram/pages/my/info/info.json +++ b/miniprogram/pages/my/info/info.json @@ -1,3 +1,8 @@ { - "usingComponents": {} + "navigationBarTitleText": "报修记录", + "usingComponents": { + "van-divider": "@vant/weapp/divider/index", + "van-icon": "@vant/weapp/icon/index" + }, + "onReachBottomDistance": 100 } \ No newline at end of file diff --git a/miniprogram/pages/my/info/info.wxml b/miniprogram/pages/my/info/info.wxml index 345beef..1878234 100644 --- a/miniprogram/pages/my/info/info.wxml +++ b/miniprogram/pages/my/info/info.wxml @@ -1,2 +1,18 @@ - -pages/my/info/info.wxml \ No newline at end of file + + + + + + 消息提醒 + {{item.content}} + {{item.createTime}} + + + + + + + 数据已全部加载 + + + \ No newline at end of file diff --git a/miniprogram/pages/my/info/info.wxss b/miniprogram/pages/my/info/info.wxss index 1d2f237..23eb144 100644 --- a/miniprogram/pages/my/info/info.wxss +++ b/miniprogram/pages/my/info/info.wxss @@ -1 +1,64 @@ -/* pages/my/info/info.wxss */ \ No newline at end of file +.containerView.public { + background: none; + height: auto; +} + + +.infoView { + /* border: 1px solid red; */ + background: white; + margin: 10rpx 0; +} + +.infoView .itemView { + position: relative; + display: flex; + justify-content: space-between; + align-items: center; + padding: 30rpx 40rpx; + border-bottom: 2rpx solid rgb(126, 126, 126, 0.2); +} + +.infoView .itemView.activity::after { + display: block; + content: ''; + position: absolute; + right: 26rpx; + top: 30rpx; + width: 16rpx; + height: 16rpx; + border-radius: 20rpx; + background: red; +} + +.infoView .itemView:last-of-type { + border-bottom: none; +} + +.infoView .itemView .contentView {} + +.infoView .itemView .arrow { + margin-left: 20rpx; +} + +.infoView .itemView .contentView .title { + font-size: 30rpx; + color: black; +} + +.infoView .itemView .contentView .msg { + font-size: 26rpx; + color: gray; + margin-top: 16rpx; +} + +.infoView .itemView .contentView .time { + font-size: 24rpx; + color: gray; + margin-top: 4rpx +} + + +.loadAllLine { + margin-top: 80rpx; +} \ No newline at end of file