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 @@