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({