Skip to content

Commit 078e368

Browse files
committed
🐞 fix: 修复输入框样式问题
1 parent d3c0e6c commit 078e368

7 files changed

Lines changed: 78 additions & 65 deletions

File tree

electron/main/store/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { screen } from "electron";
22
import { storeLog } from "../logger";
33
import type { LyricConfig } from "../../../src/types/desktop-lyric";
4+
import { defaultAMLLDbServer } from "../utils/config";
45
import defaultLyricConfig from "../../../src/assets/data/lyricConfig";
56
import Store from "electron-store";
67

@@ -49,7 +50,7 @@ export const useStore = () => {
4950
config: defaultLyricConfig,
5051
},
5152
proxy: "",
52-
amllDbServer: "https://amll-ttml-db.stevexmh.net/ncm/%s",
53+
amllDbServer: defaultAMLLDbServer,
5354
},
5455
});
5556
};

electron/main/utils/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ export const appName = app.getName() || "SPlayer";
3232
*/
3333
export const port = Number(import.meta.env["VITE_SERVER_PORT"] || 25884);
3434

35+
/**
36+
* 默认 AMLL TTML DB Server
37+
* @returns string
38+
*/
39+
export const defaultAMLLDbServer = "https://amlldb.bikonoo.com/ncm-lyrics/%s.ttml";
40+
3541
/**
3642
* 主窗口加载地址
3743
* @returns string

electron/server/netease/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { pathCase } from "change-case";
33
import { serverLog } from "../../main/logger";
44
import { useStore } from "../../main/store";
55
import NeteaseCloudMusicApi from "@neteasecloudmusicapienhanced/api";
6+
import { defaultAMLLDbServer } from "../../main/utils/config";
67

78
// 获取数据
89
const getHandler = (name: string, neteaseApi: (params: any) => any) => {
@@ -70,7 +71,7 @@ export const initNcmAPI = async (fastify: FastifyInstance) => {
7071
return reply.status(400).send({ error: "id is required" });
7172
}
7273
const store = useStore();
73-
const server = store.get("amllDbServer") ?? "https://amll-ttml-db.stevexmh.net/ncm/%s";
74+
const server = store.get("amllDbServer") ?? defaultAMLLDbServer;
7475
const url = server.replace("%s", String(id));
7576
try {
7677
const response = await fetch(url);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "splayer",
33
"productName": "SPlayer",
4-
"version": "3.0.0",
4+
"version": "3.0.0-beta.7",
55
"description": "A minimalist music player",
66
"main": "./out/main/index.js",
77
"author": "imsyy",

src/components/Modal/AMLLServer.vue

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
v-model:value="serverUrl"
1313
:status="inputStatus"
1414
:allow-input="noSideSpace"
15-
ref="inputElement"
1615
placeholder="请输入 AMLL TTML DB 地址"
1716
/>
1817

@@ -22,6 +21,8 @@
2221
<n-card
2322
v-for="server in amllDbServers"
2423
:key="server.value"
24+
size="small"
25+
hoverable
2526
@click="selectServer(server.value)"
2627
>
2728
<n-flex vertical size="small">
@@ -51,12 +52,17 @@ const props = defineProps<{ onClose: () => void }>();
5152
5253
const settingStore = useSettingStore();
5354
const serverUrl = ref(settingStore.amllDbServer);
54-
const inputStatus = ref<"success" | "error">("success");
55+
const inputStatus = ref<"success" | "error" | "warning">("success");
5556
5657
const noSideSpace = (value: string) => value.trim() === value;
5758
5859
const isValidServer = (url: string) => isValidURL(url) && url.includes("%s");
5960
61+
/**
62+
* 渲染高亮
63+
* @param text 文本
64+
* @returns 高亮文本
65+
*/
6066
const renderHighlight = (text: string): string => {
6167
return text.replace("%s", "<span class='replace-part'>%s</span>");
6268
};
@@ -80,53 +86,36 @@ watch(serverUrl, (url: string) => {
8086
inputStatus.value = isValidServer(url) ? "success" : "error";
8187
});
8288
83-
const inputElement = ref<HTMLElement | null>(null);
84-
let flashInputAnimate: Animation | null = null;
85-
89+
/**
90+
* 选择服务器
91+
* @param url 服务器 URL
92+
*/
8693
const selectServer = (url: string) => {
8794
serverUrl.value = url;
88-
triggerFlashInput();
89-
};
90-
91-
const triggerFlashInput = () => {
92-
flashInputAnimate?.cancel();
93-
if (!inputElement.value) return;
94-
const element: HTMLElement = inputElement.value.$el;
95-
96-
flashInputAnimate = element.animate([
97-
{ backgroundColor: "rgba(var(--primary), 0.5)" },
98-
{},
99-
], {
100-
duration: 500,
101-
easing: 'ease-out',
102-
});
95+
inputStatus.value = "success";
96+
useTimeoutFn(() => {
97+
inputStatus.value = isValidServer(url) ? "success" : "error";
98+
}, 300);
10399
};
104100
</script>
105101

