Merge branch 'dev-20250930' of http://25.13.9.101:9000/K17_AITS/tra-app into dev-20250930

This commit is contained in:
田岩
2025-08-08 14:23:03 +08:00
5 changed files with 194 additions and 126 deletions
+46 -9
View File
@@ -34,6 +34,9 @@
<image class="btn-box" v-else src="/src/static/images/course/close-active.png" mode=""></image>
</view>
</view>
<view :class="['talk-dialog',isOut?'is-out':'']">
<image src="@/static/images/course/voice-white.gif" mode="" class="gif-box"></image>
</view>
</view>
</uv-overlay>
</view>
@@ -150,22 +153,24 @@ const initRecord = () => {
})
}
const startFlag = ref(1)
const canStart = ref(true)
const startRecord = () => {
unref(recordObjCom).start({format:'mp3'})
}
const stopRecord = () => {
// setTimeout(() => {
try{
if(unref(recordObjCom).stop){
unref(recordObjCom).stop()
}else{
closeModel()
}
}catch{
try{
if(unref(recordObjCom).stop){
unref(recordObjCom).stop()
}else{
closeModel()
}
// }, 500)
}catch{
closeModel()
}
setTimeout(() => {
canStart.value = true
}, 1000)
}
const closeModel = (cb = () => {}) => {
setTimeout(() => {
@@ -255,6 +260,9 @@ const showOverlayTalking = (obj) => {
})
return
}
if(!canStart.value){
return
}
isMoving.value = true
emit('startRecord')
recNum.value += 1
@@ -263,6 +271,7 @@ const showOverlayTalking = (obj) => {
touchY.value = obj.changedTouches[0].pageY
baseY.value = obj.currentTarget.offsetTop
//#ifdef APP-PLUS
canStart.value = false
startRecord()
// #endif
setTimeout(() => {
@@ -442,6 +451,34 @@ const changeBtn = () => {
height: 234rpx;
margin: 0 auto;
background-color: #06f;
border-radius: 32rpx;
position: relative;
&.is-out{
background-color: #ff3e49;
&::after{
background-color: #ff3e49;
}
}
.gif-box{
position: absolute;
width: 200rpx;
height: 80rpx;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
&::after{
content: '';
width: 44rpx;
height: 44rpx;
clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
background-color: #06f;
overflow: hidden;
position: absolute;
bottom: -22rpx;
left:50%;
margin-left: -22rpx;
}
}
.white-bg-box{
height: 365rpx;
+16 -6
View File
@@ -48,9 +48,9 @@
<uv-icon class="arrow-icon" name="arrow-left" @click="backRouter()"/>
课程学习
</view>
<view class="study-num">
<view class="color-blue">{{ showOrder }}</view> / {{ pgrphNum }}
</view>
<view class="study-num">
<view class="color-blue">{{ showOrder }}</view> / {{ pgrphNum }}
</view>
<scroll-view
class="talking-list"
:scroll-y="true"
@@ -645,7 +645,13 @@ onMounted(()=>{
initsocketTask()
getData('1');
})
const keyboardHeight = ref('0px')
const setHeight = (res) => {
keyboardHeight.value = res.height +'px'
scrollToBottomNow()
}
onHide(()=>{
uni.offKeyboardHeightChange(setHeight)
if(watchFlag.value === 1) return
changePlayItemId('')
socketStore.closeSocket()
@@ -654,6 +660,7 @@ onHide(()=>{
// }).finally(() => {})
})
onShow(()=>{
uni.onKeyboardHeightChange(setHeight)
if(watchFlag.value === 1) return
// getData('2');
initsocketTask()
@@ -959,8 +966,9 @@ const chooseRateNow = (item) => {
position: absolute;
overflow: hidden;
left:0;
top: 0;
height: 100%;
bottom: 0;
// height: 100%;
height: calc(100% - v-bind(keyboardHeight));
width: 100%;
padding:0 0rpx;
box-sizing: border-box;
@@ -991,7 +999,8 @@ const chooseRateNow = (item) => {
height: 36rpx;
line-height: 36rpx;
text-align: center;
padding-top: 30rpx;
padding-top: 20rpx;
padding-bottom: 10rpx;
box-sizing: content-box;
background: url(@/static/images/course/study-bg.png) no-repeat;
border-radius: 30rpx 30rpx 0 0;
@@ -1006,6 +1015,7 @@ const chooseRateNow = (item) => {
padding: 10rpx 30rpx;
background: url(@/static/images/course/study-bg.png) no-repeat;
background-size: cover;
background-position: center bottom;
box-sizing: border-box;
width: 100%;
.talking-list-cont{
+95 -90
View File
@@ -9,14 +9,14 @@
<view class="talking-cont">
<MarkdownPreview :mdString="mdText"/>
</view>
<view class="btns-cont" v-if="false">
<view class="btns-cont" v-if="!props.isAnswering">
<view class="replay-btn" @click="reAnswer">
<image class="icon" src="@/static/images/dialog/answer-restart.png" style="width: 100%;height: 100%;"></image>
</view>
<view class="replay-btn" @click="stopAnswer">
<!-- <view class="replay-btn" @click="stopAnswer">
<image class="icon" src="@/static/images/dialog/answer-stop.png" style="width: 100%;height: 100%;"></image>
</view>
<!-- <view class="replay-btn" @click="zanAnswer">
</view> -->
<view class="replay-btn" @click="zanAnswer">
<image
class="icon"
src="@/static/images/dialog/answer-zan.png"
@@ -39,7 +39,7 @@
src="@/static/images/dialog/answer-yifankui.png"
style="width: 100%;height: 100%;"
></image>
</view> -->
</view>
</view>
</view>
</template>
@@ -57,6 +57,10 @@
isLoading:{
default: false,
type:Boolean
},
isAnswering: {
default: false,
type: Boolean
}
})
@@ -89,95 +93,96 @@
.talking-cont{
padding-bottom: 20rpx;
}
.btns-cont{
.btns-cont{
overflow: hidden;
border-top: 3rpx solid #eee;
padding-bottom: 10rpx;
.replay-btn{
float: left;
width: 46rpx;
height: 46rpx;
overflow: hidden;
border-top: 3rpx solid #eee;
.replay-btn{
float: left;
width: 46rpx;
height: 46rpx;
overflow: hidden;
margin-right: 16rpx;
margin-top: 25rpx;
}
.play-btn{
float: left;
width: 46rpx;
height: 46rpx;
overflow: hidden;
margin-right: 16rpx;
margin-top: 25rpx;
}
.next-learn-btn{
float: left;
padding: 0 60rpx 0 20rpx;
height: 62rpx;
line-height: 62rpx;
font-size: 30rpx;
background-color: #06f;
color: #fff;
border-radius: 8rpx;
margin-top: 16rpx;
margin-right: 16rpx;
position: relative;
&.replay-study-btn{
float: right;
}
&.restart{
background-color: #eaf2ff;
color: #06f;
}
.icon-iamge{
width: 25rpx;
height: 25rpx;
position: absolute;
right: 20rpx;
top: 50%;
margin-top: -12rpx;
}
}
.replay-learn-btn{
float: left;
padding: 0 60rpx 0 20rpx;
height: 62rpx;
line-height: 62rpx;
font-size: 30rpx;
color: #06f;
background-color: #eaf2ff;
border-radius: 8rpx;
margin-top: 16rpx;
margin-right: 16rpx;
position: relative;
.icon-iamge{
width: 25rpx;
height: 25rpx;
position: absolute;
right: 20rpx;
top: 50%;
margin-top: -12rpx;
}
}
.next-btn{
margin-right: 20rpx;
margin-top: 20rpx;
}
.play-btn{
float: left;
width: 46rpx;
height: 46rpx;
overflow: hidden;
margin-right: 20rpx;
margin-top: 20rpx;
}
.next-learn-btn{
float: left;
padding: 0 60rpx 0 20rpx;
height: 62rpx;
line-height: 62rpx;
font-size: 30rpx;
background-color: #06f;
color: #fff;
border-radius: 8rpx;
margin-top: 16rpx;
margin-right: 16rpx;
position: relative;
&.replay-study-btn{
float: right;
padding: 0 60rpx 0 20rpx;
height: 62rpx;
line-height: 62rpx;
font-size: 30rpx;
background-color: #06f;
color: #fff;
border-radius: 8rpx;
margin-top: 16rpx;
position: relative;
.icon-iamge{
width: 25rpx;
height: 25rpx;
position: absolute;
right: 20rpx;
top: 50%;
margin-top: -12rpx;
}
}
&.restart{
background-color: #eaf2ff;
color: #06f;
}
.icon-iamge{
width: 25rpx;
height: 25rpx;
position: absolute;
right: 20rpx;
top: 50%;
margin-top: -12rpx;
}
}
.replay-learn-btn{
float: left;
padding: 0 60rpx 0 20rpx;
height: 62rpx;
line-height: 62rpx;
font-size: 30rpx;
color: #06f;
background-color: #eaf2ff;
border-radius: 8rpx;
margin-top: 16rpx;
margin-right: 16rpx;
position: relative;
.icon-iamge{
width: 25rpx;
height: 25rpx;
position: absolute;
right: 20rpx;
top: 50%;
margin-top: -12rpx;
}
}
.next-btn{
float: right;
padding: 0 60rpx 0 20rpx;
height: 62rpx;
line-height: 62rpx;
font-size: 30rpx;
background-color: #06f;
color: #fff;
border-radius: 8rpx;
margin-top: 16rpx;
position: relative;
.icon-iamge{
width: 25rpx;
height: 25rpx;
position: absolute;
right: 20rpx;
top: 50%;
margin-top: -12rpx;
}
}
}
}
</style>
@@ -10,6 +10,7 @@
v-else-if="talkingType === 'answer'"
:dataInfo="props.talkingInfo"
:isLoading="!!props.talkingInfo.isLoading"
:isAnswering="props.isAnswering"
@handleEvents="handleEvents"
></answerVue>
<view v-else></view>
@@ -34,6 +35,10 @@
activeVoiceId:{
default:'',
type: String
},
isAnswering: {
default: false,
type: Boolean
}
})
watch(() => props.activeVoiceId, () => {},{deep: true,immediate: true})
+32 -21
View File
@@ -14,6 +14,7 @@
<image src="@/static/images/dialog/history.png" alt="" class="image-icon"></image>
</view>
</view>
<view class="ai-info">
<!-- <image src="@/static/images/dialog/pet-3.png" alt="" class="image-pet-bg"></image> -->
<image src="@/static/images/dialog/pet-bg-base.png" alt="" class="image-pet-bg"></image>
@@ -43,7 +44,7 @@
<view class="talking-list">
<scroll-view class="talking-scroll-list" :scroll-y="true" :scroll-top="scrollTop"
:show-scrollbar="false" :scroll-with-animation="false">
<TalkingItem v-for="item in talkingList" :talkingType="item.type" :talkingInfo="item"
<TalkingItem v-for="item in talkingList" :talkingType="item.type" :talkingInfo="item" :isAnswering="!answerIsOver"
:activeVoiceId="activeVoiceTalkingItemId" @handleEvents="talkItemEvents">
</TalkingItem>
</scroll-view>
@@ -286,7 +287,8 @@
talkingText: answerText.value,
isLoading: false,
id: _id,
...body
...body,
askData: {...askData.value}
})
} else if (body.event === 'token') {
answerIsOver.value = false
@@ -349,22 +351,26 @@
const talkItemEvents = (type, data, id = '') => {
switch (type) {
case 'reAnswer':
console.log('重新获取数据')
// 设置停止回调
stopAnswerCallBack.value = ($data) => {
sendMessage({
"commond": 'ASK',
"body": $data
})
}
// 停止获取
console.log('重新提问回答')
sendMessage({
"commond": 'ASK-STOP',
"body": {
reqBatch: reqBatch.value,
seqNo: seqNo.value,
}
"commond": 'ASK',
"body": data.askData
})
// // 设置停止回调
// stopAnswerCallBack.value = ($data) => {
// sendMessage({
// "commond": 'ASK',
// "body": $data
// })
// }
// // 停止获取
// sendMessage({
// "commond": 'ASK-STOP',
// "body": {
// reqBatch: reqBatch.value,
// seqNo: seqNo.value,
// }
// })
break;
case 'stop':
console.log('停止获取数据')
@@ -541,11 +547,16 @@
const refreshData = () => {
loadData();
};
const keyboardHeight = ref('0px')
const setHeight = (res) => {
keyboardHeight.value = res.height +'px'
}
onHide(() => {
uni.offKeyboardHeightChange(setHeight)
})
onShow(() => {
uni.onKeyboardHeightChange(setHeight)
})
onUnload(() => {
watchFlag.value = 1
@@ -561,7 +572,7 @@
position: relative;
display: flex;
flex-direction: column;
height: 100vh;
height: calc(100vh - 0px);
overflow: hidden;
}
@@ -582,8 +593,8 @@
position: absolute;
overflow: hidden;
left: 0;
top: 0%;
height: 100%;
bottom: 0%;
height: calc(100% - v-bind(keyboardHeight));
width: 100%;
padding: 0;
box-sizing: border-box;