Compare commits

...

2 Commits

Author SHA1 Message Date
唐明明
81543cdcdc merge 2022-02-24 15:21:44 +08:00
唐明明
3ea3a2decd 新增语音时长0秒提示信息,调整取消后仍然调用发送语音的bug 2022-02-24 15:21:20 +08:00
3 changed files with 18 additions and 2 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -47,6 +47,7 @@
maxRecordTime: 60, maxRecordTime: 60,
recorderManager: null, recorderManager: null,
mp3AudioSrc: null, mp3AudioSrc: null,
isMoveCancel: false,
isBetaPlay: false, // 暂时无用 isBetaPlay: false, // 暂时无用
startOffsetTop: 0 startOffsetTop: 0
} }
@@ -69,7 +70,6 @@
this.getAndroidPermission().then(code => { this.getAndroidPermission().then(code => {
switch (code) { switch (code) {
case 1: case 1:
this.showConfirm = true
this.startOffsetTop = e.target.offsetTop this.startOffsetTop = e.target.offsetTop
this.showRecordTip = true this.showRecordTip = true
this.recorderManager.start() this.recorderManager.start()
@@ -104,6 +104,21 @@
clearInterval(this.interval) clearInterval(this.interval)
// 监听录音结束 // 监听录音结束
this.recorderManager.onStop(res => { this.recorderManager.onStop(res => {
if(this.isMoveCancel) {
this.isMoveCancel = false
return
}
console.log(this.maxRecordTime - this.recordTime)
if((this.maxRecordTime - this.recordTime) <= 0){
uni.showToast({
title: '说话时间太短',
icon : 'none',
})
this.showRecordTip = false
return
}
this.mp3AudioSrc = res.tempFilePath this.mp3AudioSrc = res.tempFilePath
this.showRecordTip = false this.showRecordTip = false
this.senVoice() this.senVoice()
@@ -132,9 +147,10 @@
touchmove(e){ touchmove(e){
if(this.startOffsetTop - e.changedTouches[0].pageY > 100){ if(this.startOffsetTop - e.changedTouches[0].pageY > 100){
if(this.showRecordTip){ if(this.showRecordTip){
this.isMoveCancel = true
this.showRecordTip = false this.showRecordTip = false
clearInterval(this.interval)
this.recorderManager.stop() this.recorderManager.stop()
clearInterval(this.interval)
this.recordTime = this.maxRecordTime this.recordTime = this.maxRecordTime
this.mp3AudioSrc = null this.mp3AudioSrc = null
return return

BIN
static/.DS_Store vendored

Binary file not shown.