no message

This commit is contained in:
kuaifan 2022-06-10 09:55:57 +08:00
parent 9a9ff64576
commit b9ddc0cf1f
2 changed files with 17 additions and 40 deletions

View File

@ -73,7 +73,6 @@
<DynamicScroller <DynamicScroller
ref="scroller" ref="scroller"
class="dialog-scroller scrollbar-overlay" class="dialog-scroller scrollbar-overlay"
:style="{visibility: scrollerShow ? 'visible' : 'hidden'}"
:disabled="touchBackInProgress" :disabled="touchBackInProgress"
:items="allMsgs" :items="allMsgs"
:min-item-size="58" :min-item-size="58"
@ -329,7 +328,6 @@ export default {
dialogDrag: false, dialogDrag: false,
groupInfoShow: false, groupInfoShow: false,
scrollerShow: false,
navStyle: {}, navStyle: {},
@ -451,28 +449,14 @@ export default {
dialogId: { dialogId: {
handler(id) { handler(id) {
if (id) { if (id) {
this.scrollerShow = false;
this.msgNew = 0; this.msgNew = 0;
this.topId = -1; this.topId = -1;
// //
let cacheTimer = null;
if (this.allMsgList.length > 0) { if (this.allMsgList.length > 0) {
cacheTimer = setTimeout(_ => { this.allMsgs = this.allMsgList;
this.allMsgs = this.allMsgList; requestAnimationFrame(this.onToBottom);
this.onToBottom().then(_ => {
this.scrollerShow = true
});
}, 1);
} }
const startTime = new Date().getTime(); this.$store.dispatch("getDialogMsgs", id).catch(_ => {});
this.$store.dispatch("getDialogMsgs", id).then(_ => {
cacheTimer && clearTimeout(cacheTimer);
setTimeout(_ => {
this.onToBottom().then(_ => {
this.scrollerShow = true
});
}, Math.max(0, 100 - (new Date().getTime() - startTime)));
}).catch(_ => {});
// //
this.$store.dispatch('saveInDialog', { this.$store.dispatch('saveInDialog', {
uid: this._uid, uid: this._uid,
@ -515,15 +499,14 @@ export default {
allMsgList(newList, oldList) { allMsgList(newList, oldList) {
const {scrollE} = this.scrollInfo(); const {scrollE} = this.scrollInfo();
this.allMsgs = newList; this.allMsgs = newList;
this.$nextTick(_ => { //
if (scrollE > 10 && oldList.length > 0) { if (scrollE > 10 && oldList.length > 0) {
const lastId = oldList[oldList.length - 1].id const lastId = oldList[oldList.length - 1].id
const tmpList = newList.filter(item => item.id && item.id > lastId) const tmpList = newList.filter(item => item.id && item.id > lastId)
this.msgNew += tmpList.length this.msgNew += tmpList.length
} else { } else {
this.onToBottom(); requestAnimationFrame(this.onToBottom)
} }
})
}, },
windowScrollY(val) { windowScrollY(val) {
@ -533,9 +516,7 @@ export default {
marginTop: val + 'px' marginTop: val + 'px'
} }
if (scrollE <= 10) { if (scrollE <= 10) {
this.$nextTick(_ => { requestAnimationFrame(this.onToBottom)
this.onToBottom();
})
} }
} }
}, },
@ -787,14 +768,9 @@ export default {
onToBottom() { onToBottom() {
this.msgNew = 0; this.msgNew = 0;
return new Promise(resolve => { if (this.isReady) {
if (this.isReady) { this.$refs.scroller?.scrollToBottom();
this.$refs.scroller?.scrollToBottom(); }
requestAnimationFrame(resolve)
} else {
resolve();
}
})
}, },
openProject() { openProject() {

View File

@ -801,11 +801,12 @@
display: none; display: none;
position: absolute; position: absolute;
top: -38px; top: -38px;
right: 24px;
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
color: #ffffff; color: #ffffff;
font-size: 12px; font-size: 12px;
background-color: rgba(0, 0, 0, 0.6); background-color: #555555;
padding: 0 12px; padding: 0 12px;
margin-bottom: 20px; margin-bottom: 20px;
margin-right: 10px; margin-right: 10px;