|
4 | 4 | <n-h3 prefix="bar">通用字体</n-h3> |
5 | 5 | <n-card v-if="isElectron" class="set-item"> |
6 | 6 | <div class="label"> |
7 | | - <n-text class="name">自定义 CSS 字体</n-text> |
8 | | - <n-text class="tip" :depth="3"> 开启后可手动输入字体名称,支持 CSS 字体族 </n-text> |
| 7 | + <n-text class="name">字体设置样式</n-text> |
| 8 | + <n-text class="tip" :depth="3"> 下面的字体如何显示,如何设置 </n-text> |
9 | 9 | </div> |
10 | | - <n-switch v-model:value="settingStore.useCustomFont" class="set" :round="false" /> |
| 10 | + <n-select |
| 11 | + v-model:value="settingStore.fontSettingStyle" |
| 12 | + :options="[ |
| 13 | + { |
| 14 | + label: '自定义 CSS 字体', |
| 15 | + value: 'custom', |
| 16 | + }, |
| 17 | + { |
| 18 | + label: '多字体备选', |
| 19 | + value: 'multi', |
| 20 | + }, |
| 21 | + { |
| 22 | + label: '单字体选择', |
| 23 | + value: 'single', |
| 24 | + }, |
| 25 | + ]" |
| 26 | + class="set" |
| 27 | + :round="false" |
| 28 | + /> |
11 | 29 | </n-card> |
12 | 30 | <n-card |
13 | 31 | class="set-item" |
14 | | - :class="{ 'input-mode': settingStore.useCustomFont || !isElectron }" |
| 32 | + :class="{ 'input-mode': isInputMode }" |
15 | 33 | > |
16 | 34 | <div class="label"> |
17 | 35 | <div style="display: flex; justify-content: space-between; align-items: center"> |
|
34 | 52 | </div> |
35 | 53 | <n-flex align="center"> |
36 | 54 | <s-input |
37 | | - v-if="settingStore.useCustomFont || !isElectron" |
| 55 | + v-if="settingStore.fontSettingStyle === 'custom' || !isElectron" |
38 | 56 | v-model:value="settingStore.globalFont" |
39 | 57 | :update-value-on-input="false" |
40 | 58 | placeholder="输入字体名称" |
41 | 59 | class="set" |
42 | 60 | /> |
43 | 61 | <n-select |
44 | | - v-else |
| 62 | + v-else-if="settingStore.fontSettingStyle === 'multi'" |
| 63 | + :value="settingStore.globalFont.split(',').map(s => s.trim())" |
| 64 | + :on-update-value="(value: Array<string>) => settingStore.globalFont = value.join(', ')" |
| 65 | + :options="getOptions('globalFont')" |
| 66 | + class="set" |
| 67 | + filterable |
| 68 | + multiple |
| 69 | + tag |
| 70 | + /> |
| 71 | + <n-select |
| 72 | + v-else-if="settingStore.fontSettingStyle === 'single'" |
45 | 73 | v-model:value="settingStore.globalFont" |
46 | 74 | :options="getOptions('globalFont')" |
47 | 75 | class="set" |
|
54 | 82 | <n-h3 prefix="bar">桌面歌词</n-h3> |
55 | 83 | <n-card |
56 | 84 | class="set-item" |
57 | | - :class="{ 'input-mode': settingStore.useCustomFont }" |
| 85 | + :class="{ 'input-mode': isInputMode }" |
58 | 86 | > |
59 | 87 | <div class="label"> |
60 | 88 | <div class="label-header"> |
|
82 | 110 | </div> |
83 | 111 | <n-flex align="center"> |
84 | 112 | <s-input |
85 | | - v-if="settingStore.useCustomFont" |
| 113 | + v-if="settingStore.fontSettingStyle === 'custom'" |
86 | 114 | v-model:value="desktopLyricConfig.fontFamily" |
87 | 115 | :update-value-on-input="false" |
88 | 116 | placeholder="输入字体名称" |
89 | 117 | class="set" |
90 | 118 | @change="saveDesktopLyricConfig" |
91 | 119 | /> |
92 | 120 | <n-select |
93 | | - v-else |
| 121 | + v-else-if="settingStore.fontSettingStyle === 'multi'" |
| 122 | + :value="desktopLyricConfig.fontFamily.split(',').map(s => s.trim())" |
| 123 | + :on-update-value="(value: Array<string>) => desktopLyricConfig.fontFamily = value.join(', ')" |
| 124 | + :options="getOptions('desktop')" |
| 125 | + class="set" |
| 126 | + filterable |
| 127 | + multiple |
| 128 | + tag |
| 129 | + /> |
| 130 | + <n-select |
| 131 | + v-else-if="settingStore.fontSettingStyle === 'single'" |
94 | 132 | v-model:value="desktopLyricConfig.fontFamily" |
95 | 133 | :options="getOptions('desktop')" |
96 | 134 | class="set" |
|
106 | 144 | v-for="font in lyricFontConfigs" |
107 | 145 | :key="font.keySetting" |
108 | 146 | class="set-item" |
109 | | - :class="{ 'input-mode': settingStore.useCustomFont || !isElectron }" |
| 147 | + :class="{ 'input-mode': isInputMode }" |
110 | 148 | > |
111 | 149 | <div class="label"> |
112 | 150 | <div class="label-header"> |
|
129 | 167 | </div> |
130 | 168 | <n-flex align="center"> |
131 | 169 | <s-input |
132 | | - v-if="settingStore.useCustomFont || !isElectron" |
| 170 | + v-if="settingStore.fontSettingStyle === 'custom' || !isElectron" |
133 | 171 | v-model:value="settingStore[font.keySetting]" |
134 | 172 | :update-value-on-input="false" |
135 | 173 | placeholder="输入字体名称" |
136 | 174 | class="set" |
137 | 175 | /> |
138 | 176 | <n-select |
139 | | - v-else |
| 177 | + v-else-if="settingStore.fontSettingStyle === 'multi'" |
| 178 | + :value="settingStore[font.keySetting].split(',').map(s => s.trim())" |
| 179 | + :on-update-value="(value: Array<string>) => settingStore[font.keySetting] = value.join(', ')" |
| 180 | + :options="getOptions(font.keySetting)" |
| 181 | + class="set" |
| 182 | + filterable |
| 183 | + multiple |
| 184 | + tag |
| 185 | + /> |
| 186 | + <n-select |
| 187 | + v-else-if="settingStore.fontSettingStyle === 'single'" |
140 | 188 | v-model:value="settingStore[font.keySetting]" |
141 | 189 | :options="getOptions(font.keySetting)" |
142 | 190 | class="set" |
@@ -165,6 +213,9 @@ const systemFonts = ref<SelectOption[]>([]); |
165 | 213 | // 桌面歌词配置 |
166 | 214 | const desktopLyricConfig = reactive<LyricConfig>({ ...defaultDesktopLyricConfig }); |
167 | 215 |
|
| 216 | +// 是否为输入模式 |
| 217 | +const isInputMode = computed(() => settingStore.fontSettingStyle !== "single" || !isElectron); |
| 218 | +
|
168 | 219 | // 获取下拉选项 |
169 | 220 | const getOptions = (key: string) => { |
170 | 221 | const isGlobal = key === "globalFont"; |
|
0 commit comments