一些操作2
This commit is contained in:
@@ -9,4 +9,14 @@ export const queryHotQuestionApi = (data) => {
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
// 获取问答历史
|
||||
|
||||
// 问答反馈
|
||||
export const insertTraAskFeedback = (data) => {
|
||||
return request({
|
||||
url: '/traask/traAskFeedback/insertTraAskFeedback',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
};
|
||||
+8
-6
@@ -5,16 +5,16 @@ import common from '@/common/common.js'
|
||||
|
||||
const ENV = import.meta.env
|
||||
|
||||
export const get_base_url = url => {
|
||||
export const get_base_url = (url = '') => {
|
||||
if (ENV.MODE === 'development') { // 开发环境
|
||||
// H5必须用非https,手机端必须用https
|
||||
// #ifdef H5
|
||||
return ENV.VITE_APP_BASE_H5_API_Url || ENV.VITE_APP_BASE_API_Url
|
||||
const baseUrl = ENV.VITE_APP_BASE_API_Url
|
||||
if (baseUrl.startsWith('https')) {
|
||||
return baseUrl.replace('https', 'http')
|
||||
if (url) {
|
||||
let _str = (url.split('/')[0] || url.split('/')[1])?.toUpperCase()
|
||||
return ENV[`VITE_APP_BASE_H5_API_Url_${_str}`] || ENV.VITE_APP_BASE_H5_API_Url || ENV.VITE_APP_BASE_API_Url
|
||||
} else {
|
||||
return ENV.VITE_APP_BASE_H5_API_Url || ENV.VITE_APP_BASE_API_Url
|
||||
}
|
||||
return baseUrl
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
return ENV.VITE_APP_BASE_API_Url
|
||||
@@ -80,6 +80,8 @@ export default function request({
|
||||
headers_base['summary'] = token // 让每个请求携带令牌
|
||||
}
|
||||
let that = this
|
||||
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: `${baseUrl || base_url}${url}`,
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
<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"/>
|
||||
</view>
|
||||
<view v-if="type === 3 && dataInfo.knoExampie " style="overflow: hidden;">
|
||||
举例:{{ dataInfo.knoExampie }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="btns-cont" v-show="!dataInfo.isLoading">
|
||||
<view class="replay-btn" @click.stop="restartPlay" v-if="!([5].indexOf(type) >= 0)">
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
<template>
|
||||
<view class="talk-btns" ref="talkBtnRef">
|
||||
<view
|
||||
class="touch-btn"
|
||||
@touchstart="getRecordPermission"
|
||||
@touchend="hideOverlayTalking"
|
||||
@touchmove="handleMove"
|
||||
v-if="!keyboardIsShow"
|
||||
>按住说话
|
||||
<view class="touch-btn" @touchstart="getRecordPermission" @touchend="hideOverlayTalking" @touchmove="handleMove"
|
||||
v-if="!keyboardIsShow">按住说话
|
||||
</view>
|
||||
<view class="touch-btn" v-if="keyboardIsShow">
|
||||
<uv-input class="input-box" ref="inputRef" v-model="answerValue" :maxlength="props.textValueLength" :adjustPosition="false"
|
||||
placeholderStyle='color:#999999;font-size:26rpx' placeholder="请输入文字">
|
||||
<uv-input class="input-box" ref="inputRef" v-model="answerValue" :maxlength="props.textValueLength"
|
||||
:adjustPosition="false" placeholderStyle='color:#999999;font-size:26rpx' placeholder="请输入文字">
|
||||
</uv-input>
|
||||
</view>
|
||||
<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 && !answerValue" src="/src/static/images/course/record.png" mode="" @click="changeBtn"></image>
|
||||
<image class="talk-btn-icon" v-show="keyboardIsShow && !!answerValue" src="/src/static/images/course/send.png" mode=""
|
||||
@click.stop="showKeyboard"
|
||||
></image>
|
||||
<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 && !answerValue" src="/src/static/images/course/record.png"
|
||||
mode="" @click="changeBtn"></image>
|
||||
<image class="talk-btn-icon" v-show="keyboardIsShow && !!answerValue" src="/src/static/images/course/send.png"
|
||||
mode="" @click.stop="showKeyboard"></image>
|
||||
</view>
|
||||
<uv-overlay :show="showTalkingModel" opacity=".9" @click="showTalkingModel = false">
|
||||
<view class="overlay-box">
|
||||
@@ -29,7 +25,7 @@
|
||||
</view>
|
||||
<view class="tips-box">松开发送</view>
|
||||
<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-else src="/src/static/images/course/close-active.png" mode=""></image>
|
||||
</view>
|
||||
@@ -40,348 +36,383 @@
|
||||
</view>
|
||||
</uv-overlay>
|
||||
</view>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { toRefs, ref, computed, unref, onMounted, onUnmounted, nextTick, watch, getCurrentInstance } from 'vue';
|
||||
import common from '../../../common/common';
|
||||
import permission from '@/common/permission.js'
|
||||
import { getPhoneEnvBool } from '@/common/common.js'
|
||||
const proxy = getCurrentInstance()
|
||||
const emit = defineEmits(['uploadVoice', 'submitAnswer','startRecord'])
|
||||
const props = defineProps({
|
||||
isDisabled:{
|
||||
default: true,
|
||||
type: Boolean
|
||||
},
|
||||
isLoading:{
|
||||
default: false,
|
||||
type: Boolean
|
||||
},
|
||||
loadingText:{
|
||||
default: '发送回答中,请稍后再试!',
|
||||
type: String
|
||||
},
|
||||
onlyVoice:{
|
||||
default: false,
|
||||
type: Boolean
|
||||
},
|
||||
canAnswer:{
|
||||
default: true,
|
||||
type: Boolean
|
||||
},
|
||||
canAnswerText:{
|
||||
default: '当前状态不能发送内容!',
|
||||
type: String
|
||||
},
|
||||
textValueLength:{
|
||||
type: Number,
|
||||
default: 500
|
||||
}
|
||||
})
|
||||
const { isDisabled, onlyVoice } = toRefs(props)
|
||||
const isLoadingState = computed(() => props.isLoading)
|
||||
|
||||
const showTalkingModel = ref(false)
|
||||
const keyboardIsShow = ref(false)
|
||||
|
||||
watch(()=>props.isLoading,()=>{},{
|
||||
deep:true,immediate:true
|
||||
})
|
||||
watch(()=>props.canAnswer,()=>{},{
|
||||
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()
|
||||
import {
|
||||
toRefs,
|
||||
ref,
|
||||
computed,
|
||||
unref,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
nextTick,
|
||||
watch,
|
||||
getCurrentInstance
|
||||
} from 'vue';
|
||||
import common from '../../../common/common';
|
||||
import permission from '@/common/permission.js'
|
||||
import {
|
||||
getPhoneEnvBool
|
||||
} from '@/common/common.js'
|
||||
const proxy = getCurrentInstance()
|
||||
const emit = defineEmits(['uploadVoice', 'submitAnswer', 'startRecord'])
|
||||
const props = defineProps({
|
||||
isDisabled: {
|
||||
default: true,
|
||||
type: Boolean
|
||||
},
|
||||
isLoading: {
|
||||
default: false,
|
||||
type: Boolean
|
||||
},
|
||||
loadingText: {
|
||||
default: '发送回答中,请稍后再试!',
|
||||
type: String
|
||||
},
|
||||
onlyVoice: {
|
||||
default: false,
|
||||
type: Boolean
|
||||
},
|
||||
canAnswer: {
|
||||
default: true,
|
||||
type: Boolean
|
||||
},
|
||||
canAnswerText: {
|
||||
default: '当前状态不能发送内容!',
|
||||
type: String
|
||||
},
|
||||
textValueLength: {
|
||||
type: Number,
|
||||
default: 500
|
||||
}
|
||||
})
|
||||
unref(recordObjCom).onStart(() => {
|
||||
startFlag.value = 1
|
||||
setTimeout(()=>{
|
||||
startFlag.value = 2
|
||||
},1000)
|
||||
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 {
|
||||
isDisabled,
|
||||
onlyVoice
|
||||
} = toRefs(props)
|
||||
const isLoadingState = computed(() => props.isLoading)
|
||||
|
||||
const stopRecord = () => {
|
||||
isStopNum.value = isStartNum.value
|
||||
try{
|
||||
if(unref(recordObjCom).stop){
|
||||
unref(recordObjCom).stop()
|
||||
}else{
|
||||
closeModel()
|
||||
const showTalkingModel = ref(false)
|
||||
const keyboardIsShow = ref(false)
|
||||
|
||||
watch(() => props.isLoading, () => {}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
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()
|
||||
}
|
||||
// setTimeout(() => {
|
||||
// canStart.value = true
|
||||
// }, 1000)
|
||||
}
|
||||
const closeModel = (cb = () => {}) => {
|
||||
isStopNum.value = isStartNum.value
|
||||
setTimeout(() => {
|
||||
showTalkingModel.value = false
|
||||
cb && cb()
|
||||
}, 350)
|
||||
}
|
||||
// #endif
|
||||
//#ifndef APP-PLUS
|
||||
const recordObjCom = ref({})
|
||||
const initRecord = () => {}
|
||||
// #endif
|
||||
onMounted(async ()=>{
|
||||
initRecord?.()
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true
|
||||
})
|
||||
|
||||
|
||||
const answerValue = ref('')
|
||||
const talkBtnRef = ref()
|
||||
// 录音
|
||||
const audioPath = ref('')
|
||||
const audioObj = uni.createInnerAudioContext()
|
||||
//#ifdef APP-PLUS
|
||||
// 安卓端
|
||||
if(IsAndEnv){
|
||||
let _recordPerm = await permission.requestAndroidPermission('android.permission.RECORD_AUDIO')
|
||||
if(_recordPerm !== 1){
|
||||
common.show('提示信息', '当前页面需要使用的录音权限,是否前往开启?',true, '取消','确定').then((res) => {
|
||||
if(res) {
|
||||
// 去开启权限
|
||||
permission.gotoAppPermissionSetting()
|
||||
}else{
|
||||
// 取消
|
||||
common.navigateBack()
|
||||
}
|
||||
})
|
||||
// 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()
|
||||
}
|
||||
}else{
|
||||
})
|
||||
unref(recordObjCom).onStart(() => {
|
||||
startFlag.value = 1
|
||||
setTimeout(() => {
|
||||
startFlag.value = 2
|
||||
}, 1000)
|
||||
let _recordPerm = uni.getAppAuthorizeSetting()
|
||||
let _state = _recordPerm.microphoneAuthorized
|
||||
if(_state === 'denied'){
|
||||
common.show('提示信息', '当前页面需要使用的录音权限,是否前往开启?',true, '取消','确定').then((res) => {
|
||||
if(res) {
|
||||
console.log(isStopNum.value === isStartNum.value, _state)
|
||||
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 = () => {
|
||||
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()
|
||||
}else{
|
||||
permission.gotoAppPermissionSetting()
|
||||
} else {
|
||||
// 取消
|
||||
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()
|
||||
}
|
||||
}
|
||||
// #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
|
||||
setTimeout(() => {
|
||||
hideOverlayTalking()
|
||||
},59 * 1010)
|
||||
}else{
|
||||
showTalkingModel.value = false
|
||||
uni.showToast({
|
||||
title: '暂无问题需要回答!',
|
||||
icon: "none",
|
||||
duration:1000
|
||||
})
|
||||
})
|
||||
// 录音结束
|
||||
|
||||
// 记录 按下移动位置
|
||||
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) => {
|
||||
if (isTalking.value) {
|
||||
common.msg('操作频繁,请稍后重试!')
|
||||
return
|
||||
}
|
||||
showOverlayTalking(obj)
|
||||
}
|
||||
}
|
||||
const hideOverlayTalking = (obj) => {
|
||||
isMoving.value = false
|
||||
if(!showTalkingModel.value) return
|
||||
//#ifdef APP-PLUS
|
||||
stopRecord()
|
||||
// #endif
|
||||
}
|
||||
|
||||
const handleMove = (obj) => {
|
||||
if(isMoving.value){
|
||||
touchX.value = obj.changedTouches[0].pageX
|
||||
touchY.value = obj.changedTouches[0].pageY
|
||||
if(outScreen.value){
|
||||
hideOverlayTalking(obj)
|
||||
const isMoving = ref(false)
|
||||
const isTalking = 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
|
||||
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 showKeyboard = () => {
|
||||
if(isLoadingState.value){
|
||||
uni.showToast({
|
||||
title: props.loadingText,
|
||||
icon: "none",
|
||||
duration:1000
|
||||
})
|
||||
return
|
||||
const hideOverlayTalking = (obj) => {
|
||||
isMoving.value = false
|
||||
if (!showTalkingModel.value) return
|
||||
//#ifdef APP-PLUS
|
||||
stopRecord()
|
||||
// #endif
|
||||
}
|
||||
if(!isDisabled.value){
|
||||
if(keyboardIsShow.value){
|
||||
if(answerValue.value.trim()){
|
||||
emit(
|
||||
'submitAnswer',
|
||||
answerValue.value,
|
||||
changeBtn
|
||||
)
|
||||
}else{
|
||||
// keyboardIsShow.value = !keyboardIsShow.value
|
||||
common.msg("不能发送空白消息!")
|
||||
|
||||
const handleMove = (obj) => {
|
||||
if (isMoving.value) {
|
||||
touchX.value = obj.changedTouches[0].pageX
|
||||
touchY.value = obj.changedTouches[0].pageY
|
||||
if (outScreen.value) {
|
||||
hideOverlayTalking(obj)
|
||||
}
|
||||
}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 = ''
|
||||
}
|
||||
// 发送文本
|
||||
const showKeyboard = () => {
|
||||
if (isLoadingState.value) {
|
||||
uni.showToast({
|
||||
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>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.talk-btns{
|
||||
.talk-btns {
|
||||
height: 150rpx;
|
||||
background-color: #fff;
|
||||
padding: 25rpx 30rpx 0;
|
||||
position: relative;
|
||||
.touch-btn{
|
||||
|
||||
.touch-btn {
|
||||
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;
|
||||
line-height: 92rpx;
|
||||
color: #000;
|
||||
font-weight: 400;
|
||||
position: relative;
|
||||
.input-box{
|
||||
|
||||
.input-box {
|
||||
width: 100%;
|
||||
height: 92rpx;
|
||||
line-height: 92rpx;
|
||||
text-align: left;
|
||||
box-sizing: border-box;
|
||||
padding:0 40rpx 0 40rpx;
|
||||
padding: 0 40rpx 0 40rpx;
|
||||
}
|
||||
}
|
||||
.talk-btn-box{
|
||||
|
||||
.talk-btn-box {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 120rpx;
|
||||
right: 0;
|
||||
top:0;
|
||||
.talk-btn-icon{
|
||||
top: 0;
|
||||
|
||||
.talk-btn-icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
position: absolute;
|
||||
@@ -391,40 +422,45 @@ const changeBtn = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.overlay-box{
|
||||
|
||||
.overlay-box {
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
// justify-content: flex-end;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.circle-bg-box{
|
||||
|
||||
.circle-bg-box {
|
||||
height: 234rpx;
|
||||
background: url(@/static/images/course/talking.png) no-repeat;
|
||||
background-size: cover;
|
||||
position: relative;
|
||||
.icon-box{
|
||||
|
||||
.icon-box {
|
||||
position: absolute;
|
||||
left:50%;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-left: -17rpx;
|
||||
margin-top: -24rpx;
|
||||
width: 34rpx;
|
||||
height: 48rpx;
|
||||
image{
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.tips-box{
|
||||
|
||||
.tips-box {
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
color:#c0c0c0;
|
||||
color: #c0c0c0;
|
||||
text-align: center;
|
||||
margin: 12rpx 0 24rpx;
|
||||
}
|
||||
.btns-box{
|
||||
|
||||
.btns-box {
|
||||
height: 270rpx;
|
||||
// padding: 0 120rpx;
|
||||
width: 154rpx;
|
||||
@@ -433,42 +469,50 @@ const changeBtn = () => {
|
||||
font-size: 28rpx;
|
||||
text-align: center;
|
||||
line-height: 116rpx;
|
||||
.close-btn{
|
||||
|
||||
.close-btn {
|
||||
float: left;
|
||||
height: 100%;
|
||||
width: 154rpx;
|
||||
overflow: hidden;
|
||||
color:#999;
|
||||
&.is-out{
|
||||
color:#fff;
|
||||
color: #999;
|
||||
|
||||
&.is-out {
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.translate-btn{
|
||||
|
||||
.translate-btn {
|
||||
float: right;
|
||||
height: 100%;
|
||||
width: 154rpx;
|
||||
overflow: hidden;
|
||||
color:#999;
|
||||
color: #999;
|
||||
}
|
||||
.btn-box{
|
||||
|
||||
.btn-box {
|
||||
width: 100%;
|
||||
height: 154rpx;
|
||||
}
|
||||
}
|
||||
.talk-dialog{
|
||||
|
||||
.talk-dialog {
|
||||
width: 506rpx;
|
||||
height: 234rpx;
|
||||
margin: 0 auto;
|
||||
background-color: #06f;
|
||||
border-radius: 32rpx;
|
||||
position: relative;
|
||||
&.is-out{
|
||||
|
||||
&.is-out {
|
||||
background-color: #ff3e49;
|
||||
&::after{
|
||||
|
||||
&::after {
|
||||
background-color: #ff3e49;
|
||||
}
|
||||
}
|
||||
.gif-box{
|
||||
|
||||
.gif-box {
|
||||
position: absolute;
|
||||
width: 200rpx;
|
||||
height: 80rpx;
|
||||
@@ -476,7 +520,8 @@ const changeBtn = () => {
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
&::after{
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
@@ -485,35 +530,40 @@ const changeBtn = () => {
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
bottom: -22rpx;
|
||||
left:50%;
|
||||
left: 50%;
|
||||
margin-left: -22rpx;
|
||||
}
|
||||
}
|
||||
.white-bg-box{
|
||||
|
||||
.white-bg-box {
|
||||
height: 365rpx;
|
||||
background-color: #fff;
|
||||
overflow: hidden;
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
padding: 58rpx 36rpx;
|
||||
.box-title{
|
||||
|
||||
.box-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
line-height: 46rpx;
|
||||
margin-bottom: 46rpx;
|
||||
}
|
||||
.box-btns{
|
||||
|
||||
.box-btns {
|
||||
height: 46rpx;
|
||||
line-height: 46rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
color: #999;
|
||||
.is-active{
|
||||
|
||||
.is-active {
|
||||
color: #06f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
::v-deep .uv-input__content__field-wrapper__field{
|
||||
|
||||
::v-deep .uv-input__content__field-wrapper__field {
|
||||
padding-right: 60rpx;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -279,7 +279,7 @@ import { onShow } from "@dcloudio/uni-app"
|
||||
}
|
||||
// 跳转 课程详情
|
||||
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)
|
||||
}
|
||||
onMounted(()=>{
|
||||
|
||||
@@ -31,13 +31,8 @@
|
||||
</view>
|
||||
<view class="fl1"></view>
|
||||
<view class="num-item" @click="collect_click(form.collectId)">
|
||||
<image
|
||||
v-if="form.collectId"
|
||||
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>
|
||||
<image v-if="form.collectId" 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>
|
||||
@@ -74,12 +69,12 @@
|
||||
</scroll-view>
|
||||
<view class="btn-box btn-box-height font_pf">
|
||||
<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" @click="goto_examination()">去考试</uv-button>
|
||||
</template>
|
||||
<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>
|
||||
</template>
|
||||
@@ -125,7 +120,7 @@
|
||||
form.value = body;
|
||||
};
|
||||
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(() => {
|
||||
@@ -137,9 +132,6 @@
|
||||
const childScrollStatus = ref(false);
|
||||
const scroll_fun = (e) => {
|
||||
scrollTop.value = e.detail.scrollTop;
|
||||
// getElementPosition().then(res => {
|
||||
// childScrollStatus.value = statusBarHeight === res.top
|
||||
// })
|
||||
};
|
||||
|
||||
const swiper_change = (res) => {
|
||||
@@ -149,7 +141,7 @@
|
||||
const goto_examination = async () => {
|
||||
common.loading();
|
||||
startExamByCrs({
|
||||
// crsId : form.value.crsId
|
||||
// crsId : crsId.value
|
||||
crsId: 'CRS0250181220722025070408313900000018729'
|
||||
})
|
||||
.then((res) => {
|
||||
@@ -181,10 +173,10 @@
|
||||
uni.$on('refresh_comment_data', () => {
|
||||
console.log('发评论了刷新');
|
||||
commentRef.value?.getData('submit');
|
||||
|
||||
tabAct.value = 2;
|
||||
});
|
||||
});
|
||||
|
||||
onLoad((params) => {
|
||||
crsId.value = params.crsId;
|
||||
});
|
||||
|
||||
@@ -31,18 +31,18 @@
|
||||
<view class="talking-cont">
|
||||
<MarkdownPreview :mdString="mdText" />
|
||||
</view>
|
||||
<view class="btns-cont" v-if="!props.isAnswering">
|
||||
<view class="btns-cont" v-if="!props.isLoading">
|
||||
<view class="replay-btn" @click="reAnswer">
|
||||
<image class="icon" src="@/static/images/dialog/answer-restart1.png" style="width: 100%;height: 100%;"></image>
|
||||
</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>
|
||||
</view> -->
|
||||
</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>
|
||||
</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-yifankui1.png" style="width: 100%;height: 100%;"></image>
|
||||
</view>
|
||||
@@ -102,6 +102,9 @@
|
||||
const zanAnswer = () => {
|
||||
emit('handleEvents', 'great')
|
||||
}
|
||||
const feedbackAnswer = ()=>{
|
||||
emit('handleEvents', 'feedback')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -45,10 +45,10 @@
|
||||
watch(() => props.talkingInfo, () => {},{deep: true,immediate: true})
|
||||
const { talkingType } = toRefs(props)
|
||||
const handleEvents = (type) => {
|
||||
emit('handleEvents', type, props.talkingInfo)
|
||||
emit('handleEvents',{ type, data: props.talkingInfo, id:""})
|
||||
}
|
||||
const changePlay = (id) => {
|
||||
emit('handleEvents', 'changePlay', props.talkingInfo, id)
|
||||
emit('handleEvents', {type: 'changePlay', data: props.talkingInfo, id})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
+33
-12
@@ -11,7 +11,7 @@
|
||||
AI问答
|
||||
<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/history.png" alt="" class="image-icon"></image>
|
||||
<image src="@/static/images/dialog/history.png" alt="" class="image-icon" @click="showHistory"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -84,6 +84,10 @@
|
||||
<TouchBtn class="talk-btns" @uploadVoice="uploadRecordNow" @submitAnswer="submitAnswerNow"
|
||||
@startRecord="startRecordCallback" :loadingText="sendLoadingText" :isLoading="!answerIsOver"
|
||||
:isDisabled="false" />
|
||||
<!-- 反馈组件 -->
|
||||
<Feedback ref="feedbackRef"></Feedback>
|
||||
<History ref="historyRef"></History>
|
||||
<PreviewVue ref="previewRef"/>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -101,6 +105,7 @@
|
||||
import common from '@/common/common';
|
||||
import TouchBtn from '@/pages/course/components/touchBtn.vue'
|
||||
import TalkingItem from './components/talking-item.vue';
|
||||
import PreviewVue from './components/preview.vue';
|
||||
import {
|
||||
useSocketStore
|
||||
} from "@/store/socket.js"
|
||||
@@ -128,8 +133,12 @@
|
||||
commonUploadVoiceFile
|
||||
} from "@/api/common.js"
|
||||
import {
|
||||
queryHotQuestionApi
|
||||
queryHotQuestionApi,
|
||||
insertTraAskFeedback
|
||||
} from "@/api/dialog.js"
|
||||
import Feedback from './components/feedback.vue'
|
||||
import History from './components/history.vue'
|
||||
|
||||
const {
|
||||
statusBarHeight
|
||||
} = uni.getWindowInfo()
|
||||
@@ -141,6 +150,7 @@
|
||||
SocketObj
|
||||
} = storeToRefs(socketStore)
|
||||
|
||||
const feedbackRef = ref()
|
||||
const userInfo = ref(getUserInfo())
|
||||
const questionList = ref([
|
||||
// '对公小程序开户流程?',
|
||||
@@ -275,7 +285,7 @@
|
||||
return
|
||||
}
|
||||
if (commond === 'ASK-STOP') {
|
||||
// console.log('停止回答标记!')
|
||||
console.log('停止回答标记!')
|
||||
stopAnswerCallBack.value && stopAnswerCallBack.value(askData.value)
|
||||
setTimeout(() => {
|
||||
stopAnswerCallBack.value = null
|
||||
@@ -354,10 +364,18 @@
|
||||
}
|
||||
|
||||
const stopAnswerCallBack = ref(null)
|
||||
const talkItemEvents = (type, data, id = '') => {
|
||||
const talkItemEvents = ({type, data, id}) => {
|
||||
switch (type) {
|
||||
case 'reAnswer':
|
||||
console.log('重新提问回答')
|
||||
// 停止获取
|
||||
sendMessage({
|
||||
"commond": 'ASK-STOP',
|
||||
"body": {
|
||||
reqBatch: reqBatch.value,
|
||||
seqNo: seqNo.value,
|
||||
}
|
||||
})
|
||||
sendMessage({
|
||||
"commond": 'ASK',
|
||||
"body": data.askData
|
||||
@@ -369,14 +387,6 @@
|
||||
// "body": $data
|
||||
// })
|
||||
// }
|
||||
// // 停止获取
|
||||
// sendMessage({
|
||||
// "commond": 'ASK-STOP',
|
||||
// "body": {
|
||||
// reqBatch: reqBatch.value,
|
||||
// seqNo: seqNo.value,
|
||||
// }
|
||||
// })
|
||||
break;
|
||||
case 'stop':
|
||||
console.log('停止获取数据')
|
||||
@@ -394,10 +404,17 @@
|
||||
console.log('播放/暂停')
|
||||
activeVoiceTalkingItemId.value = id
|
||||
break;
|
||||
case 'feedback':
|
||||
feedbackRef.value.open(data)
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
const historyRef = ref(null)
|
||||
const showHistory = () => {
|
||||
historyRef.value.open()
|
||||
}
|
||||
const routerTo = (type) => {
|
||||
switch (type) {
|
||||
case 'AI学':
|
||||
@@ -546,8 +563,10 @@
|
||||
return
|
||||
}
|
||||
})
|
||||
const previewRef = ref()
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
// previewRef.value.open()
|
||||
})
|
||||
|
||||
const refreshData = () => {
|
||||
@@ -558,12 +577,14 @@
|
||||
const setHeight = (res) => {
|
||||
keyboardHeight.value = res.height +'px'
|
||||
}
|
||||
//#ifdef APP-PLUS
|
||||
onHide(() => {
|
||||
uni.offKeyboardHeightChange(setHeight)
|
||||
})
|
||||
onShow(() => {
|
||||
uni.onKeyboardHeightChange(setHeight)
|
||||
})
|
||||
// #endif
|
||||
onUnload(() => {
|
||||
watchFlag.value = 1
|
||||
socketStore?.closeSocket()
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 754 B |
Reference in New Issue
Block a user