|
|
@@ -5867,8 +5867,35 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ compress(img, width, height, ratio) {
|
|
|
+ var canvas, ctx, img64;
|
|
|
+ canvas = document.createElement('canvas');
|
|
|
+ canvas.width = width;
|
|
|
+ canvas.height = height;
|
|
|
+ ctx = canvas.getContext("2d");
|
|
|
+ ctx.drawImage(img, 0, 0, width, height);
|
|
|
+ img64 = canvas.toDataURL("image/jpeg", ratio);
|
|
|
+ return img64;
|
|
|
+ },
|
|
|
+ base64ToFile(base64, fileName) {
|
|
|
+ let data = base64.split(',');
|
|
|
+ let type = data[0].match(/:(.*?);/)[1];
|
|
|
+ // let suffix = type.split('/')[1];
|
|
|
+ const bstr = window.atob(data[1]);
|
|
|
+ let n = bstr.length
|
|
|
+ const u8arr = new Uint8Array(n)
|
|
|
+ while (n--) {
|
|
|
+ u8arr[n] = bstr.charCodeAt(n)
|
|
|
+ }
|
|
|
+ // const file = new File([u8arr], `${fileName}.${suffix}`, {
|
|
|
+ const file = new File([u8arr], `${fileName}`, {
|
|
|
+ type: type
|
|
|
+ })
|
|
|
+ return file;
|
|
|
+ },
|
|
|
carfrontChange(file) {
|
|
|
//选择行驶证正面
|
|
|
+ let that =this
|
|
|
let size=file.size / 1024 / 1024 < 5;
|
|
|
const isJPG = file.raw.type === 'image/jpeg'||file.raw.type === 'image/png';
|
|
|
if(!size){
|
|
|
@@ -5879,6 +5906,40 @@ export default {
|
|
|
this.$message.error('上传头像图片只能是 JPG、PNG 格式!')
|
|
|
return false
|
|
|
}
|
|
|
+// let name=file.raw.name
|
|
|
+// var image = new Image();
|
|
|
+// image.src = window.URL.createObjectURL(file.raw);
|
|
|
+// that.carfrontImg = image.src
|
|
|
+// image.onload = function(){
|
|
|
+// let aaa= that.base64ToFile(that.compress(image, 500, 400, 0.7),name)
|
|
|
+ // var file = file.raw;
|
|
|
+ // let files = window.URL.createObjectURL(file); //转临时路径
|
|
|
+ // that.carfrontImg = image.src;
|
|
|
+ // const params = new FormData(); // 声明formData数据类型
|
|
|
+ // params.append("multipartFile", aaa);
|
|
|
+ // params.append("type", "image");
|
|
|
+
|
|
|
+ // that.$api.letter.uploadFile(params).then(res => {
|
|
|
+ // if (res.code == "200") {
|
|
|
+ // that.CarFrontFile = aaa;//文件流
|
|
|
+
|
|
|
+ // if (that.imageList1.some(v => v.imageType == 'C01')) {
|
|
|
+ // that.imageList1.map(val => {
|
|
|
+ // if (val.imageType == 'C01') {
|
|
|
+ // val.imageId = res.data.id;
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // that.imageList1.push({
|
|
|
+ // imageId: res.data.id,
|
|
|
+ // imageType: "C01",
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // that.$message({ message: res.msg, type: "warning" });
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
var file = file.raw;
|
|
|
let files = window.URL.createObjectURL(file); //转临时路径
|
|
|
this.carfrontImg = files;
|
|
|
@@ -5904,7 +5965,6 @@ export default {
|
|
|
this.$message({ message: res.msg, type: "warning" });
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
},
|
|
|
carbackChange(file) {
|
|
|
let size=file.size / 1024 / 1024 < 5;
|
|
|
@@ -6348,8 +6408,9 @@ export default {
|
|
|
//影像上传
|
|
|
uploadinformation() {
|
|
|
// //上传图片
|
|
|
+ const mergedArray = [...this.imageList1, ...this.imageList2, ...this.imageList3, ...this.imageList4];
|
|
|
let imageparam = {
|
|
|
- imageList: mergedArray,
|
|
|
+ imageList: mergedArray,
|
|
|
quoteNo: this.quoteno
|
|
|
}
|
|
|
this.$api.letter.uploadImages(imageparam).then(responses => {
|