学习回复滚动到底部方法

This commit is contained in:
yanghang
2025-07-03 09:34:52 +08:00
parent b3d18a65c9
commit 98fb45e7da
2 changed files with 20 additions and 13 deletions
+7 -4
View File
@@ -1,6 +1,6 @@
<!-- type: 3, 段落信息 4 问题信息 5 统计信息 1语音回答 2 文本回答 0纯文本信息 不翻译 -->
<!-- type: 3, 段落信息 4 问题信息 5 统计信息 1语音回答 2 文本回答 0纯文本信息 不翻译 6: 发送loading状态-->
<template>
<view class="ai-answer" v-if="[3,4,5,6].indexOf(type) >= 0">
<view class="ai-answer" v-if="[3,4,5].indexOf(type) >= 0">
<view class="user-info">
<view class="avatar-box">
<ImagePreview class="img-box" :imgId="dataInfo?.userInfo?.imgAddr"></ImagePreview>
@@ -108,7 +108,7 @@
</view>
</view>
</view>
<view class="user-answer" v-else-if="type === 0">
<view class="user-answer" v-else-if="[0, 6].indexOf(type) >= 0">
<view class="user-info">
<view class="avatar-box">
<!-- <ImagePreview class="img-box" :imgId="''"></ImagePreview> -->
@@ -119,9 +119,12 @@
</view>
</view>
<view class="talking-info-less">
<view class="talking-text">
<view class="talking-text" v-if="type === 0">
{{ dataInfo.talkingContent }}
</view>
<view class="talking-text" v-if="type === 6">
<CommonLoading color="#fff"/>
</view>
</view>
</view>
<view v-else></view>
+13 -9
View File
@@ -43,9 +43,15 @@
</view>
<view class="body-title" @click="scrollToBottomNow">
<uv-icon class="arrow-icon" name="arrow-left" @click="common.navigateBack()"/>
课程学习
课程学习{{scrollTop}}
</view>
<scroll-view class="talking-list" :scroll-y="true">
<scroll-view
class="talking-list"
:scroll-y="true"
:scroll-top="scrollTop"
:show-scrollbar="false"
:scroll-with-animation="true"
>
<!-- <view class="talking-list-cont" id="scroll-box" ref="scrollBoxRef"> -->
<view class="study-num">
<view class="color-blue">{{ showOrder }}</view> / {{ pgrphNum }}
@@ -79,7 +85,7 @@
>按住说话
</view>
<view class="touch-btn" v-if="keyboardIsShow">
<uv-input class="input-box" ref="inputRef" v-model.trim="answerValue"
<uv-input class="input-box" ref="inputRef" v-model.trim="answerValue" maxlength="1000"
placeholderStyle='color:#999999;font-size:26rpx' placeholder="请输入答案">
</uv-input>
</view>
@@ -347,18 +353,15 @@ const nextQuestionSuccess = (info) => {
getQuestionInfoUnStudy(info.pgrphId)
}
const scrollBoxRef = ref()
const scrollTop = ref(99999)
const scrollToBottomNow = () => {
nextTick(()=>{
setTimeout(() => {
// let scrollElem = scrollBoxRef.value.$el
// // let scrollElem = document.getElementById('scroll-box')
// scrollElem.scrollTo({
// top: scrollElem.scrollHeight, behavior: 'smooth'
// })
scrollTop.value += 1
scrollTop.value += 1
let _arr = talkingList.value || []
if(_arr.length && _arr.length > 0){
let _last = talkingList.value[talkingList.value.length - 1]
console.log('#item' + _last.id)
uni.pageScrollTo({
selector: '#item' + _last.id,
duration: 300
@@ -516,6 +519,7 @@ const hideOverlayTalking = (obj) => {
userInfo: {...choiceTeacherInfo.value},
id: _id
})
scrollToBottomNow()
// #endif
//#ifdef APP-PLUS
commonUploadVoiceFile(audioPath.value, '/trastudy/traStdyInfo/studyAnswerVoiceUp', _data).then(res=>{