From 8b2c71c7a7bcbb03c2c80c0a3f7d72bfcb737e0b Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 24 Jan 2024 14:40:50 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=85=A8=E5=B1=8F=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E8=A7=86=E5=9B=BE=E5=83=8F=E7=B4=A0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas/components/editor/CanvasOptBar.vue | 2 +- .../canvas/components/editor/Preview.vue | 83 ++++++++++++++++--- .../canvas/customComponent/UserViewDialog.vue | 1 - .../src/components/canvas/utils/utils.js | 7 ++ 4 files changed, 80 insertions(+), 13 deletions(-) diff --git a/core/frontend/src/components/canvas/components/editor/CanvasOptBar.vue b/core/frontend/src/components/canvas/components/editor/CanvasOptBar.vue index d81fb40174..2eff60e48f 100644 --- a/core/frontend/src/components/canvas/components/editor/CanvasOptBar.vue +++ b/core/frontend/src/components/canvas/components/editor/CanvasOptBar.vue @@ -106,7 +106,7 @@ export default { }, computed: { isPcTerminal() { - return this.terminal === 'PC' + return this.terminal === 'pc' }, functionClass() { let result = 'function-light' diff --git a/core/frontend/src/components/canvas/components/editor/Preview.vue b/core/frontend/src/components/canvas/components/editor/Preview.vue index 1cbca01509..073ec965e9 100644 --- a/core/frontend/src/components/canvas/components/editor/Preview.vue +++ b/core/frontend/src/components/canvas/components/editor/Preview.vue @@ -116,15 +116,39 @@ v-if="chartDetailsVisible" style="position: absolute;right: 70px;top:15px" > - - {{ $t('chart.export_img') }} - + + + 导出分辨率 + + + + + + + + {{ $t('chart.export_img') }} + + + { + this.$refs['userViewDialog-canvas-main'].exportViewImg(this.pixel, () => { this.imageDownloading = false }) }, diff --git a/core/frontend/src/components/canvas/customComponent/UserViewDialog.vue b/core/frontend/src/components/canvas/customComponent/UserViewDialog.vue index abde76c736..8439019ce9 100644 --- a/core/frontend/src/components/canvas/customComponent/UserViewDialog.vue +++ b/core/frontend/src/components/canvas/customComponent/UserViewDialog.vue @@ -5,7 +5,6 @@ > { const dom = document.body.appendChild(canvas) dom.style.display = 'none' @@ -238,8 +243,10 @@ export function exportImg(imgName, callback) { a.click() URL.revokeObjectURL(blob) document.body.removeChild(a) + window.devicePixelRatio = originalDPR callback() }).catch(() => { + window.devicePixelRatio = originalDPR callback() }) }