From fe63b85f09a3a3639c05e83110d830da9fd59911 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 21 Feb 2022 17:58:33 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=E8=A7=86=E5=9B=BE=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/canvas/components/Toolbar.vue | 3 +- .../canvas/custom-component/UserView.vue | 138 +++++++----- frontend/src/views/chart/chart/chart.js | 8 + .../src/views/chart/chart/common/common.js | 2 +- .../views/chart/chart/common/common_antv.js | 2 +- .../views/chart/components/ChartComponent.vue | 2 +- .../chart/components/ChartComponentG2.vue | 2 +- .../chart/components/ChartComponentS2.vue | 18 +- .../BackgroundColorSelector.vue | 196 +++++++++++++++--- .../chart/components/normal/LabelNormal.vue | 2 +- .../chart/components/table/TableNormal.vue | 4 +- frontend/src/views/chart/view/ChartEdit.vue | 33 ++- 12 files changed, 296 insertions(+), 114 deletions(-) diff --git a/frontend/src/components/canvas/components/Toolbar.vue b/frontend/src/components/canvas/components/Toolbar.vue index a7663d7af6..da033cd36a 100644 --- a/frontend/src/components/canvas/components/Toolbar.vue +++ b/frontend/src/components/canvas/components/Toolbar.vue @@ -126,7 +126,8 @@ export default { 'targetLinkageInfo', 'mobileLayoutStatus', 'mobileComponentData', - 'componentDataCache' + 'componentDataCache', + 'styleChangeTimes' ]) }, created() { diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index a17634a791..69f5a4ee7c 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -8,62 +8,64 @@ 'rect-shape' ]" > - -
-
- {{ message }},{{ $t('chart.chart_show_error') }} -
- {{ $t('chart.chart_error_tips') }} +
+ +
+
+ {{ message }},{{ $t('chart.chart_show_error') }} +
+ {{ $t('chart.chart_error_tips') }} +
+
+ + + + + + +
+
-
- - - - - - -
-
@@ -90,6 +92,7 @@ import EditBarView from '@/components/canvas/components/Editor/EditBarView' import { customAttrTrans, customStyleTrans, recursionTransObj } from '@/components/canvas/utils/style' import ChartComponentS2 from '@/views/chart/components/ChartComponentS2' import PluginCom from '@/views/system/plugin/PluginCom' +import { hexColorToRGBA } from '@/views/chart/chart/util' export default { name: 'UserView', components: { PluginCom, ChartComponentS2, EditBarView, ChartComponent, TableNormal, LabelNormal, DrillPath, ChartComponentG2 }, @@ -168,6 +171,31 @@ export default { this.bindPluginEvent() }, computed: { + // 视图 + componentBackGround() { + const customStyle = JSON.parse(this.chart.customStyle) + let style = { + height: '100%', + width: '100%', + backgroundSize: '100% 100% !important', + borderRadius: '0px' + } + if (customStyle && customStyle.background) { + style.borderRadius = customStyle.background.borderRadius + 'px!important' + if (customStyle.background.backgroundType === 'outImage' && typeof (customStyle.background.outImage) === 'string') { + style = { + background: `url(${customStyle.background.outImage}) no-repeat`, + ...style + } + } else if (!customStyle.background.backgroundType || customStyle.background.backgroundType === 'color') { + style = { + background: hexColorToRGBA(customStyle.background.color, customStyle.background.alpha), + ...style + } + } + } + return style + }, scaleCoefficient() { if (this.terminal === 'pc' && !this.mobileLayoutStatus) { return 1.1 diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index df770bd6e8..179f42bcc7 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -1,3 +1,8 @@ +import {ApplicationContext} from "@/utils/ApplicationContext"; +import {BASE_MOBILE_STYLE, HYPERLINKS} from "@/components/canvas/custom-component/component-list"; +import store from "@/store"; +import {deepCopy, resetID} from "@/components/canvas/utils/utils"; + export const DEFAULT_COLOR_CASE = { value: 'default', colors: ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'], @@ -192,7 +197,10 @@ export const DEFAULT_YAXIS_EXT_STYLE = { } } export const DEFAULT_BACKGROUND_COLOR = { + backgroundType: 'color', color: '#ffffff', + outImage: null, + innerImage: null, alpha: 100, borderRadius: 5 } diff --git a/frontend/src/views/chart/chart/common/common.js b/frontend/src/views/chart/chart/common/common.js index 3945d4f4bf..34445d128d 100644 --- a/frontend/src/views/chart/chart/common/common.js +++ b/frontend/src/views/chart/chart/common/common.js @@ -174,7 +174,7 @@ export function componentStyle(chart_option, chart) { chart_option.radar.splitArea = customStyle.split.splitArea } if (customStyle.background) { - chart_option.backgroundColor = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha) + // chart_option.backgroundColor = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha) } } } diff --git a/frontend/src/views/chart/chart/common/common_antv.js b/frontend/src/views/chart/chart/common/common_antv.js index 4175a70bf1..b67db98842 100644 --- a/frontend/src/views/chart/chart/common/common_antv.js +++ b/frontend/src/views/chart/chart/common/common_antv.js @@ -40,7 +40,7 @@ export function getTheme(chart) { customStyle = JSON.parse(chart.customStyle) // bg if (customStyle.background) { - bgColor = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha) + // bgColor = hexColorToRGBA(customStyle.background.color, customStyle.background.alpha) } // legend if (customStyle.legend) { diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index 3082ccf498..aaadf57ee5 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -7,7 +7,7 @@ :style="trackBarStyleTime" @trackClick="trackClick" /> -
+
diff --git a/frontend/src/views/chart/components/ChartComponentG2.vue b/frontend/src/views/chart/components/ChartComponentG2.vue index 66c9437c86..ce766e8f2a 100644 --- a/frontend/src/views/chart/components/ChartComponentG2.vue +++ b/frontend/src/views/chart/components/ChartComponentG2.vue @@ -87,7 +87,7 @@ export default { }, bg_class() { return { - borderRadius: this.borderRadius + // borderRadius: this.borderRadius } } }, diff --git a/frontend/src/views/chart/components/ChartComponentS2.vue b/frontend/src/views/chart/components/ChartComponentS2.vue index e4b4b3b1fd..318997f0f1 100644 --- a/frontend/src/views/chart/components/ChartComponentS2.vue +++ b/frontend/src/views/chart/components/ChartComponentS2.vue @@ -1,10 +1,10 @@