From 7c501cec451f364c56eab38c4243f37823d5e4cd Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sun, 13 Apr 2025 14:59:37 +0800 Subject: [PATCH] no message --- .../pages/manage/components/DialogWrapper.vue | 9 ++++---- .../js/pages/manage/components/TaskDetail.vue | 22 +++++++++---------- resources/assets/js/store/actions.js | 19 ++++++++++++++++ 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index d4fac70b7..a5acd3598 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -2365,6 +2365,10 @@ export default { this.focusTimer && clearTimeout(this.focusTimer) this.focusLazy = true this.$emit("on-focus") + // + this.$refs.footer?.scrollIntoView({ + block: "end" + }) }, onEventBlur() { @@ -4398,10 +4402,7 @@ export default { if (!this.$refs.input?.isFocus) { return true; // 输入框未聚焦 } - this.$refs.footer?.scrollIntoView({ - block: 'end', - behavior: 'smooth' - }) + this.$store.dispatch("scrollBottom", this.$refs.footer) }, 500) } } diff --git a/resources/assets/js/pages/manage/components/TaskDetail.vue b/resources/assets/js/pages/manage/components/TaskDetail.vue index a31aac6c4..8551593ec 100755 --- a/resources/assets/js/pages/manage/components/TaskDetail.vue +++ b/resources/assets/js/pages/manage/components/TaskDetail.vue @@ -510,6 +510,7 @@ :maxlength="200000" :placeholder="$L('输入消息...')" :send-menu="false" + @on-focus="onFocus" @on-more="onEventMore" @on-file="onSelectFile" @on-record="onRecord" @@ -746,7 +747,7 @@ export default { mounted() { this.keepInterval = setInterval(() => { this.keepUnix = $A.dayjs().unix(); - this.keepIntoInput(500); + this.keepIntoInput(); }, 1000); // emitter.on('receiveTask', this.onReceiveShow); @@ -1130,10 +1131,6 @@ export default { return; } $A.setStorage('task.dialogWidth', w); - }, - - taskContent(v) { - v && this.keepIntoInput(10) } }, @@ -1655,6 +1652,12 @@ export default { } }, + onFocus() { + this.$refs.taskDialog?.scrollIntoView({ + block: "end" + }) + }, + onEventMore(e) { if (['image', 'file'].includes(e)) { this.onUploadClick(false) @@ -2147,7 +2150,7 @@ export default { } }, - keepIntoInput(delay) { + keepIntoInput() { if (!this.$isEEUiApp) { return } @@ -2156,11 +2159,8 @@ export default { if (!this.$refs.chatInput?.isFocus) { return true; // 输入框未聚焦 } - this.$refs.taskDialog?.scrollIntoView({ - block: 'end', - behavior: 'smooth' - }) - }, delay) + this.$store.dispatch("scrollBottom", this.$refs.taskDialog) + }, 500) } } } diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 49bbbfeea..63d756133 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -1163,6 +1163,25 @@ export default { } }, + /** + * 滚动到底部(将 el 底部对齐到网页底部) + * @param state + * @param el + */ + scrollBottom({state}, el) { + if (!el) { + return + } + const rect = el.getBoundingClientRect(); + if (!rect) { + return; + } + window.scrollTo({ + top: rect.bottom + state.safeAreaSize.bottom, + behavior: 'smooth' + }); + }, + /** *****************************************************************************************/ /** *************************************** 新窗口打开 ****************************************/ /** *****************************************************************************************/