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 025e48e6
authored
Oct 24, 2024
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
变量
1 parent
cc4dbb26
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
17 deletions
mixin/click.js
mixin/click.js
View file @
025e48e
...
@@ -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-10-2
1 10:49:34
* @LastEditTime: 2024-10-2
3 17:23:29
* @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
*/
*/
...
@@ -14,6 +14,11 @@ const UPLOAD_STATUS = {
...
@@ -14,6 +14,11 @@ const UPLOAD_STATUS = {
success
:
1
,
success
:
1
,
fail
:
2
fail
:
2
}
}
const
AUDIO_STATUS
=
{
START
:
'start'
,
//开始
END
:
'end'
,
//结束
ABNORMAL
:
'abnormal'
//异常
}
const
audioTime
=
10
*
60
*
1000
const
audioTime
=
10
*
60
*
1000
import
{
mapMutations
,
mapState
}
from
'vuex'
import
{
mapMutations
,
mapState
}
from
'vuex'
import
utils
from
'@/utils/utils.js'
import
utils
from
'@/utils/utils.js'
...
@@ -41,7 +46,7 @@ export default {
...
@@ -41,7 +46,7 @@ export default {
changeData
:
{
changeData
:
{
handler
(
val
)
{
handler
(
val
)
{
console
.
log
(
val
,
'val'
,
this
.
audioInfo
.
audioStatus
)
console
.
log
(
val
,
'val'
,
this
.
audioInfo
.
audioStatus
)
if
(
this
.
audioInfo
.
audioStatus
!=
'start'
)
return
if
(
this
.
audioInfo
.
audioStatus
!=
AUDIO_STATUS
.
START
)
return
const
{
customerInfo
,
booksList
,
receptionStatus
}
=
val
const
{
customerInfo
,
booksList
,
receptionStatus
}
=
val
const
params
=
this
.
getParams
(
customerInfo
,
booksList
,
receptionStatus
)
const
params
=
this
.
getParams
(
customerInfo
,
booksList
,
receptionStatus
)
interruptRecord
.
updatePreRecords
(
params
)
interruptRecord
.
updatePreRecords
(
params
)
...
@@ -83,7 +88,7 @@ export default {
...
@@ -83,7 +88,7 @@ export default {
this
.
times
=
0
this
.
times
=
0
clearInterval
(
this
.
timer
)
clearInterval
(
this
.
timer
)
this
.
timer
=
null
this
.
timer
=
null
this
.
stopAudio
(
'abnormal'
)
this
.
stopAudio
(
AUDIO_STATUS
.
ABNORMAL
)
this
.
setReceptionStatus
(
0
)
this
.
setReceptionStatus
(
0
)
this
.
setAudioInfo
({
endReasonType
:
1
})
this
.
setAudioInfo
({
endReasonType
:
1
})
},
},
...
@@ -151,12 +156,12 @@ export default {
...
@@ -151,12 +156,12 @@ export default {
//开始录音
//开始录音
startAudio
:
utils
.
throttle
(
async
function
()
{
startAudio
:
utils
.
throttle
(
async
function
()
{
if
(
this
.
audioInfo
.
audioStatus
==
'start'
)
return
if
(
this
.
audioInfo
.
audioStatus
==
AUDIO_STATUS
.
START
)
return
this
.
setBooks
([])
this
.
setBooks
([])
this
.
$store
.
dispatch
(
'clearCustomerInfo'
)
this
.
$store
.
dispatch
(
'clearCustomerInfo'
)
this
.
setReceptionStatus
(
''
)
this
.
setReceptionStatus
(
''
)
this
.
initTime
()
this
.
initTime
()
this
.
setAudioInfo
({
audioList
:
[],
audioStatus
:
'start'
})
this
.
setAudioInfo
({
audioList
:
[],
audioStatus
:
AUDIO_STATUS
.
START
})
recorderManager
.
onStart
(()
=>
{
recorderManager
.
onStart
(()
=>
{
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
)
...
@@ -169,7 +174,7 @@ export default {
...
@@ -169,7 +174,7 @@ export default {
numberOfChannels
:
1
numberOfChannels
:
1
})
})
recorderManager
.
onStop
(
async
res
=>
{
recorderManager
.
onStop
(
async
res
=>
{
if
(
this
.
audioInfo
.
audioStatus
==
'start'
)
{
if
(
this
.
audioInfo
.
audioStatus
==
AUDIO_STATUS
.
START
)
{
uni
.
getRecorderManager
().
start
({
uni
.
getRecorderManager
().
start
({
duration
:
audioTime
,
duration
:
audioTime
,
sampleRate
:
16000
,
sampleRate
:
16000
,
...
@@ -178,6 +183,11 @@ export default {
...
@@ -178,6 +183,11 @@ export default {
}
}
})
})
},
300
),
},
300
),
/**
* 保存记录
* @params {boolean} isNormal 是否是正常保存
* @returns {void}
*/
async
handleSave
(
isNormal
=
true
)
{
async
handleSave
(
isNormal
=
true
)
{
const
records
=
interruptRecord
.
getPreRecord
()
const
records
=
interruptRecord
.
getPreRecord
()
console
.
log
(
records
,
'records'
)
console
.
log
(
records
,
'records'
)
...
@@ -203,7 +213,6 @@ export default {
...
@@ -203,7 +213,6 @@ export default {
}
}
delete
records
.
audioPath
delete
records
.
audioPath
let
saveRecords
=
Object
.
assign
(
records
,
{
recordUrlList
})
let
saveRecords
=
Object
.
assign
(
records
,
{
recordUrlList
})
console
.
log
(
isNormal
,
'isNormal'
)
if
(
isNormal
)
{
if
(
isNormal
)
{
this
.
saveRecord
(
saveRecords
)
this
.
saveRecord
(
saveRecords
)
}
else
{
}
else
{
...
@@ -222,7 +231,11 @@ export default {
...
@@ -222,7 +231,11 @@ export default {
interruptRecord
.
removePreRecord
(
record
.
id
)
interruptRecord
.
removePreRecord
(
record
.
id
)
unlock
()
unlock
()
},
},
//结束接待
/**
* 结束接待
* @params {boolean} status true 不保存记录/AUDIO_STATUS.ABNORMAL 只要断开录音
* @returns {void}
*/
stopAudio
:
utils
.
throttle
(
async
function
(
status
)
{
stopAudio
:
utils
.
throttle
(
async
function
(
status
)
{
console
.
log
(
'结束'
)
console
.
log
(
'结束'
)
// const result = await this.$permision.requestAndroidPermission(
// const result = await this.$permision.requestAndroidPermission(
...
@@ -235,27 +248,27 @@ export default {
...
@@ -235,27 +248,27 @@ export default {
// });
// });
// return;
// return;
// }
// }
if
(
status
==
'abnormal'
)
{
if
(
status
==
AUDIO_STATUS
.
ABNORMAL
)
{
this
.
setAudioInfo
({
audioStatus
:
'abnormal'
})
this
.
setAudioInfo
({
audioStatus
:
AUDIO_STATUS
.
ABNORMAL
})
recorderManager
.
stop
()
recorderManager
.
stop
()
return
return
}
}
if
(
this
.
audioInfo
.
audioStatus
==
'abnormal'
&&
status
!=
true
)
{
if
(
this
.
audioInfo
.
audioStatus
==
AUDIO_STATUS
.
ABNORMAL
&&
status
!=
true
)
{
this
.
setAudioInfo
({
audioStatus
:
'end'
})
this
.
setAudioInfo
({
audioStatus
:
AUDIO_STATUS
.
END
})
this
.
handleSave
()
this
.
handleSave
()
return
return
}
}
if
(
this
.
audioInfo
.
audioStatus
!=
'start'
)
{
if
(
this
.
audioInfo
.
audioStatus
!=
AUDIO_STATUS
.
START
)
{
return
return
}
}
this
.
setAudioInfo
({
audioStatus
:
'end'
})
this
.
setAudioInfo
({
audioStatus
:
AUDIO_STATUS
.
END
})
//直接退出
//直接退出
uni
.
showLoading
({
uni
.
showLoading
({
mask
:
true
mask
:
true
})
})
setTimeout
(()
=>
{
setTimeout
(()
=>
{
uni
.
hideLoading
()
uni
.
hideLoading
()
if
(
this
.
audioInfo
.
audioStatus
==
'end'
)
{
if
(
this
.
audioInfo
.
audioStatus
==
AUDIO_STATUS
.
END
)
{
this
.
handleSave
()
this
.
handleSave
()
}
}
},
3000
)
},
3000
)
...
@@ -263,14 +276,13 @@ export default {
...
@@ -263,14 +276,13 @@ export default {
clearInterval
(
this
.
timer
)
clearInterval
(
this
.
timer
)
this
.
timer
=
null
this
.
timer
=
null
if
(
status
)
{
if
(
status
)
{
this
.
setAudioInfo
({
audioStatus
:
'no'
})
this
.
removeRecords
()
this
.
removeRecords
()
}
}
recorderManager
.
stop
()
recorderManager
.
stop
()
},
1500
),
},
1500
),
//监听点击事件
//监听点击事件
initTime
()
{
initTime
()
{
if
(
this
.
audioInfo
.
audioStatus
!=
'start'
)
return
if
(
this
.
audioInfo
.
audioStatus
!=
AUDIO_STATUS
.
START
)
return
this
.
timer
=
setInterval
(()
=>
{
this
.
timer
=
setInterval
(()
=>
{
// console.log(this.times);
// console.log(this.times);
this
.
times
++
this
.
times
++
...
...
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