Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
web-purchase
Project
Project
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
张冬
web-purchase
Commits
90d666b3
Commit
90d666b3
authored
Sep 30, 2020
by
张冬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
80e24305
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
21 deletions
+1
-21
newUpload.vue
src/components/Upload/newUpload.vue
+1
-21
No files found.
src/components/Upload/newUpload.vue
View file @
90d666b3
...
@@ -65,31 +65,11 @@ import {
...
@@ -65,31 +65,11 @@ import {
const
isLt100M
=
const
isLt100M
=
file
.
size
/
1024
/
1024
>
10
&&
file
.
size
/
1024
/
1024
<
1024
;
file
.
size
/
1024
/
1024
>
10
&&
file
.
size
/
1024
/
1024
<
1024
;
const
isLt30
=
file
.
name
.
length
<
30
;
const
isLt30
=
file
.
name
.
length
<
30
;
if
([
"video/mp4"
].
indexOf
(
file
.
type
)
==
-
1
)
{
this
.
$message
.
error
(
"请上传正确的视频格式"
);
return
false
;
}
if
(
!
isLt100M
)
{
this
.
$message
.
error
(
"上传视频大小要在10MB~1GB之间哦!"
);
return
false
;
}
if
(
!
isLt30
)
{
if
(
!
isLt30
)
{
this
.
$message
.
error
(
"上传视频文件名称长度必须要小于30个文字哦!"
);
this
.
$message
.
error
(
"上传视频文件名称长度必须要小于30个文字哦!"
);
return
false
;
return
false
;
}
}
// 请求后台接口拿配置参数
// 请求后台接口拿配置参数
return
new
Promise
((
resolve
,
reject
)
=>
{
getAliOSSConfig
()
.
then
(
response
=>
{
this
.
dataObj
=
response
.
data
;
//接口返回配置参数
console
.
log
(
response
.
data
);
resolve
(
true
);
})
.
catch
(
err
=>
{
console
.
log
(
err
);
reject
(
false
);
});
});
},
},
// http-request属性来覆盖默认的上传行为(即action="url"),自定义上传的实现
// http-request属性来覆盖默认的上传行为(即action="url"),自定义上传的实现
Upload
(
file
)
{
Upload
(
file
)
{
...
@@ -102,7 +82,7 @@ import {
...
@@ -102,7 +82,7 @@ import {
fileNameLength
fileNameLength
);
);
let
fileName
=
getFileNameUUID
()
+
"."
+
fileFormat
;
let
fileName
=
getFileNameUUID
()
+
"."
+
fileFormat
;
client
(
that
.
dataObj
)
client
1
(
that
.
dataObj
)
.
multipartUpload
(
`videoTest/
${
fileName
}
`
,
file
.
file
,
{
.
multipartUpload
(
`videoTest/
${
fileName
}
`
,
file
.
file
,
{
progress
:
function
(
p
)
{
progress
:
function
(
p
)
{
//p进度条的值
//p进度条的值
...
...
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