Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
corporate-culture-qd
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王立鹏
corporate-culture-qd
Commits
75d73c97
Commit
75d73c97
authored
May 25, 2026
by
lijiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【代码优化】 refactor: 上传视频流程结束后统一释放临时视频地址,避免资源长期占用
parent
235266d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
index.vue
src/components/common/UploadVideo/index.vue
+7
-2
No files found.
src/components/common/UploadVideo/index.vue
View file @
75d73c97
...
@@ -152,14 +152,15 @@ let cancelUploadController = () => {}
...
@@ -152,14 +152,15 @@ let cancelUploadController = () => {}
const
startUpload
=
async
()
=>
{
const
startUpload
=
async
()
=>
{
if
(
!
currentFile
.
value
)
return
if
(
!
currentFile
.
value
)
return
let
localVideoUrl
=
''
try
{
try
{
uploading
.
value
=
true
uploading
.
value
=
true
uploadError
.
value
=
''
uploadError
.
value
=
''
uploadProgress
.
value
=
0
uploadProgress
.
value
=
0
// 先提案获取视频的原信息 用本地blob
// 先提案获取视频的原信息 用本地blob
const
blob
=
URL
.
createObjectURL
(
currentFile
.
value
)
localVideoUrl
=
URL
.
createObjectURL
(
currentFile
.
value
)
const
metadataPromise
=
getVideoMetadata
(
blob
)
const
metadataPromise
=
getVideoMetadata
(
localVideoUrl
)
const
{
promise
,
cancel
}
=
uploadFileApi
(
currentFile
.
value
,
{
const
{
promise
,
cancel
}
=
uploadFileApi
(
currentFile
.
value
,
{
onProgress
:
(
progress
)
=>
{
onProgress
:
(
progress
)
=>
{
uploadProgress
.
value
=
progress
uploadProgress
.
value
=
progress
...
@@ -198,6 +199,10 @@ const startUpload = async () => {
...
@@ -198,6 +199,10 @@ const startUpload = async () => {
uploading
.
value
=
false
uploading
.
value
=
false
uploadError
.
value
=
error
instanceof
Error
?
error
.
message
:
'上传失败,请重试'
uploadError
.
value
=
error
instanceof
Error
?
error
.
message
:
'上传失败,请重试'
push
.
error
(
uploadError
.
value
)
push
.
error
(
uploadError
.
value
)
}
finally
{
if
(
localVideoUrl
)
{
URL
.
revokeObjectURL
(
localVideoUrl
)
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment