From 2f9bccf65fa51f3847c73b988c57303fec051274 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Wed, 4 Sep 2024 14:37:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=95=B0=E6=8D=AE=E9=9B=86):=20=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=95=B0=E6=8D=AE=E9=9B=86-=E5=85=B3=E8=81=94?= =?UTF-8?q?=E8=A1=A8-=E6=9C=AA=E5=85=B3=E8=81=94=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E5=AD=97=E6=AE=B5-=E7=A1=AE=E8=AE=A4=E6=97=B6=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E5=BC=B9=E7=AA=97-=E6=9C=AA=E6=AD=A3=E7=A1=AE?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=AE=A1=E7=AE=97=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/store/modules/appearance.ts | 2 +- .../modules/data-visualization/dvMain.ts | 4 ++- .../components/CustomColorStyleSelect.vue | 10 ++++-- .../chart/components/editor/util/chart.ts | 4 +-- .../views/chart/components/views/index.vue | 5 ++- .../src/views/dashboard/index.vue | 2 +- .../src/views/system/font/UploadDetail.vue | 1 + .../src/views/system/font/index.vue | 33 +++++++++---------- .../data/dataset/form/DatasetUnion.vue | 5 ++- .../visualized/data/dataset/form/index.vue | 9 +++-- 10 files changed, 46 insertions(+), 29 deletions(-) diff --git a/core/core-frontend/src/store/modules/appearance.ts b/core/core-frontend/src/store/modules/appearance.ts index 6c4015ff96..a7e1352caf 100644 --- a/core/core-frontend/src/store/modules/appearance.ts +++ b/core/core-frontend/src/store/modules/appearance.ts @@ -31,7 +31,7 @@ interface AppearanceState { showDemoTips?: boolean demoTipsContent?: string community: boolean - fontList: Array<{ name: string; id: string }> + fontList: Array<{ name: string; id: string; isDefault: boolean }> } const { wsCache } = useCache() export const useAppearanceStore = defineStore('appearanceStore', { diff --git a/core/core-frontend/src/store/modules/data-visualization/dvMain.ts b/core/core-frontend/src/store/modules/data-visualization/dvMain.ts index 044cc207ff..d9b9a195c2 100644 --- a/core/core-frontend/src/store/modules/data-visualization/dvMain.ts +++ b/core/core-frontend/src/store/modules/data-visualization/dvMain.ts @@ -23,7 +23,7 @@ import { } from '@/custom-component/component-list' import { get, set } from 'lodash-es' import { viewFieldTimeTrans } from '@/utils/viewUtils' -import { isMainCanvas } from '@/utils/canvasUtils' +import { useAppearanceStoreWithOut } from '@/store/modules/appearance' export const dvMainStore = defineStore('dataVisualization', { state: () => { @@ -410,6 +410,7 @@ export const dvMainStore = defineStore('dataVisualization', { componentData.push(component) this.setCurComponent({ component: component, index: componentData.length - 1 }) } + const currentFont = useAppearanceStoreWithOut().fontList.find(ele => ele.isDefault) //如果当前的组件是UserView 图表,则想canvasView中增加一项 UserView ID 和componentID保持一致 if (component.component === 'UserView') { const defaultConfig = JSON.parse(JSON.stringify(BASE_VIEW_CONFIG)) @@ -436,6 +437,7 @@ export const dvMainStore = defineStore('dataVisualization', { newView = chartViewInstance.setupDefaultOptions(newView) newView['title'] = component.name } + currentFont && (newView.customStyle.text.fontFamily = currentFont.name) this.canvasViewInfo[component.id] = newView } if (component.component === 'VQuery') { diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/CustomColorStyleSelect.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/CustomColorStyleSelect.vue index 7cf6665475..79e070c770 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/CustomColorStyleSelect.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/CustomColorStyleSelect.vue @@ -147,11 +147,17 @@ const setupSeriesColor = () => { } } +const flag = ref(1) + const switchSeriesColor = (seriesColor, index) => { seriesColorPickerRef.value?.hide() seriesColorState.curSeriesColor = cloneDeep(seriesColor) seriesColorState.curColorIndex = index - seriesColorState.seriesColorPickerId = '#series-color-picker-' + seriesColor.id + const id = '#series-color-picker-' + seriesColor.id + `-${flag.value}` + if (document.querySelectorAll(id).length > 1) { + flag.value = 2 + } + seriesColorState.seriesColorPickerId = '#series-color-picker-' + seriesColor.id + `-${flag.value}` nextTick(() => { seriesColorPickerRef.value?.show() }) @@ -462,7 +468,7 @@ const colorItemBorderColor = (index, state) => { class="color-list-item" >
{ CHART_FONT_FAMILY_MAP[ele.name] = ele.name }) } - state.title_class.fontFamily = customStyle.text.fontFamily ? CHART_FONT_FAMILY_MAP[customStyle.text.fontFamily] : DEFAULT_TITLE_STYLE.fontFamily + if (!CHART_FONT_FAMILY_MAP[customStyle.text.fontFamily]) { + state.title_class.fontFamily = appearanceStore.fontList.find(ele => ele.isDefault)?.name + customStyle.text.fontFamily = state.title_class.fontFamily + } appearanceStore.setCurrentFont(state.title_class.fontFamily) state.title_class.letterSpacing = (customStyle.text.letterSpace diff --git a/core/core-frontend/src/views/dashboard/index.vue b/core/core-frontend/src/views/dashboard/index.vue index a53e0cf7f2..62564b16f6 100644 --- a/core/core-frontend/src/views/dashboard/index.vue +++ b/core/core-frontend/src/views/dashboard/index.vue @@ -1,5 +1,5 @@