diff --git a/src/store/globalConfig.ts b/src/store/globalConfig.ts index 2cc3f8e..738d3a8 100644 --- a/src/store/globalConfig.ts +++ b/src/store/globalConfig.ts @@ -25,6 +25,8 @@ export const useGlobalConfig = defineStore('global', { patternList: defaultPatternList as number[], background: {}, // 背景颜色或图片 font: '微软雅黑', + titleFont: '微软雅黑', + titleFontSyncGlobal: true, }, musicList: defaultMusicList as IMusic[], imageList: defaultImageList as IImage[], @@ -111,6 +113,14 @@ export const useGlobalConfig = defineStore('global', { getFont(state) { return state.globalConfig.theme.font }, + // 获取标题字体 + getTitleFont(state) { + return state.globalConfig.theme.titleFont + }, + // 获取标题字体同步全局 + getTitleFontSyncGlobal(state) { + return state.globalConfig.theme.titleFontSyncGlobal + }, // 获取是否显示头像 getIsShowAvatar(state) { return state.globalConfig.isShowAvatar @@ -241,6 +251,14 @@ export const useGlobalConfig = defineStore('global', { setFont(font: any) { this.globalConfig.theme.font = font }, + // 设置标题字体 + setTitleFont(titleFont: any) { + this.globalConfig.theme.titleFont = titleFont + }, + // 设置同步全局字体 + setTitleFontSyncGlobal(titleFontSyncGlobal: boolean) { + this.globalConfig.theme.titleFontSyncGlobal = titleFontSyncGlobal + }, // 设置是否显示头像 setIsShowAvatar(isShowAvatar: boolean) { this.globalConfig.isShowAvatar = isShowAvatar @@ -266,6 +284,8 @@ export const useGlobalConfig = defineStore('global', { patternList: defaultPatternList as number[], background: {}, // 背景颜色或图片 font: '微软雅黑', + titleFont: '微软雅黑', + titleFontSyncGlobal: true, }, musicList: defaultMusicList as IMusic[], imageList: defaultImageList as IImage[], diff --git a/src/views/Config/Global/FaceConfig/components/SelectFont.vue b/src/views/Config/Global/FaceConfig/components/SelectFont.vue index 048176e..35cdc30 100644 --- a/src/views/Config/Global/FaceConfig/components/SelectFont.vue +++ b/src/views/Config/Global/FaceConfig/components/SelectFont.vue @@ -2,7 +2,7 @@ import { refDebounced } from '@vueuse/core' import { ChevronRight, ChevronsUpDownIcon } from 'lucide-vue-next' import { PopoverArrow } from 'reka-ui' -import { ref } from 'vue' +import { computed, ref } from 'vue' import { Button } from '@/components/ui/button' import { Command, @@ -20,12 +20,14 @@ import { import { useLocalFonts } from '@/hooks/useLocalFonts' import { cn } from '@/lib/utils' +const props = defineProps<{ + disabled?: boolean +}>() const selectedFont = defineModel('selectedFont', { type: String, required: true, }) - -const { getFonts, disabled, fonts } = useLocalFonts() +const { getFonts, disabled: browserDisabled, fonts } = useLocalFonts() const open = ref(false) const activeKey = ref('') const debouncedActiveKey = refDebounced(activeKey, 20) @@ -43,12 +45,20 @@ function handelActiveKey(val: string) { function handleScroll() { activeKey.value = '' } +const disabledStyle = computed(() => { + if (props.disabled || browserDisabled) { + return { + cursor: 'not-allowed', + } + } + return {} +})