From e77ca33753925dadf946999127e90114822ae6ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=9D=B0?= Date: Sat, 5 Jul 2025 13:25:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3edge=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E5=85=8D=E8=B4=A3=E5=A3=B0=E6=98=8E=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/AiEmotion.vue | 161 +++++++++++++++++++++++------------------------- vite.config.js | 4 -- 2 files changed, 78 insertions(+), 87 deletions(-) diff --git a/src/views/AiEmotion.vue b/src/views/AiEmotion.vue index d2f28e6..8e03cfb 100644 --- a/src/views/AiEmotion.vue +++ b/src/views/AiEmotion.vue @@ -294,7 +294,7 @@ const displayDate = computed(() => { if (!currentStock.value?.apiData) return ""; const lastData = currentStock.value.apiData.GSWDJ?.at(-1); if (!lastData || !lastData[0]) return ""; - + const dateStr = lastData[0]; // 假设原格式为 YYYY-MM-DD 或 YYYY/MM/DD const dateMatch = dateStr.match(/(\d{4})[\-\/](\d{1,2})[\-\/](\d{1,2})/); @@ -303,7 +303,7 @@ const displayDate = computed(() => { // 转换为 DD/MM/YYYY 格式 return `更新时间:${day.padStart(2, '0')}/${month.padStart(2, '0')}/${year}`; } - + // 如果不匹配预期格式,返回原始值 return dateStr; }); @@ -1179,7 +1179,7 @@ const scrollToBottom = async () => { console.log('用户正在手动滚动,跳过自动滚动'); return; } - + const container = userInputDisplayRef.value; if (!container) return; await nextTick(); @@ -1192,12 +1192,12 @@ const scrollToBottom = async () => { // 处理用户滚动事件 const handleUserScroll = () => { isUserScrolling.value = true; - + // 清除之前的定时器 if (scrollTimeout.value) { clearTimeout(scrollTimeout.value); } - + // 设置定时器,2秒后重新允许自动滚动 scrollTimeout.value = setTimeout(() => { isUserScrolling.value = false; @@ -1415,7 +1415,7 @@ onMounted(async () => { // 添加新的监听器 window.addEventListener('resize', globalResizeHandler); window.aiEmotionGlobalResizeHandler = globalResizeHandler; - + // 添加滚动事件监听器 const container = userInputDisplayRef.value; if (container) { @@ -1495,7 +1495,7 @@ onUnmounted(() => { window.removeEventListener('resize', window.aiEmotionGlobalResizeHandler); window.aiEmotionGlobalResizeHandler = null; } - + // 清理滚动事件监听器 const container = userInputDisplayRef.value; if (container) { @@ -1503,7 +1503,7 @@ onUnmounted(() => { container.removeEventListener('touchmove', handleTouchMove); container.removeEventListener('scroll', handleUserScroll); } - + // 清理滚动定时器 if (scrollTimeout.value) { clearTimeout(scrollTimeout.value); @@ -1522,12 +1522,10 @@ defineExpose({