| | |
| | | if (res.code == 0) { |
| | | uni.hideLoading(); |
| | | this.total = res.data.total; |
| | | const regex = /<[^>]*>([^<]*)<\/[^>]*>/g; |
| | | |
| | | const solveHandle = v => { |
| | | const regex = /<[^>]*>([^<]*)<\/[^>]*>/g; |
| | | let result = v.replace(regex, (match, p1) => { |
| | | return p1.length > 8 ? p1.slice(0, 8) + '...' : p1; |
| | | }); |
| | | return result; |
| | | }; |
| | | if (this.pageNum > 1) { |
| | | this.messageList = this.messageList.concat(res.data.records); |
| | | this.messageList = this.messageList.map(v => { |
| | | return { |
| | | ...v, |
| | | content: solveHandle(v.content) |
| | | }; |
| | | }); |
| | | } else if (this.pageNum == 1) { |
| | | this.messageList = res.data.records; |
| | | this.messageList = this.messageList.map(v => { |
| | | return { |
| | | ...v, |
| | | content: solveHandle(v.content) |
| | | }; |
| | | }); |
| | | } |
| | | } else { |
| | | this.$u.toast('加载失败'); |