优化 图片加载

This commit is contained in:
YuanFeng 2024-09-11 22:23:28 +08:00
parent b2978d5acc
commit f4c0e96bcb
3 changed files with 13 additions and 9 deletions

View File

@ -69,6 +69,11 @@ public class FileTypeUtils {
response.setHeader("Content-Range", String.valueOf(content.length - 1));
response.setHeader("Accept-Ranges", "bytes");
}
if (contentType.startsWith("image/")) {
// 设置缓存
response.setHeader("Cache-Control", "max-age=604800");
response.setHeader("Pragma", "public");
}
// 输出附件
IoUtil.write(response.getOutputStream(), false, content);
}

View File

@ -198,7 +198,7 @@
</div>
<div
:class="{ 'hidden-div': false }">
:class="{ 'hidden-div': true }">
<DraftDesign ref="draftDesignEditRef"/>
</div>
</div>
@ -437,7 +437,7 @@ const loadConfig = (config: object, propData = {}) => {
setTimeout(()=>{
showPng();
},200)
},100)
}
const queryUseLabel = (label) => {
@ -498,17 +498,15 @@ const showPng = () => {
loading.value = true
setTimeout(() => {
draftDesignEditRef.value.toPngUrl((url) => {
console.log("url",url)
that.previewUrl = url
const info = draftDesignEditRef.value.getPropInfo();
that.propInfo = {
...info.propDefault,
...that.propInfo || {}
};
that.propOrderByList = info.propOrderByList;
setTimeout(() => {
submit();
}, 100)
submit();
loading.value = false;
}, {
widthScale: that.currentZoom,

View File

@ -14,7 +14,7 @@
:style="svgStyle"
>
<image
:href="this.cellInfo.style.shape.hrefBase64 || cellInfo.style.shape.href" x="0" y="0"
:href="this.hrefBase64 || cellInfo.style.shape.href" x="0" y="0"
style="width: 100%;height: 100%;"
:stroke="cellInfo.style.shape.strokeColor"
:stroke-width="cellInfo.style.shape.strokeWidth"
@ -259,9 +259,10 @@ export default defineComponent({
if(this.cellInfo.style.shape.href){
convertImageToBase64(this.cellInfo.style.shape.href).then((res)=>{
console.log("convertImageToBase64",this.cellInfo.style.shape.href,res)
// @ts-ignore
// this.hrefBase64 = res
this.cellInfo.style.shape.href = res
this.hrefBase64 = res
// this.cellInfo.style.shape.hrefBase64 = res
})
}
setTimeout(() => {