diff --git a/src/views/homePage.vue b/src/views/homePage.vue index f355f19..52afc47 100644 --- a/src/views/homePage.vue +++ b/src/views/homePage.vue @@ -403,7 +403,12 @@ const throttledSmoothScrollToBottom = _.throttle(smoothScrollToBottom, 300, { // AiEmotion页面自动滚动到底部的防抖函数 const debouncedAiEmotionScrollToBottom = _.debounce(() => { - if (activeTab.value === 'AiEmotion' && isAiEmotionAutoScrollEnabled.value && !isAiEmotionUserScrolling.value && !isChartInteracting.value) { + if ( + activeTab.value === "AiEmotion" && + isAiEmotionAutoScrollEnabled.value && + !isAiEmotionUserScrolling.value && + !isChartInteracting.value + ) { const container = tabContentAiEmotion.value; if (container) { container.scrollTop = container.scrollHeight - container.offsetHeight; @@ -420,7 +425,11 @@ const startAiEmotionHeightObserver = () => { // 创建ResizeObserver监听页面内容变化 aiEmotionHeightObserver.value = new ResizeObserver((entries) => { - if (isAiEmotionAutoScrollEnabled.value && activeTab.value === 'AiEmotion' && !isChartInteracting.value) { + if ( + isAiEmotionAutoScrollEnabled.value && + activeTab.value === "AiEmotion" && + !isChartInteracting.value + ) { debouncedAiEmotionScrollToBottom(); } }); @@ -450,8 +459,13 @@ const startAiEmotionHeightObserver = () => { } } }); - - if (shouldScroll && isAiEmotionAutoScrollEnabled.value && activeTab.value === 'AiEmotion' && !isChartInteracting.value) { + + if ( + shouldScroll && + isAiEmotionAutoScrollEnabled.value && + activeTab.value === "AiEmotion" && + !isChartInteracting.value + ) { debouncedAiEmotionScrollToBottom(); } }); @@ -503,7 +517,7 @@ const handleAiEmotionUserScroll = () => { const handleChartInteractionStart = () => { console.log("图表交互开始,临时禁用自动滚动"); isChartInteracting.value = true; - + // 清除之前的定时器 if (chartInteractionTimer.value) { clearTimeout(chartInteractionTimer.value); @@ -515,7 +529,7 @@ const handleChartInteractionEnd = () => { if (chartInteractionTimer.value) { clearTimeout(chartInteractionTimer.value); } - + // 设置定时器,1秒后恢复自动滚动 chartInteractionTimer.value = setTimeout(() => { isChartInteracting.value = false; @@ -909,12 +923,14 @@ const backToHome = () => { if (env == "development" || env == "test") { window.parent.location.href = "http://121.89.234.155:8807/hljw/homepage?menu=999999991"; - } else if (env == "product") { - window.parent.location.href = - "https://web.homilychart.com/product/hljw/homepage?menu=999999991"; - } else if (env == "production") { - window.parent.location.href = - "https://web.homilychart.com/hljw/homepage?menu=999999991"; + } else { + window.parent.postMessage( + { + type: "NAVIGATE_TO_HOMEPAGE", + menu: "999999991", + }, + "*" + ); } // window.parent.location.href = window.parent.document.referrer } @@ -1109,17 +1125,17 @@ onUnmounted(() => { } // 清理AiEmotion页面的高度监听器 stopAiEmotionHeightObserver(); - + // 清理图表交互相关的定时器和全局函数 - if (chartInteractionTimer.value) { - clearTimeout(chartInteractionTimer.value); - } - if (window.handleChartInteractionStart) { - delete window.handleChartInteractionStart; - } - if (window.handleChartInteractionEnd) { - delete window.handleChartInteractionEnd; - } + if (chartInteractionTimer.value) { + clearTimeout(chartInteractionTimer.value); + } + if (window.handleChartInteractionStart) { + delete window.handleChartInteractionStart; + } + if (window.handleChartInteractionEnd) { + delete window.handleChartInteractionEnd; + } });