Browse Source

解决情绪大模型交互图表时触发自动滚动的问题。

milestone-20250820-金币兑换Token
宋杰 3 days ago
parent
commit
1c86468b86
  1. 38
      src/views/components/emoEnergyConverter.vue
  2. 38
      src/views/components/emotionDecod.vue
  3. 38
      src/views/components/emotionalBottomRadar.vue
  4. 39
      src/views/components/marketTemperature.vue
  5. 47
      src/views/homePage.vue

38
src/views/components/emoEnergyConverter.vue

@ -862,6 +862,44 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
};
//
qxnlzhqEchartsInstance.setOption(option);
//
if (qxnlzhqEchartsInstance) {
//
qxnlzhqEchartsInstance.on('dataZoom', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
//
qxnlzhqEchartsInstance.on('mousewheel', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
//
qxnlzhqEchartsInstance.on('mousedown', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
//
qxnlzhqEchartsInstance.on('mouseup', () => {
if (window.handleChartInteractionEnd) {
window.handleChartInteractionEnd();
}
});
//
qxnlzhqEchartsInstance.on('click', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
}
// resize
const debounce = (func, wait) => {

38
src/views/components/emotionDecod.vue

@ -412,6 +412,44 @@ function initQXNLZHEcharts(kline, qxnlzhqData) {
}
KlineCanvsChart = echarts.init(KlineCanvs.value);
KlineCanvsChart.setOption(KlineOption);
//
if (KlineCanvsChart) {
//
KlineCanvsChart.on('dataZoom', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
//
KlineCanvsChart.on('mousewheel', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
//
KlineCanvsChart.on('mousedown', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
//
KlineCanvsChart.on('mouseup', () => {
if (window.handleChartInteractionEnd) {
window.handleChartInteractionEnd();
}
});
//
KlineCanvsChart.on('click', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
}
// resize
const debounce = (func, wait) => {

38
src/views/components/emotionalBottomRadar.vue

@ -676,6 +676,44 @@ function initEmotionalBottomRadar(KlineData, barAndLineData) {
// 使
bottomRadarChart.setOption(option)
//
if (bottomRadarChart) {
//
bottomRadarChart.on('dataZoom', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
//
bottomRadarChart.on('mousewheel', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
//
bottomRadarChart.on('mousedown', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
//
bottomRadarChart.on('mouseup', () => {
if (window.handleChartInteractionEnd) {
window.handleChartInteractionEnd();
}
});
//
bottomRadarChart.on('click', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
}
//
if (bottomRadarRef.value) {

39
src/views/components/marketTemperature.vue

@ -678,6 +678,45 @@ function initChart(raw, klineDataRawValue, WDRLValue) {
},
],
});
//
if (chartInstance) {
//
chartInstance.on('dataZoom', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
//
chartInstance.on('mousewheel', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
//
chartInstance.on('mousedown', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
//
chartInstance.on('mouseup', () => {
if (window.handleChartInteractionEnd) {
window.handleChartInteractionEnd();
}
});
//
chartInstance.on('click', () => {
if (window.handleChartInteractionStart) {
window.handleChartInteractionStart();
}
});
}
// resize
const debounce = (func, wait) => {
let timeout;

47
src/views/homePage.vue

@ -370,6 +370,8 @@ const aiEmotionHeightObserver = ref(null);
const isAiEmotionAutoScrollEnabled = ref(false);
const isAiEmotionUserScrolling = ref(false); //
const aiEmotionScrollTimer = ref(null); //
const isChartInteracting = ref(false); //
const chartInteractionTimer = ref(null); //
//
const getCurrentScrollContainer = () => {
@ -406,7 +408,7 @@ const throttledSmoothScrollToBottom = _.throttle(smoothScrollToBottom, 300, {
// AiEmotion
const debouncedAiEmotionScrollToBottom = _.debounce(() => {
if (activeTab.value === 'AiEmotion' && isAiEmotionAutoScrollEnabled.value && !isAiEmotionUserScrolling.value) {
if (activeTab.value === 'AiEmotion' && isAiEmotionAutoScrollEnabled.value && !isAiEmotionUserScrolling.value && !isChartInteracting.value) {
const container = tabContentAiEmotion.value;
if (container) {
container.scrollTop = container.scrollHeight - container.offsetHeight;
@ -423,7 +425,7 @@ const startAiEmotionHeightObserver = () => {
// ResizeObserver
aiEmotionHeightObserver.value = new ResizeObserver((entries) => {
if (isAiEmotionAutoScrollEnabled.value && activeTab.value === 'AiEmotion') {
if (isAiEmotionAutoScrollEnabled.value && activeTab.value === 'AiEmotion' && !isChartInteracting.value) {
debouncedAiEmotionScrollToBottom();
}
});
@ -454,7 +456,7 @@ const startAiEmotionHeightObserver = () => {
}
});
if (shouldScroll && isAiEmotionAutoScrollEnabled.value && activeTab.value === 'AiEmotion') {
if (shouldScroll && isAiEmotionAutoScrollEnabled.value && activeTab.value === 'AiEmotion' && !isChartInteracting.value) {
debouncedAiEmotionScrollToBottom();
}
});
@ -500,6 +502,34 @@ const handleAiEmotionUserScroll = () => {
// }, 2000);
};
//
const handleChartInteractionStart = () => {
console.log("图表交互开始,临时禁用自动滚动");
isChartInteracting.value = true;
//
if (chartInteractionTimer.value) {
clearTimeout(chartInteractionTimer.value);
}
};
const handleChartInteractionEnd = () => {
//
if (chartInteractionTimer.value) {
clearTimeout(chartInteractionTimer.value);
}
// 1
chartInteractionTimer.value = setTimeout(() => {
isChartInteracting.value = false;
console.log("图表交互结束,恢复自动滚动");
}, 1000);
};
// 使
window.handleChartInteractionStart = handleChartInteractionStart;
window.handleChartInteractionEnd = handleChartInteractionEnd;
// AiEmotion
const handleAiEmotionScrollToBottom = () => {
if (activeTab.value === 'AiEmotion') {
@ -1001,6 +1031,17 @@ onUnmounted(() => {
}
// AiEmotion
stopAiEmotionHeightObserver();
//
if (chartInteractionTimer.value) {
clearTimeout(chartInteractionTimer.value);
}
if (window.handleChartInteractionStart) {
delete window.handleChartInteractionStart;
}
if (window.handleChartInteractionEnd) {
delete window.handleChartInteractionEnd;
}
});
</script>

Loading…
Cancel
Save