一些操作2

This commit is contained in:
田岩
2025-08-19 13:53:17 +08:00
15 changed files with 1035 additions and 374 deletions
+11
View File
@@ -16,8 +16,19 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
# h5专用地址 # h5专用地址
# 王洋洋 # 王洋洋
<<<<<<< HEAD
#VITE_APP_BASE_H5_API_Url = 'http://25.64.16.140:9604' #VITE_APP_BASE_H5_API_Url = 'http://25.64.16.140:9604'
VITE_APP_BASE_H5_API_Url = 'https://aitstest.jlbank.com.cn:7001' VITE_APP_BASE_H5_API_Url = 'https://aitstest.jlbank.com.cn:7001'
#岳世凯 #岳世凯
#VITE_APP_BASE_H5_API_Url = 'http://25.64.16.141:9701' #VITE_APP_BASE_H5_API_Url = 'http://25.64.16.141:9701'
=======
# VITE_APP_BASE_H5_API_Url = 'http://25.64.16.140:9604'
# 任东
# VITE_APP_BASE_H5_API_Url = 'http://25.64.16.130:9602'
# 线上
VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001'
# VITE_APP_BASE_H5_API_Url_TRAAPP = 'http://25.18.122.65:7001'
VITE_APP_BASE_H5_API_Url_TRASTUDY = 'http://25.64.16.130:9602'
>>>>>>> 05085e8e3e537d6cc35d677431086afd747b4eee
+10
View File
@@ -9,4 +9,14 @@ export const queryHotQuestionApi = (data) => {
method: 'post', method: 'post',
data data
}); });
};
// 获取问答历史
// 问答反馈
export const insertTraAskFeedback = (data) => {
return request({
url: '/traask/traAskFeedback/insertTraAskFeedback',
method: 'post',
data
});
}; };
+8 -6
View File
@@ -5,16 +5,16 @@ import common from '@/common/common.js'
const ENV = import.meta.env const ENV = import.meta.env
export const get_base_url = url => { export const get_base_url = (url = '') => {
if (ENV.MODE === 'development') { // 开发环境 if (ENV.MODE === 'development') { // 开发环境
// H5必须用非https,手机端必须用https // H5必须用非https,手机端必须用https
// #ifdef H5 // #ifdef H5
return ENV.VITE_APP_BASE_H5_API_Url || ENV.VITE_APP_BASE_API_Url if (url) {
const baseUrl = ENV.VITE_APP_BASE_API_Url let _str = (url.split('/')[0] || url.split('/')[1])?.toUpperCase()
if (baseUrl.startsWith('https')) { return ENV[`VITE_APP_BASE_H5_API_Url_${_str}`] || ENV.VITE_APP_BASE_H5_API_Url || ENV.VITE_APP_BASE_API_Url
return baseUrl.replace('https', 'http') } else {
return ENV.VITE_APP_BASE_H5_API_Url || ENV.VITE_APP_BASE_API_Url
} }
return baseUrl
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
return ENV.VITE_APP_BASE_API_Url return ENV.VITE_APP_BASE_API_Url
@@ -80,6 +80,8 @@ export default function request({
headers_base['summary'] = token // 让每个请求携带令牌 headers_base['summary'] = token // 让每个请求携带令牌
} }
let that = this let that = this
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
url: `${baseUrl || base_url}${url}`, url: `${baseUrl || base_url}${url}`,
@@ -32,6 +32,9 @@
<ChartThree v-if="dataInfo.evalDimens.length === 3" :dataList="dataInfo.evalDimens" :score="dataInfo.intrctGrade"/> <ChartThree v-if="dataInfo.evalDimens.length === 3" :dataList="dataInfo.evalDimens" :score="dataInfo.intrctGrade"/>
<ChartFive v-if="dataInfo.evalDimens.length === 5" :dataList="dataInfo.evalDimens" :score="dataInfo.intrctGrade"/> <ChartFive v-if="dataInfo.evalDimens.length === 5" :dataList="dataInfo.evalDimens" :score="dataInfo.intrctGrade"/>
</view> </view>
<view v-if="type === 3 && dataInfo.knoExampie " style="overflow: hidden;">
举例{{ dataInfo.knoExampie }}
</view>
</view> </view>
<view class="btns-cont" v-show="!dataInfo.isLoading"> <view class="btns-cont" v-show="!dataInfo.isLoading">
<view class="replay-btn" @click.stop="restartPlay" v-if="!([5].indexOf(type) >= 0)"> <view class="replay-btn" @click.stop="restartPlay" v-if="!([5].indexOf(type) >= 0)">
+384 -334
View File
@@ -1,24 +1,20 @@
<template> <template>
<view class="talk-btns" ref="talkBtnRef"> <view class="talk-btns" ref="talkBtnRef">
<view <view class="touch-btn" @touchstart="getRecordPermission" @touchend="hideOverlayTalking" @touchmove="handleMove"
class="touch-btn" v-if="!keyboardIsShow">按住说话
@touchstart="getRecordPermission"
@touchend="hideOverlayTalking"
@touchmove="handleMove"
v-if="!keyboardIsShow"
>按住说话
</view> </view>
<view class="touch-btn" v-if="keyboardIsShow"> <view class="touch-btn" v-if="keyboardIsShow">
<uv-input class="input-box" ref="inputRef" v-model="answerValue" :maxlength="props.textValueLength" :adjustPosition="false" <uv-input class="input-box" ref="inputRef" v-model="answerValue" :maxlength="props.textValueLength"
placeholderStyle='color:#999999;font-size:26rpx' placeholder="请输入文字"> :adjustPosition="false" placeholderStyle='color:#999999;font-size:26rpx' placeholder="请输入文字">
</uv-input> </uv-input>
</view> </view>
<view class="talk-btn-box" v-show="!onlyVoice"> <view class="talk-btn-box" v-show="!onlyVoice">
<image class="talk-btn-icon" v-show="!keyboardIsShow" src="/src/static/images/course/jianpan.png" mode="" @click="changeBtn"></image> <image class="talk-btn-icon" v-show="!keyboardIsShow" src="/src/static/images/course/jianpan.png" mode=""
<image class="talk-btn-icon" v-show="keyboardIsShow && !answerValue" src="/src/static/images/course/record.png" mode="" @click="changeBtn"></image> @click="changeBtn"></image>
<image class="talk-btn-icon" v-show="keyboardIsShow && !!answerValue" src="/src/static/images/course/send.png" mode="" <image class="talk-btn-icon" v-show="keyboardIsShow && !answerValue" src="/src/static/images/course/record.png"
@click.stop="showKeyboard" mode="" @click="changeBtn"></image>
></image> <image class="talk-btn-icon" v-show="keyboardIsShow && !!answerValue" src="/src/static/images/course/send.png"
mode="" @click.stop="showKeyboard"></image>
</view> </view>
<uv-overlay :show="showTalkingModel" opacity=".9" @click="showTalkingModel = false"> <uv-overlay :show="showTalkingModel" opacity=".9" @click="showTalkingModel = false">
<view class="overlay-box"> <view class="overlay-box">
@@ -29,7 +25,7 @@
</view> </view>
<view class="tips-box">松开发送</view> <view class="tips-box">松开发送</view>
<view class="btns-box"> <view class="btns-box">
<view :class="['close-btn',isOut?'is-out':'']" >取消 <view :class="['close-btn',isOut?'is-out':'']">取消
<image class="btn-box" v-if="!isOut" src="/src/static/images/course/close.png" mode=""></image> <image class="btn-box" v-if="!isOut" src="/src/static/images/course/close.png" mode=""></image>
<image class="btn-box" v-else src="/src/static/images/course/close-active.png" mode=""></image> <image class="btn-box" v-else src="/src/static/images/course/close-active.png" mode=""></image>
</view> </view>
@@ -40,348 +36,383 @@
</view> </view>
</uv-overlay> </uv-overlay>
</view> </view>
</template> </template>
<script setup> <script setup>
import { toRefs, ref, computed, unref, onMounted, onUnmounted, nextTick, watch, getCurrentInstance } from 'vue'; import {
import common from '../../../common/common'; toRefs,
import permission from '@/common/permission.js' ref,
import { getPhoneEnvBool } from '@/common/common.js' computed,
const proxy = getCurrentInstance() unref,
const emit = defineEmits(['uploadVoice', 'submitAnswer','startRecord']) onMounted,
const props = defineProps({ onUnmounted,
isDisabled:{ nextTick,
default: true, watch,
type: Boolean getCurrentInstance
}, } from 'vue';
isLoading:{ import common from '../../../common/common';
default: false, import permission from '@/common/permission.js'
type: Boolean import {
}, getPhoneEnvBool
loadingText:{ } from '@/common/common.js'
default: '发送回答中,请稍后再试!', const proxy = getCurrentInstance()
type: String const emit = defineEmits(['uploadVoice', 'submitAnswer', 'startRecord'])
}, const props = defineProps({
onlyVoice:{ isDisabled: {
default: false, default: true,
type: Boolean type: Boolean
}, },
canAnswer:{ isLoading: {
default: true, default: false,
type: Boolean type: Boolean
}, },
canAnswerText:{ loadingText: {
default: '当前状态不能发送内容', default: '发送回答中,请稍后再试',
type: String type: String
}, },
textValueLength:{ onlyVoice: {
type: Number, default: false,
default: 500 type: Boolean
} },
}) canAnswer: {
const { isDisabled, onlyVoice } = toRefs(props) default: true,
const isLoadingState = computed(() => props.isLoading) type: Boolean
},
const showTalkingModel = ref(false) canAnswerText: {
const keyboardIsShow = ref(false) default: '当前状态不能发送内容!',
type: String
watch(()=>props.isLoading,()=>{},{ },
deep:true,immediate:true textValueLength: {
}) type: Number,
watch(()=>props.canAnswer,()=>{},{ default: 500
deep:true,immediate:true
})
watch(()=>props.onlyVoice,()=>{},{
deep:true,immediate:true
})
watch(()=>props.isDisabled,(val)=>{
if(val){
keyboardIsShow.value = false
}
},{
deep:true,immediate:true
})
const answerValue = ref('')
const talkBtnRef = ref()
// 录音
const audioPath = ref('')
const audioObj = uni.createInnerAudioContext()
//#ifdef APP-PLUS
// app端
const recordObjCom = ref({})
const IsAndEnv = getPhoneEnvBool('AND')
const isStartNum = ref(0)
const isStopNum = ref(0)
const initRecord = () => {
recordObjCom.value = uni.getRecorderManager()
unref(recordObjCom)?.onStop((res, duration)=>{
audioPath.value = res.tempFilePath
if(!isOut.value){
if(startFlag.value !== 2){
// setTimeout(() => {
// showTalkingModel.value = false
// nextTick(() => {
// // showTalkingModel.value = false
// common.msg('说话时间太短,没有听清!')
// })
// },100)
closeModel(()=>{
nextTick(() => {
// showTalkingModel.value = false
common.msg('说话时间太短,没有听清!')
})
})
}else{
closeModel()
emit('uploadVoice', audioPath.value)
}
}else{
closeModel()
} }
}) })
unref(recordObjCom).onStart(() => { const {
startFlag.value = 1 isDisabled,
setTimeout(()=>{ onlyVoice
startFlag.value = 2 } = toRefs(props)
},1000) const isLoadingState = computed(() => props.isLoading)
let _recordPerm = uni.getAppAuthorizeSetting()
let _state = _recordPerm.microphoneAuthorized
if(_state === 'authorized'){
if(isStopNum.value === isStartNum.value){
stopRecord()
}else{
showTalkingModel.value = true
}
}
})
}
const startFlag = ref(1)
// const canStart = ref(true)
const startRecord = () => {
isStartNum.value += 1
unref(recordObjCom).start({format:'mp3'})
}
const stopRecord = () => { const showTalkingModel = ref(false)
isStopNum.value = isStartNum.value const keyboardIsShow = ref(false)
try{
if(unref(recordObjCom).stop){ watch(() => props.isLoading, () => {}, {
unref(recordObjCom).stop() deep: true,
}else{ immediate: true
closeModel() })
watch(() => props.canAnswer, () => {}, {
deep: true,
immediate: true
})
watch(() => props.onlyVoice, () => {}, {
deep: true,
immediate: true
})
watch(() => props.isDisabled, (val) => {
if (val) {
keyboardIsShow.value = false
} }
}catch{ }, {
closeModel() deep: true,
} immediate: true
// setTimeout(() => { })
// canStart.value = true
// }, 1000)
} const answerValue = ref('')
const closeModel = (cb = () => {}) => { const talkBtnRef = ref()
isStopNum.value = isStartNum.value // 录音
setTimeout(() => { const audioPath = ref('')
showTalkingModel.value = false const audioObj = uni.createInnerAudioContext()
cb && cb()
}, 350)
}
// #endif
//#ifndef APP-PLUS
const recordObjCom = ref({})
const initRecord = () => {}
// #endif
onMounted(async ()=>{
initRecord?.()
//#ifdef APP-PLUS //#ifdef APP-PLUS
// 安卓 // app
if(IsAndEnv){ const recordObjCom = ref({})
let _recordPerm = await permission.requestAndroidPermission('android.permission.RECORD_AUDIO') const IsAndEnv = getPhoneEnvBool('AND')
if(_recordPerm !== 1){ const isStartNum = ref(0)
common.show('提示信息', '当前页面需要使用的录音权限,是否前往开启?',true, '取消','确定').then((res) => { const isStopNum = ref(0)
if(res) { const initRecord = () => {
// 去开启权限 recordObjCom.value = uni.getRecorderManager()
permission.gotoAppPermissionSetting() unref(recordObjCom)?.onStop((res, duration) => {
}else{ audioPath.value = res.tempFilePath
// 取消 if (!isOut.value) {
common.navigateBack() if (startFlag.value !== 2) {
} // setTimeout(() => {
}) // showTalkingModel.value = false
// nextTick(() => {
// // showTalkingModel.value = false
// common.msg('说话时间太短,没有听清!')
// })
// },100)
closeModel(() => {
nextTick(() => {
// showTalkingModel.value = false
common.msg('说话时间太短,没有听清!')
})
})
} else {
closeModel()
emit('uploadVoice', audioPath.value)
}
} else {
closeModel()
} }
}else{ })
unref(recordObjCom).onStart(() => {
startFlag.value = 1
setTimeout(() => {
startFlag.value = 2
}, 1000)
let _recordPerm = uni.getAppAuthorizeSetting() let _recordPerm = uni.getAppAuthorizeSetting()
let _state = _recordPerm.microphoneAuthorized let _state = _recordPerm.microphoneAuthorized
if(_state === 'denied'){ console.log(isStopNum.value === isStartNum.value, _state)
common.show('提示信息', '当前页面需要使用的录音权限,是否前往开启?',true, '取消','确定').then((res) => { if (_state === 'authorized') {
if(res) { if (isStopNum.value === isStartNum.value) {
stopRecord()
} else {
showTalkingModel.value = true
}
}
})
}
const startFlag = ref(1)
// const canStart = ref(true)
const startRecord = () => {
isStartNum.value += 1
unref(recordObjCom).start({
format: 'mp3'
})
}
const stopRecord = () => {
isStopNum.value = isStartNum.value
try {
if (unref(recordObjCom).stop) {
unref(recordObjCom).stop()
} else {
closeModel()
}
} catch {
closeModel()
}
// setTimeout(() => {
// canStart.value = true
// }, 1000)
}
const closeModel = (cb = () => {}) => {
isStopNum.value = isStartNum.value
setTimeout(() => {
showTalkingModel.value = false
cb && cb()
}, 350)
setTimeout(() => {
isTalking.value = false
}, 800)
}
// #endif
//#ifndef APP-PLUS
const recordObjCom = ref({})
const initRecord = () => {}
// #endif
onMounted(async () => {
initRecord?.()
//#ifdef APP-PLUS
// 安卓端
if (IsAndEnv) {
let _recordPerm = await permission.requestAndroidPermission('android.permission.RECORD_AUDIO')
if (_recordPerm !== 1) {
common.show('提示信息', '当前页面需要使用的录音权限,是否前往开启?', true, '取消', '确定').then((res) => {
if (res) {
// 去开启权限 // 去开启权限
uni.openAppAuthorizeSetting() permission.gotoAppPermissionSetting()
}else{ } else {
// 取消 // 取消
common.navigateBack() common.navigateBack()
} }
}) })
}else if(_state === 'not determined'){ }
} else {
let _recordPerm = uni.getAppAuthorizeSetting()
let _state = _recordPerm.microphoneAuthorized
if (_state === 'denied') {
common.show('提示信息', '当前页面需要使用的录音权限,是否前往开启?', true, '取消', '确定').then((res) => {
if (res) {
// 去开启权限
uni.openAppAuthorizeSetting()
} else {
// 取消
common.navigateBack()
}
})
} else if (_state === 'not determined') {
// startRecord() // startRecord()
} }
} }
// #endif
})
// 录音结束
// 记录 按下移动位置
const touchX = ref(0)
const touchY = ref(0)
const baseY = ref(0)
const windowInfo = uni.getWindowInfo()
// 计算是否超出按下盒子位置
const isOut = computed(() => {
let _btnHeight = windowInfo.screenWidth/750 * 234
let moveVal = (windowInfo.screenHeight - touchY.value) > _btnHeight
return moveVal
})
const outScreen = computed(()=>{
(windowInfo.screenHeight - touchY.value) <= 0
})
const recNum = ref(1)
const activeNum = ref(1)
const getRecordPermission = (obj) => {
showOverlayTalking(obj)
}
const isMoving = ref(false)
const showOverlayTalking = (obj) => {
if(showTalkingModel.value) return
if(isLoadingState.value){
uni.showToast({
title: props.loadingText,
icon: "none",
duration:1000
})
return
}
if(!props.canAnswer){
uni.showToast({
title: props.canAnswerText,
icon: "none",
duration:1000
})
return
}
// if(!canStart.value){
// return
// }
isMoving.value = true
emit('startRecord')
recNum.value += 1
if(!isDisabled.value){
touchX.value = obj.changedTouches[0].pageX
touchY.value = obj.changedTouches[0].pageY
baseY.value = obj.currentTarget.offsetTop
//#ifdef APP-PLUS
// canStart.value = false
startRecord()
// #endif // #endif
setTimeout(() => { })
hideOverlayTalking() // 录音结束
},59 * 1010)
}else{ // 记录 按下移动位置
showTalkingModel.value = false const touchX = ref(0)
uni.showToast({ const touchY = ref(0)
title: '暂无问题需要回答!', const baseY = ref(0)
icon: "none", const windowInfo = uni.getWindowInfo()
duration:1000 // 计算是否超出按下盒子位置
}) const isOut = computed(() => {
let _btnHeight = windowInfo.screenWidth / 750 * 234
let moveVal = (windowInfo.screenHeight - touchY.value) > _btnHeight
return moveVal
})
const outScreen = computed(() => {
(windowInfo.screenHeight - touchY.value) <= 0
})
const recNum = ref(1)
const activeNum = ref(1)
const getRecordPermission = (obj) => {
if (isTalking.value) {
common.msg('操作频繁,请稍后重试!')
return
}
showOverlayTalking(obj)
} }
} const isMoving = ref(false)
const hideOverlayTalking = (obj) => { const isTalking = ref(false)
isMoving.value = false const showOverlayTalking = (obj) => {
if(!showTalkingModel.value) return if (showTalkingModel.value) return
//#ifdef APP-PLUS if (isLoadingState.value) {
stopRecord() uni.showToast({
// #endif title: props.loadingText,
} icon: "none",
duration: 1000
const handleMove = (obj) => { })
if(isMoving.value){ return
touchX.value = obj.changedTouches[0].pageX }
touchY.value = obj.changedTouches[0].pageY if (!props.canAnswer) {
if(outScreen.value){ uni.showToast({
hideOverlayTalking(obj) title: props.canAnswerText,
icon: "none",
duration: 1000
})
return
}
// if(!canStart.value){
// return
// }
isMoving.value = true
isTalking.value = true
emit('startRecord')
recNum.value += 1
if (!isDisabled.value) {
touchX.value = obj.changedTouches[0].pageX
touchY.value = obj.changedTouches[0].pageY
baseY.value = obj.currentTarget.offsetTop
//#ifdef APP-PLUS
// canStart.value = false
startRecord()
// #endif
setTimeout(() => {
hideOverlayTalking()
}, 59 * 1010)
} else {
showTalkingModel.value = false
uni.showToast({
title: '暂无问题需要回答!',
icon: "none",
duration: 1000
})
} }
} }
} const hideOverlayTalking = (obj) => {
// 发送文本 isMoving.value = false
const showKeyboard = () => { if (!showTalkingModel.value) return
if(isLoadingState.value){ //#ifdef APP-PLUS
uni.showToast({ stopRecord()
title: props.loadingText, // #endif
icon: "none",
duration:1000
})
return
} }
if(!isDisabled.value){
if(keyboardIsShow.value){ const handleMove = (obj) => {
if(answerValue.value.trim()){ if (isMoving.value) {
emit( touchX.value = obj.changedTouches[0].pageX
'submitAnswer', touchY.value = obj.changedTouches[0].pageY
answerValue.value, if (outScreen.value) {
changeBtn hideOverlayTalking(obj)
)
}else{
// keyboardIsShow.value = !keyboardIsShow.value
common.msg("不能发送空白消息!")
} }
}else{
keyboardIsShow.value = !keyboardIsShow.value
} }
}else{
uni.showToast({
title: '暂无问题需要回答!',
icon: "none",
duration:1000
})
} }
} // 发送文本
const changeBtn = () => { const showKeyboard = () => {
if(props.isDisabled) return if (isLoadingState.value) {
keyboardIsShow.value = !keyboardIsShow.value uni.showToast({
answerValue.value = '' title: props.loadingText,
} icon: "none",
duration: 1000
})
return
}
if (!isDisabled.value) {
if (keyboardIsShow.value) {
if (answerValue.value.trim()) {
emit(
'submitAnswer',
answerValue.value,
changeBtn
)
} else {
// keyboardIsShow.value = !keyboardIsShow.value
common.msg("不能发送空白消息!")
}
} else {
keyboardIsShow.value = !keyboardIsShow.value
}
} else {
uni.showToast({
title: '暂无问题需要回答!',
icon: "none",
duration: 1000
})
}
}
const changeBtn = () => {
if (props.isDisabled) return
keyboardIsShow.value = !keyboardIsShow.value
answerValue.value = ''
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.talk-btns{ .talk-btns {
height: 150rpx; height: 150rpx;
background-color: #fff; background-color: #fff;
padding: 25rpx 30rpx 0; padding: 25rpx 30rpx 0;
position: relative; position: relative;
.touch-btn{
.touch-btn {
height: 92rpx; height: 92rpx;
box-shadow: 0 8rpx 20rpx 0 rgba(0,0,0,.06); box-shadow: 0 8rpx 20rpx 0 rgba(0, 0, 0, .06);
text-align: center; text-align: center;
line-height: 92rpx; line-height: 92rpx;
color: #000; color: #000;
font-weight: 400; font-weight: 400;
position: relative; position: relative;
.input-box{
.input-box {
width: 100%; width: 100%;
height: 92rpx; height: 92rpx;
line-height: 92rpx; line-height: 92rpx;
text-align: left; text-align: left;
box-sizing: border-box; box-sizing: border-box;
padding:0 40rpx 0 40rpx; padding: 0 40rpx 0 40rpx;
} }
} }
.talk-btn-box{
.talk-btn-box {
position: absolute; position: absolute;
height: 100%; height: 100%;
width: 120rpx; width: 120rpx;
right: 0; right: 0;
top:0; top: 0;
.talk-btn-icon{
.talk-btn-icon {
width: 40rpx; width: 40rpx;
height: 40rpx; height: 40rpx;
position: absolute; position: absolute;
@@ -391,40 +422,45 @@ const changeBtn = () => {
} }
} }
} }
.overlay-box{ .overlay-box {
display: flex; display: flex;
flex-direction: column-reverse; flex-direction: column-reverse;
// justify-content: flex-end; // justify-content: flex-end;
width: 100%; width: 100%;
height: 100%; height: 100%;
.circle-bg-box{
.circle-bg-box {
height: 234rpx; height: 234rpx;
background: url(@/static/images/course/talking.png) no-repeat; background: url(@/static/images/course/talking.png) no-repeat;
background-size: cover; background-size: cover;
position: relative; position: relative;
.icon-box{
.icon-box {
position: absolute; position: absolute;
left:50%; left: 50%;
top: 50%; top: 50%;
margin-left: -17rpx; margin-left: -17rpx;
margin-top: -24rpx; margin-top: -24rpx;
width: 34rpx; width: 34rpx;
height: 48rpx; height: 48rpx;
image{
image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
} }
.tips-box{
.tips-box {
height: 40rpx; height: 40rpx;
line-height: 40rpx; line-height: 40rpx;
color:#c0c0c0; color: #c0c0c0;
text-align: center; text-align: center;
margin: 12rpx 0 24rpx; margin: 12rpx 0 24rpx;
} }
.btns-box{
.btns-box {
height: 270rpx; height: 270rpx;
// padding: 0 120rpx; // padding: 0 120rpx;
width: 154rpx; width: 154rpx;
@@ -433,42 +469,50 @@ const changeBtn = () => {
font-size: 28rpx; font-size: 28rpx;
text-align: center; text-align: center;
line-height: 116rpx; line-height: 116rpx;
.close-btn{
.close-btn {
float: left; float: left;
height: 100%; height: 100%;
width: 154rpx; width: 154rpx;
overflow: hidden; overflow: hidden;
color:#999; color: #999;
&.is-out{
color:#fff; &.is-out {
color: #fff;
} }
} }
.translate-btn{
.translate-btn {
float: right; float: right;
height: 100%; height: 100%;
width: 154rpx; width: 154rpx;
overflow: hidden; overflow: hidden;
color:#999; color: #999;
} }
.btn-box{
.btn-box {
width: 100%; width: 100%;
height: 154rpx; height: 154rpx;
} }
} }
.talk-dialog{
.talk-dialog {
width: 506rpx; width: 506rpx;
height: 234rpx; height: 234rpx;
margin: 0 auto; margin: 0 auto;
background-color: #06f; background-color: #06f;
border-radius: 32rpx; border-radius: 32rpx;
position: relative; position: relative;
&.is-out{
&.is-out {
background-color: #ff3e49; background-color: #ff3e49;
&::after{
&::after {
background-color: #ff3e49; background-color: #ff3e49;
} }
} }
.gif-box{
.gif-box {
position: absolute; position: absolute;
width: 200rpx; width: 200rpx;
height: 80rpx; height: 80rpx;
@@ -476,7 +520,8 @@ const changeBtn = () => {
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
&::after{
&::after {
content: ''; content: '';
width: 44rpx; width: 44rpx;
height: 44rpx; height: 44rpx;
@@ -485,35 +530,40 @@ const changeBtn = () => {
overflow: hidden; overflow: hidden;
position: absolute; position: absolute;
bottom: -22rpx; bottom: -22rpx;
left:50%; left: 50%;
margin-left: -22rpx; margin-left: -22rpx;
} }
} }
.white-bg-box{
.white-bg-box {
height: 365rpx; height: 365rpx;
background-color: #fff; background-color: #fff;
overflow: hidden; overflow: hidden;
border-radius: 32rpx 32rpx 0 0; border-radius: 32rpx 32rpx 0 0;
padding: 58rpx 36rpx; padding: 58rpx 36rpx;
.box-title{
.box-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
line-height: 46rpx; line-height: 46rpx;
margin-bottom: 46rpx; margin-bottom: 46rpx;
} }
.box-btns{
.box-btns {
height: 46rpx; height: 46rpx;
line-height: 46rpx; line-height: 46rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
color: #999; color: #999;
.is-active{
.is-active {
color: #06f; color: #06f;
} }
} }
} }
} }
::v-deep .uv-input__content__field-wrapper__field{
::v-deep .uv-input__content__field-wrapper__field {
padding-right: 60rpx; padding-right: 60rpx;
} }
</style> </style>
+1 -1
View File
@@ -279,7 +279,7 @@ import { onShow } from "@dcloudio/uni-app"
} }
// 跳转 课程详情 // 跳转 课程详情
const toCourseDetail = (item) => { const toCourseDetail = (item) => {
common.navigateTo('/pages/courseDetail/index?crsNum=' + item.crsNum) common.navigateTo('/pages/courseDetail/index?crsNum=' + item.crsNum + '&crsId=' + item.crsId)
// common.navigateTo('/pages/course/study?crsNum=' + item.crsNum) // common.navigateTo('/pages/course/study?crsNum=' + item.crsNum)
} }
onMounted(()=>{ onMounted(()=>{
+7 -15
View File
@@ -31,13 +31,8 @@
</view> </view>
<view class="fl1"></view> <view class="fl1"></view>
<view class="num-item" @click="collect_click(form.collectId)"> <view class="num-item" @click="collect_click(form.collectId)">
<image <image v-if="form.collectId" class="collect-icon" src="/src/static/images/courseDetail/out_collect.png" mode="widthFix"></image>
v-if="form.collectId" <image v-else class="collect-icon" src="/src/static/images/courseDetail/in_collect.png" mode="widthFix"></image>
class="collect-icon"
src="/src/static/images/courseDetail/out_collect.png"
mode="widthFix"
></image>
<image v-else class="collect-icon" src="/src/static/images/courseDetail/in_collect.png" mode="widthFix"></image>
</view> </view>
</view> </view>
</view> </view>
@@ -74,12 +69,12 @@
</scroll-view> </scroll-view>
<view class="btn-box btn-box-height font_pf"> <view class="btn-box btn-box-height font_pf">
<template v-if="[0, 1].includes(tabAct)"> <template v-if="[0, 1].includes(tabAct)">
<uv-button type="primary" @click="common.navigateTo('/pages/course/study?crsNum=' + crsNum + '&crsId=' + form.crsId + '&imgId=' + form.imgId)">去学习</uv-button> <uv-button type="primary" @click="common.navigateTo('/pages/course/study?crsNum=' + form.crsNum + '&crsId=' + crsId + '&imgId=' + form.imgId)">去学习</uv-button>
<uv-button type="primary">去练习</uv-button> <uv-button type="primary">去练习</uv-button>
<uv-button type="primary" @click="goto_examination()">去考试</uv-button> <uv-button type="primary" @click="goto_examination()">去考试</uv-button>
</template> </template>
<template v-if="tabAct == 2"> <template v-if="tabAct == 2">
<uv-button type="primary" class="send_evaluate" @click="common.navigateTo('/pages/courseDetail/submit?crsNum=' + crsNum + '&imgId=' + form.imgId)"> <uv-button type="primary" class="send_evaluate" @click="common.navigateTo('/pages/courseDetail/submit?crsNum=' + form.crsNum + '&imgId=' + form.imgId)">
发布评价 发布评价
</uv-button> </uv-button>
</template> </template>
@@ -125,7 +120,7 @@
form.value = body; form.value = body;
}; };
const toStudyPrgh = (info) => { const toStudyPrgh = (info) => {
common.navigateTo('/pages/course/study?crsNum=' + form.value.value + '&crsId=' + crsId.value + '&pgrphId=' + info.pgrphId + '&imgId=' + form.imgId); common.navigateTo('/pages/course/study?crsNum=' + form.value.crsNum + '&crsId=' + crsId.value + '&pgrphId=' + info.pgrphId + '&imgId=' + form.imgId);
}; };
const bgOpacity = computed(() => { const bgOpacity = computed(() => {
@@ -137,9 +132,6 @@
const childScrollStatus = ref(false); const childScrollStatus = ref(false);
const scroll_fun = (e) => { const scroll_fun = (e) => {
scrollTop.value = e.detail.scrollTop; scrollTop.value = e.detail.scrollTop;
// getElementPosition().then(res => {
// childScrollStatus.value = statusBarHeight === res.top
// })
}; };
const swiper_change = (res) => { const swiper_change = (res) => {
@@ -149,7 +141,7 @@
const goto_examination = async () => { const goto_examination = async () => {
common.loading(); common.loading();
startExamByCrs({ startExamByCrs({
// crsId : form.value.crsId // crsId : crsId.value
crsId: 'CRS0250181220722025070408313900000018729' crsId: 'CRS0250181220722025070408313900000018729'
}) })
.then((res) => { .then((res) => {
@@ -181,10 +173,10 @@
uni.$on('refresh_comment_data', () => { uni.$on('refresh_comment_data', () => {
console.log('发评论了刷新'); console.log('发评论了刷新');
commentRef.value?.getData('submit'); commentRef.value?.getData('submit');
tabAct.value = 2; tabAct.value = 2;
}); });
}); });
onLoad((params) => { onLoad((params) => {
crsId.value = params.crsId; crsId.value = params.crsId;
}); });
+7 -4
View File
@@ -31,18 +31,18 @@
<view class="talking-cont"> <view class="talking-cont">
<MarkdownPreview :mdString="mdText" /> <MarkdownPreview :mdString="mdText" />
</view> </view>
<view class="btns-cont" v-if="!props.isAnswering"> <view class="btns-cont" v-if="!props.isLoading">
<view class="replay-btn" @click="reAnswer"> <view class="replay-btn" @click="reAnswer">
<image class="icon" src="@/static/images/dialog/answer-restart1.png" style="width: 100%;height: 100%;"></image> <image class="icon" src="@/static/images/dialog/answer-restart1.png" style="width: 100%;height: 100%;"></image>
</view> </view>
<!-- <view class="replay-btn" @click="stopAnswer"> <view class="replay-btn" @click="stopAnswer" v-if="props.isAnswering">
<image class="icon" src="@/static/images/dialog/answer-stop1.png" style="width: 100%;height: 100%;"></image> <image class="icon" src="@/static/images/dialog/answer-stop1.png" style="width: 100%;height: 100%;"></image>
</view> --> </view>
<view class="replay-btn" @click="zanAnswer"> <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-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" src="@/static/images/dialog/answer-yizan1.png" style="width: 100%;height: 100%;"></image>
</view> </view>
<view class="play-btn"> <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-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" src="@/static/images/dialog/answer-yifankui1.png" style="width: 100%;height: 100%;"></image>
</view> </view>
@@ -102,6 +102,9 @@
const zanAnswer = () => { const zanAnswer = () => {
emit('handleEvents', 'great') emit('handleEvents', 'great')
} }
const feedbackAnswer = ()=>{
emit('handleEvents', 'feedback')
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
+222
View File
@@ -0,0 +1,222 @@
<template>
<uni-popup ref="feedbackPopupRef" class="popup">
<view class="feedback_popup_div" :style="{marginBottom:feedback_popup_bottom}">
<view class="title_div">
<view class="text">
反馈
</view>
<view class="popup_back_div" @click="openFeedback(false)">
<image :src="optionErrorIcon('#000000')" class="img"></image>
</view>
</view>
<view class="feedback_item_div">
<view class="feedback_item"
:class="{'feedback_item_clidked':feedbackInfo.type.includes(feedback_type_item.value)}"
@click="feedback_item_click(feedback_type_item.value)"
v-for="feedback_type_item in feedbackTypeList">{{feedback_type_item.label}}</view>
</view>
<view class="feedback_text_area_div">
<uv-textarea height="124" count :maxlength="100" placeholder="请输入反馈内容..." :adjustPosition="false"
v-model="feedbackInfo.text"></uv-textarea>
</view>
<view class="feedback_button">
<uv-button class="button" type="primary" :throttleTime="100" text="提交" color="#0066FF"
custom-style="color:#FFFFFF;borderRadius:16rpx;height:92rpx;"
@click="submit_feedback_fun()"></uv-button>
</view>
</view>
</uni-popup>
</template>
<script setup>
import {
ref,
reactive,
computed,
onMounted,
nextTick
} from 'vue';
import {
insertTraAskFeedback
} from "@/api/dialog.js"
import {
optionErrorIcon
} from '@/common/imgSvg'
import common from '../../../common/common';
const feedback_popup_bottom = ref('0px') // 反馈框下距离
const feedbackPopupRef = ref(null)
// FM("01", "虚假信息"),
// AE("02", "回答不准确"),
// NH("03", "没有帮助"),
// OTHER("04", "其他"),
const feedbackTypeList = reactive([{
value: "01",
label: "虚假信息",
}, {
value: "02",
label: "回答不准确",
}, {
value: "03",
label: "没有帮助",
}, {
value: "04",
label: "其他",
}])
const feedbackInfo = reactive({
type: [], // 反馈类型
text: '', // 反馈内容
examId: '', // 考试ID
qnsId: '', // 试题IDID
})
const feedback_item_click = (value) => {
// 单选
feedbackInfo.type = [value]
// 多选
// if (feedbackInfo.type.includes(value)) {
// feedbackInfo.type = feedbackInfo.type.filter(item => item !== value); // 如果已存在,则从数组中移除
// } else {
// feedbackInfo.type.push(value); // 如果不存在,则添加到数组中
// }
}
const answerData = ref({})
// 反馈提交
const submit_feedback_fun = () => {
// todo 待接口
console.log('反馈提交');
const params = JSON.parse(JSON.stringify({
askId: answerData.value.seqNo,
fbkTyp: feedbackInfo.type[0],
fbkContent: feedbackInfo.text
}))
insertTraAskFeedback(params).then(res=>{
common.msg('反馈提交成功!')
feedbackInfo = {
type: [], // 反馈类型
text: '', // 反馈内容
examId: '', // 考试ID
qnsId: '', // 试题IDID
}
emit('feedbackAnswer', params)
close()
})
}
const openFeedback = (status) => {
if (status) {
feedbackPopupRef.value.open('bottom')
// feedbackInfo.examId
const systemInfo = uni.getSystemInfoSync();
// 安全区域底部到屏幕底部的高度(即底部安全区域高度)
const safeAreaBottomHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom;
//#ifdef APP-PLUS
nextTick(() => {
uni.onKeyboardHeightChange(res => {
let keyboardHeight = res.height;
// 仅在iOS端补偿安全区域高度
if (systemInfo.platform === 'ios') {
keyboardHeight = Math.max(0, keyboardHeight - safeAreaBottomHeight); // 避免负数
}
feedback_popup_bottom.value = `${keyboardHeight}px`;
});
})
// #endif
} else {
feedbackPopupRef.value.close()
}
}
const open = (data) => {
answerData.value = JSON.parse(JSON.stringify(data))
openFeedback(true)
}
const close = () => {
openFeedback()
}
defineExpose({
open,
close
})
</script>
<style scoped lang="scss">
.feedback_popup_div {
width: 100%;
height: 100%;
background-color: #FFFFFF;
padding: 10rpx 34rpx;
display: flex;
flex-direction: column;
align-items: center;
border-radius: 16rpx 16rpx 0px 0px;
position: relative;
.title_div {
width: 100%;
text-align: center;
padding: 30rpx 0;
font-family: PingFangSC;
font-weight: 600;
font-size: 34rpx;
color: #000000;
text-align: center;
font-style: normal;
border-bottom: 2rpx solid #EFEFEF;
}
.popup_back_div {
width: 60rpx;
height: 60rpx;
position: absolute;
top: 30rpx;
right: 30rpx;
display: flex;
align-items: center;
justify-content: center;
.img {
width: 30rpx;
height: 30rpx;
}
}
.feedback_item.feedback_item_clidked {
border: 2rpx solid #0066FF !important;
background-color: #fff !important;
}
.feedback_item_div {
// display: flex;
// align-items: center;
// justify-content: space-between;
width: 100%;
margin: 30rpx 0;
.feedback_item {
float: left;
width: calc(50% - 20rpx);
border: 2rpx solid #F0F0F0;
background-color: #F0F0F0;
border-radius: 16rpx;
padding: 26rpx 36rpx;
font-family: PingFangSC;
font-weight: 500;
font-size: 30rpx;
color: #000000;
text-align: center;
margin-bottom: 20rpx;
&:nth-child(2n){
margin-left: 40rpx;
}
}
}
.feedback_text_area_div {
width: 100%;
margin-bottom: 40rpx;
}
.feedback_button {
width: 100%;
margin-bottom: 20rpx;
}
}
</style>
+82
View File
@@ -0,0 +1,82 @@
<template>
<uni-popup ref="historyPopupRef" class="popup">
<view class="history-popup-view">
<view class="history-title">
<image class="icon-image" src="@/static/images/dialog/history-icon.png" mode=""></image>
对话记录
</view>
<view class="history-list">
<view class="history-item" v-for="item in 8" @click="chooseHistory(item)">
{{'信息补录操作时需录入什么信息信息补录操作时需录入什么信息'}}
</view>
</view>
</view>
</uni-popup>
</template>
<script setup>
import {
ref,
reactive,
computed,
onMounted,
nextTick
} from 'vue';
const historyPopupRef = ref()
const open = () => {
openFeedback(true)
}
const close = () => {
openFeedback()
}
const openFeedback = (status) => {
if (status) {
historyPopupRef.value.open('left')
} else {
historyPopupRef.value.close()
}
}
const chooseHistory = (item) => {
console.log(item)
}
defineExpose({
open,close
})
</script>
<style scoped lang="scss">
.history-popup-view{
width: 582rpx;
height: 100%;
background-color: #fff;
padding: 40rpx;
padding-top: calc(20rpx + var(--status-bar-height));
.history-title{
height: 40rpx;
line-height: 40rpx;
padding-left: 40rpx;
position: relative;
font-size: 29rpx;
color: #000;
margin-bottom: 20rpx;
.icon-image{
position: absolute;
left:0;
height: 32rpx;
width: 32rpx;
top: 4rpx;
}
}
.history-list{
.history-item{
height: 78rpx;
line-height: 78rpx;
font-size: 28rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
}
}
</style>
+93
View File
@@ -0,0 +1,93 @@
<template>
<uni-popup ref="previewPopupRef" class="popup">
<view>
<Table :columns="columns" :data="tableData" >
<template #cell="{ row, column }">
<!-- 自定义 age -->
<template v-if="column.key === 'age'">
<view @click="test" :style="{ color: '#f00' }">
{{ row.age }}
</view>
</template>
<!-- 默认渲染 -->
<template v-else>
{{ row[column.key] }}
</template>
</template>
<!-- 操作列插槽 -->
<!-- <template #actions="{ row, index }">
<button type="primary" size="mini" @click="handleDelete(row, index)">删除</button>
</template> -->
</Table>
</view>
</uni-popup>
</template>
<script setup>
import {
ref,
onMounted,
computed,
} from 'vue'
import Table from './table.vue'
// 表格列配置
const columns = ref([{
title: '姓名',
key: 'name',
width: '120rpx'
},
{
title: '年龄',
key: 'age',
width: '120rpx',
slot: 'age'
},
{
title: '地址',
width: '180rpx',
key: 'address'
}
])
// 表格数据
const tableData = ref([{
name: '张三',
age: 25,
address: '北京市'
},
{
name: '李四',
age: 30,
address: '上海市'
},
{
name: '王五',
age: 28,
address: '广州市'
}
])
const previewPopupRef =ref()
const openFeedback = (status) => {
if (status) {
previewPopupRef.value.open('bottom')
} else {
previewPopupRef.value.close()
}
}
const open = (data) => {
openFeedback(true)
}
const close = () => {
openFeedback()
}
defineExpose({
open,
close
})
</script>
<style scoped lang="scss">
</style>
+172
View File
@@ -0,0 +1,172 @@
<template>
<view class="table-container">
<!-- 表格 -->
<view class="table">
<!-- 表头 -->
<view class="table-header">
<view v-if="canCheck" class="header-cell checkbox-cell">
<checkbox-group @change="handleSelectAll">
<checkbox :checked="isAllSelected" />
</checkbox-group>
</view>
<view v-for="(column, index) in columns" :key="index" class="header-cell"
:style="{ width: column.width || 'auto' }">
{{ column.title }}
</view>
<view v-if="hasActions" class="header-cell actions-cell">操作</view>
</view>
<!-- 表格行 -->
<view class="table-body">
<view v-for="(row, rowIndex) in data" :key="rowIndex" class="table-row"
:class="{ selected: selectedRows.includes(row) }">
<!-- 复选框 -->
<view v-if="canCheck" class="body-cell checkbox-cell">
<checkbox-group @change="(e) => handleSelectRow(row, e)">
<checkbox :checked="selectedRows.includes(row)" />
</checkbox-group>
</view>
<!-- 数据列 -->
<view v-for="(column, colIndex) in columns" :key="colIndex" class="body-cell"
:style="{ width: column.width || 'auto' }">
<slot name="cell" :row="row" :column="column" :index="rowIndex">
<!-- 默认渲染 -->
{{ row[column.key] }}
</slot>
</view>
<!-- 操作列 -->
<view v-if="hasActions" class="body-cell actions-cell">
<slot name="actions" :row="row" :index="rowIndex"></slot>
</view>
</view>
</view>
</view>
<!-- 加载更多 -->
<view v-if="hasMore" class="load-more" @click="loadMore">
<text>点击加载更多</text>
</view>
</view>
</template>
<script setup>
import {
ref,
computed,
useSlots
} from 'vue'
// 定义 props
const props = defineProps({
columns: { // 表格列配置
default: () => ([]),
type: Array
},
data: { // 表格数据
default: () => ([]),
type: Array
},
canCheck: { // 是否显示复选框
default: false,
type: Boolean
},
hasMore: { // 是否还有更多数据
default: false,
type: Boolean
},
})
// 定义事件
const emit = defineEmits(['select-all', 'select-row', 'load-more'])
// 获取插槽
const slots = useSlots()
// 选中的行
const selectedRows = ref([])
// 是否全选
const isAllSelected = computed(() => {
return selectedRows.value.length === props.data.length
})
// 是否有操作列
const hasActions = computed(() => {
return !!slots.actions // 检查是否有 actions 插槽
})
// 处理全选
const handleSelectAll = (e) => {
if (e.detail.value.length > 0) {
selectedRows.value = [...props.data]
} else {
selectedRows.value = []
}
emit('select-all', selectedRows.value)
}
// 处理选择行
const handleSelectRow = (row, e) => {
if (e.detail.value.length > 0) {
selectedRows.value.push(row)
} else {
selectedRows.value = selectedRows.value.filter((r) => r !== row)
}
emit('select-row', selectedRows.value)
}
// 加载更多
const loadMore = () => {
emit('load-more')
}
</script>
<style scoped>
.table-container {
width: 100%;
background-color: #fff;
}
.table {
width: 100%;
border-collapse: collapse;
}
.table-header,
.table-row {
display: flex;
align-items: center;
border-bottom: 2rpx solid #eee;
}
.header-cell,
.body-cell {
padding: 10rpx;
text-align: left;
border-right: 2rpx solid #eee;
box-sizing: border-box;
height: 100%;
}
.checkbox-cell {
width: 100rpx;
text-align: center;
}
.actions-cell {
display: flex;
justify-content: flex-end;
}
.selected {
background-color: #f0f0f0;
}
.load-more {
text-align: center;
padding: 10rpx;
color: #007aff;
cursor: pointer;
}
</style>
+2 -2
View File
@@ -45,10 +45,10 @@
watch(() => props.talkingInfo, () => {},{deep: true,immediate: true}) watch(() => props.talkingInfo, () => {},{deep: true,immediate: true})
const { talkingType } = toRefs(props) const { talkingType } = toRefs(props)
const handleEvents = (type) => { const handleEvents = (type) => {
emit('handleEvents', type, props.talkingInfo) emit('handleEvents',{ type, data: props.talkingInfo, id:""})
} }
const changePlay = (id) => { const changePlay = (id) => {
emit('handleEvents', 'changePlay', props.talkingInfo, id) emit('handleEvents', {type: 'changePlay', data: props.talkingInfo, id})
} }
</script> </script>
+33 -12
View File
@@ -11,7 +11,7 @@
AI问答 AI问答
<view class="seek-setting"> <view class="seek-setting">
<image src="@/static/images/dialog/new-dialog.png" alt="" class="image-icon-new" @click="createNewDialog"></image> <image src="@/static/images/dialog/new-dialog.png" alt="" class="image-icon-new" @click="createNewDialog"></image>
<image src="@/static/images/dialog/history.png" alt="" class="image-icon"></image> <image src="@/static/images/dialog/history.png" alt="" class="image-icon" @click="showHistory"></image>
</view> </view>
</view> </view>
@@ -84,6 +84,10 @@
<TouchBtn class="talk-btns" @uploadVoice="uploadRecordNow" @submitAnswer="submitAnswerNow" <TouchBtn class="talk-btns" @uploadVoice="uploadRecordNow" @submitAnswer="submitAnswerNow"
@startRecord="startRecordCallback" :loadingText="sendLoadingText" :isLoading="!answerIsOver" @startRecord="startRecordCallback" :loadingText="sendLoadingText" :isLoading="!answerIsOver"
:isDisabled="false" /> :isDisabled="false" />
<!-- 反馈组件 -->
<Feedback ref="feedbackRef"></Feedback>
<History ref="historyRef"></History>
<PreviewVue ref="previewRef"/>
</scroll-view> </scroll-view>
</view> </view>
</template> </template>
@@ -101,6 +105,7 @@
import common from '@/common/common'; import common from '@/common/common';
import TouchBtn from '@/pages/course/components/touchBtn.vue' import TouchBtn from '@/pages/course/components/touchBtn.vue'
import TalkingItem from './components/talking-item.vue'; import TalkingItem from './components/talking-item.vue';
import PreviewVue from './components/preview.vue';
import { import {
useSocketStore useSocketStore
} from "@/store/socket.js" } from "@/store/socket.js"
@@ -128,8 +133,12 @@
commonUploadVoiceFile commonUploadVoiceFile
} from "@/api/common.js" } from "@/api/common.js"
import { import {
queryHotQuestionApi queryHotQuestionApi,
insertTraAskFeedback
} from "@/api/dialog.js" } from "@/api/dialog.js"
import Feedback from './components/feedback.vue'
import History from './components/history.vue'
const { const {
statusBarHeight statusBarHeight
} = uni.getWindowInfo() } = uni.getWindowInfo()
@@ -141,6 +150,7 @@
SocketObj SocketObj
} = storeToRefs(socketStore) } = storeToRefs(socketStore)
const feedbackRef = ref()
const userInfo = ref(getUserInfo()) const userInfo = ref(getUserInfo())
const questionList = ref([ const questionList = ref([
// '对公小程序开户流程?', // '对公小程序开户流程?',
@@ -275,7 +285,7 @@
return return
} }
if (commond === 'ASK-STOP') { if (commond === 'ASK-STOP') {
// console.log('停止回答标记!') console.log('停止回答标记!')
stopAnswerCallBack.value && stopAnswerCallBack.value(askData.value) stopAnswerCallBack.value && stopAnswerCallBack.value(askData.value)
setTimeout(() => { setTimeout(() => {
stopAnswerCallBack.value = null stopAnswerCallBack.value = null
@@ -354,10 +364,18 @@
} }
const stopAnswerCallBack = ref(null) const stopAnswerCallBack = ref(null)
const talkItemEvents = (type, data, id = '') => { const talkItemEvents = ({type, data, id}) => {
switch (type) { switch (type) {
case 'reAnswer': case 'reAnswer':
console.log('重新提问回答') console.log('重新提问回答')
// 停止获取
sendMessage({
"commond": 'ASK-STOP',
"body": {
reqBatch: reqBatch.value,
seqNo: seqNo.value,
}
})
sendMessage({ sendMessage({
"commond": 'ASK', "commond": 'ASK',
"body": data.askData "body": data.askData
@@ -369,14 +387,6 @@
// "body": $data // "body": $data
// }) // })
// } // }
// // 停止获取
// sendMessage({
// "commond": 'ASK-STOP',
// "body": {
// reqBatch: reqBatch.value,
// seqNo: seqNo.value,
// }
// })
break; break;
case 'stop': case 'stop':
console.log('停止获取数据') console.log('停止获取数据')
@@ -394,10 +404,17 @@
console.log('播放/暂停') console.log('播放/暂停')
activeVoiceTalkingItemId.value = id activeVoiceTalkingItemId.value = id
break; break;
case 'feedback':
feedbackRef.value.open(data)
break;
default: default:
break; break;
} }
} }
const historyRef = ref(null)
const showHistory = () => {
historyRef.value.open()
}
const routerTo = (type) => { const routerTo = (type) => {
switch (type) { switch (type) {
case 'AI学': case 'AI学':
@@ -546,8 +563,10 @@
return return
} }
}) })
const previewRef = ref()
onMounted(() => { onMounted(() => {
loadData() loadData()
// previewRef.value.open()
}) })
const refreshData = () => { const refreshData = () => {
@@ -558,12 +577,14 @@
const setHeight = (res) => { const setHeight = (res) => {
keyboardHeight.value = res.height +'px' keyboardHeight.value = res.height +'px'
} }
//#ifdef APP-PLUS
onHide(() => { onHide(() => {
uni.offKeyboardHeightChange(setHeight) uni.offKeyboardHeightChange(setHeight)
}) })
onShow(() => { onShow(() => {
uni.onKeyboardHeightChange(setHeight) uni.onKeyboardHeightChange(setHeight)
}) })
// #endif
onUnload(() => { onUnload(() => {
watchFlag.value = 1 watchFlag.value = 1
socketStore?.closeSocket() socketStore?.closeSocket()
Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B