|
@@ -14,6 +14,8 @@
|
|
|
:file-list="currentfileList"
|
|
|
:show-file-list="showList"
|
|
|
:limit="filleNumber"
|
|
|
+ :before-remove="beforeRemove"
|
|
|
+ :on-remove="handleRemove"
|
|
|
>
|
|
|
<div class="uploadBtn">
|
|
|
<img
|
|
@@ -92,7 +94,10 @@ export default {
|
|
|
created() {
|
|
|
this.currentfileList = this.fileList || [];
|
|
|
// this.showList = this.fileList ? true : false;
|
|
|
- if (this.type == "upload_control_preview_chs"||this.type=='upload_pdf_chs') {
|
|
|
+ if (
|
|
|
+ this.type == "upload_control_preview_chs" ||
|
|
|
+ this.type == "upload_pdf_chs"
|
|
|
+ ) {
|
|
|
this.showList = true;
|
|
|
} else {
|
|
|
this.showList = false;
|
|
@@ -127,23 +132,23 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
handlebeforeUplaod(file) {
|
|
|
- if(file.type.indexOf('image/') != -1 ){
|
|
|
- if (file.size > 2 * 1024 * 1024) {
|
|
|
- this.$message.warning('上传图片大小不能超过2M');
|
|
|
- return false //必须返回false
|
|
|
- }
|
|
|
- }else if(file.type.indexOf('application/pdf') != -1){
|
|
|
- if (file.size > 20 * 1024 * 1024) {
|
|
|
- this.$message.warning('上传pdf大小不能超过20M');
|
|
|
- return false //必须返回false
|
|
|
- }
|
|
|
- }else{
|
|
|
- if (file.size > 500 * 1024 * 1024) {
|
|
|
- this.$message.warning('上传文件大小不能超过500M');
|
|
|
- return false //必须返回false
|
|
|
- }
|
|
|
+ if (file.type.indexOf("image/") != -1) {
|
|
|
+ if (file.size > 2 * 1024 * 1024) {
|
|
|
+ this.$message.warning("上传图片大小不能超过2M");
|
|
|
+ return false; //必须返回false
|
|
|
}
|
|
|
-
|
|
|
+ } else if (file.type.indexOf("application/pdf") != -1) {
|
|
|
+ if (file.size > 20 * 1024 * 1024) {
|
|
|
+ this.$message.warning("上传pdf大小不能超过20M");
|
|
|
+ return false; //必须返回false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (file.size > 500 * 1024 * 1024) {
|
|
|
+ this.$message.warning("上传文件大小不能超过500M");
|
|
|
+ return false; //必须返回false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
this.loading = this.$loading({
|
|
|
lock: true,
|
|
|
text: "Loading",
|
|
@@ -151,14 +156,13 @@ export default {
|
|
|
background: "rgba(0, 0, 0, 0.7)",
|
|
|
});
|
|
|
},
|
|
|
- // handleRemove(file, fileList) {
|
|
|
- // this.changeFillId(fileList);
|
|
|
- // this.$message.success("移除成功");
|
|
|
- // },
|
|
|
- // handleRemove(file, fileList) {
|
|
|
- // this.changeFillId(fileList);
|
|
|
- // this.$message.success("移除成功");
|
|
|
- // },
|
|
|
+ handleRemove(file, fileList) {
|
|
|
+ this.changeFillId(fileList, "", this.index, this.index2);
|
|
|
+ this.$message.success("移除成功");
|
|
|
+ },
|
|
|
+ beforeRemove(file, fileList) {
|
|
|
+ return this.$confirm(`确定移除 ${file.name}?`);
|
|
|
+ },
|
|
|
beforeRemove(file, fileList) {
|
|
|
return this.$confirm(`确定移除 ${file.name}?`);
|
|
|
},
|