Skip to content

Commit daa8e75

Browse files
committed
feat: 优化登录功能 添加UID登录功能
1 parent aeb7f03 commit daa8e75

File tree

18 files changed

+1028
-193
lines changed

18 files changed

+1028
-193
lines changed

eslint.config.mjs

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,10 @@ export default [
6666
'@typescript-eslint/no-explicit-any': 'off',
6767
'@typescript-eslint/explicit-module-boundary-types': 'off',
6868
'@typescript-eslint/no-unused-vars': [
69-
'warn',
70-
{
71-
argsIgnorePattern:
72-
'^_|^e$|^event$|^error$|^data$|^callback$|^args$|^value$|^loading$|^width$|^height$|^showPlaylist$|^id$|^enabledSources$|^progress$|^status$|^success$|^filePath$|^locale$|^channel$|^listener$|^url$|^songId$|^delta$|^item$|^err$|^gradient$|^theme$',
73-
varsIgnorePattern:
74-
'^_|^e$|^event$|^error$|^data$|^callback$|^args$|^NONE$|^TIME$|^SONGS$|^PLAYLIST_END$|^c$|^l$|^Window$|^key$|^color$',
75-
ignoreRestSiblings: true
76-
}
69+
'error',
70+
// we are only using this rule to check for unused arguments since TS
71+
// catches unused variables but not args.
72+
{ varsIgnorePattern: '.*', args: 'none' }
7773
],
7874
'@typescript-eslint/no-use-before-define': 'off',
7975
'@typescript-eslint/ban-ts-comment': 'off',
@@ -83,14 +79,10 @@ export default [
8379
'simple-import-sort/exports': 'error',
8480
'no-console': 'off',
8581
'no-unused-vars': [
86-
'warn',
87-
{
88-
argsIgnorePattern:
89-
'^_|^e$|^event$|^error$|^data$|^callback$|^args$|^value$|^loading$|^width$|^height$|^showPlaylist$|^id$|^enabledSources$|^progress$|^status$|^success$|^filePath$|^locale$|^channel$|^listener$|^url$|^songId$|^delta$|^item$|^err$|^gradient$|^theme$',
90-
varsIgnorePattern:
91-
'^_|^e$|^event$|^error$|^data$|^callback$|^args$|^NONE$|^TIME$|^SONGS$|^PLAYLIST_END$|^c$|^l$|^Window$|^key$|^color$',
92-
ignoreRestSiblings: true
93-
}
82+
'error',
83+
// we are only using this rule to check for unused arguments since TS
84+
// catches unused variables but not args.
85+
{ varsIgnorePattern: '.*', args: 'none' }
9486
],
9587
'no-use-before-define': 'off',
9688
'max-classes-per-file': 'off',
@@ -235,14 +227,10 @@ export default [
235227
'class-methods-use-this': 'off',
236228
'no-case-declarations': 'off',
237229
'no-unused-vars': [
238-
'warn',
239-
{
240-
argsIgnorePattern:
241-
'^_|^e$|^event$|^error$|^data$|^callback$|^args$|^value$|^loading$|^width$|^height$|^showPlaylist$|^id$|^enabledSources$|^progress$|^status$|^success$|^filePath$|^locale$|^channel$|^listener$|^url$|^songId$|^delta$|^item$|^err$|^gradient$|^theme$',
242-
varsIgnorePattern:
243-
'^_|^e$|^event$|^error$|^data$|^callback$|^args$|^NONE$|^TIME$|^SONGS$|^PLAYLIST_END$|^c$|^l$|^Window$|^key$|^color$',
244-
ignoreRestSiblings: true
245-
}
230+
'error',
231+
// we are only using this rule to check for unused arguments since TS
232+
// catches unused variables but not args.
233+
{ varsIgnorePattern: '.*', args: 'none' }
246234
]
247235
}
248236
}

src/i18n/lang/en-US/login.ts

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,61 @@ export default {
22
title: {
33
qr: 'QR Code Login',
44
phone: 'Phone Login',
5-
token: 'Cookie Login'
5+
cookie: 'Cookie Login',
6+
uid: 'UID Login'
67
},
78
qrTip: 'Scan with NetEase Cloud Music APP',
89
phoneTip: 'Login with NetEase Cloud account',
910
tokenTip: 'Enter a valid NetEase Cloud Music Cookie to login',
11+
uidTip: 'Enter User ID for quick login',
1012
placeholder: {
1113
phone: 'Phone Number',
1214
password: 'Password',
13-
token: 'Please enter NetEase Cloud Music Cookie (token)'
15+
cookie: 'Please enter NetEase Cloud Music Cookie (token)',
16+
uid: 'Please enter User ID (UID)'
1417
},
1518
button: {
1619
login: 'Login',
1720
switchToQr: 'QR Code Login',
1821
switchToPhone: 'Phone Login',
1922
switchToToken: 'Use Cookie Login',
23+
switchToUid: 'UID Login',
2024
backToQr: 'Back to QR Code Login',
21-
tokenLogin: 'Cookie Login',
22-
autoGetCookie: 'Auto Get Cookie'
25+
cookieLogin: 'Cookie Login',
26+
autoGetCookie: 'Auto Get Cookie',
27+
refresh: 'Click to Refresh',
28+
refreshing: 'Refreshing...',
29+
refreshQr: 'Refresh QR Code'
2330
},
2431
message: {
2532
loginSuccess: 'Login successful',
33+
loginFailed: 'Login failed',
2634
tokenLoginSuccess: 'Cookie login successful',
35+
uidLoginSuccess: 'UID login successful',
2736
loadError: 'Error loading login information',
2837
qrCheckError: 'Error checking QR code status',
2938
tokenRequired: 'Please enter Cookie',
3039
tokenInvalid: 'Invalid Cookie, please check and try again',
40+
uidRequired: 'Please enter User ID',
41+
uidInvalid: 'Invalid User ID or user does not exist',
42+
uidLoginFailed: 'UID login failed, please check if User ID is correct',
43+
phoneRequired: 'Please enter phone number',
44+
passwordRequired: 'Please enter password',
45+
phoneLoginFailed: 'Phone login failed, please check if phone number and password are correct',
3146
autoGetCookieSuccess: 'Auto get Cookie successful',
3247
autoGetCookieFailed: 'Auto get Cookie failed',
33-
autoGetCookieTip: 'Will open NetEase Cloud Music login page, please complete login and close the window'
48+
autoGetCookieTip: 'Will open NetEase Cloud Music login page, please complete login and close the window',
49+
qrCheckFailed: 'Failed to check QR code status, please refresh and try again',
50+
qrLoading: 'Loading QR code...',
51+
qrExpired: 'QR code has expired, please click to refresh',
52+
qrExpiredShort: 'QR code expired',
53+
qrExpiredWarning: 'QR code has expired, please click to refresh for a new one',
54+
qrScanned: 'QR code scanned, please confirm login on your phone',
55+
qrScannedShort: 'Scanned',
56+
qrScannedInfo: 'QR code scanned, please confirm login on your phone',
57+
qrConfirmed: 'Login successful, redirecting...',
58+
qrGenerating: 'Generating QR code...'
3459
},
35-
qrTitle: 'NetEase Cloud Music QR Code Login'
60+
qrTitle: 'NetEase Cloud Music QR Code Login',
61+
uidWarning: 'Note: UID login is only for viewing user public information and cannot access features that require login permissions.'
3662
};

src/i18n/lang/ja-JP/login.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,47 @@ export default {
22
title: {
33
qr: 'QRコードログイン',
44
phone: '電話番号ログイン',
5-
token: 'Cookieログイン'
5+
cookie: 'Cookieログイン',
6+
uid: 'UIDログイン'
67
},
78
qrTip: 'NetEase Cloudアプリでログイン',
89
phoneTip: 'NetEase Cloudアカウントでログイン',
910
tokenTip: '有効なNetEase Cloud MusicのCookieを入力してログイン',
11+
uidTip: 'ユーザーIDを入力してクイックログイン',
1012
placeholder: {
1113
phone: '電話番号',
1214
password: 'パスワード',
13-
token: 'NetEase Cloud MusicのCookie(token)を入力してください'
15+
cookie: 'NetEase Cloud MusicのCookie(token)を入力してください',
16+
uid: 'ユーザーID(UID)を入力してください'
1417
},
1518
button: {
1619
login: 'ログイン',
1720
switchToQr: 'QRコードログイン',
1821
switchToPhone: '電話番号ログイン',
1922
switchToToken: 'Cookieログインを使用',
23+
switchToUid: 'UIDログイン',
2024
backToQr: 'QRコードログインに戻る',
21-
tokenLogin: 'Cookieログイン',
22-
autoGetCookie: 'Cookie自動取得'
25+
cookieLogin: 'Cookieログイン',
26+
autoGetCookie: 'Cookie自動取得',
27+
refresh: 'クリックしてリフレッシュ',
28+
refreshing: 'リフレッシュ中...',
29+
refreshQr: 'QRコードをリフレッシュ'
2330
},
2431
message: {
2532
loginSuccess: 'ログイン成功',
2633
tokenLoginSuccess: 'Cookieログイン成功',
34+
uidLoginSuccess: 'UIDログイン成功',
2735
loadError: 'ログイン情報の読み込み中にエラーが発生しました',
2836
qrCheckError: 'QRコードの状態確認中にエラーが発生しました',
2937
tokenRequired: 'Cookieを入力してください',
3038
tokenInvalid: 'Cookieが無効です。確認して再試行してください',
39+
uidRequired: 'ユーザーIDを入力してください',
40+
uidInvalid: 'ユーザーIDが無効またはユーザーが存在しません',
41+
uidLoginFailed: 'UIDログインに失敗しました。ユーザーIDが正しいか確認してください',
3142
autoGetCookieSuccess: 'Cookie自動取得成功',
3243
autoGetCookieFailed: 'Cookie自動取得失敗',
3344
autoGetCookieTip: 'NetEase Cloud Musicのログインページを開きます。ログイン完了後、ウィンドウを閉じてください'
3445
},
35-
qrTitle: 'NetEase Cloud Music QRコードログイン'
46+
qrTitle: 'NetEase Cloud Music QRコードログイン',
47+
uidWarning: '注意:UIDログインはユーザーの公開情報を表示するためのみ使用でき、ログイン権限が必要な機能にはアクセスできません。'
3648
};

src/i18n/lang/ko-KR/login.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,47 @@ export default {
22
title: {
33
qr: 'QR코드 로그인',
44
phone: '휴대폰 번호 로그인',
5-
token: 'Cookie 로그인'
5+
cookie: 'Cookie 로그인',
6+
uid: 'UID 로그인'
67
},
78
qrTip: '넷이즈 클라우드 뮤직 앱으로 QR코드를 스캔하여 로그인',
89
phoneTip: '넷이즈 클라우드 계정으로 로그인',
910
tokenTip: '유효한 넷이즈 클라우드 뮤직 Cookie을 입력하여 로그인',
11+
uidTip: '사용자 ID를 입력하여 빠른 로그인',
1012
placeholder: {
1113
phone: '휴대폰 번호',
1214
password: '비밀번호',
13-
token: '넷이즈 클라우드 뮤직 Cookie(token)을 입력하세요'
15+
cookie: '넷이즈 클라우드 뮤직 Cookie(token)을 입력하세요',
16+
uid: '사용자 ID(UID)를 입력하세요'
1417
},
1518
button: {
1619
login: '로그인',
1720
switchToQr: 'QR코드 로그인',
1821
switchToPhone: '휴대폰 번호 로그인',
1922
switchToToken: 'Cookie 로그인 사용',
23+
switchToUid: 'UID 로그인',
2024
backToQr: 'QR코드 로그인으로 돌아가기',
21-
tokenLogin: 'Cookie 로그인',
22-
autoGetCookie: 'Cookie 자동 가져오기'
25+
cookieLogin: 'Cookie 로그인',
26+
autoGetCookie: 'Cookie 자동 가져오기',
27+
refresh: '새로고침',
28+
refreshing: '새로고침 중...',
29+
refreshQr: 'QR코드 새로고침'
2330
},
2431
message: {
2532
loginSuccess: '로그인 성공',
2633
tokenLoginSuccess: 'Cookie 로그인 성공',
34+
uidLoginSuccess: 'UID 로그인 성공',
2735
loadError: '로그인 정보 로드 중 오류 발생',
2836
qrCheckError: 'QR코드 상태 확인 중 오류 발생',
2937
tokenRequired: 'Cookie을 입력하세요',
3038
tokenInvalid: 'Cookie이 유효하지 않습니다. 확인 후 다시 시도하세요',
39+
uidRequired: '사용자 ID를 입력하세요',
40+
uidInvalid: '사용자 ID가 유효하지 않거나 사용자가 존재하지 않습니다',
41+
uidLoginFailed: 'UID 로그인에 실패했습니다. 사용자 ID가 올바른지 확인하세요',
3142
autoGetCookieSuccess: 'Cookie 자동 가져오기 성공',
3243
autoGetCookieFailed: 'Cookie 자동 가져오기 실패',
3344
autoGetCookieTip: '넷이즈 클라우드 뮤직 로그인 페이지를 열겠습니다. 로그인 완료 후 창을 닫아주세요'
3445
},
35-
qrTitle: '넷이즈 클라우드 뮤직 QR코드 로그인'
46+
qrTitle: '넷이즈 클라우드 뮤직 QR코드 로그인',
47+
uidWarning: '주의: UID 로그인은 사용자 공개 정보를 확인하는 데만 사용할 수 있으며, 로그인 권한이 필요한 기능에 액세스할 수 없습니다.'
3648
};

src/i18n/lang/zh-CN/login.ts

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,61 @@ export default {
22
title: {
33
qr: '扫码登录',
44
phone: '手机号登录',
5-
token: 'Cookie登录'
5+
cookie: 'Cookie登录',
6+
uid: 'UID登录'
67
},
78
qrTip: '使用网易云APP扫码登录',
89
phoneTip: '使用网易云账号登录',
910
tokenTip: '输入有效的网易云音乐Cookie即可登录',
11+
uidTip: '输入用户ID快速登录',
1012
placeholder: {
1113
phone: '手机号',
1214
password: '密码',
13-
token: '请输入网易云音乐Cookie(token)'
15+
cookie: '请输入网易云音乐Cookie(token)',
16+
uid: '请输入用户ID(UID)'
1417
},
1518
button: {
1619
login: '登录',
1720
switchToQr: '扫码登录',
1821
switchToPhone: '手机号登录',
1922
switchToToken: '使用Cookie登录',
23+
switchToUid: 'UID登录',
2024
backToQr: '返回二维码登录',
21-
tokenLogin: 'Cookie登录',
22-
autoGetCookie: '自动获取Cookie'
25+
cookieLogin: 'Cookie登录',
26+
autoGetCookie: '自动获取Cookie',
27+
refresh: '点击刷新',
28+
refreshing: '刷新中...',
29+
refreshQr: '刷新二维码'
2330
},
2431
message: {
2532
loginSuccess: '登录成功',
33+
loginFailed: '登录失败',
2634
tokenLoginSuccess: 'Cookie登录成功',
35+
uidLoginSuccess: 'UID登录成功',
2736
loadError: '加载登录信息时出错',
2837
qrCheckError: '检查二维码状态时出错',
2938
tokenRequired: '请输入Cookie',
3039
tokenInvalid: 'Cookie无效,请检查后重试',
40+
uidRequired: '请输入用户ID',
41+
uidInvalid: '用户ID无效或用户不存在',
42+
uidLoginFailed: 'UID登录失败,请检查用户ID是否正确',
43+
phoneRequired: '请输入手机号',
44+
passwordRequired: '请输入密码',
45+
phoneLoginFailed: '手机号登录失败,请检查手机号和密码是否正确',
3146
autoGetCookieSuccess: '自动获取Cookie成功',
3247
autoGetCookieFailed: '自动获取Cookie失败',
33-
autoGetCookieTip: '将打开网易云音乐登录页面,请完成登录后关闭窗口'
48+
autoGetCookieTip: '将打开网易云音乐登录页面,请完成登录后关闭窗口',
49+
qrCheckFailed: '检查二维码状态失败,请刷新重试',
50+
qrLoading: '正在加载二维码...',
51+
qrExpired: '二维码已过期,请点击刷新',
52+
qrExpiredShort: '二维码已过期',
53+
qrExpiredWarning: '二维码已过期,请点击刷新获取新的二维码',
54+
qrScanned: '已扫码,请在手机上确认登录',
55+
qrScannedShort: '已扫码',
56+
qrScannedInfo: '已扫码,请在手机上确认登录',
57+
qrConfirmed: '登录成功,正在跳转...',
58+
qrGenerating: '正在生成二维码...'
3459
},
35-
qrTitle: '扫码登录网易云音乐'
60+
qrTitle: '扫码登录网易云音乐',
61+
uidWarning: '注意:UID登录仅用于查看用户公开信息,无法访问需要登录权限的功能'
3662
};

src/i18n/lang/zh-Hant/login.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,47 @@ export default {
22
title: {
33
qr: '掃碼登入',
44
phone: '手機號登入',
5-
token: 'Cookie登入'
5+
cookie: 'Cookie登入',
6+
uid: 'UID登入'
67
},
78
qrTip: '使用網易雲APP掃碼登入',
89
phoneTip: '使用網易雲帳號登入',
910
tokenTip: '輸入有效的網易雲音樂Cookie即可登入',
11+
uidTip: '輸入使用者ID快速登入',
1012
placeholder: {
1113
phone: '手機號',
1214
password: '密碼',
13-
token: '請輸入網易雲音樂Cookie(token)'
15+
cookie: '請輸入網易雲音樂Cookie(token)',
16+
uid: '請輸入使用者ID(UID)'
1417
},
1518
button: {
1619
login: '登入',
1720
switchToQr: '掃碼登入',
1821
switchToPhone: '手機號登入',
1922
switchToToken: '使用Cookie登入',
23+
switchToUid: 'UID登入',
2024
backToQr: '返回二維碼登入',
21-
tokenLogin: 'Cookie登入',
22-
autoGetCookie: '自動取得Cookie'
25+
cookieLogin: 'Cookie登入',
26+
autoGetCookie: '自動取得Cookie',
27+
refresh: '點擊刷新',
28+
refreshing: '刷新中...',
29+
refreshQr: '刷新二維碼'
2330
},
2431
message: {
2532
loginSuccess: '登入成功',
2633
tokenLoginSuccess: 'Cookie登入成功',
34+
uidLoginSuccess: 'UID登入成功',
2735
loadError: '載入登入資訊時出錯',
2836
qrCheckError: '檢查二維碼狀態時出錯',
2937
tokenRequired: '請輸入Cookie',
3038
tokenInvalid: 'Cookie無效,請檢查後重試',
39+
uidRequired: '請輸入使用者ID',
40+
uidInvalid: '使用者ID無效或使用者不存在',
41+
uidLoginFailed: 'UID登入失敗,請檢查使用者ID是否正確',
3142
autoGetCookieSuccess: '自動取得Cookie成功',
3243
autoGetCookieFailed: '自動取得Cookie失敗',
3344
autoGetCookieTip: '將開啟網易雲音樂登入頁面,請完成登入後關閉視窗'
3445
},
35-
qrTitle: '掃碼登入網易雲音樂'
46+
qrTitle: '掃碼登入網易雲音樂',
47+
uidWarning: '注意:UID登入僅用於查看使用者公開資訊,無法訪問需要登入權限的功能'
3648
};

src/renderer/api/login.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,11 @@ export function loginByCellphone(phone: string, password: string) {
4444
password
4545
});
4646
}
47+
48+
// UID登录 - 通过用户ID获取用户信息
49+
// /user/detail
50+
export function loginByUid(uid: string | number) {
51+
return request.get('/user/detail', {
52+
params: { uid }
53+
});
54+
}

0 commit comments

Comments
 (0)