| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <text class="flex j-center fs-27 color4 pb-48">全部已读</text> |
| | | <text class="flex j-center fs-27 color4 pb-48" @click="Allread">全部已读</text> |
| | | |
| | | </view> |
| | | |
| | |
| | | import { |
| | | getBanner, |
| | | getMessagelist, |
| | | getappletcinfo |
| | | getappletcinfo, |
| | | getread |
| | | } from './service.js' |
| | | export default { |
| | | components: { |
| | |
| | | msgListTotal: [], |
| | | member:1, |
| | | userInfo:{}, |
| | | isLoading: false, |
| | | } |
| | | }, |
| | | onPullDownRefresh() { |
| | | if (!this.isLoading) { |
| | | this.pageNum = this.pageNum + 1 |
| | | this.getMessagelist() |
| | | } else { |
| | | return uni.showToast({ |
| | | title: '没有更多了...', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | onLoad() { |
| | | this.getBanner() |
| | |
| | | this.getappletcinfo() |
| | | }, |
| | | methods: { |
| | | Allread() { |
| | | getread().then(resp => { |
| | | console.log(resp, '====='); |
| | | this.getMessagelist() |
| | | }) |
| | | }, |
| | | getBanner() { |
| | | getBanner().then(resp => { |
| | | console.log(resp, '获取banner'); |
| | |
| | | } |
| | | getMessagelist(data).then(resp => { |
| | | console.log(resp, '获取消息列表'); |
| | | this.msgListTotal = resp.data.records.map(item => { |
| | | if (resp.data.records.length < 5 && this.pageNum == 1) { |
| | | this.msgListTotal = resp.data.records |
| | | this.isLoading = true |
| | | |
| | | } else if (resp.data.records.length < 5 && this.pageNum != 1) { |
| | | this.msgListTotal = [...this.msgListTotal, resp.data.records] |
| | | this.isLoading = true |
| | | } else { |
| | | this.msgListTotal = [...this.msgListTotal, resp.data.records] |
| | | this.isLoading = false |
| | | } |
| | | this.msgListTotal = this.msgListTotal.map(item => { |
| | | const timeDifference = new Date().getTime() - new Date(item.createTime).getTime() |
| | | // 使用 dayjs 的 duration 来处理时间差 |
| | | |
| | |
| | | // 计算分钟数 |
| | | const minutes = Math.floor(remainingSecondsAfterHours / 60); |
| | | |
| | | item.time = days&&hours?`${days} 天 ${hours}小时 ${minutes} `:!days&&hours?`${hours}小时 ${minutes}`:`${minutes}` |
| | | item.time = days && hours ? `${days} 天 ${hours}小时 ${minutes} ` : !days && hours ? |
| | | `${hours}小时 ${minutes}` : `${minutes}` |
| | | |
| | | return item |
| | | }) |