Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 572ab854
authored
Nov 06, 2024
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
日志
1 parent
ad42c056
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
24 deletions
mixin/click.js
mixin/click.js
View file @
572ab85
...
...
@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 11:28:48
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2024-11-05
09:53:23
* @LastEditTime: 2024-11-05
16:49:39
* @FilePath: \gl_tape\mixin\click.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
...
...
@@ -20,13 +20,13 @@ const AUDIO_STATUS = {
ABNORMAL
:
'abnormal'
//40分钟未触碰平板,断开录音,不提交记录
}
const
audioTime
=
10
*
60
*
1000
let
timer_interval
=
null
import
{
mapMutations
,
mapState
}
from
'vuex'
import
utils
from
'@/utils/utils.js'
export
default
{
data
()
{
return
{
voicePath
:
''
,
timer
:
null
,
times
:
0
,
timeout
:
240
,
reaction
:
1
...
...
@@ -36,12 +36,12 @@ export default {
uni
.
$logger
.
local
.
info
(
`进入接待首页!`
)
this
.
handleSave
(
false
)
// 获取当前页面栈数组
const
pages
=
getCurrentPages
()
const
currentPage
=
pages
[
pages
.
length
-
1
]
const
route
=
currentPage
.
route
const
url
=
[
'pages/equity/index'
,
'pages/boutique/index'
]
if
(
url
.
includes
(
route
))
return
this
.
initTime
()
//
const pages = getCurrentPages()
//
const currentPage = pages[pages.length - 1]
//
const route = currentPage.route
//
const url = ['pages/equity/index', 'pages/boutique/index']
//
if (url.includes(route)) return
//
this.initTime()
},
watch
:
{
/**
...
...
@@ -90,9 +90,7 @@ export default {
this
.
$refs
.
tipBox
?.
close
()
},
closeAudio
()
{
this
.
times
=
0
clearInterval
(
this
.
timer
)
this
.
timer
=
null
this
.
endWatchClick
()
this
.
stopAudio
(
AUDIO_STATUS
.
ABNORMAL
)
this
.
setReceptionStatus
(
0
)
this
.
setAudioInfo
({
endReasonType
:
1
})
...
...
@@ -169,7 +167,7 @@ export default {
this
.
initTime
()
this
.
setAudioInfo
({
audioList
:
[],
audioStatus
:
AUDIO_STATUS
.
START
})
recorderManager
.
onStart
(()
=>
{
uni
.
$logger
.
local
.
info
(
'开
始录音
'
)
uni
.
$logger
.
local
.
info
(
'开
启录音!
'
)
//开始录音保持记录,1s延时是因为第一段录音结束时间的文件修改时间等于第二段开始的文件修改时间,加上1s延时,就不会这个问题
setTimeout
(()
=>
{
const
params
=
this
.
getParams
(
this
.
$store
.
state
.
user
.
customerInfo
,
this
.
booksList
,
this
.
receptionStatus
)
...
...
@@ -182,14 +180,16 @@ export default {
numberOfChannels
:
1
})
recorderManager
.
onStop
(
async
res
=>
{
uni
.
$logger
.
local
.
info
(
'结束录音'
)
//第一段录音结束,还在接待中,则开启第二段录音
if
(
this
.
audioInfo
.
audioStatus
==
AUDIO_STATUS
.
START
)
{
uni
.
$logger
.
local
.
info
(
'接待中,再次开启录音!'
)
uni
.
getRecorderManager
().
start
({
duration
:
audioTime
,
sampleRate
:
16000
,
numberOfChannels
:
1
})
}
else
{
uni
.
$logger
.
local
.
info
(
'断开录音!'
)
}
})
},
300
),
...
...
@@ -264,7 +264,7 @@ export default {
* @returns {void}
*/
stopAudio
:
utils
.
throttle
(
async
function
(
status
)
{
uni
.
$logger
.
local
.
info
(
'结束接待'
)
uni
.
$logger
.
local
.
info
(
'结束接待
!
'
)
// const result = await this.$permision.requestAndroidPermission(
// "android.permission.RECORD_AUDIO"
// );
...
...
@@ -278,11 +278,13 @@ export default {
//如果是40分钟未触碰平板,只要断开录音即可
if
(
status
==
AUDIO_STATUS
.
ABNORMAL
)
{
this
.
setAudioInfo
({
audioStatus
:
AUDIO_STATUS
.
ABNORMAL
})
uni
.
$logger
.
local
.
info
(
'40分钟未触碰平板,断开录音!'
)
recorderManager
.
stop
()
return
}
//如果是40分钟未触碰平板后完成接待,需要保存记录
if
(
this
.
audioInfo
.
audioStatus
==
AUDIO_STATUS
.
ABNORMAL
&&
status
!=
true
)
{
uni
.
$logger
.
local
.
info
(
'40分钟未触碰平板,保存记录!'
)
this
.
setAudioInfo
({
audioStatus
:
AUDIO_STATUS
.
END
})
this
.
handleSave
()
return
...
...
@@ -301,34 +303,38 @@ export default {
this
.
handleSave
()
}
},
3000
)
this
.
times
=
0
clearInterval
(
this
.
timer
)
this
.
timer
=
null
this
.
endWatchClick
()
if
(
status
)
{
uni
.
$logger
.
local
.
info
(
'退出接待'
)
uni
.
$logger
.
local
.
info
(
'退出接待
,不保存记录!
'
)
this
.
removeRecords
()
}
recorderManager
.
stop
()
},
1500
),
//监听点击事件
initTime
()
{
if
(
this
.
audioInfo
.
audioStatus
!=
AUDIO_STATUS
.
START
)
return
this
.
timer
=
setInterval
(()
=>
{
// console.log(this.times);
if
(
timer_interval
)
{
this
.
endWatchClick
()
}
timer_interval
=
setInterval
(()
=>
{
this
.
times
++
console
.
log
(
this
.
times
,
'this.times'
)
if
(
this
.
times
>=
this
.
timeout
)
{
//关闭录音
this
.
closeAudio
()
clearInterval
(
this
.
timer
)
}
},
1000
*
10
)
},
endWatchClick
()
{
console
.
log
(
timer_interval
,
'endWatchClick'
)
if
(
timer_interval
)
clearInterval
(
timer_interval
)
timer_interval
=
null
this
.
times
=
0
},
handleTouchStart
()
{
this
.
times
=
0
}
},
beforeCreate
()
{
clearInterval
(
this
.
timer
)
this
.
timer
=
null
// this.endWatchClick && this.endWatchClick()
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment