From d830c151e4b245e8f8043590bfec2b38cb393c00 Mon Sep 17 00:00:00 2001 From: cdswyda Date: Wed, 10 Nov 2021 10:39:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E5=A4=84=E7=90=86=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 图片上传返回获取地址,不应将图片的协议、域名等信息可能不能写入数据中。 --- src/controllers/imageCtrl.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/controllers/imageCtrl.js b/src/controllers/imageCtrl.js index ce0df59..6fcb720 100644 --- a/src/controllers/imageCtrl.js +++ b/src/controllers/imageCtrl.js @@ -118,7 +118,8 @@ const imageCtrl = { modelHtml: function(id, imgItem) { let _this = this; - let src = imgItem.src; + let imgUrlHandle = Store.toJsonOptions && Store.toJsonOptions['imgUrlHandle']; + let src = typeof imgUrlHandle === 'function' ? imgUrlHandle(imgItem.src) : imgItem.src; let imgItemParam = _this.getImgItemParam(imgItem); let width = imgItemParam.width * Store.zoomRatio; @@ -391,9 +392,10 @@ const imageCtrl = { "top": top, "position": position }); - + let imgUrlHandle = Store.toJsonOptions && Store.toJsonOptions['imgUrlHandle']; + let imgUrl = typeof imgUrlHandle === 'function' ? imgUrlHandle(item.src) : item.src; $("#luckysheet-modal-dialog-activeImage .luckysheet-modal-dialog-content").css({ - "background-image": "url(" + item.src + ")", + "background-image": "url(" + imgUrl + ")", "background-size": item.default.width * Store.zoomRatio + "px " + item.default.height * Store.zoomRatio + "px", "background-position": -item.crop.offsetLeft * Store.zoomRatio + "px " + -item.crop.offsetTop * Store.zoomRatio + "px" })