diff --git a/src/views/voice/recordPage/index.vue b/src/views/voice/recordPage/index.vue index 9ad97b5..e87a699 100644 --- a/src/views/voice/recordPage/index.vue +++ b/src/views/voice/recordPage/index.vue @@ -212,27 +212,57 @@ lockReconnect.value = false; }, 8000); } - /** * 录音的具体操作功能 * */ // 开始录音 function startRecorder(val) { - data.showModal = true; - nowword.value = '开始录音,正在录音...'; data.recordStatus = val; // 获取麦克风权限 Recorder.getPermission().then( () => { - proxy.$modal.msgSuccess('获取权限成功,开始录音'); - recorder.start(); + // proxy.$modal.msgSuccess("获取权限成功,开始录音"); + recorder.start().then(() => { + + data.showModal = true; +nowword.value = "开始录音,正在录音..."; + process.value = 2; + showSecond.value = 8; + + settimEnd.value = setTimeout(() => { + stopRecorderAndupload('stop'); + }, showSecond.value * 1000); + + timEnd.value = setInterval(setTime, 1000); + + }); }, - error => { - proxy.$modal.msgError('请先允许该网页使用麦克风'); + (error) => { + proxy.$modal.msgError("请先允许该网页使用麦克风"); // console.log(`${error.name} : ${error.message}`); } ); } +// /** +// * 录音的具体操作功能 +// * */ +// // 开始录音 +// function startRecorder(val) { +// data.showModal = true; +// nowword.value = '开始录音,正在录音...'; +// data.recordStatus = val; +// // 获取麦克风权限 +// Recorder.getPermission().then( +// () => { +// proxy.$modal.msgSuccess('获取权限成功,开始录音'); +// recorder.start(); +// }, +// error => { +// proxy.$modal.msgError('请先允许该网页使用麦克风'); +// // console.log(`${error.name} : ${error.message}`); +// } +// ); +// } // 结束录音 function stopRecorder(val) { @@ -274,14 +304,7 @@ clearInterval(timEnd.value); if (process.value == 1) { startRecorder('begin'); - process.value = 2; - showSecond.value = 8; - settimEnd.value = setTimeout(() => { - stopRecorderAndupload('stop'); - }, showSecond.value * 1000); - - timEnd.value = setInterval(setTime, 1000); } else { showSecond.value = 0; clearTimeout(settimEnd.value); @@ -301,7 +324,8 @@ function closedia() { showSecond.value = 8; data.showModal = false; - nowword.value = '你好,请点击【开始录制】,进行语音录制!'; + // nowword.value = '你好,请点击【开始录制】,进行语音录制!'; + nowword.value = '语音录制中...'; stopRecorder(); }