|
@@ -14,7 +14,8 @@
|
|
selectIndex || selectIndex == 0 ? 'record-black' : '',
|
|
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 v-if="type && type == 'normal'" class="line" />
|
|
<div
|
|
<div
|
|
:class="['playBack', hasMicro]"
|
|
:class="['playBack', hasMicro]"
|
|
@@ -71,7 +72,8 @@
|
|
microphoneStatus ? 'record-ing' : '',
|
|
microphoneStatus ? 'record-ing' : '',
|
|
selectIndex || selectIndex == 0 ? 'record-black' : '',
|
|
selectIndex || selectIndex == 0 ? 'record-black' : '',
|
|
]"
|
|
]"
|
|
- >{{ isPlaying ? "-" : "" }}{{ handleDateTime(recordtime) }}</span>
|
|
|
|
|
|
+ >{{ isPlaying ? "-" : "" }}{{ handleDateTime(recordtime) }}</span
|
|
|
|
+ >
|
|
<el-select
|
|
<el-select
|
|
v-model="selectIndex"
|
|
v-model="selectIndex"
|
|
placeholder="无录音"
|
|
placeholder="无录音"
|
|
@@ -106,7 +108,7 @@
|
|
import Recorder from "js-audio-recorder"; // 录音插件
|
|
import Recorder from "js-audio-recorder"; // 录音插件
|
|
export default {
|
|
export default {
|
|
components: {},
|
|
components: {},
|
|
- props: ["wavData", "type", "fileName", "selectData"],
|
|
|
|
|
|
+ props: ["wavData", "type", "fileName", "selectData", "tmIndex"],
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
recorder: new Recorder({
|
|
recorder: new Recorder({
|
|
@@ -167,12 +169,12 @@ export default {
|
|
// 开始录音
|
|
// 开始录音
|
|
microphone() {
|
|
microphone() {
|
|
let _this = this;
|
|
let _this = this;
|
|
-
|
|
|
|
|
|
+
|
|
if (!_this.microphoneStatus) {
|
|
if (!_this.microphoneStatus) {
|
|
_this.hasMicro = "";
|
|
_this.hasMicro = "";
|
|
_this.$root.isRecording = true;
|
|
_this.$root.isRecording = true;
|
|
_this.$emit("getWavblob", null);
|
|
_this.$emit("getWavblob", null);
|
|
- this.$emit("getSelectData", { type: '' });
|
|
|
|
|
|
+ this.$emit("getSelectData", { type: "" });
|
|
// 开始录音
|
|
// 开始录音
|
|
this.recorder.start();
|
|
this.recorder.start();
|
|
this.microphoneStatus = true;
|
|
this.microphoneStatus = true;
|
|
@@ -191,6 +193,7 @@ export default {
|
|
};
|
|
};
|
|
if (this.selectData) obj.selectData = this.selectData;
|
|
if (this.selectData) obj.selectData = this.selectData;
|
|
_this.recordList.push(obj);
|
|
_this.recordList.push(obj);
|
|
|
|
+
|
|
_this.recordFile++;
|
|
_this.recordFile++;
|
|
_this.selectIndex = _this.recordList.length - 1;
|
|
_this.selectIndex = _this.recordList.length - 1;
|
|
} else {
|
|
} else {
|
|
@@ -225,13 +228,22 @@ export default {
|
|
// ) {
|
|
// ) {
|
|
_this.wavblob = _this.recordList[_this.selectIndex].wavData;
|
|
_this.wavblob = _this.recordList[_this.selectIndex].wavData;
|
|
_this.$emit("getWavblob", _this.wavblob);
|
|
_this.$emit("getWavblob", _this.wavblob);
|
|
- if (this.recordList[this.selectIndex].selectData) this.$emit("getSelectData", this.recordList[this.selectIndex].selectData);
|
|
|
|
|
|
+ _this.$emit(
|
|
|
|
+ "handleWav",
|
|
|
|
+ JSON.parse(JSON.stringify(_this.recordList)),
|
|
|
|
+ _this.tmIndex
|
|
|
|
+ );
|
|
|
|
+ if (this.recordList[this.selectIndex].selectData)
|
|
|
|
+ this.$emit(
|
|
|
|
+ "getSelectData",
|
|
|
|
+ this.recordList[this.selectIndex].selectData
|
|
|
|
+ );
|
|
// }
|
|
// }
|
|
};
|
|
};
|
|
}
|
|
}
|
|
},
|
|
},
|
|
playmicrophone(totalTimes) {
|
|
playmicrophone(totalTimes) {
|
|
- if(this.hasMicro){
|
|
|
|
|
|
+ if (this.hasMicro) {
|
|
this.isPlaying = true;
|
|
this.isPlaying = true;
|
|
if (this.selectIndex || this.selectIndex == 0) {
|
|
if (this.selectIndex || this.selectIndex == 0) {
|
|
let totalTime = totalTimes;
|
|
let totalTime = totalTimes;
|
|
@@ -310,29 +322,36 @@ export default {
|
|
this.audio.pause();
|
|
this.audio.pause();
|
|
this.oldIndex = null;
|
|
this.oldIndex = null;
|
|
this.$emit("getWavblob", this.wavblob);
|
|
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);
|
|
this.$emit("sentPause", false);
|
|
},
|
|
},
|
|
handleDelete() {
|
|
handleDelete() {
|
|
- if(this.hasMicro){
|
|
|
|
- if (this.selectIndex || this.selectIndex == 0) {
|
|
|
|
- this.recordList.splice(this.selectIndex, 1);
|
|
|
|
- this.selectIndex =
|
|
|
|
- this.recordList.length > 0 ? this.recordList.length - 1 : null;
|
|
|
|
- this.hasMicro = this.recordList.length > 0 ? "normal" : "";
|
|
|
|
- this.recordtime =
|
|
|
|
- this.recordList.length > 0
|
|
|
|
- ? this.recordList[this.selectIndex].toltime
|
|
|
|
|
|
+ let _this = this;
|
|
|
|
+ if (_this.hasMicro) {
|
|
|
|
+ if (_this.selectIndex || _this.selectIndex == 0) {
|
|
|
|
+ _this.recordList.splice(_this.selectIndex, 1);
|
|
|
|
+ _this.$emit(
|
|
|
|
+ "handleWav",
|
|
|
|
+ JSON.parse(JSON.stringify(_this.recordList)),
|
|
|
|
+ _this.tmIndex
|
|
|
|
+ );
|
|
|
|
+ _this.selectIndex =
|
|
|
|
+ _this.recordList.length > 0 ? _this.recordList.length - 1 : null;
|
|
|
|
+ _this.hasMicro = _this.recordList.length > 0 ? "normal" : "";
|
|
|
|
+ _this.recordtime =
|
|
|
|
+ _this.recordList.length > 0
|
|
|
|
+ ? _this.recordList[_this.selectIndex].toltime
|
|
: 0;
|
|
: 0;
|
|
- this.audio.pause();
|
|
|
|
- this.audio = new window.Audio();
|
|
|
|
- this.wavblob =
|
|
|
|
- this.recordList.length > 0
|
|
|
|
- ? this.recordList[this.selectIndex].wavData
|
|
|
|
|
|
+ _this.audio.pause();
|
|
|
|
+ _this.audio = new window.Audio();
|
|
|
|
+ _this.wavblob =
|
|
|
|
+ _this.recordList.length > 0
|
|
|
|
+ ? _this.recordList[_this.selectIndex].wavData
|
|
: null;
|
|
: null;
|
|
- this.oldIndex = null;
|
|
|
|
- this.isPlaying = false;
|
|
|
|
- clearInterval(this.timer);
|
|
|
|
|
|
+ _this.oldIndex = null;
|
|
|
|
+ _this.isPlaying = false;
|
|
|
|
+ clearInterval(_this.timer);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|