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 6a0aee8a
authored
Jan 20, 2025
by
liimin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新增录音时 等待1秒防止出现空文件
1 parent
8f8b00f8
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
9 deletions
utils/recordManager/TempRecord.js
utils/recordManager/helpler.js
ws/workers/AddRecordWorker.js
ws/workers/AddTempRecordWorker.js
ws/workers/RecordsWorker.js
ws/workers/TempRecordsWorker.js
utils/recordManager/TempRecord.js
View file @
6a0aee8
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
* @Author: limin
* @Author: limin
* @Date: 2025-01-02 18:49:17
* @Date: 2025-01-02 18:49:17
* @LastEditors: limin
* @LastEditors: limin
* @LastEditTime: 2025-01-20 1
6:42:41
* @LastEditTime: 2025-01-20 1
8:15:46
* @FilePath: \gl_tape\utils\recordManager\TempRecord.js
* @FilePath: \gl_tape\utils\recordManager\TempRecord.js
*/
*/
import
utils
from
'../utils'
import
utils
from
'../utils'
...
@@ -129,6 +129,8 @@ class TempRecord {
...
@@ -129,6 +129,8 @@ class TempRecord {
await
this
.
saveLastAudio
()
await
this
.
saveLastAudio
()
//删除上一个临时文件
//删除上一个临时文件
await
this
.
removeOldTempAudio
()
await
this
.
removeOldTempAudio
()
//等待1秒
await
helpler
.
sleep
(
1000
)
//新增一个录音
//新增一个录音
await
this
.
addNewAudio
()
await
this
.
addNewAudio
()
//更新临时录音文件
//更新临时录音文件
...
...
utils/recordManager/helpler.js
View file @
6a0aee8
...
@@ -103,6 +103,10 @@ async function __getFileMetadata(fileEntry) {
...
@@ -103,6 +103,10 @@ async function __getFileMetadata(fileEntry) {
)
)
})
})
}
}
async
function
sleep
(
time
){
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
time
))
}
export
default
{
export
default
{
getLatestAudioFilePath
getLatestAudioFilePath
,
sleep
}
}
ws/workers/AddRecordWorker.js
View file @
6a0aee8
/*
/*
* @Author: 前端 qianduan01@didihu.com.cn
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2025-01-14 16:49:00
* @Date: 2025-01-14 16:49:00
* @LastEditors:
前端 qianduan01@didihu.com.c
n
* @LastEditors:
limi
n
* @LastEditTime: 2025-01-
14 18:14:20
* @LastEditTime: 2025-01-
20 17:31:12
* @FilePath: \gl
-
tape\ws\workers\AddRecordWorker.js
* @FilePath: \gl
_
tape\ws\workers\AddRecordWorker.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
*/
*/
import
{
RecordDto
}
from
'@/utils/recordManager/index'
import
{
RecordDto
}
from
'@/utils/recordManager/index'
...
@@ -26,7 +26,7 @@ export default class AddRecordWorker {
...
@@ -26,7 +26,7 @@ export default class AddRecordWorker {
await
uni
.
$dbManager
.
addRecord
(
record
)
await
uni
.
$dbManager
.
addRecord
(
record
)
const
msg
=
`写入待上传记录成功 temp record ->
${
JSON
.
stringify
(
record
)}
`
const
msg
=
`写入待上传记录成功 temp record ->
${
JSON
.
stringify
(
record
)}
`
uni
.
$logger
.
local
.
info
(
msg
)
uni
.
$logger
.
local
.
info
(
msg
)
ws
.
send
({
code
:
200
,
msg
})
ws
.
send
({
code
:
200
,
msg
:
'写入待上传记录成功'
,
data
:
record
})
}
catch
(
error
)
{
}
catch
(
error
)
{
const
msg
=
`写入待上传记录失败 error ->
${
error
.
message
}
`
const
msg
=
`写入待上传记录失败 error ->
${
error
.
message
}
`
uni
.
$logger
.
local
.
error
(
msg
)
uni
.
$logger
.
local
.
error
(
msg
)
...
...
ws/workers/AddTempRecordWorker.js
View file @
6a0aee8
...
@@ -18,7 +18,7 @@ export default class AddTempRecordWorker {
...
@@ -18,7 +18,7 @@ export default class AddTempRecordWorker {
await
uni
.
$dbTempRecord
.
addRecord
(
record
)
await
uni
.
$dbTempRecord
.
addRecord
(
record
)
const
msg
=
`写入待提交记录成功 temp record ->
${
JSON
.
stringify
(
record
)}
`
const
msg
=
`写入待提交记录成功 temp record ->
${
JSON
.
stringify
(
record
)}
`
uni
.
$logger
.
local
.
info
(
msg
)
uni
.
$logger
.
local
.
info
(
msg
)
ws
.
send
({
code
:
200
,
msg
})
ws
.
send
({
code
:
200
,
msg
:
'写入待提交记录成功'
,
data
:
record
})
}
catch
(
error
)
{
}
catch
(
error
)
{
const
msg
=
`写入待提交记录失败 error ->
${
error
.
message
}
`
const
msg
=
`写入待提交记录失败 error ->
${
error
.
message
}
`
uni
.
$logger
.
local
.
error
(
msg
)
uni
.
$logger
.
local
.
error
(
msg
)
...
...
ws/workers/RecordsWorker.js
View file @
6a0aee8
...
@@ -6,7 +6,7 @@ export default class RecordsWorker {
...
@@ -6,7 +6,7 @@ export default class RecordsWorker {
const
records
=
await
uni
.
$dbManager
.
getRecords
()
const
records
=
await
uni
.
$dbManager
.
getRecords
()
const
msg
=
`记录获取成功 records ->
${
JSON
.
stringify
(
records
)}
`
const
msg
=
`记录获取成功 records ->
${
JSON
.
stringify
(
records
)}
`
uni
.
$logger
.
local
.
info
(
msg
)
uni
.
$logger
.
local
.
info
(
msg
)
ws
.
send
({
code
:
200
,
msg
})
ws
.
send
({
code
:
200
,
msg
:
'获取记录成功'
,
data
:
records
})
}
catch
(
error
)
{
}
catch
(
error
)
{
const
msg
=
`获取记录失败 error ->
${
error
.
message
}
`
const
msg
=
`获取记录失败 error ->
${
error
.
message
}
`
uni
.
$logger
.
local
.
error
(
msg
)
uni
.
$logger
.
local
.
error
(
msg
)
...
...
ws/workers/TempRecordsWorker.js
View file @
6a0aee8
...
@@ -5,7 +5,7 @@ export default class TempRecordsWorker {
...
@@ -5,7 +5,7 @@ export default class TempRecordsWorker {
const
records
=
await
uni
.
$dbTempRecord
.
getRecords
()
const
records
=
await
uni
.
$dbTempRecord
.
getRecords
()
const
msg
=
`记录获取待提交记录成功 temp records ->
${
JSON
.
stringify
(
records
)}
`
const
msg
=
`记录获取待提交记录成功 temp records ->
${
JSON
.
stringify
(
records
)}
`
uni
.
$logger
.
local
.
info
(
msg
)
uni
.
$logger
.
local
.
info
(
msg
)
ws
.
send
({
code
:
200
,
msg
})
ws
.
send
({
code
:
200
,
msg
:
'获取待提交记录成功'
,
data
:
records
})
}
catch
(
error
)
{
}
catch
(
error
)
{
const
msg
=
`获取待提交记录失败 error ->
${
error
.
message
}
`
const
msg
=
`获取待提交记录失败 error ->
${
error
.
message
}
`
uni
.
$logger
.
local
.
error
(
msg
)
uni
.
$logger
.
local
.
error
(
msg
)
...
...
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