Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
aixianling
2022-06-17 13:40:25 +08:00

View File

@@ -63,7 +63,7 @@
<span class="line19 animation"></span> <span class="line19 animation"></span>
<span class="line20 animation"></span> <span class="line20 animation"></span>
</div> </div>
<h2>{{ time }}</h2> <h2>{{ time }}S</h2>
</div> </div>
</div> </div>
</template> </template>
@@ -93,8 +93,7 @@
isRecording: false, isRecording: false,
recorder: null, recorder: null,
blobFile: null, blobFile: null,
counterDownTime: 0, time: 60,
time: '00:00:00',
timingTimeout: null, timingTimeout: null,
equipmentList: [], equipmentList: [],
recordList: [], recordList: [],
@@ -192,13 +191,11 @@
}, },
timing () { timing () {
var durationObj = this.$dayjs.duration(this.counterDownTime * 1000) this.time = this.time - 1
var hours = durationObj.hours() > 9 ? durationObj.hours() : '0' + durationObj.hours()
var min = durationObj.minutes() > 9 ? durationObj.minutes() : '0' + durationObj.minutes()
var seconds = durationObj.seconds() > 9 ? durationObj.seconds() : '0' + durationObj.seconds()
this.time = hours + ':' + min + ':' + seconds if (this.time === 0) {
this.counterDownTime++ this.stop()
}
this.timingTimeout = setTimeout(() => { this.timingTimeout = setTimeout(() => {
this.timing() this.timing()
}, 1000) }, 1000)
@@ -238,17 +235,16 @@
}, },
stop (isCancel) { stop (isCancel) {
this.counterDownTime = 0
clearTimeout(this.timingTimeout) clearTimeout(this.timingTimeout)
this.recorder.stop((blob, duration) => { this.recorder.stop((blob, duration) => {
this.recorder.close() this.recorder.close()
this.recorder = null this.recorder = null
if (isCancel) { if (isCancel) {
this.time = 60
return false return false
} }
this.time = '00:00:00'
let formData = {} let formData = {}
formData = new FormData() formData = new FormData()
formData.append('file', new window.File([blob], `${(new Date).getTime()}` )) formData.append('file', new window.File([blob], `${(new Date).getTime()}` ))
@@ -286,6 +282,8 @@
}).catch(() => { }).catch(() => {
this.isShow = false this.isShow = false
}) })
this.time = 60
console.log(blob, (window.URL || webkitURL).createObjectURL(blob), '时长:' + duration + 'ms') console.log(blob, (window.URL || webkitURL).createObjectURL(blob), '时长:' + duration + 'ms')
}, msg => { }, msg => {
console.log('录音失败:' + msg) console.log('录音失败:' + msg)