Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yl15_ai_video
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
template admin
yl15_ai_video
Commits
26fa0202
Commit
26fa0202
authored
Mar 25, 2026
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
39b2e852
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
index.html
form/index.html
+1
-1
index.js
form/index.js
+22
-6
No files found.
form/index.html
View file @
26fa0202
...
...
@@ -33,7 +33,7 @@
:before-upload=
"beforeUpload"
:on-change=
"handleFileChange"
:on-error=
"handleUploadError"
accept=
"
video/*
"
>
accept=
"
.mp4,video/mp4,application/mp4
"
>
<el-button
type=
"primary"
:loading=
"uploading"
:disabled=
"uploading"
>
选择视频
</el-button>
<span
class=
"hint"
>
支持重复上传,会覆盖当前视频
</span>
</el-upload>
...
...
form/index.js
View file @
26fa0202
...
...
@@ -82,13 +82,27 @@ new Vue({
}
},
methods
:
{
/** 仅允许 .mp4;MIME 有值时须为 video/mp4 或 application/mp4(部分环境 type 为空则只靠扩展名) */
isMp4File
:
function
(
file
)
{
var
raw
=
file
&&
file
.
raw
?
file
.
raw
:
file
;
if
(
!
raw
||
!
raw
.
name
)
{
return
false
;
}
if
(
!
/
\.
mp4$/i
.
test
(
raw
.
name
))
{
return
false
;
}
var
t
=
(
raw
.
type
||
''
).
toLowerCase
();
if
(
t
&&
t
!==
'
video/mp4
'
&&
t
!==
'
application/mp4
'
)
{
return
false
;
}
return
true
;
},
beforeUpload
:
function
(
file
)
{
if
(
this
.
uploading
)
{
this
.
$message
.
warning
(
'
正在上传,请稍候再试
'
);
return
false
;
}
var
isMP4
=
file
.
type
===
'
video/mp4
'
;
if
(
!
isMP4
)
{
if
(
!
this
.
isMp4File
(
file
))
{
this
.
$message
.
error
(
'
只能上传 mp4 文件
'
);
return
false
;
}
...
...
@@ -105,6 +119,9 @@ new Vue({
if
(
!
rawFile
)
{
return
;
}
if
(
!
this
.
isMp4File
(
file
))
{
return
;
}
if
(
this
.
videoPreviewUrl
&&
this
.
videoPreviewUrl
.
indexOf
(
'
blob:
'
)
===
0
)
{
URL
.
revokeObjectURL
(
this
.
videoPreviewUrl
);
}
...
...
@@ -243,7 +260,7 @@ new Vue({
accessKeyId
:
ossConfig
.
accessKeyId
,
accessKeySecret
:
ossConfig
.
accessKeySecret
,
stsToken
:
ossConfig
.
securityToken
,
bucket
:
'
iplayabc-worker-queue-video
-mini
'
,
bucket
:
'
iplayabc-worker-queue-video
lmh
'
,
cors
:
true
,
secure
:
true
,
silent
:
true
...
...
@@ -267,15 +284,14 @@ new Vue({
if
(
ext
!==
'
mp4
'
)
{
return
newFileName
;
}
var
miniName
=
md5
+
'
_mini.mp4
'
;
return
videoClient
.
multipartUpload
(
miniName
,
file
,
{
return
videoClient
.
multipartUpload
(
newFileName
,
file
,
{
progress
:
function
(
p
)
{
if
(
uploadId
===
_this
.
currentUploadId
)
{
_this
.
uploadProgress
=
Math
.
floor
(
p
*
50
)
+
50
;
}
}
}).
then
(
function
()
{
return
mini
Name
;
return
newFile
Name
;
});
});
}).
then
(
function
(
fileName
)
{
...
...
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