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 91e7612d
authored
Jul 08, 2024
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
上传优化
1 parent
32a5259b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
24 deletions
mixin/click.js
mixin/uploader.js
mixin/click.js
View file @
91e7612
...
@@ -21,7 +21,7 @@ export default {
...
@@ -21,7 +21,7 @@ export default {
voicePath
:
""
,
voicePath
:
""
,
timer
:
null
,
timer
:
null
,
times
:
0
,
times
:
0
,
timeout
:
3
,
timeout
:
240
,
reaction
:
1
,
reaction
:
1
,
};
};
},
},
...
@@ -84,7 +84,6 @@ export default {
...
@@ -84,7 +84,6 @@ export default {
this
.
setAudioInfo
({
endReasonType
:
1
});
this
.
setAudioInfo
({
endReasonType
:
1
});
},
},
getParams
()
{
getParams
()
{
console
.
log
(
this
.
$store
.
state
.
user
.
customerInfo
);
const
{
shopMerchantId
,
phone
,
sceneType
,
uuid
,
name
,
merchantId
}
=
uni
.
$storage
.
get
(
"userInfo"
),
const
{
shopMerchantId
,
phone
,
sceneType
,
uuid
,
name
,
merchantId
}
=
uni
.
$storage
.
get
(
"userInfo"
),
{
customerName
,
phoneNumber
,
salesUuid
,
carModel
,
staffName
}
=
{
customerName
,
phoneNumber
,
salesUuid
,
carModel
,
staffName
}
=
this
.
$store
.
state
.
user
.
customerInfo
,
this
.
$store
.
state
.
user
.
customerInfo
,
...
@@ -213,7 +212,7 @@ export default {
...
@@ -213,7 +212,7 @@ export default {
recorderManager
.
stop
();
recorderManager
.
stop
();
return
;
return
;
}
}
if
(
this
.
audioInfo
.
audioStatus
==
"abnormal"
)
{
if
(
this
.
audioInfo
.
audioStatus
==
"abnormal"
&&
status
!=
true
)
{
this
.
setAudioInfo
({
audioStatus
:
"end"
});
this
.
setAudioInfo
({
audioStatus
:
"end"
});
this
.
handleSave
();
this
.
handleSave
();
return
;
return
;
...
...
mixin/uploader.js
View file @
91e7612
...
@@ -36,25 +36,30 @@ export default {
...
@@ -36,25 +36,30 @@ export default {
* @throws {Error} 如果解构对象时缺少关键属性,将抛出错误
* @throws {Error} 如果解构对象时缺少关键属性,将抛出错误
*/
*/
handlerMessage
(
result
)
{
handlerMessage
(
result
)
{
const
{
code
,
fileName
,
data
,
recordId
,
filePath
,
filePathOnClient
=
filePath
+
fileName
}
=
result
.
detail
.
data
[
0
]
try
{
if
(
code
==
0
)
{
const
{
code
,
fileName
,
data
,
recordId
,
filePath
,
filePathOnClient
=
filePath
+
fileName
}
=
result
.
detail
.
data
[
0
]
const
filePathOnServer
=
data
.
oss
.
res
.
requestUrls
[
0
].
split
(
'?'
)[
0
]
if
(
code
==
0
)
{
this
.
uploadSuccess
(
recordId
,
filePathOnServer
,
filePathOnClient
,
fileName
)
const
filePathOnServer
=
data
.
oss
.
res
.
requestUrls
[
0
].
split
(
'?'
)[
0
]
}
else
{
this
.
uploadSuccess
(
recordId
,
filePathOnServer
,
filePathOnClient
,
fileName
)
this
.
reportError
(
recordId
,
filePathOnClient
)
}
else
{
this
.
polling
()
this
.
reportError
(
recordId
,
fileName
,
data
.
oss
.
res
)
this
.
$sendSentry
(
`上传失败:文件名-
${
fileName
}
错误码-
${
data
.
oss
.
res
.
status
}
,失败原因-
${
JSON
.
stringify
(
data
.
oss
.
res
)}
`
);
this
.
polling
()
// this.$sendSentry(`上传失败:文件名-${fileName} 错误码-${data.oss.res.status},失败原因-${JSON.stringify(data.oss.res)}`);
}
}
catch
(
e
)
{
console
.
log
(
e
)
}
}
},
},
/**
/**
* 上报文件上传失败日志
* 上报文件上传失败日志
*/
*/
reportError
(
recordId
,
filePath
)
{
reportError
(
recordId
,
filePath
,
res
)
{
const
{
customerName
,
phoneNumber
,
carModel
,
salesName
}
=
const
{
customerName
,
phoneNumber
,
carModel
,
salesName
}
=
uni
.
$recordManager
.
getRecordById
(
recordId
)
||
{};
uni
.
$recordManager
.
getRecordById
(
recordId
)
||
{};
const
{
name
}
=
uni
.
$storage
.
get
(
"userInfo"
);
const
{
name
}
=
uni
.
$storage
.
get
(
"userInfo"
);
this
.
$sendSentry
(
this
.
$sendSentry
(
`上传失败:文件-
${
filePath
}
手机号-
${
phoneNumber
}
姓名-
${
customerName
}
销售-
${
salesName
}
车型-
${
carModel
}
员工-
${
name
}
`
`上传失败:文件-
${
filePath
}
手机号-
${
phoneNumber
}
姓名-
${
customerName
}
销售-
${
salesName
}
车型-
${
carModel
}
员工-
${
name
}
-错误码-
${
res
.
status
}
,失败原因-
${
JSON
.
stringify
(
res
)}
`
);
);
},
},
/**
/**
...
@@ -229,14 +234,13 @@ export default {
...
@@ -229,14 +234,13 @@ export default {
*/
*/
flattenData
(
records
)
{
flattenData
(
records
)
{
const
result
=
records
.
reduce
((
acc
,
cur
)
=>
{
const
result
=
records
.
reduce
((
acc
,
cur
)
=>
{
acc
=
acc
.
concat
(
const
recordUrlList
=
cur
.
recordUrlList
.
map
(
file
=>
{
cur
.
recordUrlList
.
map
(
file
=>
{
const
aFullPath
=
file
.
file
.
split
(
'/'
)
const
aFullPath
=
file
.
file
.
split
(
'/'
)
const
fileName
=
aFullPath
.
pop
()
const
fileName
=
aFullPath
.
pop
()
const
filePath
=
aFullPath
.
join
(
'/'
)
+
'/'
const
filePath
=
aFullPath
.
join
(
'/'
)
+
'/'
return
file
.
status
?
{
...
file
,
recordId
:
cur
.
id
,
fileName
,
filePath
}
:
[]
return
{
...
file
,
recordId
:
cur
.
id
,
fileName
,
filePath
}
})
})
acc
=
acc
.
concat
(...
recordUrlList
)
)
return
acc
return
acc
},
[])
},
[])
return
result
return
result
...
@@ -268,9 +272,9 @@ export default {
...
@@ -268,9 +272,9 @@ export default {
this
.
pollingLater
(
interval
)
this
.
pollingLater
(
interval
)
}
else
{
}
else
{
let
record
=
this
.
snapshot
.
dequeue
()
let
record
=
this
.
snapshot
.
dequeue
()
while
(
record
.
file
.
startsWith
(
'http'
))
{
//
while(record.file.startsWith('http')) {
record
=
this
.
snapshot
.
dequeue
()
//
record = this.snapshot.dequeue()
}
//
}
this
.
uploadRecord
(
record
)
this
.
uploadRecord
(
record
)
}
}
},
},
...
...
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