hookehuyr

fix(StudyDetailPage): 调整评论区域滚动偏移量并重新计算容器高度

将评论区域的滚动偏移量从30调整为20,以提高用户体验。同时,在点击课程时重新计算顶部和底部容器的高度,确保布局正确
......@@ -332,7 +332,7 @@ const handleScroll = () => {
if (!introElement || !commentElement) return;
const scrollTop = window.scrollY;
const commentOffset = commentElement.offsetTop - parseInt(topWrapperHeight.value) - 30; // 30是一个偏移量
const commentOffset = commentElement.offsetTop - parseInt(topWrapperHeight.value) - 20; // 20是一个偏移量
// 根据滚动位置更新activeTab
if (scrollTop >= commentOffset) {
......@@ -365,6 +365,18 @@ const handleLessonClick = async (lesson) => {
commentList.value = comment.data.comment_list;
commentCount.value = comment.data.comment_count;
}
// 重新计算顶部和底部容器的高度
nextTick(() => {
const topWrapper = document.querySelector('.top-wrapper');
const bottomWrapper = document.querySelector('.bottom-wrapper');
if (topWrapper) {
topWrapperHeight.value = topWrapper.clientHeight + 'px';
}
if (bottomWrapper) {
bottomWrapperHeight.value = bottomWrapper.clientHeight + 'px';
}
});
}
};
......