//url.split(',')[1] 为base64图片
let bytes = window.atob(url.split(',')[1]); //通过atob将base64进行编码
var buffer = new ArrayBuffer(bytes.length);
var uint = new Uint8Array(buffer); //生成一个8位数的数组
for (var i = 0; i < bytes.length; i++) {
uint[i] = bytes.charCodeAt(i); //根据长度返回相对应的Unicode 编码
}
//Blob对象
var imageFile = new Blob([buffer], { type: 'image/jpeg' }); //type为图片的格式
const fd = new FormData();
fd.append('file', imageFile, 'DX.jpg');