Skip to content

Commit 3ba85f3

Browse files
committed
feat: 优化类型处理
1 parent daa8e75 commit 3ba85f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+104
-88
lines changed

src/i18n/languages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// 语言显示名称映射
44
export const LANGUAGE_DISPLAY_NAMES: Record<string, string> = {
55
'zh-CN': '简体中文',
6-
'zh-Hant': '繁體中文',
6+
'zh-Hant': '繁體中文',
77
'en-US': 'English',
88
'ja-JP': '日本語',
99
'ko-KR': '한국어'
@@ -22,4 +22,4 @@ export const LANGUAGE_PRIORITY: Record<string, number> = {
2222
'en-US': 3,
2323
'ja-JP': 4,
2424
'ko-KR': 5
25-
};
25+
};

src/i18n/utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const buildLanguageMessages = () => {
1010
const match = path.match(/\.\/lang\/([^/]+)\/([^/]+)\.ts$/);
1111
if (match) {
1212
const [, langCode, moduleName] = match;
13-
13+
1414
// 跳过 index 文件
1515
if (moduleName !== 'index') {
1616
if (!messages[langCode]) {
@@ -45,16 +45,16 @@ export const getLanguageDisplayNames = (): Record<string, string> => {
4545
export const getLanguageOptions = () => {
4646
const supportedLanguages = getSupportedLanguages();
4747
const displayNames = getLanguageDisplayNames();
48-
48+
4949
// 按优先级排序
5050
const sortedLanguages = supportedLanguages.sort((a, b) => {
5151
const priorityA = LANGUAGE_PRIORITY[a] || 999;
5252
const priorityB = LANGUAGE_PRIORITY[b] || 999;
5353
return priorityA - priorityB;
5454
});
55-
56-
return sortedLanguages.map(lang => ({
55+
56+
return sortedLanguages.map((lang) => ({
5757
label: displayNames[lang] || lang,
5858
value: lang
5959
}));
60-
};
60+
};

src/main/modules/loginWindow.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ const loginTitle = i18n.global.t('login.qrTitle');
1313
*/
1414
const openLoginWindow = async (mainWin: BrowserWindow) => {
1515
let loginTimer: NodeJS.Timeout;
16-
16+
1717
// 如果登录窗口已存在,则聚焦并返回
1818
if (loginWindow && !loginWindow.isDestroyed()) {
1919
loginWindow.focus();
2020
return;
2121
}
2222

2323
const loginSession = session.fromPartition('persist:login');
24-
24+
2525
// 清除 Cookie
2626
await loginSession.clearStorageData({
27-
storages: ['cookies', 'localstorage'],
27+
storages: ['cookies', 'localstorage']
2828
});
2929

3030
loginWindow = new BrowserWindow({
@@ -38,8 +38,8 @@ const openLoginWindow = async (mainWin: BrowserWindow) => {
3838
session: loginSession,
3939
sandbox: false,
4040
webSecurity: false,
41-
preload: join(__dirname, '../../preload/index.js'),
42-
},
41+
preload: join(__dirname, '../../preload/index.js')
42+
}
4343
});
4444

4545
// 打开网易云登录页面
@@ -57,17 +57,17 @@ const openLoginWindow = async (mainWin: BrowserWindow) => {
5757
if (loginTimer) clearInterval(loginTimer);
5858
return;
5959
}
60-
60+
6161
const MUSIC_U = await loginSession.cookies.get({
62-
name: 'MUSIC_U',
62+
name: 'MUSIC_U'
6363
});
64-
64+
6565
if (MUSIC_U && MUSIC_U?.length > 0) {
6666
if (loginTimer) clearInterval(loginTimer);
6767
const value = `MUSIC_U=${MUSIC_U[0].value};`;
68-
68+
6969
mainWin?.webContents.send('send-cookies', value);
70-
70+
7171
// 关闭登录窗口
7272
loginWindow.destroy();
7373
loginWindow = null;
@@ -81,7 +81,7 @@ const openLoginWindow = async (mainWin: BrowserWindow) => {
8181
loginWindow.webContents.once('did-finish-load', () => {
8282
loginWindow?.show();
8383
loginTimer = setInterval(checkLogin, 500);
84-
84+
8585
loginWindow?.on('closed', () => {
8686
if (loginTimer) clearInterval(loginTimer);
8787
loginWindow = null;

src/renderer/api/gdmusic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import axios from 'axios';
22

3-
import type { MusicSourceType } from '@/type/music';
3+
import type { MusicSourceType } from '@/types/music';
44

55
/**
66
* GD音乐台解析服务

src/renderer/api/home.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { IData } from '@/type';
2-
import { IAlbumNew } from '@/type/album';
3-
import { IDayRecommend } from '@/type/day_recommend';
4-
import { IRecommendMusic } from '@/type/music';
5-
import { IPlayListSort } from '@/type/playlist';
6-
import { IHotSearch, ISearchKeyword } from '@/type/search';
7-
import { IHotSinger } from '@/type/singer';
1+
import { IData } from '@/types';
2+
import { IAlbumNew } from '@/types/album';
3+
import { IDayRecommend } from '@/types/day_recommend';
4+
import { IRecommendMusic } from '@/types/music';
5+
import { IPlayListSort } from '@/types/playlist';
6+
import { IHotSearch, ISearchKeyword } from '@/types/search';
7+
import { IHotSinger } from '@/types/singer';
88
import request from '@/utils/request';
99

1010
interface IHotSingerParams {

src/renderer/api/list.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { IList } from '@/type/list';
2-
import type { IListDetail } from '@/type/listDetail';
1+
import { IList } from '@/types/list';
2+
import type { IListDetail } from '@/types/listDetail';
33
import request from '@/utils/request';
44

55
interface IListByTagParams {

src/renderer/api/music.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { cloneDeep } from 'lodash';
22

33
import { musicDB } from '@/hooks/MusicHook';
44
import { useSettingsStore, useUserStore } from '@/store';
5-
import type { ILyric } from '@/type/lyric';
6-
import type { SongResult } from '@/type/music';
5+
import type { ILyric } from '@/types/lyric';
6+
import type { SongResult } from '@/types/music';
77
import { isElectron } from '@/utils';
88
import request from '@/utils/request';
99
import requestMusic from '@/utils/request_music';

src/renderer/api/mv.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { IData } from '@/type';
2-
import { IMvUrlData } from '@/type/mv';
1+
import { IData } from '@/types';
2+
import { IMvUrlData } from '@/types/mv';
33
import request from '@/utils/request';
44

55
interface MvParams {

src/renderer/api/user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { IUserDetail, IUserFollow } from '@/type/user';
1+
import type { IUserDetail, IUserFollow } from '@/types/user';
22
import request from '@/utils/request';
33

44
// /user/detail

src/renderer/components/MusicList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ import { useI18n } from 'vue-i18n';
113113
import { getMusicDetail } from '@/api/music';
114114
import SongItem from '@/components/common/SongItem.vue';
115115
import { usePlayerStore } from '@/store/modules/player';
116-
import { SongResult } from '@/type/music';
116+
import { SongResult } from '@/types/music';
117117
import { getImgUrl, isMobile, setAnimationClass } from '@/utils';
118118
119119
import PlayBottom from './common/PlayBottom.vue';

0 commit comments

Comments
 (0)