|
@@ -6,7 +6,7 @@
|
|
|
:class="[
|
|
|
'record',
|
|
|
microphoneStatus ? 'active' : '',
|
|
|
- !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
|
|
|
+ !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
|
|
|
]"
|
|
|
@click="microphone"
|
|
|
/>
|
|
@@ -16,7 +16,7 @@
|
|
|
'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>
|
|
|
<div v-if="type && type == 'normal'" class="line" />
|
|
@@ -36,7 +36,7 @@
|
|
|
:class="[
|
|
|
'record',
|
|
|
microphoneStatus ? 'active' : '',
|
|
|
- !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
|
|
|
+ !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
|
|
|
]"
|
|
|
@click="microphone"
|
|
|
/>
|
|
@@ -69,7 +69,7 @@
|
|
|
hasMicro && (!TaskModel || TaskModel != 'ANSWER')
|
|
|
? 'record-delete-has'
|
|
|
: '',
|
|
|
- !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
|
|
|
+ !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
|
|
|
]"
|
|
|
@click="handleDelete"
|
|
|
/>
|
|
@@ -79,7 +79,7 @@
|
|
|
:class="[
|
|
|
'record',
|
|
|
microphoneStatus ? 'active' : '',
|
|
|
- !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
|
|
|
+ !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
|
|
|
]"
|
|
|
@click="microphone"
|
|
|
/>
|
|
@@ -87,7 +87,7 @@
|
|
|
:class="[
|
|
|
'record-time',
|
|
|
microphoneStatus ? 'record-ing' : '',
|
|
|
- selectIndex || selectIndex == 0 ? 'record-black' : '',
|
|
|
+ selectIndex || selectIndex == 0 ? 'record-black' : ''
|
|
|
]"
|
|
|
>{{ isPlaying ? "-" : "" }}{{ handleDateTime(recordtime) }}</span>
|
|
|
<el-select
|
|
@@ -118,7 +118,7 @@
|
|
|
hasMicro && (!TaskModel || TaskModel != 'ANSWER')
|
|
|
? 'record-delete-has'
|
|
|
: '',
|
|
|
- !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow',
|
|
|
+ !TaskModel || TaskModel != 'ANSWER' ? '' : 'notAllow'
|
|
|
]"
|
|
|
@click="handleDelete"
|
|
|
/>
|
|
@@ -138,14 +138,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,28 +158,31 @@ export default {
|
|
|
selectIndex: null, // 选中的录音索引
|
|
|
oldIndex: null, // 存储播放录音索引
|
|
|
playtime: 0, // 播放时间
|
|
|
- isPlaying: false,
|
|
|
+ isPlaying: false
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
|
watch: {
|
|
|
sentIndex: {
|
|
|
- handler (newVal, oldVal) {
|
|
|
+ handler(newVal, oldVal) {
|
|
|
if (newVal != oldVal) {
|
|
|
if (this.recordList.length > 0) {
|
|
|
this.selectIndex = 0;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- deep: true,
|
|
|
+ deep: true
|
|
|
},
|
|
|
+ answerRecordList(newVal) {
|
|
|
+ this.recordList = newVal;
|
|
|
+ }
|
|
|
},
|
|
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {
|
|
|
this.handleActive();
|
|
|
let that = this;
|
|
|
|
|
|
- window.stopAudioSound = function () {
|
|
|
+ window.stopAudioSound = function() {
|
|
|
if (that.audio) {
|
|
|
that.audio.pause();
|
|
|
}
|
|
@@ -193,21 +196,18 @@ export default {
|
|
|
: [];
|
|
|
if (_this.recordList.length > 0) {
|
|
|
_this.selectIndex = 0;
|
|
|
- this.$emit(
|
|
|
- "getSelectData",
|
|
|
- this.recordList[0].selectData
|
|
|
- );
|
|
|
+ this.$emit("getSelectData", this.recordList[0].selectData);
|
|
|
_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 +244,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);
|
|
@@ -369,7 +369,9 @@ export default {
|
|
|
this.audio.pause();
|
|
|
this.oldIndex = null;
|
|
|
this.$emit("getWavblob", this.wavblob);
|
|
|
- if (this.recordList[index].selectData) { this.$emit("getSelectData", this.recordList[index].selectData); }
|
|
|
+ if (this.recordList[index].selectData) {
|
|
|
+ this.$emit("getSelectData", this.recordList[index].selectData);
|
|
|
+ }
|
|
|
this.$emit("sentPause", false);
|
|
|
},
|
|
|
handleDelete() {
|
|
@@ -398,17 +400,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>
|
|
|
+<style lang="scss" scoped>
|
|
|
//@import url(); 引入公共css类
|
|
|
.NNPE-Book-record {
|
|
|
display: flex;
|