|
@@ -131,12 +131,11 @@
|
|
|
<el-input v-model="form.address" autocomplete="off" placeholder="请输入门牌号.."></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="相关资料:" :label-width="formLabelWidth" prop="" class="custom-align-right">
|
|
|
- <el-upload class="upload-demo" :action="uploadFileUrl" :headers="headers" :on-preview="handlePreview"
|
|
|
- :on-remove="handleRemove" :before-remove="beforeRemove" :on-success="handleUploadSuccess" multiple
|
|
|
- :limit="30" :on-exceed="handleExceed" :file-list="otherList" list-type="picture"
|
|
|
- :before-upload="beforeAvatarUpload">
|
|
|
+ <el-upload class="upload-demo" :action="uploadFileUrl" :headers="headers" accept=".jpg, .jpeg, .png, .pdf"
|
|
|
+ :before-remove="beforeRemove" :on-success="handleUploadSuccess" multiple :limit="30"
|
|
|
+ :on-exceed="handleExceed" :file-list="otherList" list-type="picture" :before-upload="beforeAvatarUpload1">
|
|
|
<el-button size="small" type="primary">点击上传</el-button>
|
|
|
- <div slot="tip" class="el-upload__tip">每张图片最大1MB,最多上传30张图片。</div>
|
|
|
+ <div slot="tip" class="el-upload__tip">每张图片最大2MB,最多上传30张图片。</div>
|
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="提示词:" :label-width="formLabelWidth" prop="" class="custom-align-right">
|
|
@@ -432,7 +431,7 @@ export default {
|
|
|
const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
|
|
|
if (!isJPG && !isPNG) {
|
|
|
- this.$message.error('上传头像图片只能是 JPG 或 PNG 格��!');
|
|
|
+ this.$message.error('上传头像图片只能是 JPG 或 PNG 格式!');
|
|
|
return false;
|
|
|
}
|
|
|
if (!isLt2M) {
|
|
@@ -462,17 +461,15 @@ export default {
|
|
|
this.photoUrl = ''; // 清空图片 URL
|
|
|
},
|
|
|
//2.3 多文件上传
|
|
|
- handleRemove(file, fileList) {
|
|
|
- console.log(file, fileList);
|
|
|
- },
|
|
|
- handlePreview(file) {
|
|
|
- console.log(file);
|
|
|
- },
|
|
|
handleExceed(files, fileList) {
|
|
|
this.$message.warning(`当前限制选择 30 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
|
|
|
},
|
|
|
beforeRemove(file, fileList) {
|
|
|
- return this.$confirm(`确定移除 ${file.name}?`);
|
|
|
+ console.log('file, fileList',file, fileList);
|
|
|
+ for(let item of fileList){
|
|
|
+ this.form.other = this.form.other.filter(item => item !== file.url);
|
|
|
+ }
|
|
|
+ return this.$confirm(`确定移除 ${file.name}?`);
|
|
|
},
|
|
|
//获取token
|
|
|
getTokenFromCookie() {
|
|
@@ -500,17 +497,11 @@ export default {
|
|
|
console.log(this.form.other);
|
|
|
},
|
|
|
//只能上传图片
|
|
|
- beforeAvatarUpload(file) {
|
|
|
- const isJPG = file.type === 'image/jpeg';
|
|
|
- const isPNG = file.type === 'image/png';
|
|
|
- const isLt1M = file.size / 1024 / 1024 < 1;
|
|
|
+ beforeAvatarUpload1(file) {
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
|
|
|
- if (!isJPG && !isPNG) {
|
|
|
- this.$message.error('上传图片只能是 JPG 或 PNG 格式!');
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (!isLt1M) {
|
|
|
- this.$message.error('上传图片大小不能超过 1MB!');
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error('上传图片大小不能超过 2MB!');
|
|
|
return false;
|
|
|
}
|
|
|
},
|