diff --git a/yunkes/src/components/staffchat/ChatMain.vue b/yunkes/src/components/staffchat/ChatMain.vue new file mode 100644 index 0000000..936cdbc --- /dev/null +++ b/yunkes/src/components/staffchat/ChatMain.vue @@ -0,0 +1,13 @@ + + + + diff --git a/yunkes/src/components/staffchat/ContactsPane.vue b/yunkes/src/components/staffchat/ContactsPane.vue new file mode 100644 index 0000000..8f24f8c --- /dev/null +++ b/yunkes/src/components/staffchat/ContactsPane.vue @@ -0,0 +1,8 @@ + + + + diff --git a/yunkes/src/components/staffchat/MomentsPane.vue b/yunkes/src/components/staffchat/MomentsPane.vue new file mode 100644 index 0000000..7f83835 --- /dev/null +++ b/yunkes/src/components/staffchat/MomentsPane.vue @@ -0,0 +1,8 @@ + + + + diff --git a/yunkes/src/components/staffchat/SessionPane.vue b/yunkes/src/components/staffchat/SessionPane.vue new file mode 100644 index 0000000..dbe5d9f --- /dev/null +++ b/yunkes/src/components/staffchat/SessionPane.vue @@ -0,0 +1,18 @@ + + + + diff --git a/yunkes/src/components/staffchat/StaffChatSide.vue b/yunkes/src/components/staffchat/StaffChatSide.vue new file mode 100644 index 0000000..cb5be7a --- /dev/null +++ b/yunkes/src/components/staffchat/StaffChatSide.vue @@ -0,0 +1,149 @@ + + + + + diff --git a/yunkes/src/components/staffchat/StatsPane.vue b/yunkes/src/components/staffchat/StatsPane.vue new file mode 100644 index 0000000..81a3337 --- /dev/null +++ b/yunkes/src/components/staffchat/StatsPane.vue @@ -0,0 +1,8 @@ + + + + diff --git a/yunkes/src/utils/__tests__/format.spec.ts b/yunkes/src/utils/__tests__/format.spec.ts index 5f8a87c..f2d34c9 100644 --- a/yunkes/src/utils/__tests__/format.spec.ts +++ b/yunkes/src/utils/__tests__/format.spec.ts @@ -36,4 +36,9 @@ describe('relativeChatTime', () => { const lastYear = new Date().getFullYear() - 1 expect(relativeChatTime(at(lastYear, 5, 10))).toBe(`${lastYear}年6月10日`) }) + + it('null/undefined → 空串(可空友好,免调用方 ?? 0 渲染 1970)', () => { + expect(relativeChatTime(null)).toBe('') + expect(relativeChatTime(undefined)).toBe('') + }) }) diff --git a/yunkes/src/utils/format.ts b/yunkes/src/utils/format.ts index 703841a..90d84ec 100644 --- a/yunkes/src/utils/format.ts +++ b/yunkes/src/utils/format.ts @@ -24,8 +24,11 @@ export function formatTimeShort(ts?: number | null): string { /** * 云客聊天窗口相对时间(会话列表/消息时间轴用): 今天→HH:mm, * 昨天→`昨天`, 今年→`M月D日`, 往年→`YYYY年M月D日`。 + * null/undefined → `''`(与 formatTimeShort 一致,调用方可直接传可空字段, + * 无需 `?? 0` 兜底——那会把缺时间渲染成 1970年1月1日)。 */ -export function relativeChatTime(ms: number): string { +export function relativeChatTime(ms?: number | null): string { + if (ms == null) return '' const d = new Date(ms) const now = new Date() const sameDay = (a: Date, b: Date) => a.toDateString() === b.toDateString() diff --git a/yunkes/src/views/StaffChat.vue b/yunkes/src/views/StaffChat.vue index 91d8e08..a1db081 100644 --- a/yunkes/src/views/StaffChat.vue +++ b/yunkes/src/views/StaffChat.vue @@ -1,14 +1,136 @@ - + + +