diff --git a/src/views/system/voiceTraining/index.vue b/src/views/system/voiceTraining/index.vue
index f834afda1..caee56de0 100644
--- a/src/views/system/voiceTraining/index.vue
+++ b/src/views/system/voiceTraining/index.vue
@@ -2,30 +2,34 @@
@@ -46,10 +50,10 @@ export default {
};
},
methods: {
- getUrl(el) {
- return `https://oss.joylink.club/oss/joylink${el.filePath}`;
- },
- covertTime(time) {
+ getUrl(el) {
+ return `https://oss.joylink.club/oss/joylink${el.filePath}`;
+ },
+ covertTime(time) {
const date = new Date(time);
let hour = date.getHours();
let minute = date.getMinutes();
@@ -66,60 +70,60 @@ export default {
if (!this.recordSending && !this.recorders && !this.microphone) {
const StereoAudioRecorder = RecordRTC.StereoAudioRecorder;
navigator.getUserMedia({ audio: true }, function (stream) {
- that.microphone = stream;
- that.recorders = new RecordRTC(that.microphone, {
- type: 'audio',
- recorderType: StereoAudioRecorder,
- numberOfAudioChannels: 1,
- bitsPerSecond:256000,
- desiredSampRate: 16000
- });
- that.recorders.startRecording();
- that.recordSending = true;
- that.audioPlay = false;
- that.inter = setInterval(() => {
- if (that.seconds < 60) {
- that.seconds++;
- } else {
- clearInterval(that.inter);
- that.stopRecording();
- }
- }, 1000);
- }, function (error) {
- switch (error.code || error.name) {
- case 'PERMISSION_DENIED':
- case 'PermissionDeniedError':
- that.$message({
- showClose: true,
- message: '用户拒绝提供信息',
- type: 'error'
- });
- break;
- case 'NOT_SUPPORTED_ERROR':
- case 'NotSupportedError':
- that.$message({
- showClose: true,
- message: '浏览器不支持硬件设备',
- type: 'error'
- });
- break;
- case 'MANDATORY_UNSATISFIED_ERROR':
- case 'MandatoryUnsatisfiedError':
- that.$message({
- showClose: true,
- message: '无法发现指定的硬件设备',
- type: 'error'
- });
- break;
- default:
- that.$message({
- showClose: true,
- message: '无法打开麦克风',
- type: 'error'
- });
- break;
+ that.microphone = stream;
+ that.recorders = new RecordRTC(that.microphone, {
+ type: 'audio',
+ recorderType: StereoAudioRecorder,
+ numberOfAudioChannels: 1,
+ bitsPerSecond:256000,
+ desiredSampRate: 16000
+ });
+ that.recorders.startRecording();
+ that.recordSending = true;
+ that.audioPlay = false;
+ that.inter = setInterval(() => {
+ if (that.seconds < 60) {
+ that.seconds++;
+ } else {
+ clearInterval(that.inter);
+ that.stopRecording();
}
+ }, 1000);
+ }, function (error) {
+ switch (error.code || error.name) {
+ case 'PERMISSION_DENIED':
+ case 'PermissionDeniedError':
+ that.$message({
+ showClose: true,
+ message: '用户拒绝提供信息',
+ type: 'error'
+ });
+ break;
+ case 'NOT_SUPPORTED_ERROR':
+ case 'NotSupportedError':
+ that.$message({
+ showClose: true,
+ message: '浏览器不支持硬件设备',
+ type: 'error'
+ });
+ break;
+ case 'MANDATORY_UNSATISFIED_ERROR':
+ case 'MandatoryUnsatisfiedError':
+ that.$message({
+ showClose: true,
+ message: '无法发现指定的硬件设备',
+ type: 'error'
+ });
+ break;
+ default:
+ that.$message({
+ showClose: true,
+ message: '无法打开麦克风',
+ type: 'error'
+ });
+ break;
}
+ }
);
}
} else {
@@ -149,7 +153,7 @@ export default {
uploadAudioFiles(fd)
.then((resp) => {
that.audioPlay = false;
- that.messageList.push(resp.data);
+ that.messageList.push(resp.data);
})
.catch(error => {
console.log(error);
@@ -163,6 +167,9 @@ export default {
that.recorders = null;
}
});
+ },
+ deleteRecord(index) {
+ this.messageList.splice(index, 1);
}
}
};
@@ -232,4 +239,5 @@ export default {
padding: 3px;
}
}
+ .deleteRecord{}