From ef002f9863ae45dc551c75692f6966949cf03967 Mon Sep 17 00:00:00 2001 From: eoao Date: Tue, 20 Jan 2026 21:46:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=82=AE=E7=AE=B1=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=BD=AE=E9=A1=B6=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/email-scroll/index.vue | 17 ++++---- mail-vue/src/layout/account/index.vue | 42 +++++++++++++++---- mail-vue/src/request/account.js | 7 +++- mail-worker/src/api/account-api.js | 5 +++ mail-worker/src/entity/account.js | 1 + mail-worker/src/init/init.js | 11 +++++ mail-worker/src/service/account-service.js | 31 ++++++++++++-- mail-worker/src/service/email-service.js | 4 +- 8 files changed, 94 insertions(+), 24 deletions(-) diff --git a/mail-vue/src/components/email-scroll/index.vue b/mail-vue/src/components/email-scroll/index.vue index 870af1e..aedfcc0 100644 --- a/mail-vue/src/components/email-scroll/index.vue +++ b/mail-vue/src/components/email-scroll/index.vue @@ -227,8 +227,7 @@ let skeletonRows = 0 const timePaddingRight = ref(''); const keyCount = ref(0) const queryParam = reactive({ - emailId: 0, - size: 50, + size: 50 }); defineExpose({ @@ -507,7 +506,7 @@ function addItem(email) { emailList.push(email); } - if (email.emailId > latestEmail.value.emailId) { + if (email.emailId > latestEmail.value?.emailId) { latestEmail.value = email } @@ -528,7 +527,7 @@ function addItem(email) { } } - if (email.emailId > latestEmail.value.emailId) { + if (email.emailId > latestEmail.value?.emailId) { latestEmail.value = email } @@ -566,6 +565,8 @@ function getEmailList(refresh = false) { if (reqLock) return; + let emailId = emailList.length > 0 ? emailList.at(-1).emailId : 0; + reqLock = true if (!refresh) { @@ -577,6 +578,7 @@ function getEmailList(refresh = false) { } else { getSkeletonRows() + emailId = 0 loading.value = true scrollTop = 0 } @@ -587,10 +589,11 @@ function getEmailList(refresh = false) { followLoading.value = !refresh; } let start = Date.now(); - props.getEmailList(queryParam.emailId, queryParam.size).then(async data => { + + props.getEmailList(emailId, queryParam.size).then(async data => { let end = Date.now(); let duration = end - start; - if (duration < 300 && !queryParam.emailId) { + if (duration < 300 && !emailId) { await sleep(300 - duration) } firstLoad.value = false @@ -615,7 +618,6 @@ function getEmailList(refresh = false) { followLoading.value = data.list.length >= queryParam.size; total.value = data.total; - queryParam.emailId = data.list.length > 0 ? data.list.at(-1).emailId : 0 }).finally(() => { loading.value = false reqLock = false @@ -653,7 +655,6 @@ function refresh() { function refreshList() { checkAll.value = false; isIndeterminate.value = false; - queryParam.emailId = 0; getEmailList(true); } diff --git a/mail-vue/src/layout/account/index.vue b/mail-vue/src/layout/account/index.vue index ab01a50..23c5b40 100644 --- a/mail-vue/src/layout/account/index.vue +++ b/mail-vue/src/layout/account/index.vue @@ -6,7 +6,7 @@
-