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
Show 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 @@
...
@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 11:28:48
* @Date: 2024-04-08 11:28:48
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @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
* @FilePath: \gl_tape\mixin\click.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
...
@@ -20,13 +20,13 @@ const AUDIO_STATUS = {
...
@@ -20,13 +20,13 @@ const AUDIO_STATUS = {
ABNORMAL
:
'abnormal'
//40分钟未触碰平板,断开录音,不提交记录
ABNORMAL
:
'abnormal'
//40分钟未触碰平板,断开录音,不提交记录
}
}
const
audioTime
=
10
*
60
*
1000
const
audioTime
=
10
*
60
*
1000
let
timer_interval
=
null
import
{
mapMutations
,
mapState
}
from
'vuex'
import
{
mapMutations
,
mapState
}
from
'vuex'
import
utils
from
'@/utils/utils.js'
import
utils
from
'@/utils/utils.js'
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
voicePath
:
''
,
voicePath
:
''
,
timer
:
null
,
times
:
0
,
times
:
0
,
timeout
:
240
,
timeout
:
240
,
reaction
:
1
reaction
:
1
...
@@ -36,12 +36,12 @@ export default {
...
@@ -36,12 +36,12 @@ export default {
uni
.
$logger
.
local
.
info
(
`进入接待首页!`
)
uni
.
$logger
.
local
.
info
(
`进入接待首页!`
)
this
.
handleSave
(
false
)
this
.
handleSave
(
false
)
// 获取当前页面栈数组
// 获取当前页面栈数组
const
pages
=
getCurrentPages
()
//
const pages = getCurrentPages()
const
currentPage
=
pages
[
pages
.
length
-
1
]
//
const currentPage = pages[pages.length - 1]
const
route
=
currentPage
.
route
//
const route = currentPage.route
const
url
=
[
'pages/equity/index'
,
'pages/boutique/index'
]
//
const url = ['pages/equity/index', 'pages/boutique/index']
if
(
url
.
includes
(
route
))
return
//
if (url.includes(route)) return
this
.
initTime
()
//
this.initTime()
},
},
watch
:
{
watch
:
{
/**
/**
...
@@ -90,9 +90,7 @@ export default {
...
@@ -90,9 +90,7 @@ export default {
this
.
$refs
.
tipBox
?.
close
()
this
.
$refs
.
tipBox
?.
close
()
},
},
closeAudio
()
{
closeAudio
()
{
this
.
times
=
0
this
.
endWatchClick
()
clearInterval
(
this
.
timer
)
this
.
timer
=
null
this
.
stopAudio
(
AUDIO_STATUS
.
ABNORMAL
)
this
.
stopAudio
(
AUDIO_STATUS
.
ABNORMAL
)
this
.
setReceptionStatus
(
0
)
this
.
setReceptionStatus
(
0
)
this
.
setAudioInfo
({
endReasonType
:
1
})
this
.
setAudioInfo
({
endReasonType
:
1
})
...
@@ -169,7 +167,7 @@ export default {
...
@@ -169,7 +167,7 @@ export default {
this
.
initTime
()
this
.
initTime
()
this
.
setAudioInfo
({
audioList
:
[],
audioStatus
:
AUDIO_STATUS
.
START
})
this
.
setAudioInfo
({
audioList
:
[],
audioStatus
:
AUDIO_STATUS
.
START
})
recorderManager
.
onStart
(()
=>
{
recorderManager
.
onStart
(()
=>
{
uni
.
$logger
.
local
.
info
(
'开
始录音
'
)
uni
.
$logger
.
local
.
info
(
'开
启录音!
'
)
//开始录音保持记录,1s延时是因为第一段录音结束时间的文件修改时间等于第二段开始的文件修改时间,加上1s延时,就不会这个问题
//开始录音保持记录,1s延时是因为第一段录音结束时间的文件修改时间等于第二段开始的文件修改时间,加上1s延时,就不会这个问题
setTimeout
(()
=>
{
setTimeout
(()
=>
{
const
params
=
this
.
getParams
(
this
.
$store
.
state
.
user
.
customerInfo
,
this
.
booksList
,
this
.
receptionStatus
)
const
params
=
this
.
getParams
(
this
.
$store
.
state
.
user
.
customerInfo
,
this
.
booksList
,
this
.
receptionStatus
)
...
@@ -182,14 +180,16 @@ export default {
...
@@ -182,14 +180,16 @@ export default {
numberOfChannels
:
1
numberOfChannels
:
1
})
})
recorderManager
.
onStop
(
async
res
=>
{
recorderManager
.
onStop
(
async
res
=>
{
uni
.
$logger
.
local
.
info
(
'结束录音'
)
//第一段录音结束,还在接待中,则开启第二段录音
//第一段录音结束,还在接待中,则开启第二段录音
if
(
this
.
audioInfo
.
audioStatus
==
AUDIO_STATUS
.
START
)
{
if
(
this
.
audioInfo
.
audioStatus
==
AUDIO_STATUS
.
START
)
{
uni
.
$logger
.
local
.
info
(
'接待中,再次开启录音!'
)
uni
.
getRecorderManager
().
start
({
uni
.
getRecorderManager
().
start
({
duration
:
audioTime
,
duration
:
audioTime
,
sampleRate
:
16000
,
sampleRate
:
16000
,
numberOfChannels
:
1
numberOfChannels
:
1
})
})
}
else
{
uni
.
$logger
.
local
.
info
(
'断开录音!'
)
}
}
})
})
},
300
),
},
300
),
...
@@ -264,7 +264,7 @@ export default {
...
@@ -264,7 +264,7 @@ export default {
* @returns {void}
* @returns {void}
*/
*/
stopAudio
:
utils
.
throttle
(
async
function
(
status
)
{
stopAudio
:
utils
.
throttle
(
async
function
(
status
)
{
uni
.
$logger
.
local
.
info
(
'结束接待'
)
uni
.
$logger
.
local
.
info
(
'结束接待
!
'
)
// const result = await this.$permision.requestAndroidPermission(
// const result = await this.$permision.requestAndroidPermission(
// "android.permission.RECORD_AUDIO"
// "android.permission.RECORD_AUDIO"
// );
// );
...
@@ -278,11 +278,13 @@ export default {
...
@@ -278,11 +278,13 @@ export default {
//如果是40分钟未触碰平板,只要断开录音即可
//如果是40分钟未触碰平板,只要断开录音即可
if
(
status
==
AUDIO_STATUS
.
ABNORMAL
)
{
if
(
status
==
AUDIO_STATUS
.
ABNORMAL
)
{
this
.
setAudioInfo
({
audioStatus
:
AUDIO_STATUS
.
ABNORMAL
})
this
.
setAudioInfo
({
audioStatus
:
AUDIO_STATUS
.
ABNORMAL
})
uni
.
$logger
.
local
.
info
(
'40分钟未触碰平板,断开录音!'
)
recorderManager
.
stop
()
recorderManager
.
stop
()
return
return
}
}
//如果是40分钟未触碰平板后完成接待,需要保存记录
//如果是40分钟未触碰平板后完成接待,需要保存记录
if
(
this
.
audioInfo
.
audioStatus
==
AUDIO_STATUS
.
ABNORMAL
&&
status
!=
true
)
{
if
(
this
.
audioInfo
.
audioStatus
==
AUDIO_STATUS
.
ABNORMAL
&&
status
!=
true
)
{
uni
.
$logger
.
local
.
info
(
'40分钟未触碰平板,保存记录!'
)
this
.
setAudioInfo
({
audioStatus
:
AUDIO_STATUS
.
END
})
this
.
setAudioInfo
({
audioStatus
:
AUDIO_STATUS
.
END
})
this
.
handleSave
()
this
.
handleSave
()
return
return
...
@@ -301,34 +303,38 @@ export default {
...
@@ -301,34 +303,38 @@ export default {
this
.
handleSave
()
this
.
handleSave
()
}
}
},
3000
)
},
3000
)
this
.
times
=
0
this
.
endWatchClick
()
clearInterval
(
this
.
timer
)
this
.
timer
=
null
if
(
status
)
{
if
(
status
)
{
uni
.
$logger
.
local
.
info
(
'退出接待'
)
uni
.
$logger
.
local
.
info
(
'退出接待
,不保存记录!
'
)
this
.
removeRecords
()
this
.
removeRecords
()
}
}
recorderManager
.
stop
()
recorderManager
.
stop
()
},
1500
),
},
1500
),
//监听点击事件
//监听点击事件
initTime
()
{
initTime
()
{
if
(
this
.
audioInfo
.
audioStatus
!=
AUDIO_STATUS
.
START
)
return
if
(
timer_interval
)
{
this
.
timer
=
setInterval
(()
=>
{
this
.
endWatchClick
()
// console.log(this.times);
}
timer_interval
=
setInterval
(()
=>
{
this
.
times
++
this
.
times
++
console
.
log
(
this
.
times
,
'this.times'
)
if
(
this
.
times
>=
this
.
timeout
)
{
if
(
this
.
times
>=
this
.
timeout
)
{
//关闭录音
//关闭录音
this
.
closeAudio
()
this
.
closeAudio
()
clearInterval
(
this
.
timer
)
}
}
},
1000
*
10
)
},
1000
*
10
)
},
},
endWatchClick
()
{
console
.
log
(
timer_interval
,
'endWatchClick'
)
if
(
timer_interval
)
clearInterval
(
timer_interval
)
timer_interval
=
null
this
.
times
=
0
},
handleTouchStart
()
{
handleTouchStart
()
{
this
.
times
=
0
this
.
times
=
0
}
}
},
},
beforeCreate
()
{
beforeCreate
()
{
clearInterval
(
this
.
timer
)
// this.endWatchClick && this.endWatchClick()
this
.
timer
=
null
}
}
}
}
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