Commit 46cf8d8f by liuquan

U:修复发送语音bug

U:修复语音bug,持续点击无效,以及显示bug
parent 17481f62
......@@ -50,6 +50,7 @@ Page({
msgContent: '', //默认消息文字
isRecord: false, //录音显示
isRecording: false, //是否正在录音
isTouch:false, //防止录音单次点击出现bug
canSend: true,
title: "正在录音",
audioSave: '', //当前播放音频路径
......@@ -94,6 +95,7 @@ Page({
console.log('recorder pause')
})
recorderManager.onError(function (errMsg) {
wx.
console.warn('recorder error:', errMsg);
});
recorderManager.onStop((res) => {
......@@ -1242,6 +1244,8 @@ Page({
*/
handleLongPress(e) {
var that = this;
that.data.isTouch=true;
console.log("手指按下")
that.data.startPoint = e.touches[0];
if (!this.data.payFlag) {
that.moreService();
......@@ -1276,11 +1280,13 @@ Page({
* 手指离开页面滑动
*/
handleTouchEnd() {
console.log("手指离开")
this.data.isTouch=false;
wx.hideLoading()
recorderManager.stop()
this.setData({
isRecording: false
})
wx.hideLoading()
recorderManager.stop()
},
// 开始录音之前要判断一下是否开启权限
startRecording() {
......@@ -1308,12 +1314,19 @@ Page({
}
})
} else if (auth === true) { // 用户已经同意授权
that.setData({
canSend: true,
isRecording: true,
title: "正在录音"
})
recorderManager.start(recordOptions)
// console.log('this.data.isTouch',this.data.isTouch)
if(this.data.isTouch){
that.setData({
canSend: true,
isRecording: true,
title: "正在录音"
})
recorderManager.start(recordOptions)
}else{
that.setData({
errorToptips: '说话时间太短'
})
}
} else { // 第一次进来,未发起授权
wx.authorize({
scope: 'scope.record',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment