|
|
@ -258,8 +258,6 @@ const hasTriggeredAudio = ref(false); // 是否已触发音频播放 |
|
|
|
const hasTriggeredTypewriter = ref(false); // 是否已触发打字机效果 |
|
|
|
const intersectionObserver = ref(null); // 存储observer实例 |
|
|
|
const isUserInitiated = ref(false); // 标记是否为用户主动搜索 |
|
|
|
const isUserScrolling = ref(false); // 标记用户是否正在手动滚动 |
|
|
|
const scrollTimeout = ref(null); // 滚动超时定时器 |
|
|
|
|
|
|
|
// 显示的文本内容(用于打字机效果) |
|
|
|
const displayedTexts = ref({ |
|
|
@ -846,10 +844,7 @@ function playAudio(url) { |
|
|
|
isAudioPlaying.value = true; |
|
|
|
emotionAudioStore.isPlaying = true; |
|
|
|
console.log('开始播放场景应用语音'); |
|
|
|
// 音频开始播放时,滚动到底部 |
|
|
|
// setTimeout(() => { |
|
|
|
// scrollToBottom(); |
|
|
|
// }, 100); |
|
|
|
// 音频开始播放时的自动滚动已移除 |
|
|
|
}, |
|
|
|
onend: () => { |
|
|
|
isAudioPlaying.value = false; |
|
|
@ -1518,36 +1513,11 @@ function renderCharts(data) { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// const scrollToBottom = async () => { |
|
|
|
// // 如果用户正在手动滚动,则不执行自动滚动 |
|
|
|
// if (isUserScrolling.value) { |
|
|
|
// console.log('用户正在手动滚动,跳过自动滚动'); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// scrollToBottom函数已移除 |
|
|
|
|
|
|
|
// const container = userInputDisplayRef.value; |
|
|
|
// if (!container) return; |
|
|
|
// await nextTick(); |
|
|
|
// console.log(container.scrollHeight, "container.scrollHeight"); |
|
|
|
// console.log(container.scrollTop, "container.scrollTop"); |
|
|
|
// console.log(container.offsetHeight, "container.offsetHeight"); |
|
|
|
// container.scrollTop = container.scrollHeight - container.offsetHeight; |
|
|
|
// }; |
|
|
|
|
|
|
|
// 处理用户滚动事件 |
|
|
|
// 处理用户滚动事件(用于其他滚动相关功能) |
|
|
|
const handleUserScroll = () => { |
|
|
|
isUserScrolling.value = true; |
|
|
|
|
|
|
|
// 清除之前的定时器 |
|
|
|
if (scrollTimeout.value) { |
|
|
|
clearTimeout(scrollTimeout.value); |
|
|
|
} |
|
|
|
|
|
|
|
// 设置定时器,2秒后重新允许自动滚动 |
|
|
|
scrollTimeout.value = setTimeout(() => { |
|
|
|
isUserScrolling.value = false; |
|
|
|
console.log('用户滚动结束,重新允许自动滚动'); |
|
|
|
}, 2000); |
|
|
|
// 用户滚动事件处理逻辑已简化,因为自动滚动功能已移除 |
|
|
|
}; |
|
|
|
|
|
|
|
// 处理滚轮事件 |
|
|
@ -1589,16 +1559,11 @@ function isDataLoaded() { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
console.log('所有数据和组件已加载完成,可以开始滚动'); |
|
|
|
console.log('所有数据和组件已加载完成'); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
// 自动滚动函数(已禁用) |
|
|
|
function startAutoScroll() { |
|
|
|
// 自动滚动功能已被禁用 |
|
|
|
console.log('自动滚动功能已被禁用'); |
|
|
|
return; |
|
|
|
} |
|
|
|
// 自动滚动函数已移除 |
|
|
|
|
|
|
|
// 设置Intersection Observer监听场景应用部分 |
|
|
|
function setupIntersectionObserver() { |
|
|
@ -1690,12 +1655,7 @@ function setupIntersectionObserver() { |
|
|
|
intersectionObserver.value = observer; |
|
|
|
} |
|
|
|
|
|
|
|
// 手动触发自动滚动(已禁用) |
|
|
|
function triggerAutoScroll() { |
|
|
|
// 自动滚动功能已被禁用 |
|
|
|
console.log('自动滚动功能已被禁用'); |
|
|
|
return; |
|
|
|
} |
|
|
|
// 手动触发自动滚动函数已移除 |
|
|
|
|
|
|
|
// 返回顶部功能 |
|
|
|
const scrollToTop = () => { |
|
|
@ -1911,11 +1871,7 @@ onUnmounted(() => { |
|
|
|
window.removeEventListener('scroll', handlePageScroll); |
|
|
|
document.removeEventListener('scroll', handlePageScroll); |
|
|
|
|
|
|
|
// 清理滚动定时器 |
|
|
|
if (scrollTimeout.value) { |
|
|
|
clearTimeout(scrollTimeout.value); |
|
|
|
scrollTimeout.value = null; |
|
|
|
} |
|
|
|
// 滚动相关清理已简化 |
|
|
|
}); |
|
|
|
|
|
|
|
// 声明组件可以触发的事件 |
|
|
@ -1923,8 +1879,7 @@ const emit = defineEmits(['updateMessage', 'sendMessage', 'ensureAIchat']); |
|
|
|
|
|
|
|
// 导出方法供外部使用 |
|
|
|
defineExpose({ |
|
|
|
handleSendMessage, |
|
|
|
triggerAutoScroll |
|
|
|
handleSendMessage |
|
|
|
}); |
|
|
|
</script> |
|
|
|
|
|
|
|