diff --git a/.env.development.yh b/.env.development.yh
index 2b8b529b..193ce295 100644
--- a/.env.development.yh
+++ b/.env.development.yh
@@ -2,9 +2,9 @@
ENV = 'development.yh'
# 'development.yh'
-VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001'
+# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001'
-# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.91:9786'
+VITE_APP_BASE_H5_API_Url = 'http://25.18.122.91:9786'
# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.78:9786'
# VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
# VITE_APP_BASE_H5_API_Url_TRAEXAM = 'http://25.64.32.154:9604'
diff --git a/src/common/common.js b/src/common/common.js
index 613c33cd..e5416482 100644
--- a/src/common/common.js
+++ b/src/common/common.js
@@ -5,7 +5,7 @@ import {
import showDialog from '@/common/dialogMessage'
import common from '@/common/common'
// #endif
-function msg(title, duration = 1000) {
+function msg(title, duration = 1500) {
uni.showToast({
title: title,
duration: duration,
diff --git a/src/pages/course/components/talkingItem.vue b/src/pages/course/components/talkingItem.vue
index 7b12b937..f2e54504 100644
--- a/src/pages/course/components/talkingItem.vue
+++ b/src/pages/course/components/talkingItem.vue
@@ -61,7 +61,7 @@
-
{
+ return (dataInfo.value.imageAddrs || [])
+ })
+
const previewFile = info => {
previewFileFnc({
fileId: info.fileId,
@@ -705,19 +709,30 @@
// }
};
const setVoiceTime = (sum) => {
- sum += 1;
- if (talkVoiceObj.value.duration) {
- voiceTime.value = (Math.ceil(talkVoiceObj.value.duration) || 0) + 's';
- } else {
- if (sum === 100) {
- voiceTime.value = (unref(dataInfo).voiceTime || 0) + 's';
- return;
+ plus.io.getAudioInfo({
+ filePath: unref(dataInfo).talkingVoice,
+ success:(res)=>{
+ voiceTime.value = (Math.floor(res.duration) || 1) + 's'
+ },
+ fail:(res)=>{
+ voiceTime.value = (unref(dataInfo).voiceTime || 1) + 's'
}
- setTimeout(() => {
- setVoiceTime(sum);
- }, 300);
- }
- };
+ })
+ }
+ // const setVoiceTime = (sum) => {
+ // sum += 1;
+ // if (talkVoiceObj.value.duration) {
+ // voiceTime.value = (Math.ceil(talkVoiceObj.value.duration) || 0) + 's';
+ // } else {
+ // if (sum === 100) {
+ // voiceTime.value = (unref(dataInfo).voiceTime || 0) + 's';
+ // return;
+ // }
+ // setTimeout(() => {
+ // setVoiceTime(sum);
+ // }, 300);
+ // }
+ // };
const playQnsVoice = (readType = 'qns', item) => {
if (type.value === 2) {
// 文本转语音
@@ -942,6 +957,13 @@
&:nth-child(3n){
margin-right: 0;
}
+ &.cont-img-box2{
+ width: calc(50% - 10rpx);
+ height: 200rpx;
+ &:nth-child(2n){
+ margin-right: 0rpx;
+ }
+ }
}
}
diff --git a/src/pages/course/components/touchBtn.vue b/src/pages/course/components/touchBtn.vue
index 0655014d..c3c16b5c 100644
--- a/src/pages/course/components/touchBtn.vue
+++ b/src/pages/course/components/touchBtn.vue
@@ -1,7 +1,7 @@
+ @touchcancel="hideOverlayTalking" v-if="!keyboardIsShow">
按住说话
@@ -9,6 +9,7 @@
:adjustPosition="adjustPosition" placeholderStyle="color:#999999;font-size:26rpx"
placeholder="请输入文字">
+
@@ -17,25 +18,52 @@
-
+
+
+ { console.log(1111)}" mask-background-color="rgba(0,0,0,0.9)">
-
-
-
+
+
+
+
+
+
+ 松开发送
- 松开发送
-
-
- 取消
-
-
+
+
+
+ 发送
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
@@ -65,6 +93,9 @@
onHide,
onShow
} from '@dcloudio/uni-app';
+ import {
+ commonUploadVoiceFile
+ } from '@/api/common.js';
const storageStore = useStorageStore();
@@ -107,6 +138,10 @@
default: 'mp3', // 生成语音文件类型
type: String
},
+ answerMethod: {
+ default: '01', //01 不限制 02 文字 03 语音
+ type: String
+ },
});
const {
isDisabled,
@@ -124,7 +159,15 @@
watch(
() => showTalkingModel.value,
- (val) => (val ? talkModelRef.value.open() : talkModelRef.value.close())
+ (val) => {
+ if (val) {
+ talkModelRef.value.open()
+ } else {
+ talkModelRef.value.close()
+ transVoiceIng.value = false
+ }
+ }
+
);
watch(
() => props.isLoading,
@@ -161,16 +204,18 @@
const answerValue = ref('');
const talkBtnRef = ref();
+ const transVoiceIng = ref(false)
// 录音
const audioPath = ref('');
const audioObj = uni.createInnerAudioContext();
const isGettingPermission = ref(false)
+ const isStartNum = ref(0);
+ const isStopNum = ref(0);
//#ifdef APP-PLUS
// app端
const recordObjCom = ref({});
const IsAndEnv = getPhoneEnvBool('AND');
- const isStartNum = ref(0);
- const isStopNum = ref(0);
+ const transLoading = ref(false)
const initRecord = () => {
recordObjCom.value = uni.getRecorderManager();
unref(recordObjCom)?.onStop((res, duration) => {
@@ -180,27 +225,51 @@
return
}
audioPath.value = res.tempFilePath;
+ console.log(isOut.value, isOutLeft.value, isOutRight.value)
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();
+ if (props.answerMethod === '02') {
+ common.msg('当前回答限制为仅文本回答!')
+ return
+ }
emit('uploadVoice', audioPath.value, recordTime.value);
}
- } else {
+ } else if (isOutLeft.value) {
+ console.log('取消')
closeModel();
+ } else if (isOutRight.value) {
+ console.log('转文本')
+ transLoading.value = true
+ commonUploadVoiceFile(audioPath.value, '/traapp/voice/voiceChart', {}).then(res => {
+ console.log(res)
+ transLoading.value = false
+ if (!!(res.body.chatBody || '').trim()) {
+ answerValue.value = res.body.chatBody
+ } else {
+ closeModel()
+ uni.showToast({
+ title: '未识别到文字',
+ icon: 'none',
+ duration: 1000
+ });
+ }
+ }).catch(err => {
+ console.log(err)
+ transLoading.value = false
+ closeModel()
+ uni.showToast({
+ title: '系统异常,请联系管理员',
+ icon: 'none',
+ duration: 1000
+ });
+ })
}
});
unref(recordObjCom).onStart(() => {
@@ -227,6 +296,8 @@
}
});
};
+
+
const setRecordTime = () => {
setTimeout(() => {
if (isRecording.value) {
@@ -251,16 +322,24 @@
try {
if (unref(recordObjCom).stop) {
unref(recordObjCom).stop();
+ if (!transVoiceIng.value) {
+ console.log('1234')
+ setTimeout(() => {
+ closeModel()
+ }, 300)
+ }
} else {
closeModel();
}
} catch {
+ console.log('catch')
closeModel();
}
// setTimeout(() => {
// canStart.value = true
// }, 1000)
};
+ // #endif
const closeModel = (cb = () => {}) => {
isStopNum.value = isStartNum.value;
setTimeout(() => {
@@ -271,7 +350,21 @@
isTalking.value = false;
}, 800);
};
- // #endif
+
+ const sendText = () => {
+ keyboardIsShow.value = true
+ showKeyboard(closeModel)
+ }
+
+ const sendVoice = () => {
+ closeModel();
+ if (props.answerMethod === '02') {
+ common.msg('当前回答限制为仅文本回答!')
+ return
+ }
+ emit('uploadVoice', audioPath.value, recordTime.value);
+ }
+
//#ifndef APP-PLUS
const recordObjCom = ref({});
const initRecord = () => {};
@@ -293,6 +386,15 @@
let moveVal = windowInfo.screenHeight - touchY.value > _btnHeight;
return moveVal;
});
+ const isOutLeft = computed(() => {
+ let _left = windowInfo.screenWidth / 2 > touchX.value
+ return _left && isOut.value;
+ });
+ const isOutRight = computed(() => {
+ let _right = windowInfo.screenWidth / 2 < touchX.value
+ return _right && isOut.value;
+ // return true
+ });
const outScreen = computed(() => {
windowInfo.screenHeight - touchY.value <= 0;
});
@@ -327,7 +429,7 @@
}
// #endif
//#ifdef H5
- showOverlayTalking(obj);
+ showOverlayTalking(obj);
// #endif
};
const getPermission = async () => {
@@ -381,6 +483,7 @@
const isMoving = ref(false);
const isTalking = ref(false);
const showOverlayTalking = (obj) => {
+ console.log(obj)
if (showTalkingModel.value) return;
if (isGettingPermission.value) {
//#ifdef APP-PLUS
@@ -422,7 +525,7 @@
startRecord();
// #endif
//#ifdef H5
- showTalkingModel.value = true
+ showTalkingModel.value = true
// #endif
setTimeout(() => {
if (_recnum === recNum.value) {
@@ -442,10 +545,20 @@
isMoving.value = false;
if (!showTalkingModel.value) return;
//#ifdef APP-PLUS
+ transVoiceIng.value = isOutRight.value
stopRecord();
// #endif
+
+
//#ifdef H5
- showTalkingModel.value = false
+ if (isOutRight.value) {
+ console.log('H5转文本')
+ transVoiceIng.value = true
+ emit('transVoice', audioPath.value);
+ } else {
+ transVoiceIng.value = false
+ showTalkingModel.value = false
+ }
// #endif
};
@@ -459,19 +572,20 @@
}
};
// 发送文本
- const showKeyboard = () => {
+ const showKeyboard = (cb = () => {}) => {
+ if (props.answerMethod === '03') {
+ common.msg('当前回答限制为仅语音回答!')
+ return
+ }
if (isLoadingState.value) {
- uni.showToast({
- title: props.loadingText,
- icon: 'none',
- duration: 1000
- });
+ common.msg(props.loadingText);
return;
}
if (!isDisabled.value) {
if (keyboardIsShow.value) {
if (answerValue.value.trim()) {
emit('submitAnswer', answerValue.value, changeBtn);
+ cb && cb()
} else {
// keyboardIsShow.value = !keyboardIsShow.value
common.msg('不能发送空白消息!');
@@ -480,11 +594,7 @@
keyboardIsShow.value = !keyboardIsShow.value;
}
} else {
- uni.showToast({
- title: '暂无问题需要回答!',
- icon: 'none',
- duration: 1000
- });
+ common.msg('暂无问题需要回答!');
}
};
const changeBtn = () => {
@@ -549,9 +659,10 @@
// justify-content: flex-end;
width: 100%;
height: 100%;
- pointer-events: none;
+ // pointer-events: none;
max-height: 100vh;
justify-content: space-between;
+ padding-bottom: 0;
.circle-bg-box {
height: 234rpx;
@@ -560,63 +671,102 @@
position: relative;
pointer-events: none;
- .icon-box {
- position: absolute;
- left: 50%;
- top: 50%;
- margin-left: -17rpx;
- margin-top: -24rpx;
- width: 34rpx;
- height: 48rpx;
- pointer-events: none;
+ &.no-bg {
+ background: none;
+ overflow: hidden;
+ }
- image {
- width: 100%;
- height: 100%;
- pointer-events: none;
- }
+ .tips-box {
+ padding-top: 67rpx;
+ line-height: 40rpx;
+ font-size: 33rpx;
+ color: #000;
+ text-align: center;
}
}
- .tips-box {
- height: 40rpx;
- line-height: 40rpx;
- font-size: 28rpx;
- color: #c0c0c0;
- text-align: center;
- margin: 12rpx 0 24rpx;
- pointer-events: none;
- }
.btns-box {
- height: 270rpx;
+ height: 240rpx;
// padding: 0 120rpx;
- width: 154rpx;
- margin: 0 auto;
+ width: 100%;
+ margin: 0 auto -20rpx;
overflow: hidden;
font-size: 28rpx;
text-align: center;
- line-height: 116rpx;
- pointer-events: none;
+ padding-top: 40rpx;
display: flex;
+ position: relative;
+ z-index: 12000;
+ justify-content: space-around;
+
+ .transVoiceIng {
+ width: 154rpx;
+ height: 154rpx;
+ overflow: hidden;
+ position: relative;
+ z-index: 12010;
+
+ &.cancel-btn {
+ background: url(@/static/images/course/cancel-btn.png) no-repeat;
+ background-size: cover;
+ }
+
+ &.trans-btn {
+ background: url(@/static/images/course/trans-btn.png) no-repeat;
+ background-size: cover;
+ }
+ }
+
+ .send-btn {
+ position: relative;
+ width: 262rpx;
+ height: 154rpx;
+ line-height: 154rpx;
+ overflow: hidden;
+ background-color: #d8d8d8;
+ border-radius: 77rpx;
+ font-size: 33rpx;
+ z-index: 12010;
+ }
.close-btn {
- padding-top: 40rpx;
line-height: 28rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
float: left;
height: 100%;
- width: 100%;
+ width: 50%;
overflow: hidden;
color: #999;
- pointer-events: none;
+ position: relative;
&.is-out {
color: #fff;
pointer-events: none;
}
+
+ .btn-box {
+ width: 100%;
+ height: 200rpx;
+ pointer-events: none;
+ margin: 0 auto;
+ position: absolute;
+ top: 0;
+ }
+
+ &:not(.trans-btn) {
+ .btn-box {
+ right: 40rpx;
+ }
+ }
+
+ &.trans-btn {
+ .btn-box {
+ left: 40rpx;
+ }
+ }
}
.translate-btn {
@@ -628,12 +778,6 @@
pointer-events: none;
}
- .btn-box {
- width: 100%;
- max-height: 152rpx;
- pointer-events: none;
- margin: 0 auto;
- }
}
.talk-dialog {
@@ -643,7 +787,33 @@
background-color: #06f;
border-radius: 32rpx;
position: relative;
- pointer-events: none;
+
+ &.talk-textarea {
+ width: 700rpx;
+ background-color: #06f;
+
+ &::after {
+ left: 80%;
+ }
+
+ .trans-loading-box {
+ width: 100%;
+ height: 100%;
+ position: relative;
+
+ .loading-box {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ }
+ }
+ }
+
+ ::v-deep .uv-border {
+ border-color: #ffffff00 !important;
+ }
+
&.is-out {
background-color: #ff3e49;
@@ -676,164 +846,18 @@
margin-left: -22rpx;
pointer-events: none;
}
+
+ .voice-input-box {
+ width: 700rpx;
+ height: 234rpx;
+ position: relative;
+ z-index: 1200;
+
+ }
}
}
::v-deep .uv-input__content__field-wrapper__field {
padding-right: 60rpx;
}
-
-
\ No newline at end of file
diff --git a/src/pages/course/components/touchBtn1.vue b/src/pages/course/components/touchBtn1.vue
new file mode 100644
index 00000000..2e221eb8
--- /dev/null
+++ b/src/pages/course/components/touchBtn1.vue
@@ -0,0 +1,839 @@
+
+
+
+ 按住说话
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 松开发送
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue
index 49253192..20c28eae 100644
--- a/src/pages/course/study.vue
+++ b/src/pages/course/study.vue
@@ -48,7 +48,13 @@
{{ showOrder }}
- / {{ pgrphNum }}
+
+
+
+
+
+ {{ pgrphNum }}
+
@@ -83,6 +89,7 @@
:canAnswer="testAnswer"
:adjustPosition="true"
:canAnswerText="canAnswerText"
+ :answerMethod="answerMethod"
:isDisabled="(lastTalkingInfo.type || 0) !== 4 || ['SN', 'MU', 'JD'].includes(lastTalkingInfo.qnsTyp)" />
@@ -250,6 +257,7 @@ const getData = async flag => {
watchFlag.value += 1
}
}
+const answerMethod = ref('01')
const startStudy = data => {
studyStartApi(data)
.then(res => {
@@ -260,6 +268,9 @@ const startStudy = data => {
logId.value = body.logId || ''
getGraphInfoUnStudy(1)
step.value = 2
+
+ console.log(body)
+ answerMethod.value = body.answerMethod || '01'
})
.catch(err => {})
}
@@ -1292,19 +1303,44 @@ const chooseRateNow = item => {
}
.study-num {
- height: 36rpx;
- line-height: 36rpx;
+ height: 56rpx;
+ line-height: 46rpx;
+ font-size: 36rpx;
text-align: center;
- padding-top: 20rpx;
- padding-bottom: 10rpx;
- box-sizing: content-box;
+ padding-top: 10rpx;
+ box-sizing: border-box;
background: url(@/static/images/course/study-bg.png) no-repeat;
border-radius: 30rpx 30rpx 0 0;
-
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
.color-blue {
color: #06f;
display: inline;
}
+ .bg-block{
+ display: inline-block;
+ width: 200rpx;
+ height: 100%;
+ // padding: 4rpx 0 12rpx;
+ position: relative;
+ margin: 0 30rpx;
+ }
+ .bg-gray{
+ width: 100%;
+ background-color: #e6eafd;
+ overflow: hidden;
+ border-radius: 15rpx;
+ position: absolute;
+ top: 13rpx;
+ left:0;
+ height: 20rpx;
+ .bg-blue{
+ height: 100%;
+ float: left;
+ background-color: #06f;
+ }
+ }
}
.talking-list {
diff --git a/src/pages/index/dialog.vue b/src/pages/index/dialog.vue
index 1dfdd62e..35ff96b3 100644
--- a/src/pages/index/dialog.vue
+++ b/src/pages/index/dialog.vue
@@ -824,13 +824,20 @@
const keyboardHeight = ref('0px');
const setHeight = (res) => {
keyboardHeight.value = (res.height || 0) + 'px';
+ setTimeout(()=>{
+ console.log(totalBotHeight.value)
+ },1000)
};
const keyBoardIsHide = computed(() => {
return parseInt(keyboardHeight.value) == 0;
});
const bottomHeight = ref('0px');
const totalBotHeight = computed(() => {
- return keyBoardIsHide.value ? 0 + 'px' : parseInt(keyboardHeight.value) - parseInt(bottomHeight.value) + 'px';
+ let isIos
+ // #ifdef APP-PLUS
+ isIos = (plus.os.name == "iOS")
+ // #endif
+ return isIos || keyBoardIsHide.value ? 0 + 'px' : parseInt(keyboardHeight.value) + parseInt(bottomHeight.value) + 'px';
});
const changeAppHeightBottom = (height) => {
//#ifdef APP-PLUS
@@ -838,6 +845,8 @@
const systemInfo = uni.getSystemInfoSync();
// 计算安全区域底部高度
bottomHeight.value = systemInfo.screenHeight - systemInfo.safeArea.bottom + 'px';
+ console.log(systemInfo)
+ console.log(systemInfo.screenHeight , systemInfo.safeArea.bottom )
// #endif
};
@@ -907,7 +916,7 @@
bottom: 0;
left: 0;
box-sizing: border-box;
- padding-top: v-bind(pageTopPadding);
+ padding-top: var(--status-bar-height);
// padding-bottom: v-bind(bottomHeight);
// display: flex;
// flex-direction: column;
diff --git a/src/pages/me/index.vue b/src/pages/me/index.vue
index db535971..2c269ea1 100644
--- a/src/pages/me/index.vue
+++ b/src/pages/me/index.vue
@@ -200,7 +200,7 @@
const badgeNumRef = ref(null);
const currentPointsRef = ref(null);
const gotoTestPage = () => {
- // common.navigateTo('/pages/test/index');
+ common.navigateTo('/pages/test/index');
};
const user_info = reactive({
userName: '',
diff --git a/src/pages/sparring/js/useWebSocket.js b/src/pages/sparring/js/useWebSocket.js
index facb120a..b87ecc01 100644
--- a/src/pages/sparring/js/useWebSocket.js
+++ b/src/pages/sparring/js/useWebSocket.js
@@ -83,7 +83,6 @@ export default function useWebSocket(aaas = null, options = {}) {
playPcmCallback(numArray)
break;
case MessageType.ERROR:
- console.log('错误',body.errCode, body.errMsg);
switch (body.errCode) {
case 1:
// ASR或TTS初始化出错
@@ -105,20 +104,14 @@ export default function useWebSocket(aaas = null, options = {}) {
code: 4001,
reason: body.errMsg
})
- onClose({
- code: 4001,
- reason: body.errMsg
- })
break;
default:
- ws.value.close({
- code: 4001,
- reason: body.errMsg
- })
- onClose({
- code: 4001,
- reason: body.errMsg
- })
+ console.log('其他错误码的默认处理', body);
+ // 其他错误码的默认处理(如果需要)
+ // ws.value.close({
+ // code: 1001,
+ // reason: body.errMsg
+ // })
break;
}
break;
diff --git a/src/static/images/course/cancel-active.png b/src/static/images/course/cancel-active.png
new file mode 100644
index 00000000..7c762380
Binary files /dev/null and b/src/static/images/course/cancel-active.png differ
diff --git a/src/static/images/course/cancel-btn.png b/src/static/images/course/cancel-btn.png
new file mode 100644
index 00000000..080473f6
Binary files /dev/null and b/src/static/images/course/cancel-btn.png differ
diff --git a/src/static/images/course/cancel.png b/src/static/images/course/cancel.png
new file mode 100644
index 00000000..4edd76e6
Binary files /dev/null and b/src/static/images/course/cancel.png differ
diff --git a/src/static/images/course/trans-btn.png b/src/static/images/course/trans-btn.png
new file mode 100644
index 00000000..c681090a
Binary files /dev/null and b/src/static/images/course/trans-btn.png differ
diff --git a/src/static/images/course/translate-active.png b/src/static/images/course/translate-active.png
new file mode 100644
index 00000000..ce1a14a8
Binary files /dev/null and b/src/static/images/course/translate-active.png differ
diff --git a/src/static/images/course/translate.png b/src/static/images/course/translate.png
new file mode 100644
index 00000000..1e8100ae
Binary files /dev/null and b/src/static/images/course/translate.png differ