|
|
|
|
@ -291,6 +291,8 @@
|
|
|
|
|
list-type="picture-card"
|
|
|
|
|
:on-preview="handlePreviewFile"
|
|
|
|
|
:on-success="uploadServiceSuccess"
|
|
|
|
|
:before-upload="limitGifFileType"
|
|
|
|
|
accept=".GIF,.gif"
|
|
|
|
|
>
|
|
|
|
|
<i class="el-icon-plus"></i>
|
|
|
|
|
</el-upload>
|
|
|
|
|
@ -309,6 +311,8 @@
|
|
|
|
|
list-type="picture-card"
|
|
|
|
|
:on-preview="handlePreviewFile"
|
|
|
|
|
:on-success="uploadServiceSuccess"
|
|
|
|
|
:before-upload="limitGifFileType"
|
|
|
|
|
accept=".GIF,.gif"
|
|
|
|
|
>
|
|
|
|
|
<i class="el-icon-plus"></i>
|
|
|
|
|
</el-upload>
|
|
|
|
|
@ -728,6 +732,26 @@ export default {
|
|
|
|
|
handlePreview(file) {
|
|
|
|
|
console.log(file);
|
|
|
|
|
},
|
|
|
|
|
limitGifFileType(file) {
|
|
|
|
|
const imageType = ['image/gif', 'image/GIF']
|
|
|
|
|
let isVideo = imageType.includes(file.type)
|
|
|
|
|
// 检验文件格式
|
|
|
|
|
if (!isVideo) {
|
|
|
|
|
this.$message.error(`图片格式错误!`)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
// 校检文件大小
|
|
|
|
|
let fileSize = 5;
|
|
|
|
|
if (fileSize) {
|
|
|
|
|
let isLt = file.size / 1024 / 1024 < fileSize
|
|
|
|
|
if (!isLt) {
|
|
|
|
|
this.$message.error(`上传文件大小不能超过 ${fileSize} MB!`)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
limitImageFileType(file) {
|
|
|
|
|
const imageType = ['image/jpeg', 'image/jpg', 'image/png', 'image/svg']
|
|
|
|
|
let isVideo = imageType.includes(file.type)
|
|
|
|
|
@ -746,7 +770,6 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
limitVideFileType(file) {
|
|
|
|
|
const videoType = ['video/mp4','video/avi','video/mov','video/rmvb','video/rm','video/flv','video/3gp']
|
|
|
|
|
|