From 2c5cea15650d54ffa834199283600dd54dad1dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Thu, 27 Aug 2026 15:15:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(staffchat):=20=E8=81=8A=E5=A4=A9=E7=AA=97?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=97=B6=E6=AE=B5=E6=94=B9=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E6=97=B6=E9=97=B4+=E7=A9=BA=E6=80=81=E5=88=86=E8=AF=AD(?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8A=A5=E5=BE=88=E5=A4=9A=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=A9=BA=E7=9A=84)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit defaultRange() 默认近 14 天窗,实测 78% 群(766/979)/89% 单聊(9374/10497) 的最新消息在任意 14 天窗外——这些会话打开即全空(典型:张士蓓「11台长安X5」 1016 条消息全在 7-27 前,默认窗滤成 0 条,云客后台却看得到)。云客默认直接 展示最近消息不限窗,对齐改为默认全部时间;首屏本就跳最后一页看最新+上翻 加载更旧,全量窗下首屏仍只拉一页。空态分语:有窗=「所选时间范围内无消息, 清空日期窗可查看全部」,无窗=「该会话无聊天记录」(真没聊过)。 Co-Authored-By: Claude --- yunkes/src/components/staffchat/ChatMain.vue | 25 +++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/yunkes/src/components/staffchat/ChatMain.vue b/yunkes/src/components/staffchat/ChatMain.vue index ec7b740..996cc0f 100644 --- a/yunkes/src/components/staffchat/ChatMain.vue +++ b/yunkes/src/components/staffchat/ChatMain.vue @@ -1,6 +1,6 @@ @@ -101,18 +101,12 @@ const conversationTitle = computed(() => { return isGroup.value ? `群聊记录 · ${displayName}` : `与 ${displayName} 的聊天记录` }) -// ── 日期窗:云客对齐,默认近 14 天;清空 = 全部时间(null) ───────────────────── +// ── 日期窗:默认全部时间(null);选窗后按窗过滤,清空回到全部 ────────────────── // route.query 合法 ms start/end 仍优先(带日期窗的跳转入口,如红包明细)。 - -/** 近 14 天窗:今天往前 13 天的 00:00:00 ~ 今天 23:59:59.999。 */ -function defaultRange(): [Date, Date] { - const end = new Date() - end.setHours(23, 59, 59, 999) - const start = new Date() - start.setDate(start.getDate() - 13) - start.setHours(0, 0, 0, 0) - return [start, end] -} +// 2026-08-27 前 defaultRange() 默认近 14 天——实测 78% 群/89% 单聊的最新消息 +// 在任意 14 天窗之外,这些会话打开即全空(用户报「很多聊天记录都是空的」); +// 云客默认直接展示最近消息不限窗,故对齐改为默认全部。前端本就「首屏跳到 +// 最后一页看最新 + 上翻加载更旧」,全量窗下首屏仍只拉一页,性能无忧。 function rangeFromQuery(): [Date, Date] | null { const s = route.query.start, @@ -125,7 +119,7 @@ function rangeFromQuery(): [Date, Date] | null { return null } -const dateRange = ref<[Date, Date] | null>(rangeFromQuery() ?? defaultRange()) +const dateRange = ref<[Date, Date] | null>(rangeFromQuery() ?? null) const winStart = computed(() => dateRange.value?.[0].getTime()) const winEnd = computed(() => dateRange.value?.[1].getTime()) const keyword = ref('') @@ -442,7 +436,10 @@ const drawerTitle = computed(() => {