From 97ef183e3679e72b81bebad26b79f7de8639640d Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 25 Aug 2022 14:19:48 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=88=86=E7=A6=BB?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E7=8A=B6=E6=80=81=E4=B8=8B=EF=BC=8C=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E5=8A=A0=E8=BD=BD=E4=BB=AA=E8=A1=A8=E6=9D=BF=E8=83=8C?= =?UTF-8?q?=E6=99=AF=E5=9B=BE=E7=89=87=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/DeDrag/index.vue | 3 ++- .../canvas/components/Editor/ComponentWrapper.vue | 5 +++-- .../src/components/canvas/components/Editor/Preview.vue | 4 ++-- .../canvas/components/Editor/PreviewMobile.vue | 4 ++-- .../src/components/canvas/components/Editor/index.vue | 4 ++-- .../canvas/custom-component/UserViewDialog.vue | 8 ++++---- .../canvas/custom-component/UserViewMobileDialog.vue | 8 ++++---- frontend/src/components/canvas/utils/utils.js | 9 +++++++++ frontend/src/views/background/BackgroundItem.vue | 3 ++- frontend/src/views/panel/LinkJumpSet/index.vue | 3 ++- .../SubjectSetting/PreSubject/SubjectTemplateItem.vue | 3 ++- .../PreSubject/SubjectTemplateItemback.vue | 3 ++- .../PreSubjectHistory/SubjectTemplateItem.vue | 3 ++- .../PreSubjectHistory/SubjectTemplateItemback.vue | 3 ++- frontend/src/views/panel/edit/ComponentWaitItem.vue | 3 ++- frontend/src/views/panel/edit/index.vue | 6 +++--- frontend/src/views/panel/list/EditPanel/index.vue | 4 ++-- .../views/panel/template/component/TemplateImport.vue | 5 +++-- .../templateMarket/component/TemplateMarketItem.vue | 4 +++- .../component/TemplateMarketPreviewItem.vue | 4 +++- 20 files changed, 56 insertions(+), 33 deletions(-) diff --git a/frontend/src/components/DeDrag/index.vue b/frontend/src/components/DeDrag/index.vue index 4641aae1be..d232e01bf5 100644 --- a/frontend/src/components/DeDrag/index.vue +++ b/frontend/src/components/DeDrag/index.vue @@ -81,6 +81,7 @@ import { mapState } from 'vuex' import EditBar from '@/components/canvas/components/Editor/EditBar' import MobileCheckBar from '@/components/canvas/components/Editor/MobileCheckBar' import { hexColorToRGBA } from '@/views/chart/chart/util' +import {imgUrlTrans} from "@/components/canvas/utils/utils"; export default { replace: true, @@ -594,7 +595,7 @@ export default { style['border-radius'] = (this.element.commonBackground.borderRadius || 0) + 'px' if (this.element.commonBackground.enable) { if (this.element.commonBackground.backgroundType === 'outerImage' && typeof this.element.commonBackground.outerImage === 'string') { - style['background'] = `url(${this.element.commonBackground.outerImage}) no-repeat ${colorRGBA}` + style['background'] = `url(${imgUrlTrans(this.element.commonBackground.outerImage)}) no-repeat ${colorRGBA}` } else { style['background-color'] = colorRGBA } diff --git a/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue b/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue index c688aa6fbc..92dca2fb45 100644 --- a/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue +++ b/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue @@ -58,6 +58,7 @@ import EditBar from '@/components/canvas/components/Editor/EditBar' import MobileCheckBar from '@/components/canvas/components/Editor/MobileCheckBar' import CloseBar from '@/components/canvas/components/Editor/CloseBar' import { hexColorToRGBA } from '@/views/chart/chart/util' +import {imgUrlTrans} from "@/components/canvas/utils/utils"; export default { components: { CloseBar, MobileCheckBar, DeOutWidget, EditBar }, @@ -155,9 +156,9 @@ export default { if (this.config.commonBackground.enable) { if (this.screenShot && this.config.commonBackground.backgroundType === 'innerImage' && typeof this.config.commonBackground.innerImage === 'string') { let innerImage = this.config.commonBackground.innerImage.replace('svg', 'png') - style['background'] = `url(${innerImage}) no-repeat ${colorRGBA}` + style['background'] = `url(${imgUrlTrans(innerImage)}) no-repeat ${colorRGBA}` } else if (this.config.commonBackground.backgroundType === 'outerImage' && typeof this.config.commonBackground.outerImage === 'string') { - style['background'] = `url(${this.config.commonBackground.outerImage}) no-repeat ${colorRGBA}` + style['background'] = `url(${imgUrlTrans(this.config.commonBackground.outerImage)}) no-repeat ${colorRGBA}` } else { style['background-color'] = colorRGBA } diff --git a/frontend/src/components/canvas/components/Editor/Preview.vue b/frontend/src/components/canvas/components/Editor/Preview.vue index 22442e71fd..cf2618a374 100644 --- a/frontend/src/components/canvas/components/Editor/Preview.vue +++ b/frontend/src/components/canvas/components/Editor/Preview.vue @@ -75,7 +75,7 @@ import { mapState } from 'vuex' import ComponentWrapper from './ComponentWrapper' import { changeStyleWithScale } from '@/components/canvas/utils/translate' import { uuid } from 'vue-uuid' -import { deepCopy } from '@/components/canvas/utils/utils' +import {deepCopy, imgUrlTrans} from '@/components/canvas/utils/utils' import eventBus from '@/components/canvas/utils/eventBus' import elementResizeDetectorMaker from 'element-resize-detector' import UserViewDialog from '@/components/canvas/custom-component/UserViewDialog' @@ -231,7 +231,7 @@ export default { if (this.canvasStyleData.openCommonStyle) { if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) { style = { - background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`, + background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`, ...style } } else if (this.canvasStyleData.panel.backgroundType === 'color') { diff --git a/frontend/src/components/canvas/components/Editor/PreviewMobile.vue b/frontend/src/components/canvas/components/Editor/PreviewMobile.vue index 2445d21888..cbdab932ea 100644 --- a/frontend/src/components/canvas/components/Editor/PreviewMobile.vue +++ b/frontend/src/components/canvas/components/Editor/PreviewMobile.vue @@ -46,7 +46,7 @@ import { mapState } from 'vuex' import ComponentWrapper from './ComponentWrapper' import { changeStyleWithScale } from '@/components/canvas/utils/translate' import { uuid } from 'vue-uuid' -import { deepCopy } from '@/components/canvas/utils/utils' +import {deepCopy, imgUrlTrans} from '@/components/canvas/utils/utils' import eventBus from '@/components/canvas/utils/eventBus' import elementResizeDetectorMaker from 'element-resize-detector' import UserViewDialog from '@/components/canvas/custom-component/UserViewDialog' @@ -113,7 +113,7 @@ export default { if (this.canvasStyleData.openCommonStyle) { if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) { style = { - background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`, + background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`, ...style } } else if (this.canvasStyleData.panel.backgroundType === 'color') { diff --git a/frontend/src/components/canvas/components/Editor/index.vue b/frontend/src/components/canvas/components/Editor/index.vue index f66c8c01d0..189782501b 100644 --- a/frontend/src/components/canvas/components/Editor/index.vue +++ b/frontend/src/components/canvas/components/Editor/index.vue @@ -189,7 +189,7 @@ import DeDrag from '@/components/DeDrag' // eslint-disable-next-line no-unused-vars import { getStyle, getComponentRotatedStyle } from '@/components/canvas/utils/style' -import { _$ } from '@/components/canvas/utils/utils' +import {_$, imgUrlTrans} from '@/components/canvas/utils/utils' import ContextMenu from './ContextMenu' import MarkLine from './MarkLine' import Area from './Area' @@ -968,7 +968,7 @@ export default { if (this.canvasStyleData.openCommonStyle) { if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) { style = { - background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`, + background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`, ...style } } else if (this.canvasStyleData.panel.backgroundType === 'color') { diff --git a/frontend/src/components/canvas/custom-component/UserViewDialog.vue b/frontend/src/components/canvas/custom-component/UserViewDialog.vue index 1e7684384c..c0ea007e19 100644 --- a/frontend/src/components/canvas/custom-component/UserViewDialog.vue +++ b/frontend/src/components/canvas/custom-component/UserViewDialog.vue @@ -42,7 +42,7 @@ import LabelNormalText from '@/views/chart/components/normal/LabelNormalText' import { exportDetails, innerExportDetails } from '@/api/panel/panel' import html2canvas from 'html2canvasde' import { hexColorToRGBA } from '@/views/chart/chart/util' -import { deepCopy, exportImg } from '@/components/canvas/utils/utils' +import {deepCopy, exportImg, imgUrlTrans} from '@/components/canvas/utils/utils' import { getLinkToken, getToken } from '@/utils/auth' export default { name: 'UserViewDialog', @@ -84,7 +84,7 @@ export default { if (this.canvasStyleData.openCommonStyle) { if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) { style = { - background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`, + background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`, ...style } } else if (this.canvasStyleData.panel.backgroundType === 'color') { @@ -125,9 +125,9 @@ export default { if (this.element.commonBackground.enable) { if (this.screenShot && this.element.commonBackground.backgroundType === 'innerImage' && typeof this.element.commonBackground.innerImage === 'string') { let innerImage = this.element.commonBackground.innerImage.replace('svg', 'png') - style['background'] = `url(${innerImage}) no-repeat ${colorRGBA}` + style['background'] = `url(${imgUrlTrans(innerImage)}) no-repeat ${colorRGBA}` } else if (this.element.commonBackground.backgroundType === 'outerImage' && typeof this.element.commonBackground.outerImage === 'string') { - style['background'] = `url(${this.element.commonBackground.outerImage}) no-repeat ${colorRGBA}` + style['background'] = `url(${imgUrlTrans(this.element.commonBackground.outerImage)}) no-repeat ${colorRGBA}` } else { style['background-color'] = colorRGBA } diff --git a/frontend/src/components/canvas/custom-component/UserViewMobileDialog.vue b/frontend/src/components/canvas/custom-component/UserViewMobileDialog.vue index dbb8466bd5..5c2f5cdc84 100644 --- a/frontend/src/components/canvas/custom-component/UserViewMobileDialog.vue +++ b/frontend/src/components/canvas/custom-component/UserViewMobileDialog.vue @@ -34,7 +34,7 @@ import DeContainer from '@/components/dataease/DeContainer' import LabelNormalText from '@/views/chart/components/normal/LabelNormalText' import ChartComponentS2 from '@/views/chart/components/ChartComponentS2' import PluginCom from '@/views/system/plugin/PluginCom' -import { deepCopy } from '@/components/canvas/utils/utils' +import {deepCopy, imgUrlTrans} from '@/components/canvas/utils/utils' import {hexColorToRGBA} from "@/views/chart/chart/util"; export default { name: 'UserViewMobileDialog', @@ -66,7 +66,7 @@ export default { if (this.canvasStyleData.openCommonStyle) { if (this.canvasStyleData.panel.backgroundType === 'image' && this.canvasStyleData.panel.imageUrl) { style = { - background: `url(${this.canvasStyleData.panel.imageUrl}) no-repeat`, + background: `url(${imgUrlTrans(this.canvasStyleData.panel.imageUrl)}) no-repeat`, ...style } } else if (this.canvasStyleData.panel.backgroundType === 'color') { @@ -107,9 +107,9 @@ export default { if (this.element.commonBackground.enable) { if (this.screenShot && this.element.commonBackground.backgroundType === 'innerImage' && typeof this.element.commonBackground.innerImage === 'string') { let innerImage = this.element.commonBackground.innerImage.replace('svg', 'png') - style['background'] = `url(${innerImage}) no-repeat ${colorRGBA}` + style['background'] = `url(${imgUrlTrans(innerImage)}) no-repeat ${colorRGBA}` } else if (this.element.commonBackground.backgroundType === 'outerImage' && typeof this.element.commonBackground.outerImage === 'string') { - style['background'] = `url(${this.element.commonBackground.outerImage}) no-repeat ${colorRGBA}` + style['background'] = `url(${imgUrlTrans(this.element.commonBackground.outerImage)}) no-repeat ${colorRGBA}` } else { style['background-color'] = colorRGBA } diff --git a/frontend/src/components/canvas/utils/utils.js b/frontend/src/components/canvas/utils/utils.js index aa539fd6ed..6a1438a768 100644 --- a/frontend/src/components/canvas/utils/utils.js +++ b/frontend/src/components/canvas/utils/utils.js @@ -216,3 +216,12 @@ export function colorReverse(OldColorValue) { const str = '000000' + (0xFFFFFF - OldColorValue).toString(16) return '#' + str.substring(str.length - 6, str.length) } + +export function imgUrlTrans(url) { + if(url && url.indexOf('static-resource') > -1){ + return process.env.VUE_APP_BASE_API + url.replace('/static-resource','static-resource') + }else { + return url + } + +} diff --git a/frontend/src/views/background/BackgroundItem.vue b/frontend/src/views/background/BackgroundItem.vue index b90b658aab..7a71c59462 100644 --- a/frontend/src/views/background/BackgroundItem.vue +++ b/frontend/src/views/background/BackgroundItem.vue @@ -17,6 +17,7 @@