|
@@ -6,7 +6,7 @@
|
|
|
:class="[
|
|
|
'record',
|
|
|
microphoneStatus ? 'active' : '',
|
|
|
- !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
|
|
|
+ !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
|
|
|
]"
|
|
|
@click="microphone"
|
|
|
/>
|
|
@@ -16,9 +16,10 @@
|
|
|
'record-time',
|
|
|
microphoneStatus ? 'record-ing' : '',
|
|
|
selectIndex || selectIndex == 0 ? 'record-black' : '',
|
|
|
- type && type == 'normal' ? 'record-time-flex' : ''
|
|
|
+ type && type == 'normal' ? 'record-time-flex' : '',
|
|
|
]"
|
|
|
- >{{ isPlaying ? "-" : "" }}{{ handleDateTime(recordtime) }}</span>
|
|
|
+ >{{ isPlaying ? "-" : "" }}{{ handleDateTime(recordtime) }}</span
|
|
|
+ >
|
|
|
<div v-if="type && type == 'normal'" class="line" />
|
|
|
<div
|
|
|
:class="['playBack', hasMicro]"
|
|
@@ -36,7 +37,7 @@
|
|
|
:class="[
|
|
|
'record',
|
|
|
microphoneStatus ? 'active' : '',
|
|
|
- !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
|
|
|
+ !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
|
|
|
]"
|
|
|
@click="microphone"
|
|
|
/>
|
|
@@ -69,7 +70,7 @@
|
|
|
hasMicro && (!TaskModel || TaskModel != 'ANSWER')
|
|
|
? 'record-delete-has'
|
|
|
: '',
|
|
|
- !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
|
|
|
+ !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
|
|
|
]"
|
|
|
@click="handleDelete"
|
|
|
/>
|
|
@@ -79,7 +80,7 @@
|
|
|
:class="[
|
|
|
'record',
|
|
|
microphoneStatus ? 'active' : '',
|
|
|
- !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
|
|
|
+ !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
|
|
|
]"
|
|
|
@click="microphone"
|
|
|
/>
|
|
@@ -87,9 +88,10 @@
|
|
|
:class="[
|
|
|
'record-time',
|
|
|
microphoneStatus ? 'record-ing' : '',
|
|
|
- selectIndex || selectIndex == 0 ? 'record-black' : ''
|
|
|
+ selectIndex || selectIndex == 0 ? 'record-black' : '',
|
|
|
]"
|
|
|
- >{{ isPlaying ? "-" : "" }}{{ handleDateTime(recordtime) }}</span>
|
|
|
+ >{{ isPlaying ? "-" : "" }}{{ handleDateTime(recordtime) }}</span
|
|
|
+ >
|
|
|
<el-select
|
|
|
v-model="selectIndex"
|
|
|
placeholder="无录音"
|
|
@@ -118,7 +120,7 @@
|
|
|
hasMicro && (!TaskModel || TaskModel != 'ANSWER')
|
|
|
? 'record-delete-has'
|
|
|
: '',
|
|
|
- !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
|
|
|
+ !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
|
|
|
]"
|
|
|
@click="handleDelete"
|
|
|
/>
|
|
@@ -138,14 +140,14 @@ export default {
|
|
|
"tmIndex",
|
|
|
"answerRecordList",
|
|
|
"TaskModel",
|
|
|
- "sentIndex"
|
|
|
+ "sentIndex",
|
|
|
],
|
|
|
data() {
|
|
|
return {
|
|
|
recorder: new Recorder({
|
|
|
sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
|
|
|
sampleRate: 16000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
|
|
|
- numChannels: 1 // 声道,支持 1 或 2, 默认是1
|
|
|
+ numChannels: 1, // 声道,支持 1 或 2, 默认是1
|
|
|
}),
|
|
|
microphoneStatus: false,
|
|
|
hasMicro: "", // 录音后的样式class
|
|
@@ -158,7 +160,7 @@ export default {
|
|
|
selectIndex: null, // 选中的录音索引
|
|
|
oldIndex: null, // 存储播放录音索引
|
|
|
playtime: 0, // 播放时间
|
|
|
- isPlaying: false
|
|
|
+ isPlaying: false,
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
@@ -171,18 +173,19 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- deep: true
|
|
|
+ deep: true,
|
|
|
},
|
|
|
answerRecordList(newVal) {
|
|
|
this.recordList = newVal;
|
|
|
- }
|
|
|
+ this.selectIndex = this.recordList.length - 1;
|
|
|
+ },
|
|
|
},
|
|
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {
|
|
|
this.handleActive();
|
|
|
let that = this;
|
|
|
|
|
|
- window.stopAudioSound = function() {
|
|
|
+ window.stopAudioSound = function () {
|
|
|
if (that.audio) {
|
|
|
that.audio.pause();
|
|
|
}
|
|
@@ -191,6 +194,7 @@ export default {
|
|
|
// 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted() {
|
|
|
let _this = this;
|
|
|
+ console.log(_this.answerRecordList);
|
|
|
_this.recordList = _this.answerRecordList
|
|
|
? JSON.parse(JSON.stringify(_this.answerRecordList))
|
|
|
: [];
|
|
@@ -200,14 +204,14 @@ export default {
|
|
|
_this.recordFile = _this.recordList.length + 1;
|
|
|
_this.handleChangeRecord(0);
|
|
|
}
|
|
|
- _this.audio.addEventListener("play", function() {
|
|
|
+ _this.audio.addEventListener("play", function () {
|
|
|
_this.changeStatus("active");
|
|
|
_this.isPlaying = true;
|
|
|
});
|
|
|
- _this.audio.addEventListener("pause", function() {
|
|
|
+ _this.audio.addEventListener("pause", function () {
|
|
|
_this.changeStatus("normal");
|
|
|
});
|
|
|
- _this.audio.addEventListener("ended", function() {
|
|
|
+ _this.audio.addEventListener("ended", function () {
|
|
|
_this.changeStatus("normal");
|
|
|
_this.isPlaying = false;
|
|
|
});
|
|
@@ -244,7 +248,7 @@ export default {
|
|
|
name: _this.fileName
|
|
|
? _this.fileName + _this.recordFile
|
|
|
: "新录音" + _this.recordFile,
|
|
|
- id: _this.recordFile + Math.round(Math.random() * 10)
|
|
|
+ id: _this.recordFile + Math.round(Math.random() * 10),
|
|
|
};
|
|
|
if (this.selectData) obj.selectData = this.selectData;
|
|
|
_this.recordList.push(obj);
|
|
@@ -400,16 +404,17 @@ export default {
|
|
|
_this.oldIndex = null;
|
|
|
_this.isPlaying = false;
|
|
|
clearInterval(_this.timer);
|
|
|
- _this.audio.addEventListener("ended", function() {
|
|
|
+ _this.audio.addEventListener("ended", function () {
|
|
|
_this.changeStatus("normal");
|
|
|
_this.isPlaying = false;
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- } // 如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
+ },
|
|
|
+ }, // 如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
};
|
|
|
</script>
|
|
|
+
|
|
|
<style lang="scss" scoped>
|
|
|
//@import url(); 引入公共css类
|
|
|
.NNPE-Book-record {
|