106102
<style scoped lang="scss">
107103
.servers-collapse {
108-
margin-top: 10px;
109-
110104
.n-card {
111105
cursor: pointer;
112-
transition: border-color 0.3s;
113-
114106
&:hover {
115107
border-color: rgba(var(--primary), 0.58);
116108
}
117109
}
118-
119110
.server-url {
120-
font-size: 11px;
121-
color: var(--n-text-color-3);
111+
font-size: 12px;
122112
margin-top: 4px;
123113
padding: 4px 8px;
124114
background: var(--n-code-color);
125115
border-radius: 4px;
126-
font-family: monospace;
127116
word-break: break-all;
128117
129-
::v-deep(.replace-part) {
118+
:deep(.replace-part) {
130119
color: var(--n-color-target);
131120
}
132121
}

src/stores/setting.ts

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ export interface SettingState {
99
themeMode: "light" | "dark" | "auto";
1010
/** 主题类别 */
1111
themeColorType:
12-
| "default"
13-
| "orange"
14-
| "blue"
15-
| "pink"
16-
| "brown"
17-
| "indigo"
18-
| "green"
19-
| "purple"
20-
| "yellow"
21-
| "teal"
22-
| "custom";
12+
| "default"
13+
| "orange"
14+
| "blue"
15+
| "pink"
16+
| "brown"
17+
| "indigo"
18+
| "green"
19+
| "purple"
20+
| "yellow"
21+
| "teal"
22+
| "custom";
2323
/** 主题自定义颜色 */
2424
themeCustomColor: string;
2525
/** 全局着色 */
@@ -96,14 +96,14 @@ export interface SettingState {
9696
proxyPort: number;
9797
/** 歌曲音质 */
9898
songLevel:
99-
| "standard"
100-
| "higher"
101-
| "exhigh"
102-
| "lossless"
103-
| "hires"
104-
| "jyeffect"
105-
| "sky"
106-
| "jymaster";
99+
| "standard"
100+
| "higher"
101+
| "exhigh"
102+
| "lossless"
103+
| "hires"
104+
| "jyeffect"
105+
| "sky"
106+
| "jymaster";
107107
/** 播放设备 */
108108
playDevice: "default" | string;
109109
/** 自动播放 */
@@ -294,7 +294,7 @@ export const useSettingStore = defineStore("setting", {
294294
lyricFontBold: true,
295295
useAMLyrics: false,
296296
useAMSpring: false,
297-
enableTTMLLyric: true,
297+
enableTTMLLyric: false,
298298
amllDbServer: defaultAMLLDbServer,
299299
showYrc: true,
300300
showYrcAnimation: true,
@@ -387,11 +387,12 @@ export const useSettingStore = defineStore("setting", {
387387
}
388388
window.$message.info(
389389
`已切换至
390-
${this.themeMode === "auto"
391-
? "跟随系统"
392-
: this.themeMode === "light"
393-
? "浅色模式"
394-
: "深色模式"
390+
${
391+
this.themeMode === "auto"
392+
? "跟随系统"
393+
: this.themeMode === "light"
394+
? "浅色模式"
395+
: "深色模式"
395396
}`,
396397
{
397398
showIcon: false,

src/utils/meta.ts

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ export const getSongLevelsData = (
107107
);
108108
};
109109

110-
// 排序选项
110+
/**
111+
* 排序选项
112+
* @returns 排序选项
113+
*/
111114
export const sortOptions = {
112115
default: { name: "默认排序", show: "all", icon: "Sort" },
113116
titleAZ: { name: "标题升序( A - Z )", show: "all", icon: "SortAZ" },
@@ -120,7 +123,11 @@ export const sortOptions = {
120123
dateDown: { name: "日期降序", show: "radio", icon: "SortDateDown" },
121124
} as const;
122125

123-
// 自定义图片工具栏
126+
/**
127+
* 渲染图片工具栏
128+
* @param nodes 图片工具栏节点
129+
* @returns 图片工具栏
130+
*/
124131
export const renderToolbar = ({ nodes }: ImageRenderToolbarProps) => {
125132
return [
126133
nodes.prev,
@@ -134,20 +141,24 @@ export const renderToolbar = ({ nodes }: ImageRenderToolbarProps) => {
134141
];
135142
};
136143

137-
// AMLL TTML DB Server 列表
144+
/**
145+
* AMLL TTML DB Server 列表
146+
* @returns AMLL TTML DB Server 列表
147+
*/
138148
export const amllDbServers = [
139149
{
140-
label: "GitHub 官方仓库 (推荐)",
150+
label: "【推荐】GitHub 官方仓库",
141151
description: "官方源,更新及时,但访问速度可能较慢",
142-
value: "https://raw.githubusercontent.com/Steve-xmh/amll-ttml-db/refs/heads/main/ncm-lyrics/%s.ttml",
152+
value:
153+
"https://raw.githubusercontent.com/Steve-xmh/amll-ttml-db/refs/heads/main/ncm-lyrics/%s.ttml",
143154
},
144155
{
145156
label: "AMLL TTML DB Service (SteveXMH)",
146-
description: "作者提供的官方镜像源,但免费额度快没了",
157+
description: "作者提供的官方镜像源,但免费额度快没了 😂",
147158
value: "https://amll-ttml-db.stevexmh.net/ncm/%s",
148159
},
149160
{
150-
label: "AMLL TTML DB 镜像站 (HelloZGY) (默认)",
161+
label: "【默认】AMLL TTML DB 镜像站 (HelloZGY)",
151162
description: "社区提供的镜像源,感谢 HelloZGY",
152163
value: "https://amlldb.bikonoo.com/ncm-lyrics/%s.ttml",
153164
},
@@ -163,5 +174,9 @@ export const amllDbServers = [
163174
},
164175
] as const;
165176

166-
// 默认 AMLL TTML DB Server (HelloZGY)
177+
/**
178+
* 默认 AMLL TTML DB Server
179+
* 感谢 HelloZGY 提供镜像源
180+
* @returns 默认 AMLL TTML DB Server
181+
*/
167182
export const defaultAMLLDbServer = amllDbServers[2].value;

0 commit comments

Comments
 (0)