zhanbo.xu

feat: 修改file逻辑

......@@ -842,7 +842,6 @@
<script>
import {
addCustomerData,
uploadCertificate,
uploadQingdaoCertificate,
updateCustomerData,
delCertificate,
......@@ -1151,7 +1150,8 @@ export default {
reader.onload = (e) => {
console.log(e);
let obj = {
file: e.target.result,
// file: e.target.result,
file: this.extractBase64(e.target.result),
name: file.name,
};
this.formData.file = obj;
......@@ -1311,15 +1311,15 @@ export default {
addCustomerData(val)
.then((res) => {
if (res.code === "200") {
if (this.formData.file) {
this.uploadCertificate(
val.ecomEntCode,
this.base64ConvertFile(
this.formData.file.file,
this.formData.file.name
)
);
}
// if (this.formData.file) {
// this.uploadCertificate(
// val.ecomEntCode,
// this.base64ConvertFile(
// this.formData.file.file,
// this.formData.file.name
// )
// );
// }
if (this.formData.qingdaoFile) {
this.uploadQingdaoCertificate(
val.ecomEntCode,
......@@ -1341,22 +1341,22 @@ export default {
this.loadings.dialogLoading = false;
});
},
uploadCertificate(ecomEntCode, file) {
uploadCertificate(ecomEntCode, file)
.then((uploadRes) => {
if (uploadRes.code === "200") {
// this.msgSuccess("客户添加和证书上传成功!");
this.close(true);
} else {
this.alertWarningMsg(uploadRes.message);
}
this.loadings.dialogLoading = false;
})
.catch((err) => {
console.log(err);
this.loadings.dialogLoading = false;
});
},
// uploadCertificate(ecomEntCode, file) {
// uploadCertificate(ecomEntCode, file)
// .then((uploadRes) => {
// if (uploadRes.code === "200") {
// // this.msgSuccess("客户添加和证书上传成功!");
// this.close(true);
// } else {
// this.alertWarningMsg(uploadRes.message);
// }
// this.loadings.dialogLoading = false;
// })
// .catch((err) => {
// console.log(err);
// this.loadings.dialogLoading = false;
// });
// },
uploadQingdaoCertificate(ecomEntCode, file) {
uploadQingdaoCertificate(ecomEntCode, file)
......@@ -1379,15 +1379,15 @@ export default {
updateCustomerData(val)
.then((res) => {
if (res.code === "200") {
if (this.formData.file) {
this.uploadCertificate(
val.ecomEntCode,
this.base64ConvertFile(
this.formData.file.file,
this.formData.file.name
)
);
}
// if (this.formData.file) {
// this.uploadCertificate(
// val.ecomEntCode,
// this.base64ConvertFile(
// this.formData.file.file,
// this.formData.file.name
// )
// );
// }
if (this.formData.qingdaoFile) {
this.uploadQingdaoCertificate(
val.ecomEntCode,
......