|
@@ -69,6 +69,7 @@
|
|
|
:on-preview="handlePictureCardPreview"
|
|
|
:on-remove="beforeRemove"
|
|
|
:on-change="dealImgChange"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
multiple
|
|
|
:limit="1"
|
|
|
:on-exceed="handleExceed"
|
|
@@ -253,6 +254,7 @@
|
|
|
:http-request="fsfzzRequest"
|
|
|
:on-preview="fsfzzPictureCardPreview"
|
|
|
:on-remove="fsfzzRemove"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
multiple
|
|
|
:limit="1"
|
|
|
:on-exceed="fsfzzExceed"
|
|
@@ -287,6 +289,7 @@
|
|
|
:http-request="fsfzfRequest"
|
|
|
:on-preview="fsfzfPictureCardPreview"
|
|
|
:on-remove="fsfzfRemove"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
multiple
|
|
|
:limit="1"
|
|
|
:on-exceed="fsfzfExceed"
|
|
@@ -362,6 +365,7 @@
|
|
|
:http-request="jsfzzRequest"
|
|
|
:on-preview="jsfzzPictureCardPreview"
|
|
|
:on-remove="jsfzzRemove"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
multiple
|
|
|
:limit="1"
|
|
|
:on-exceed="jsfzzExceed"
|
|
@@ -396,6 +400,7 @@
|
|
|
:http-request="jsfzfRequest"
|
|
|
:on-preview="jsfzfPictureCardPreview"
|
|
|
:on-remove="jsfzfRemove"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
multiple
|
|
|
:limit="1"
|
|
|
:on-exceed="jsfzfExceed"
|
|
@@ -523,6 +528,7 @@
|
|
|
:http-request="frsqsRequest"
|
|
|
:on-preview="frsqsPictureCardPreview"
|
|
|
:on-remove="frsqsRemove"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
multiple
|
|
|
:limit="1"
|
|
|
:on-exceed="frsqsExceed"
|
|
@@ -561,6 +567,7 @@
|
|
|
:http-request="szzssqRequest"
|
|
|
:on-preview="szzssqPictureCardPreview"
|
|
|
:on-remove="szzssqRemove"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
multiple
|
|
|
:limit="1"
|
|
|
:on-exceed="szzssqExceed"
|
|
@@ -597,6 +604,7 @@
|
|
|
:http-request="qtfjRequest"
|
|
|
:on-preview="qtfjPictureCardPreview"
|
|
|
:on-remove="qtfjRemove"
|
|
|
+ :before-upload="beforeAvatarUpload"
|
|
|
multiple
|
|
|
:limit="1"
|
|
|
:on-exceed="qtfjExceed"
|
|
@@ -1365,19 +1373,23 @@ export default {
|
|
|
qtfjUpload() {
|
|
|
this.$refs.qtfjload.submit();
|
|
|
},
|
|
|
+ //上传前校验
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ const isJPG = file.type === 'image/jpeg' || file.type === 'image/png';
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
+
|
|
|
+ if (!isJPG) {
|
|
|
+ this.$message.error('上传图片只能是 JPG/PNG 格式');
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error('上传图片大小不能超过 2MB');
|
|
|
+ }
|
|
|
+ return isJPG && isLt2M;
|
|
|
+ },
|
|
|
|
|
|
//营业执照上传
|
|
|
yyzzRequest(param) {
|
|
|
let fileObj = param.file; // 相当于input里取得的files
|
|
|
- const isLt2M = fileObj.size / 1024 / 1024 < 2;
|
|
|
- if (!isLt2M) {
|
|
|
- this.$message.error("上传图片大小不能超过 2MB!");
|
|
|
- loading.close();
|
|
|
- }
|
|
|
- const isJPG = fileObj.type === "image/jpeg";
|
|
|
- if (!isJPG) {
|
|
|
- this.$message.error("上传头像图片只能是 JPG 格式!");
|
|
|
- }
|
|
|
let fd = new FormData(); // FormData 对象
|
|
|
fd.append("file", fileObj); // 文件对象
|
|
|
const loading = this.$loading({
|
|
@@ -1421,11 +1433,6 @@ export default {
|
|
|
//法人身份证正面ocr识别
|
|
|
fsfzzRequest(param) {
|
|
|
let fileObj = param.file; // 相当于input里取得的files
|
|
|
- const isLt2M = fileObj.size / 1024 / 1024 < 2;
|
|
|
- if (!isLt2M) {
|
|
|
- this.$message.error("上传图片大小不能超过 2MB!");
|
|
|
- loading.close();
|
|
|
- }
|
|
|
let fd = new FormData(); // FormData 对象
|
|
|
fd.append("file", fileObj); // 文件对象
|
|
|
fd.append("fileType", "00"); // 文件类型
|
|
@@ -1477,11 +1484,6 @@ export default {
|
|
|
//经办人身份证正面
|
|
|
jsfzzRequest(param) {
|
|
|
let fileObj = param.file; // 相当于input里取得的files
|
|
|
- const isLt2M = fileObj.size / 1024 / 1024 < 2;
|
|
|
- if (!isLt2M) {
|
|
|
- this.$message.error("上传图片大小不能超过 2MB!");
|
|
|
- loading.close();
|
|
|
- }
|
|
|
let fd = new FormData(); // FormData 对象
|
|
|
fd.append("file", fileObj); // 文件对象
|
|
|
fd.append("fileType", "01"); // 文件类型
|