diff --git a/src/components/LoginDialog/components/FormLogin/VerificationCode.vue b/src/components/LoginDialog/components/FormLogin/VerificationCode.vue new file mode 100644 index 0000000..1ccc256 --- /dev/null +++ b/src/components/LoginDialog/components/FormLogin/VerificationCode.vue @@ -0,0 +1,46 @@ + + + + + + diff --git a/src/components/LoginDialog/components/QrCodeLogin/index.vue b/src/components/LoginDialog/components/QrCodeLogin/index.vue new file mode 100644 index 0000000..6a67c7e --- /dev/null +++ b/src/components/LoginDialog/components/QrCodeLogin/index.vue @@ -0,0 +1,96 @@ + + + + + + diff --git a/src/components/LoginDialog/index.vue b/src/components/LoginDialog/index.vue new file mode 100644 index 0000000..90f1519 --- /dev/null +++ b/src/components/LoginDialog/index.vue @@ -0,0 +1,158 @@ + + + + + + diff --git a/src/components/WelecomeText/index.vue b/src/components/WelecomeText/index.vue new file mode 100644 index 0000000..f6f39cd --- /dev/null +++ b/src/components/WelecomeText/index.vue @@ -0,0 +1,20 @@ + + + + + + diff --git a/src/hooks/useCollapseToggle.ts b/src/hooks/useCollapseToggle.ts index d9e44cf..d9109aa 100644 --- a/src/hooks/useCollapseToggle.ts +++ b/src/hooks/useCollapseToggle.ts @@ -51,7 +51,7 @@ export function useCollapseToggle(threshold: number = COLLAPSE_THRESHOLD) { // 使用示例与特性说明 // diff --git a/src/hooks/useSafeArea.ts b/src/hooks/useSafeArea.ts index 675d1fe..9192980 100644 --- a/src/hooks/useSafeArea.ts +++ b/src/hooks/useSafeArea.ts @@ -76,8 +76,9 @@ export function useSafeArea(options: SafeAreaOptions): { isInSafeArea: Ref {}) 进行监听。 // const { isMobile } = useScreenStore(); /** 适配移动端结束 */ diff --git a/src/hooks/useTimeGreeting.ts b/src/hooks/useTimeGreeting.ts new file mode 100644 index 0000000..e0f3202 --- /dev/null +++ b/src/hooks/useTimeGreeting.ts @@ -0,0 +1,36 @@ +import { ref } from 'vue'; + +type TimeGreeting = '凌晨' | '清晨' | '早上' | '中午' | '下午' | '傍晚' | '晚上'; + +// 时间分段配置(按顺序排列,find会返回第一个匹配项) +const timeRanges: Array<[start: number, end: number, label: TimeGreeting]> = [ + [0, 5, '凌晨'], + [5, 7, '清晨'], + [7, 12, '早上'], + [12, 14, '中午'], + [14, 18, '下午'], + [18, 21, '傍晚'], + [21, 24, '晚上'], +]; + +/** + * 获取当前时段问候语(Vue组合式函数) + * @returns 响应式的时段问候语 + */ +export function useTimeGreeting() { + // 直接计算初始值(合并初始化逻辑) + const currentHour = new Date().getHours(); + const greeting = timeRanges.find(([s, e]) => currentHour >= s && currentHour < e)?.[2] || '晚上'; + + // 使用ref保持响应式(即使不更新,组件仍可正确绑定) + return ref(greeting); +} + +// 示例用法(在Vue组件中) +// +// diff --git a/src/layouts/LayoutVertical/index.vue b/src/layouts/LayoutVertical/index.vue index 319b9ef..8468681 100644 --- a/src/layouts/LayoutVertical/index.vue +++ b/src/layouts/LayoutVertical/index.vue @@ -44,8 +44,9 @@ useWindowWidthObserver(); diff --git a/src/pages/chat/index.vue b/src/pages/chat/index.vue index 925805c..f0be3c0 100644 --- a/src/pages/chat/index.vue +++ b/src/pages/chat/index.vue @@ -1,19 +1,24 @@ + + diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index 4541ae2..e426694 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -1,10 +1,10 @@