|
@ -61,6 +61,7 @@ const historyRecordRef = ref(null); |
|
|
const { getQueryVariable, setActiveTabIndex, getUserInfo } = useDataStore(); |
|
|
const { getQueryVariable, setActiveTabIndex, getUserInfo } = useDataStore(); |
|
|
const dataStore = useDataStore(); |
|
|
const dataStore = useDataStore(); |
|
|
const chatStore = useChatStore(); |
|
|
const chatStore = useChatStore(); |
|
|
|
|
|
const deepNineStore = useDeepNineStore(); |
|
|
// 变量 |
|
|
// 变量 |
|
|
// 音频管理 |
|
|
// 音频管理 |
|
|
const emotionAudioStore = useEmotionAudioStore(); |
|
|
const emotionAudioStore = useEmotionAudioStore(); |
|
@ -588,21 +589,13 @@ const getCurrentScrollContainer = () => { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const smoothScrollToBottom = async () => { |
|
|
const smoothScrollToBottom = async () => { |
|
|
// console.log("调用滚动到底部的方法"); |
|
|
|
|
|
// await nextTick(); |
|
|
|
|
|
const container = getCurrentScrollContainer(); |
|
|
const container = getCurrentScrollContainer(); |
|
|
// console.log(container, 'container') |
|
|
|
|
|
// console.log(isScrolling.value, 'isScrolling.value') |
|
|
|
|
|
if (!container) return; |
|
|
if (!container) return; |
|
|
|
|
|
|
|
|
await nextTick(); // 确保在DOM更新后执行 |
|
|
await nextTick(); // 确保在DOM更新后执行 |
|
|
|
|
|
|
|
|
if (!isScrolling.value) { |
|
|
if (!isScrolling.value) { |
|
|
container.scrollTop = container.scrollHeight - container.offsetHeight; |
|
|
container.scrollTop = container.scrollHeight - container.offsetHeight; |
|
|
// container.scrollTop = container.scrollHeight; |
|
|
|
|
|
// container.scrollTop = container.offsetHeight; |
|
|
|
|
|
// container.scrollTop = container.scrollHeight + container.offsetHeight; |
|
|
|
|
|
// console.log(container.scrollHeight, container.offsetHeight, container.scrollHeight - container.offsetHeight, container.scrollTop, "总长度", "可视长度", "位置") |
|
|
|
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -811,7 +804,18 @@ watch( |
|
|
if (activeTab.value === "AIchat" || activeTab.value === "deepNine") { |
|
|
if (activeTab.value === "AIchat" || activeTab.value === "deepNine") { |
|
|
throttledSmoothScrollToBottom(); |
|
|
throttledSmoothScrollToBottom(); |
|
|
} |
|
|
} |
|
|
// setTimeout(throttledSmoothScrollToBottom, 100); |
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
{ deep: false, immediate: true } |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
watch( |
|
|
|
|
|
() => deepNineStore.messages.length, |
|
|
|
|
|
() => { |
|
|
|
|
|
// console.log('messages变化了') |
|
|
|
|
|
// 只有在AIchat页面时才执行自动滚动 |
|
|
|
|
|
if (activeTab.value === "AIchat" || activeTab.value === "deepNine") { |
|
|
|
|
|
throttledSmoothScrollToBottom(); |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
{ deep: false, immediate: true } |
|
|
{ deep: false, immediate: true } |
|
|
); |
|
|
); |
|
@ -876,8 +880,6 @@ watch( |
|
|
// 其他页面时停止AiEmotion页面的高度监听器 |
|
|
// 其他页面时停止AiEmotion页面的高度监听器 |
|
|
stopAiEmotionHeightObserver(); |
|
|
stopAiEmotionHeightObserver(); |
|
|
} |
|
|
} |
|
|
// AiEmotion页面不执行自动滚动,避免刷新后滚动到底部 |
|
|
|
|
|
// setTimeout(throttledSmoothScrollToBottom, 100); |
|
|
|
|
|
}, |
|
|
}, |
|
|
{ deep: true, immediate: true } |
|
|
{ deep: true, immediate: true } |
|
|
); |
|
|
); |
|
|