Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
national_museum_vod-H5
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
fubaole
national_museum_vod-H5
Commits
c58fab6f
Commit
c58fab6f
authored
Apr 06, 2021
by
乐宝呗666
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改多视频,多图片上传问题
parent
ff8a903a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
23 deletions
+57
-23
.gitignore
.gitignore
+1
-0
commitTab.vue
src/views/user/components/commitTab.vue
+56
-23
No files found.
.gitignore
View file @
c58fab6f
node_modules
package-lock.json
.DS_Store
src/views/user/components/commitTab.vue
View file @
c58fab6f
...
...
@@ -157,8 +157,8 @@ export default {
form
:
{
username
:
JSON
.
parse
(
localStorage
.
getItem
(
"userInfo"
)).
orgName
,
organId
:
JSON
.
parse
(
localStorage
.
getItem
(
"userInfo"
)).
orgId
,
images
:
[],
videos
:
[],
images
:
[],
// 文件地址
videos
:
[],
// 文件地址
},
currentDate
:
new
Date
(),
boardList
:
[],
...
...
@@ -166,8 +166,10 @@ export default {
showBoard
:
false
,
cellIcon
:
"/images/applets/date.png"
,
show
:
false
,
fileList
:
[],
imgFileList
:
[],
fileList
:
[],
// 预览
imgFileList
:
[],
// 预览
videoIds
:[],
// 文件ID
imageIds
:[]
// 文件ID
};
},
mounted
()
{
...
...
@@ -265,27 +267,30 @@ export default {
return
`
${
value
}
分`
;
},
// 删除图片
deleteImg
(
file
,
detail
){
async
deleteImg
(
file
,
detail
){
this
.
form
.
images
.
splice
(
detail
.
index
,
1
)
return
true
const
id
=
this
.
imageIds
[
detail
.
index
]
this
.
imageIds
.
splice
(
detail
.
index
,
1
)
await
this
.
deleteInterface
(
id
)
},
// 上传图片
判断
// 上传图片
uploadImg
(
file
)
{
let
param
=
new
FormData
();
if
(
Array
.
isArray
(
file
)){
file
.
forEach
(
item
=>
{
this
.
uploadImgInterface
(
item
.
file
)
param
.
append
(
"file"
,
item
.
file
)
})
}
else
{
this
.
uploadImgInterface
(
file
.
file
)
param
.
append
(
"file"
,
file
.
file
)
}
this
.
uploadImgInterface
(
param
)
},
uploadImgInterface
(
file
){
// 上传图片接口
uploadImgInterface
(
param
){
let
vm
=
this
;
let
param
=
new
FormData
();
param
.
append
(
"file"
,
file
);
vm
.
$https
(
{
url
:
"file/
image
/upload"
,
url
:
"file/
datum
/upload"
,
method
:
"post"
,
authType
:
this
.
backToken
,
},
...
...
@@ -293,7 +298,10 @@ export default {
)
.
then
((
res
)
=>
{
if
(
res
.
data
.
resultCode
===
'200'
){
this
.
form
.
images
.
push
(
res
.
data
.
data
.
url
);
res
.
data
.
data
.
fileList
.
forEach
(
item
=>
{
this
.
form
.
images
.
push
(
item
.
fileUrl
);
this
.
imageIds
.
push
(
item
.
id
);
})
}
else
{
this
.
$toast
(
res
.
data
.
message
)
}
...
...
@@ -303,25 +311,27 @@ export default {
});
},
// 删除视频
deleteVideo
(
file
,
detail
){
async
deleteVideo
(
file
,
detail
){
this
.
form
.
videos
.
splice
(
detail
.
index
,
1
)
console
.
log
(
this
.
form
.
videos
)
return
true
const
id
=
this
.
videoIds
[
detail
.
index
]
this
.
videoIds
.
splice
(
detail
.
index
,
1
)
await
this
.
deleteInterface
(
id
)
},
// 上传视频
uploadVideo
(
file
)
{
let
param
=
new
FormData
();
if
(
Array
.
isArray
(
file
)){
file
.
forEach
(
item
=>
{
this
.
uploadVideoInterface
(
item
.
file
)
param
.
append
(
"file"
,
item
.
file
)
})
}
else
{
this
.
uploadVideoInterface
(
file
.
file
)
param
.
append
(
"file"
,
file
.
file
)
}
this
.
uploadVideoInterface
(
param
)
},
uploadVideoInterface
(
file
){
// 上传视频接口
uploadVideoInterface
(
param
){
let
vm
=
this
;
const
param
=
new
FormData
();
param
.
append
(
"file"
,
file
);
vm
.
$https
(
{
url
:
"file/video/upload"
,
...
...
@@ -332,7 +342,10 @@ export default {
)
.
then
((
res
)
=>
{
if
(
res
.
data
.
resultCode
===
'200'
){
this
.
form
.
videos
.
push
(
res
.
data
.
data
.
fileList
[
0
].
fileUrl
);
res
.
data
.
data
.
fileList
.
forEach
(
item
=>
{
this
.
form
.
videos
.
push
(
item
.
fileUrl
);
this
.
videoIds
.
push
(
item
.
id
);
})
}
else
{
this
.
$toast
(
res
.
data
.
message
)
}
...
...
@@ -342,6 +355,26 @@ export default {
console
.
log
(
err
);
});
},
// 删除接口
deleteInterface
(
id
){
this
.
$https
(
{
url
:
"file/delete/"
+
id
,
method
:
"delete"
,
authType
:
this
.
backToken
,
})
.
then
((
res
)
=>
{
if
(
res
.
data
.
resultCode
===
'200'
){
return
true
}
else
{
this
.
$toast
(
res
.
data
.
message
)
return
false
}
})
.
catch
(
function
(
err
)
{
console
.
log
(
err
);
});
},
// 提交数据
onSubmit
()
{
...
...
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