mirror of https://gitee.com/y_project/RuoYi.git
兼容IE浏览器对象不支持toBlob属性或方法问题
parent
b09955f369
commit
7d1b67a8b7
|
@ -214,11 +214,11 @@ $(window).load(function() {
|
|||
});
|
||||
|
||||
function submitHandler() {
|
||||
if(!croppable){
|
||||
if (!croppable) {
|
||||
$.modal.alertWarning("裁剪框加载中,请稍后...");
|
||||
return
|
||||
}
|
||||
cropper.getCroppedCanvas().toBlob(function(img){
|
||||
cropper.getCroppedCanvas().toBlob(function(img) {
|
||||
var formdata = new FormData();
|
||||
formdata.append("avatarfile", img);
|
||||
$.ajax({
|
||||
|
@ -234,9 +234,28 @@ function submitHandler() {
|
|||
});
|
||||
}
|
||||
|
||||
$(window).resize(function(){
|
||||
$('.imageBox').height($(window).height()-80);
|
||||
$(window).resize(function() {
|
||||
$('.imageBox').height($(window).height() - 80);
|
||||
}).resize();
|
||||
|
||||
if (!HTMLCanvasElement.prototype.toBlob) {
|
||||
Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', {
|
||||
value: function(callback, type, quality) {
|
||||
var canvas = this;
|
||||
setTimeout(function() {
|
||||
var binStr = atob(canvas.toDataURL(type, quality).split(',')[1]);
|
||||
var len = binStr.length;
|
||||
var arr = new Uint8Array(len);
|
||||
for (var i = 0; i < len; i++) {
|
||||
arr[i] = binStr.charCodeAt(i);
|
||||
}
|
||||
callback(new Blob([arr], {
|
||||
type: type || 'image/png'
|
||||
}));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue