fix: bug

This commit is contained in:
杨航
2025-12-01 20:34:12 +08:00
parent 3ff18d3a57
commit 04711aa242
+60 -33
View File
@@ -12,8 +12,9 @@
</view>
<view class="top-desc">内容由AI生成</view>
</view>
<scroll-view :class="[' body-content index-dialog-body', detailInfo.traInterTyp === '01'?'talking-type1':'']" :scroll-y="true" refresher-default-style="none"
:scroll-top="scrollTop" :show-scrollbar="false" :scroll-with-animation="false">
<scroll-view :class="[' body-content index-dialog-body', detailInfo.traInterTyp === '01'?'talking-type1':'']"
:scroll-y="true" refresher-default-style="none" :scroll-top="scrollTop" :show-scrollbar="false"
:scroll-with-animation="false">
<view :class="['body-content-role', showRoleInfo?'':'hide-info']">
<view :class="['role-title']">
<ImagePreview class="role-title-avatar" :src="detailInfo.ossAddr" :isCache="true">
@@ -24,9 +25,11 @@
<text class="card-title-name">{{ detailInfo.chaName }}</text>
<text class="card-title-age">{{ detailInfo.chaAge }}</text>
<text class="card-title-img">
<image class="card-title-icon" v-if="detailInfo.gender === 'm'||detailInfo.gender === '01'" src="@/static/images/me/man.png">
<image class="card-title-icon" v-if="detailInfo.gender === 'm'||detailInfo.gender === '01'"
src="@/static/images/me/man.png">
</image>
<image class="card-title-icon" v-if="detailInfo.gender === 'f'||detailInfo.gender === '02'" src="@/static/images/me/wuman.png">
<image class="card-title-icon" v-if="detailInfo.gender === 'f'||detailInfo.gender === '02'"
src="@/static/images/me/wuman.png">
</image>
</text>
</view>
@@ -58,8 +61,8 @@
{{ detailInfo.sceneDesc }}
</view>
<view class="talking-box">
<TalkingItem v-for="(item, index) in talkingList" :talkingType="item.type" :talkingInfo="item" :roleInfo="detailInfo"
:traId="traId" :execId="execId" :isExam="talkingType === '02'"
<TalkingItem v-for="(item, index) in talkingList" :talkingType="item.type" :talkingInfo="item"
:roleInfo="detailInfo" :traId="traId" :execId="execId" :isExam="talkingType === '02'"
:isLast="index + 1 === talkingList.length" :isAnswering="!answerIsOver"
:activeVoiceId="activeVoiceTalkingItemId" @handleEvents="talkItemEvents"></TalkingItem>
</view>
@@ -70,7 +73,7 @@
</view>
</view>
<TouchBtn class="body-bottom" @uploadVoice="uploadRecordNow" @startRecord="changePlayItemId('')"
:isLoading="!answerIsOver" :isDisabled="false" v-if="detailInfo.traInterTyp === '01'"/>
:isLoading="!answerIsOver" :isDisabled="false" v-if="detailInfo.traInterTyp === '01'" />
<view class="body-bottom" v-else>
<view class="body-bottom-btn" @click="toTalking">
<view class="center-text">
@@ -123,11 +126,15 @@
storeToRefs
} from 'pinia';
import TalkingItem from './components/talking-item.vue'
import badge from '@/components/points-and-badge/badge';
import badge from '@/components/points-and-badge/badge';
import points from '@/components/points-and-badge/points';
import usePointsAndBadge from '@/components/points-and-badge/usePointsAndBadge';
const { pointAndBadgesRun, badgeRef, pointsRef } = usePointsAndBadge();
const {
pointAndBadgesRun,
badgeRef,
pointsRef
} = usePointsAndBadge();
const socketStore = useSocketStore();
const {
@@ -145,12 +152,12 @@
const showRoleInfo = ref(false)
const showLoading = ref(true)
const talkingList = ref([])
// {
// type: 'answer',
// talkingText: 'asad我是回答内容',
// isLoading: false,
// id: new Date().getTime(),
// },
// {
// type: 'answer',
// talkingText: 'asad我是回答内容',
// isLoading: false,
// id: new Date().getTime(),
// },
const askData = ref({})
const execId = ref('')
const answerIsOver = ref(true);
@@ -227,7 +234,8 @@
// #endif
}
const toTalking = () => {
common.navigateTo('/pages/sparring/talk?traId=' + traId.value + '&chaId=' + chaId.value+ '&type=' + talkingType.value+ '&isPreview=' + (isPreview.value?'1':'0'))
common.navigateTo('/pages/sparring/talk?traId=' + traId.value + '&chaId=' + chaId.value + '&type=' + talkingType
.value + '&isPreview=' + (isPreview.value ? '1' : '0'))
}
const activeVoiceTalkingItemId = ref('')
// 关闭播放状态
@@ -259,7 +267,7 @@
const answerText = ref('')
const touchBtnCallBack = ref(null)
const initsocketTask = () => {
let _src = isPreview.value ?'/trapractice/previewsocket/open':'/trapractice/partnersocket/open'
let _src = isPreview.value ? '/trapractice/previewsocket/open' : '/trapractice/partnersocket/open'
socketStore.creatSocket(_src + '?summary=');
// unref(SocketObj).on('open', (res)=>{
// if(!answerIsOver.value){
@@ -306,7 +314,7 @@
traId: traId.value,
chaId: chaId.value,
traTyp: talkingType.value,
execId: execId.value||''
execId: execId.value || ''
}
});
return;
@@ -356,12 +364,12 @@
if (body.event === 'start') {
answerIsOver.value = false;
answerText.value = '';
talkingList.value.pop();
talkingList.value.pop();
talkingList.value.push({
type: 'answer',
talkingText: answerText.value,
isLoading: false,
execLogId: body.execLogId||'',
execLogId: body.execLogId || '',
id: _id + 'ans',
...body,
askData: {
@@ -409,22 +417,29 @@
const goBack = () => {
if (detailInfo.value.traInterTyp === '01') {
overTalking()
}else{
} else {
common.navigateBack()
}
}
const overTalking = () => {
common.show('提示','确定结束陪练吗?').then(res => {
common.show('提示', '确定结束陪练吗?').then(res => {
if (res) {
partnerChatReportTrigger({
execId: execId.value,
traId: traId.value,
talkingType: isPreview.value? 'preview' : 'practice'
}).then(res=>{
talkingType: isPreview.value ? 'preview' : 'practice'
}).then(res => {
watchFlag.value = 1;
sendMessage({
commond: 'ASK-STOP',
body: {
execId: execId.value || ''
}
})
socketStore?.closeSocket();
changePlayItemId('')
common.navigateTo('/pages/sparring/result?isOver=1&traId=' + traId.value + '&execId=' + execId.value + '&type=' + talkingType.value + '&isPreview=' + (isPreview.value ?'1':''))
common.navigateTo('/pages/sparring/result?isOver=1&traId=' + traId.value + '&execId=' + execId
.value + '&type=' + talkingType.value + '&isPreview=' + (isPreview.value ? '1' : ''))
// pointAndBadgesRun(talkingType.value === '01'? '07': '08', '', ()=>{
// common.navigateTo('/pages/sparring/result?isOver=1&traId=' + traId.value + '&execId=' + execId.value + '&type=' + talkingType.value + '&isPreview=' + (isPreview.value ?'1':''))
// })
@@ -447,6 +462,12 @@
});
onUnload(() => {
watchFlag.value = 1;
sendMessage({
commond: 'ASK-STOP',
body: {
execId: execId.value || ''
}
})
socketStore?.closeSocket();
});
onMounted(() => {
@@ -510,7 +531,7 @@
left: 0;
z-index: 2;
.top-desc{
.top-desc {
position: absolute;
bottom: 0;
font-size: 18rpx;
@@ -518,6 +539,7 @@
left: 50%;
transform: translateX(-50%);
}
.top-title {
height: 90rpx;
// background-color: red;
@@ -575,10 +597,11 @@
padding: 10rpx 24rpx 20rpx;
box-sizing: border-box;
overflow-y: auto;
&.talking-type1{
&.talking-type1 {
padding: 10rpx 24rpx 140rpx;
}
.body-content-role {
background-color: #fff;
border-radius: 16rpx;
@@ -741,17 +764,20 @@
text-align: center;
}
}
.talking-box{
.talking-box {
padding-top: 24rpx;
}
}
.over-btn-box{
.over-btn-box {
position: absolute;
bottom: 180rpx;
height: 140rpx;
padding: 0 23rpx;
width: 100%;
.over-btn{
.over-btn {
float: right;
width: 194rpx;
height: 76rpx;
@@ -759,10 +785,11 @@
border: 2rpx solid #06f;
border-radius: 15rpx;
text-align: center;
color:#06f;
color: #06f;
margin-top: 34rpx;
}
}
.body-bottom {
height: 180rpx;
background-color: #fff;