Skip to content

Commit e42787b

Browse files
committed
🎨 feat: 移动设置位置
1 parent b1669b9 commit e42787b

4 files changed

Lines changed: 108 additions & 109 deletions

File tree

src/components/Player/MainAMLyric.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,12 @@ onBeforeUnmount(() => {
161161
}
162162
}
163163
}
164-
165164
:lang(ja) {
166165
font-family: var(--ja-font-family);
167166
}
168-
169167
:lang(en) {
170168
font-family: var(--en-font-family);
171169
}
172-
173170
:lang(ko) {
174171
font-family: var(--ko-font-family);
175172
}

src/components/Setting/GeneralSetting.vue

Lines changed: 8 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -213,68 +213,6 @@
213213
/>
214214
</n-flex>
215215
</n-card>
216-
<n-card class="set-item">
217-
<div class="label">
218-
<n-text class="name">歌词区域字体</n-text>
219-
<n-text class="tip" :depth="3"> 是否独立更改歌词区域字体 </n-text>
220-
</div>
221-
<n-flex>
222-
<Transition name="fade" mode="out-in">
223-
<n-button
224-
v-if="settingStore.LyricFont !== 'follow'"
225-
type="primary"
226-
strong
227-
secondary
228-
@click="settingStore.LyricFont = 'follow'"
229-
>
230-
恢复默认
231-
</n-button>
232-
</Transition>
233-
<n-select
234-
v-model:value="settingStore.LyricFont"
235-
:options="[
236-
{ label: '跟随全局', value: 'follow' },
237-
...allFontsData.filter((v) => v.value !== 'default'),
238-
]"
239-
class="set"
240-
filterable
241-
/>
242-
</n-flex>
243-
</n-card>
244-
<n-collapse-transition :show="settingStore.LyricFont !== 'follow'">
245-
<n-card
246-
v-for="item in languageFontSettings"
247-
:key="item.key"
248-
class="set-item"
249-
>
250-
<div class="label">
251-
<n-text class="name">{{ item.name }}歌词字体</n-text>
252-
<n-text class="tip" :depth="3"> {{ item.tip }} </n-text>
253-
</div>
254-
<n-flex>
255-
<Transition name="fade" mode="out-in">
256-
<n-button
257-
v-if="settingStore[item.key] !== 'follow'"
258-
type="primary"
259-
strong
260-
secondary
261-
@click="settingStore[item.key] = 'follow'"
262-
>
263-
恢复默认
264-
</n-button>
265-
</Transition>
266-
<n-select
267-
v-model:value="settingStore[item.key]"
268-
:options="[
269-
{ label: '跟随全局', value: 'follow' },
270-
...allFontsData.filter((v) => v.value !== 'default'),
271-
]"
272-
class="set"
273-
filterable
274-
/>
275-
</n-flex>
276-
</n-card>
277-
</n-collapse-transition>
278216
<n-card class="set-item">
279217
<div class="label">
280218
<n-text class="name">关闭软件时</n-text>
@@ -328,7 +266,12 @@
328266
该协议通常用于官方网页端唤起官方客户端, 启用后可能导致官方客户端无法被唤起
329267
</n-text>
330268
</div>
331-
<n-switch v-model:value="settingStore.registryProtocol.orpheus" class="set" :round="false" @update:value="orpheusChange" />
269+
<n-switch
270+
v-model:value="settingStore.registryProtocol.orpheus"
271+
class="set"
272+
:round="false"
273+
@update:value="orpheusChange"
274+
/>
332275
</n-card>
333276
<n-card class="set-item">
334277
<div class="label">
@@ -379,25 +322,6 @@ const closeTaskbarProgress = (val: boolean) => {
379322
if (!val) window.electron.ipcRenderer.send("set-bar", "none");
380323
};
381324
382-
// 语言字体配置
383-
const languageFontSettings = [
384-
{
385-
name: "英语",
386-
key: "englishLyricFont" as const,
387-
tip: "是否在歌词为英语时单独设置字体",
388-
},
389-
{
390-
name: "日语",
391-
key: "japaneseLyricFont" as const,
392-
tip: "是否在歌词为日语时单独设置字体",
393-
},
394-
{
395-
name: "韩语",
396-
key: "koreanLyricFont" as const,
397-
tip: "是否在歌词为韩语时单独设置字体",
398-
},
399-
];
400-
401325
// 获取全部系统字体
402326
const getAllSystemFonts = async () => {
403327
const allFonts = await window.electron.ipcRenderer.invoke("get-all-fonts");
@@ -473,12 +397,12 @@ const modeChange = (val: boolean) => {
473397
474398
// 全局着色更改
475399
const themeGlobalColorChange = (val: boolean) => {
476-
if (val) getCoverColor(musicStore.songCover);
400+
if (val) getCoverColor(musicStore.songCover);
477401
};
478402
479403
// 注册或取消注册协议
480404
const orpheusChange = async (isRegistry: boolean) => {
481-
sendRegisterProtocol("orpheus", isRegistry)
405+
sendRegisterProtocol("orpheus", isRegistry);
482406
};
483407
484408
onMounted(() => {

src/components/Setting/LyricsSetting.vue

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,64 @@
119119
</n-input-number>
120120
</n-flex>
121121
</n-card>
122+
<n-card class="set-item">
123+
<div class="label">
124+
<n-text class="name">歌词区域字体</n-text>
125+
<n-text class="tip" :depth="3"> 是否独立更改歌词区域字体 </n-text>
126+
</div>
127+
<n-flex>
128+
<Transition name="fade" mode="out-in">
129+
<n-button
130+
v-if="settingStore.LyricFont !== 'follow'"
131+
type="primary"
132+
strong
133+
secondary
134+
@click="settingStore.LyricFont = 'follow'"
135+
>
136+
恢复默认
137+
</n-button>
138+
</Transition>
139+
<n-select
140+
v-model:value="settingStore.LyricFont"
141+
:options="[
142+
{ label: '跟随全局', value: 'follow' },
143+
...allFontsData.filter((v) => v.value !== 'default'),
144+
]"
145+
class="set"
146+
filterable
147+
/>
148+
</n-flex>
149+
</n-card>
150+
<n-collapse-transition :show="settingStore.LyricFont !== 'follow'">
151+
<n-card v-for="item in languageFontSettings" :key="item.key" class="set-item">
152+
<div class="label">
153+
<n-text class="name">{{ item.name }}歌词字体</n-text>
154+
<n-text class="tip" :depth="3"> {{ item.tip }} </n-text>
155+
</div>
156+
<n-flex>
157+
<Transition name="fade" mode="out-in">
158+
<n-button
159+
v-if="settingStore[item.key] !== 'follow'"
160+
type="primary"
161+
strong
162+
secondary
163+
@click="settingStore[item.key] = 'follow'"
164+
>
165+
恢复默认
166+
</n-button>
167+
</Transition>
168+
<n-select
169+
v-model:value="settingStore[item.key]"
170+
:options="[
171+
{ label: '跟随全局', value: 'follow' },
172+
...allFontsData.filter((v) => v.value !== 'default'),
173+
]"
174+
class="set"
175+
filterable
176+
/>
177+
</n-flex>
178+
</n-card>
179+
</n-collapse-transition>
122180
<n-card class="set-item">
123181
<div class="label">
124182
<n-text class="name">歌词字体加粗</n-text>
@@ -649,6 +707,25 @@ const restoreDesktopLyricConfig = () => {
649707
}
650708
};
651709
710+
// 语言字体配置
711+
const languageFontSettings = [
712+
{
713+
name: "英语",
714+
key: "englishLyricFont" as const,
715+
tip: "是否在歌词为英语时单独设置字体",
716+
},
717+
{
718+
name: "日语",
719+
key: "japaneseLyricFont" as const,
720+
tip: "是否在歌词为日语时单独设置字体",
721+
},
722+
{
723+
name: "韩语",
724+
key: "koreanLyricFont" as const,
725+
tip: "是否在歌词为韩语时单独设置字体",
726+
},
727+
];
728+
652729
// 获取全部系统字体
653730
const getAllSystemFonts = async () => {
654731
const allFonts = await window.electron.ipcRenderer.invoke("get-all-fonts");

src/utils/format.ts

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ export const formatSongsList = (data: any[]): SongType[] => {
4747
typeof item.album === "string"
4848
? item.album
4949
: {
50-
id: (item.album || item.al)?.id,
51-
name: (item.album || item.al)?.name,
52-
cover: (item.album || item.al)?.picUrl,
53-
},
50+
id: (item.album || item.al)?.id,
51+
name: (item.album || item.al)?.name,
52+
cover: (item.album || item.al)?.picUrl,
53+
},
5454
alia: isArray(item.alia || item.alias || item.transNames || item.tns)
5555
? item.alia?.[0] || item.alias?.[0] || item.transNames?.[0] || item.tns?.[0]
5656
: item.alia,
5757
dj: item.dj
5858
? {
59-
id: item.mainTrackId || item.id,
60-
name: item.dj?.brand,
61-
creator: item.dj?.nickname,
62-
}
59+
id: item.mainTrackId || item.id,
60+
name: item.dj?.brand,
61+
creator: item.dj?.nickname,
62+
}
6363
: undefined,
6464
...getCoverUrl(item),
6565
duration: Number(item.duration || item.dt || 0),
@@ -175,13 +175,13 @@ export const formatCommentList = (data: any[]): CommentType[] => {
175175
beReplied:
176176
item.beReplied?.length > 0
177177
? {
178-
content: item.beReplied[0]?.content,
179-
user: {
180-
id: item.beReplied[0]?.user.userId,
181-
name: item.beReplied[0]?.user.nickname,
182-
avatarUrl: item.beReplied[0]?.user.avatarUrl,
183-
},
184-
}
178+
content: item.beReplied[0]?.content,
179+
user: {
180+
id: item.beReplied[0]?.user.userId,
181+
name: item.beReplied[0]?.user.nickname,
182+
avatarUrl: item.beReplied[0]?.user.avatarUrl,
183+
},
184+
}
185185
: undefined,
186186
time: item.time,
187187
likedCount: item.likedCount,
@@ -197,9 +197,9 @@ export const formatCommentList = (data: any[]): CommentType[] => {
197197
},
198198
ip: item?.ip
199199
? {
200-
ip: item.ip,
201-
location: item.location,
202-
}
200+
ip: item.ip,
201+
location: item.location,
202+
}
203203
: undefined,
204204
}));
205205
};
@@ -277,13 +277,14 @@ const getCoverSizeUrl = (url: string, size: number | null = null) => {
277277
* @param lyric 歌词内容
278278
* @returns 语言代码("ja" | "zh-CN" | "en")
279279
*/
280-
export const getLyricLanguage = (lyric: string): string => {
280+
export const getLyricLanguage = (lyric: string): "ja" | "ko" | "zh-CN" | "en" => {
281+
if (!lyric || typeof lyric !== "string") return "en";
281282
// 判断日语 根据平假名和片假名
282-
if (/[\u3040-\u309f\u30a0-\u30ff]/.test(lyric)) return "ja";
283+
if (/[\u3040-\u309F\u30A0-\u30FF]/.test(lyric)) return "ja";
283284
// 判断韩语 根据韩文音节
284-
if (/[\uac00-\ud7af]/.test(lyric)) return "ko";
285+
if (/[\uAC00-\uD7AF]/.test(lyric)) return "ko";
285286
// 判断简体中文 根据中日韩统一表意文字基本区
286-
if (/[\u4e00-\u9fa5]/.test(lyric)) return "zh-CN";
287+
if (/[\u4E00-\u9FFF]/.test(lyric)) return "zh-CN";
287288
// 默认英语
288289
return "en";
289290
};

0 commit comments

Comments
 (0)