上传前显示效果

$('#img_purchase').on('click',function(){
$('#purchase').click();
});
$('#img_sale').on('click',function(){
$('#sale').click();
});
function getBase64 (file,Callback) {
let reader = new FileReader()
let imgResult = ''
reader.readAsDataURL(file)
reader.onload = function () {
imgResult = reader.result
}
reader.onerror = function (error) {
Callback(error)
}
reader.onloadend = function () {
Callback(imgResult)
}
};
$(document).on('change', '#purchase', function () {
var filePath = $(this).val()
console.log(filePath);
var arr_prepath=this.files;
console.log(arr_prepath);
for (var i=0;i'+
''+
'![]()'+
'
',$('.purchase_top').firstChild);
})
}
});