| | |
| | | slot="icon"><u-icon name="volume" |
| | | color="#035CFB" |
| | | size="40"></u-icon></view> |
| | | <span slot="right-icon" style="font-size: 12px;">{{ item.createTime }}</span> |
| | | <view slot="right-icon" style="font-size: 12px;"> |
| | | <view>{{ item.createTime }}</view> |
| | | <view>发送人:<text style="font-size:12px;color:#00000082">{{item.createByName}}</text></view> |
| | | </view> |
| | | </u-cell> |
| | | </u-swipe-action-item> |
| | | </u-swipe-action> |
| | |
| | | }, |
| | | onShow() { |
| | | this.messageReq(); |
| | | }, |
| | | onPullDownRefresh(){ |
| | | this.messageReq(); |
| | | uni.stopPullDownRefresh(); |
| | | |
| | | }, |
| | | onHide() { |
| | | this.messageList = []; |
| | |
| | | }; |
| | | }); |
| | | } |
| | | setTimeout(() => { |
| | | this.onShowMessage(); |
| | | }, 500); |
| | | } else { |
| | | this.$u.toast('加载失败'); |
| | | } |
| | |
| | | }); |
| | | } |
| | | }, |
| | | //点开首页已消息 |
| | | onShowMessage(){ |
| | | const messageIds = this.messageList.filter(item=>item.status === 0); |
| | | console.log(messageIds,this.messageList,'messageIds') |
| | | this.$reqAllJson('readMessage', { |
| | | messageIds: messageIds.map(item=>item.id).join(","), |
| | | status: 0 |
| | | }, { method: 'PUT', 'Content-Type': 'application/json' }).then(res=>{ |
| | | console.log(res,'resss') |
| | | }) |
| | | //重新渲染接口 |
| | | this.$reqGet('getMessageByUser', { current: this.pageNum, size: this.pageSize }).then(res => { |
| | | if (res.code == 0) { |
| | | uni.hideLoading(); |
| | | this.total = res.data.total; |
| | | |
| | | function removeTags(str) { |
| | | return str.replace(/<\/?[^>]+>/gi, ''); |
| | | } |
| | | if (this.pageNum > 1) { |
| | | this.messageList = this.messageList.concat(res.data.records); |
| | | this.messageList = this.messageList.map(v => { |
| | | return { |
| | | ...v, |
| | | title: v.title.slice(0, 8) + '...', |
| | | content: removeTags(v.content).trim() |
| | | }; |
| | | }); |
| | | } else if (this.pageNum == 1) { |
| | | this.messageList = res.data.records; |
| | | this.messageList = this.messageList.map(v => { |
| | | return { |
| | | ...v, |
| | | title: v.title.slice(0, 8) + '...', |
| | | content: removeTags(v.content).trim() |
| | | }; |
| | | }); |
| | | } |
| | | } else { |
| | | this.$u.toast('加载失败'); |
| | | } |
| | | }); |
| | | }, |
| | | // 删除消息 |
| | | deleteMsg(value, index) { |
| | | this.show = true; |