|
@@ -221,8 +221,12 @@ export default {
|
|
this.getQuestionItem(options.id);
|
|
this.getQuestionItem(options.id);
|
|
},
|
|
},
|
|
onUnload() {
|
|
onUnload() {
|
|
|
|
+ this.resetAudio();
|
|
|
|
+ this.destroyAudio();
|
|
//录音时误操作退出页面的情况
|
|
//录音时误操作退出页面的情况
|
|
- this.globalRecorder.stop()
|
|
|
|
|
|
+ if(this.questionItem.recordStatus!==4){
|
|
|
|
+ this.globalRecorder.stop()
|
|
|
|
+ }
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
//初始化audio
|
|
//初始化audio
|
|
@@ -231,6 +235,17 @@ export default {
|
|
this.handleAudioFun();
|
|
this.handleAudioFun();
|
|
this.handleRecorderFun();
|
|
this.handleRecorderFun();
|
|
},
|
|
},
|
|
|
|
+ resetAudio(){
|
|
|
|
+ this.innerAudio.stop();
|
|
|
|
+ this.isplay = false;
|
|
|
|
+ this.changeCurrentAudio({
|
|
|
|
+ id: '',
|
|
|
|
+ answer: {
|
|
|
|
+ source: '',
|
|
|
|
+ audioTime: 0
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
//audio事件
|
|
//audio事件
|
|
handleAudioFun() {
|
|
handleAudioFun() {
|
|
this.innerAudio.onPlay(() => {
|
|
this.innerAudio.onPlay(() => {
|
|
@@ -291,6 +306,8 @@ export default {
|
|
console.log("res", JSON.stringify(res));
|
|
console.log("res", JSON.stringify(res));
|
|
this.cleanTime();
|
|
this.cleanTime();
|
|
//初始化音频播放
|
|
//初始化音频播放
|
|
|
|
+ this.innerAudio.stop();
|
|
|
|
+ this.isplay = false;
|
|
this.innerAudio.src = res.tempFilePath;
|
|
this.innerAudio.src = res.tempFilePath;
|
|
console.log('秒数',this.audioCount)
|
|
console.log('秒数',this.audioCount)
|
|
this.changeCurrentAudio({
|
|
this.changeCurrentAudio({
|
|
@@ -303,6 +320,7 @@ export default {
|
|
this.pageLoading = false;
|
|
this.pageLoading = false;
|
|
});
|
|
});
|
|
this.globalRecorder.onError((res) => {
|
|
this.globalRecorder.onError((res) => {
|
|
|
|
+ console.log('err',res.errMsg)
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title:res.errMsg,
|
|
title:res.errMsg,
|
|
icon:'none'
|
|
icon:'none'
|
|
@@ -441,6 +459,8 @@ export default {
|
|
//重新录
|
|
//重新录
|
|
if(this.questionItem.recordStatus===3)this.globalRecorder.stop();
|
|
if(this.questionItem.recordStatus===3)this.globalRecorder.stop();
|
|
this.questionItem.recordStatus = 1;
|
|
this.questionItem.recordStatus = 1;
|
|
|
|
+ this.innerAudio.stop();
|
|
|
|
+ this.isplay = false;
|
|
this.audioItem = null;
|
|
this.audioItem = null;
|
|
this.audioCount = 0;
|
|
this.audioCount = 0;
|
|
this.scrollTop = 0;
|
|
this.scrollTop = 0;
|