Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
XDJK
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wechatminiprogram
XDJK
Commits
46cf8d8f
Commit
46cf8d8f
authored
Dec 19, 2020
by
liuquan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
U:修复发送语音bug
U:修复语音bug,持续点击无效,以及显示bug
parent
17481f62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
packageA/chat/chat.js
+21
-8
No files found.
packageA/chat/chat.js
View file @
46cf8d8f
...
...
@@ -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'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment