修改播放声音通用组件

This commit is contained in:
田岩
2025-08-27 21:05:04 +08:00
7 changed files with 81 additions and 32 deletions
+4 -4
View File
@@ -39,12 +39,12 @@
<image class="icon" src="@/static/images/dialog/answer-stop1.png" style="width: 100%;height: 100%;"></image>
</view>
<view class="replay-btn" @click="zanAnswer">
<image class="icon" src="@/static/images/dialog/answer-zan1.png" style="width: 100%;height: 100%;"></image>
<image class="icon" src="@/static/images/dialog/answer-yizan1.png" style="width: 100%;height: 100%;"></image>
<image class="icon" v-if="props.dataInfo.likeStat !== 'Y'" src="@/static/images/dialog/answer-zan1.png" style="width: 100%;height: 100%;"></image>
<image class="icon" v-else src="@/static/images/dialog/answer-yizan1.png" style="width: 100%;height: 100%;"></image>
</view>
<view class="play-btn" @click="feedbackAnswer">
<image class="icon" src="@/static/images/dialog/answer-fankui1.png" style="width: 100%;height: 100%;"></image>
<image class="icon" src="@/static/images/dialog/answer-yifankui1.png" style="width: 100%;height: 100%;"></image>
<image class="icon" v-if="props.dataInfo.downvoteStat !== 'Y'" src="@/static/images/dialog/answer-fankui1.png" style="width: 100%;height: 100%;"></image>
<image class="icon" v-else src="@/static/images/dialog/answer-yifankui1.png" style="width: 100%;height: 100%;"></image>
</view>
</view>
</view>
+17 -12
View File
@@ -44,6 +44,7 @@
} from '@/common/imgSvg'
import common from '../../../common/common';
const emit = defineEmits(['feedbackAnswer'])
const feedback_popup_bottom = ref('0px') // 反馈框下距离
const feedbackPopupRef = ref(null)
// FM("01", "虚假信息"),
@@ -63,7 +64,7 @@
value: "04",
label: "其他",
}])
const feedbackInfo = reactive({
const feedbackInfo = ref({
type: [], // 反馈类型
text: '', // 反馈内容
examId: '', // 考试ID
@@ -71,40 +72,44 @@
})
const feedback_item_click = (value) => {
// 单选
feedbackInfo.type = [value]
feedbackInfo.value.type = [value]
// 多选
// if (feedbackInfo.type.includes(value)) {
// feedbackInfo.type = feedbackInfo.type.filter(item => item !== value); // 如果已存在,则从数组中移除
// if (feedbackInfo.value.type.includes(value)) {
// feedbackInfo.value.type = feedbackInfo.value.type.filter(item => item !== value); // 如果已存在,则从数组中移除
// } else {
// feedbackInfo.type.push(value); // 如果不存在,则添加到数组中
// feedbackInfo.value.type.push(value); // 如果不存在,则添加到数组中
// }
}
const answerData = ref({})
// 反馈提交
const submit_feedback_fun = () => {
if(!feedbackInfo.value.text){
common.msg('反馈内容不能为空!')
return
}
// todo 待接口
console.log('反馈提交');
const params = JSON.parse(JSON.stringify({
askId: answerData.value.seqNo,
fbkTyp: feedbackInfo.type[0],
fbkContent: feedbackInfo.text
fbkTyp: feedbackInfo.value.type[0],
reqBatch: answerData.value.reqBatch,
fbkContent: feedbackInfo.value.text
}))
insertTraAskFeedback(params).then(res=>{
common.msg('反馈提交成功!')
feedbackInfo = {
feedbackInfo.value = {
type: [], // 反馈类型
text: '', // 反馈内容
examId: '', // 考试ID
qnsId: '', // 试题IDID
}
emit('feedbackAnswer', params)
close()
emit('feedbackAnswer', params)
})
}
const openFeedback = (status) => {
if (status) {
feedbackPopupRef.value.open('bottom')
// feedbackInfo.examId
// feedbackInfo.value.examId
const systemInfo = uni.getSystemInfoSync();
// 安全区域底部到屏幕底部的高度(即底部安全区域高度)
const safeAreaBottomHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom;
@@ -129,7 +134,7 @@
openFeedback(true)
}
const close = () => {
openFeedback()
openFeedback(null)
}
defineExpose({
open,
+4 -3
View File
@@ -5,11 +5,11 @@
<image class="icon-image" src="@/static/images/dialog/history-icon.png" mode=""></image>
对话记录
</view>
<view class="history-list">
<scroll-view class="history-list" :scroll-y="true">
<view class="history-item" v-for="item in historyList" :key="item.reqBatch" @click="chooseHistory(item)">
{{item.sseContent}}
</view>
</view>
</scroll-view>
</view>
</uni-popup>
</template>
@@ -63,7 +63,7 @@
<style scoped lang="scss">
.history-popup-view{
width: 582rpx;
height: 100%;
height: 100vh;
background-color: #fff;
padding: 40rpx;
padding-top: calc(20rpx + var(--status-bar-height));
@@ -84,6 +84,7 @@
}
}
.history-list{
height: calc(100% - 60rpx);
.history-item{
height: 78rpx;
line-height: 78rpx;
+1 -2
View File
@@ -51,8 +51,7 @@
const {
talkingType
} = toRefs(props)
const handleEvents = (type, info) => {
console.log(info)
const handleEvents = (type, info = {}) => {
emit('handleEvents', {
type,
data: props.talkingInfo,
+42 -9
View File
@@ -84,7 +84,7 @@
@startRecord="startRecordCallback" :loadingText="sendLoadingText" :isLoading="!answerIsOver"
:isDisabled="false" />
<!-- 反馈组件 -->
<Feedback ref="feedbackRef"></Feedback>
<Feedback ref="feedbackRef" @feedbackAnswer="feedbackAnswer"></Feedback>
<History ref="historyRef" @showDetail="showHistoryDetail"></History>
<PreviewVue ref="previewRef" />
</scroll-view>
@@ -135,7 +135,8 @@
import {
queryHotQuestionApi,
insertTraAskFeedback,
queryAskHisByBatchIdPaging
queryAskHisByBatchIdPaging,
updateLikeStat
} from "@/api/dialog.js"
import Feedback from './components/feedback.vue'
import History from './components/history.vue'
@@ -418,15 +419,28 @@
})
break;
case 'changePlay':
console.log('播放/暂停')
activeVoiceTalkingItemId.value = id
break;
case 'feedback':
feedbackRef.value.open(data)
break;
case 'great':
console.log()
let _status = data.likeStat === 'Y' ? 'N' :'Y'
let _id = data.seqNo || data.askId
updateLikeStat({
askId: _id,
stat: _status
}).then(res=>{
talkingList.value.forEach(t=>{
if(t.seqNo === _id || t.askId === _id){
t.likeStat = _status
t.downvoteStat = _status === 'Y' ? 'N' :'Y'
}
})
})
break;
case 'preview':
console.log(type, data, id)
// showPreview.value = true
common.navigateTo('/pages/index/preview?fileId=' + info.docId)
break;
case 'toCourse':
@@ -436,6 +450,14 @@
break;
}
}
const feedbackAnswer = (params) => {
talkingList.value.forEach(t=>{
if(t.seqNo === params.askId){
t.downvoteStat = 'Y'
t.likeStat = 'N'
}
})
}
const historyRef = ref(null)
const showHistory = () => {
historyRef.value.open()
@@ -448,17 +470,23 @@
limit: 100
}).then(res=> {
console.log(res)
talkingList.value = (res.body || []).map((t,index)=> {
let _text = t.respContent.replace(/\\n/g, `\n`);
return {
type: t.chatRole === 'TCH'? 'answer':'question',
talkingText: t.respContent,
talkingText: _text,
isLoading: false,
askId: t.askId,
seqNo: t.askId,
id: t.askId + index,
talkingVoice: '',
reqBatch: item.reqBatch,
intrctWay: '01', //01-文本;02-语音;03-图片
intrctContent: t.respContent,
bucketKey: ''
intrctContent: _text,
bucketKey: '',
downvoteStat: t.downvoteStat,
likeStat: t.likeStat,
}
})
historyRef.value.close()
@@ -593,7 +621,12 @@
const getQuestionList = () => {
queryHotQuestionApi().then(res => {
console.log(res)
questionList.value = res.body
questionList.value = res.body.map(t=>{
return {
...t,
hotContent: t.refineContent
}
})
})
}
const loadData = async () => {