From b9ddc0cf1f354769274c38c583a7d4879f190f36 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Fri, 10 Jun 2022 09:55:57 +0800 Subject: [PATCH] no message --- .../pages/manage/components/DialogWrapper.vue | 54 ++++++------------- .../sass/pages/components/dialog-wrapper.scss | 3 +- 2 files changed, 17 insertions(+), 40 deletions(-) diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index 9c4c26982..7b6f32cb9 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -73,7 +73,6 @@ 0) { - cacheTimer = setTimeout(_ => { - this.allMsgs = this.allMsgList; - this.onToBottom().then(_ => { - this.scrollerShow = true - }); - }, 1); + this.allMsgs = this.allMsgList; + requestAnimationFrame(this.onToBottom); } - const startTime = new Date().getTime(); - 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("getDialogMsgs", id).catch(_ => {}); // this.$store.dispatch('saveInDialog', { uid: this._uid, @@ -515,15 +499,14 @@ export default { allMsgList(newList, oldList) { const {scrollE} = this.scrollInfo(); this.allMsgs = newList; - this.$nextTick(_ => { - if (scrollE > 10 && oldList.length > 0) { - const lastId = oldList[oldList.length - 1].id - const tmpList = newList.filter(item => item.id && item.id > lastId) - this.msgNew += tmpList.length - } else { - this.onToBottom(); - } - }) + // + if (scrollE > 10 && oldList.length > 0) { + const lastId = oldList[oldList.length - 1].id + const tmpList = newList.filter(item => item.id && item.id > lastId) + this.msgNew += tmpList.length + } else { + requestAnimationFrame(this.onToBottom) + } }, windowScrollY(val) { @@ -533,9 +516,7 @@ export default { marginTop: val + 'px' } if (scrollE <= 10) { - this.$nextTick(_ => { - this.onToBottom(); - }) + requestAnimationFrame(this.onToBottom) } } }, @@ -787,14 +768,9 @@ export default { onToBottom() { this.msgNew = 0; - return new Promise(resolve => { - if (this.isReady) { - this.$refs.scroller?.scrollToBottom(); - requestAnimationFrame(resolve) - } else { - resolve(); - } - }) + if (this.isReady) { + this.$refs.scroller?.scrollToBottom(); + } }, openProject() { diff --git a/resources/assets/sass/pages/components/dialog-wrapper.scss b/resources/assets/sass/pages/components/dialog-wrapper.scss index 680d0ed59..6a8afb018 100644 --- a/resources/assets/sass/pages/components/dialog-wrapper.scss +++ b/resources/assets/sass/pages/components/dialog-wrapper.scss @@ -801,11 +801,12 @@ display: none; position: absolute; top: -38px; + right: 24px; height: 30px; line-height: 30px; color: #ffffff; font-size: 12px; - background-color: rgba(0, 0, 0, 0.6); + background-color: #555555; padding: 0 12px; margin-bottom: 20px; margin-right: 10px;