mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 11:19:56 +00:00
perf: 优化重连时消息列表跳回第一页的情况
This commit is contained in:
parent
aa70c41041
commit
e5c622cb89
@ -570,7 +570,6 @@ export default {
|
|||||||
msgNew: 0,
|
msgNew: 0,
|
||||||
msgType: '',
|
msgType: '',
|
||||||
loadIng: 0,
|
loadIng: 0,
|
||||||
unreadMsgId: 0,
|
|
||||||
|
|
||||||
allMsgs: [],
|
allMsgs: [],
|
||||||
tempMsgs: [],
|
tempMsgs: [],
|
||||||
@ -654,11 +653,13 @@ export default {
|
|||||||
scrollTmp: 0,
|
scrollTmp: 0,
|
||||||
scrollIng: 0,
|
scrollIng: 0,
|
||||||
|
|
||||||
positionLoad: 0,
|
approveDetails: {id: 0},
|
||||||
|
|
||||||
approveDetails:{id: 0},
|
|
||||||
approveDetailsShow: false,
|
approveDetailsShow: false,
|
||||||
approvaUserStatus: ''
|
approvaUserStatus: '',
|
||||||
|
|
||||||
|
positionLoad: 0, // 定位跳转加载中
|
||||||
|
unreadMsgId: 0, // 最早未读消息id
|
||||||
|
toBottomReGetMsg: false, // 滚动到底部重新获取消息
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -997,6 +998,7 @@ export default {
|
|||||||
this.msgType = ''
|
this.msgType = ''
|
||||||
this.searchShow = false
|
this.searchShow = false
|
||||||
this.unreadMsgId = 0
|
this.unreadMsgId = 0
|
||||||
|
this.toBottomReGetMsg = false
|
||||||
//
|
//
|
||||||
if (this.allMsgList.length > 0) {
|
if (this.allMsgList.length > 0) {
|
||||||
this.allMsgs = this.allMsgList
|
this.allMsgs = this.allMsgList
|
||||||
@ -1114,11 +1116,15 @@ export default {
|
|||||||
if (num <= 1) {
|
if (num <= 1) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.getMsgs({
|
// 判断是否最后一条消息可见才重新获取消息
|
||||||
dialog_id: this.dialogId,
|
const lastMsg = this.allMsgs[this.allMsgs.length - 1]
|
||||||
msg_id: this.msgId,
|
const lastEl = $A(this.$refs.scroller.$el).find(`[data-id="${lastMsg.id}"]`)
|
||||||
msg_type: this.msgType,
|
if (lastEl.length === 0) {
|
||||||
}).catch(_ => {});
|
this.toBottomReGetMsg = true
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 开始请求重新获取消息
|
||||||
|
this.onReGetMsg()
|
||||||
},
|
},
|
||||||
|
|
||||||
allMsgList(newList, oldList) {
|
allMsgList(newList, oldList) {
|
||||||
@ -1936,6 +1942,15 @@ export default {
|
|||||||
this.$store.dispatch("openOkr", this.dialogData.link_id);
|
this.$store.dispatch("openOkr", this.dialogData.link_id);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onReGetMsg() {
|
||||||
|
this.toBottomReGetMsg = false
|
||||||
|
this.getMsgs({
|
||||||
|
dialog_id: this.dialogId,
|
||||||
|
msg_id: this.msgId,
|
||||||
|
msg_type: this.msgType,
|
||||||
|
}).catch(_ => {});
|
||||||
|
},
|
||||||
|
|
||||||
onPrevPage() {
|
onPrevPage() {
|
||||||
if (this.prevId === 0) {
|
if (this.prevId === 0) {
|
||||||
return
|
return
|
||||||
@ -2228,6 +2243,7 @@ export default {
|
|||||||
this.scrollTail = tail;
|
this.scrollTail = tail;
|
||||||
if (this.scrollTail <= 55) {
|
if (this.scrollTail <= 55) {
|
||||||
this.msgNew = 0;
|
this.msgNew = 0;
|
||||||
|
this.toBottomReGetMsg && this.onReGetMsg()
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
this.scrollAction = event.target.scrollTop;
|
this.scrollAction = event.target.scrollTop;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user