Skip to content

Commit f805f6d

Browse files
feat: login
1 parent b1d13f5 commit f805f6d

Some content is hidden

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

53 files changed

+1170
-2409
lines changed

package-lock.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

ui/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"format": "prettier --write src/"
1414
},
1515
"dependencies": {
16+
"axios": "^1.8.4",
1617
"element-plus": "^2.9.7",
18+
"nprogress": "^0.2.0",
1719
"pinia": "^3.0.1",
1820
"vue": "^3.5.13",
1921
"vue-i18n": "^11.1.3",
@@ -22,6 +24,7 @@
2224
"devDependencies": {
2325
"@tsconfig/node22": "^22.0.1",
2426
"@types/node": "^22.14.0",
27+
"@types/nprogress": "^0.2.3",
2528
"@vitejs/plugin-vue": "^5.2.3",
2629
"@vitejs/plugin-vue-jsx": "^4.1.2",
2730
"@vue/eslint-config-prettier": "^10.2.0",

ui/src/api/type/login.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ interface LoginRequest {
77
* 密码
88
*/
99
password: string
10-
/**
10+
/**
1111
* 验证码
1212
*/
13-
code: string
13+
captcha: string
1414
}
1515
export type { LoginRequest }

ui/src/api/type/user.ts

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
interface User {
2+
/**
3+
* 用户id
4+
*/
5+
id: string
6+
/**
7+
* 用户名
8+
*/
9+
username: string
10+
/**
11+
* 邮箱
12+
*/
13+
email: string
14+
/**
15+
* 用户角色
16+
*/
17+
role: string
18+
/**
19+
* 用户权限
20+
*/
21+
permissions: Array<string>
22+
/**
23+
* 是否需要修改密码
24+
*/
25+
is_edit_password?: boolean
26+
IS_XPACK?: boolean
27+
XPACK_LICENSE_IS_VALID?: boolean
28+
language: string
29+
}
30+
31+
interface LoginRequest {
32+
/**
33+
* 用户名
34+
*/
35+
username: string
36+
/**
37+
* 密码
38+
*/
39+
password: string
40+
}
41+
42+
interface RegisterRequest {
43+
/**
44+
* 用户名
45+
*/
46+
username: string
47+
/**
48+
* 密码
49+
*/
50+
password: string
51+
/**
52+
* 确定密码
53+
*/
54+
re_password: string
55+
/**
56+
* 邮箱
57+
*/
58+
email: string
59+
/**
60+
* 验证码
61+
*/
62+
code: string
63+
}
64+
65+
interface CheckCodeRequest {
66+
/**
67+
* 邮箱
68+
*/
69+
email: string
70+
/**
71+
*验证码
72+
*/
73+
code: string
74+
/**
75+
* 类型
76+
*/
77+
type: 'register' | 'reset_password'
78+
}
79+
80+
interface ResetCurrentUserPasswordRequest {
81+
/**
82+
* 验证码
83+
*/
84+
code: string
85+
/**
86+
*密码
87+
*/
88+
password: string
89+
/**
90+
* 确认密码
91+
*/
92+
re_password: string
93+
}
94+
95+
interface ResetPasswordRequest {
96+
/**
97+
* 邮箱
98+
*/
99+
email?: string
100+
/**
101+
* 验证码
102+
*/
103+
code?: string
104+
/**
105+
* 密码
106+
*/
107+
password: string
108+
/**
109+
* 确认密码
110+
*/
111+
re_password: string
112+
}
113+
114+
export type {
115+
LoginRequest,
116+
RegisterRequest,
117+
CheckCodeRequest,
118+
ResetPasswordRequest,
119+
User,
120+
ResetCurrentUserPasswordRequest
121+
}

ui/src/api/user/login.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Result } from '@/request/Result'
2+
import { get, post } from '@/request/index'
3+
import type { LoginRequest } from '@/api/type/login'
4+
import type { Ref } from 'vue'
5+
6+
/**
7+
* 登录
8+
* @param request 登录接口请求表单
9+
* @param loading 接口加载器
10+
* @returns 认证数据
11+
*/
12+
const login: (request: LoginRequest, loading?: Ref<boolean>) => Promise<Result<string>> = (
13+
request,
14+
loading,
15+
) => {
16+
return post('/user/login', request, undefined, loading)
17+
}
18+
19+
/**
20+
* 获取验证码
21+
* @param loading 接口加载器
22+
*/
23+
const getCaptcha: (loading?: Ref<boolean>) => Promise<Result<string>> = (loading) => {
24+
return get('/user/captcha', undefined, loading)
25+
}
26+
27+
export default {
28+
login,
29+
getCaptcha,
30+
}

ui/src/api/user/user.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Result } from '@/request/Result'
2+
import { get, post } from '@/request/index'
3+
import type { User } from '@/api/type/user'
4+
import type { Ref } from 'vue'
5+
6+
/**
7+
* 获取用户基本信息
8+
* @param loading 接口加载器
9+
* @returns 用户基本信息
10+
*/
11+
const getUserProfile: (loading?: Ref<boolean>) => Promise<Result<User>> = (loading) => {
12+
return get('/user/profile', undefined, loading)
13+
}
14+
15+
/**
16+
* 获取版本profile
17+
*/
18+
// const getProfile: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => {
19+
// return get('/profile', undefined, loading)
20+
// }
21+
22+
export default {
23+
getUserProfile,
24+
}

ui/src/locales/lang/en-US/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import en from 'element-plus/es/locale/lang/en'
22
import components from './components'
33
import layout from './layout'
44
import views from './views'
5+
import theme from './theme'
56
import common from './common'
67
import dynamicsForm from './dynamics-form'
78
import chat from './ai-chat'
89
export default {
910
lang: 'English',
1011
layout,
1112
views,
13+
theme,
1214
components,
1315
en,
1416
common,

ui/src/locales/lang/en-US/theme.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
export default {
2+
title: 'Appearance Settings',
3+
defaultSlogan: 'Ready-to-use, flexible RAG Chatbot',
4+
platformDisplayTheme: 'Platform Display Theme',
5+
customTheme: 'Custom Theme',
6+
platformLoginSettings: 'Platform Login Settings',
7+
custom: 'Custom',
8+
pagePreview: 'Page Preview',
9+
default: 'Default',
10+
restoreDefaults: 'Restore Defaults',
11+
orange: 'Orange',
12+
green: 'Green',
13+
purple: 'Purple',
14+
red: 'Red',
15+
loginBackground: 'Login Background Image',
16+
loginLogo: 'Login Logo',
17+
websiteLogo: 'Website Logo',
18+
replacePicture: 'Replace Image',
19+
websiteLogoTip:
20+
'Logo displayed at the top of the website. Recommended size: 48x48. Supports JPG, PNG, GIF. Maximum size: 10MB',
21+
loginLogoTip:
22+
'Logo on the right side of the login page. Recommended size: 204x52. Supports JPG, PNG, GIF. Maximum size: 10MB',
23+
loginBackgroundTip:
24+
'Left-side background image. Vector graphics recommended size: 576x900; Bitmap recommended size: 1152x1800. Supports JPG, PNG, GIF. Maximum size: 10MB',
25+
websiteName: 'Website Name',
26+
websiteNamePlaceholder: 'Please enter the website name',
27+
websiteNameTip: 'The platform name displayed in the web page tab',
28+
websiteSlogan: 'Welcome Slogan',
29+
websiteSloganPlaceholder: 'Please enter the welcome slogan',
30+
websiteSloganTip: 'The welcome slogan below the product logo',
31+
32+
defaultTip: 'The default is the MaxKB platform interface, supports custom settings',
33+
logoDefaultTip: 'The default is the MaxKB login interface, supports custom settings',
34+
platformSetting: 'Platform Settings',
35+
showUserManual: 'Show User Manual',
36+
showForum: 'Show Forum Support',
37+
showProject: 'Show Project Address',
38+
urlPlaceholder: 'Please enter the URL address',
39+
abandonUpdate: 'Abandon Update',
40+
saveAndApply: 'Save and Apply',
41+
fileMessageError: 'File size exceeds 10MB',
42+
saveSuccess: 'Appearance settings successfully applied',
43+
}

ui/src/locales/lang/en-US/views/login.ts

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
export default {
22
title: 'Login',
3+
loginForm: {
4+
username: {
5+
label: 'Username',
6+
placeholder: 'Please enter username',
7+
requiredMessage: 'Please enter username',
8+
lengthMessage: 'Length must be between 6 and 20 words',
9+
},
10+
password: {
11+
label: 'Login Password',
12+
placeholder: 'Please enter password',
13+
requiredMessage: 'Please enter password',
14+
lengthMessage: 'Length must be between 6 and 20 words',
15+
},
16+
captcha: {
17+
label: 'Verification Code',
18+
placeholder: 'Please enter verification code',
19+
requiredMessage: 'Please enter verification code',
20+
validatorMessage: 'Verification code is incorrect',
21+
},
22+
},
323
jump_tip: 'You will be redirected to the authentication source page for authentication',
424
jump: 'Redirect',
525
resetPassword: 'Change Password',
@@ -9,7 +29,7 @@ export default {
929
login: 'Login',
1030
register: 'Register',
1131
backLogin: 'Back to Login',
12-
checkCode: 'Verify Now'
32+
checkCode: 'Verify Now',
1333
},
1434
newPassword: 'New Password',
1535
enterPassword: 'Please enter your new password',
@@ -19,6 +39,6 @@ export default {
1939
placeholder: 'Please enter the verification code',
2040
getVerificationCode: 'Get Verification Code',
2141
successMessage: 'Verification code sent successfully',
22-
resend: 'Resend'
23-
}
42+
resend: 'Resend',
43+
},
2444
}

ui/src/locales/lang/en-US/views/system.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -93,48 +93,6 @@ export default {
9393
access: 'Access'
9494
}
9595
},
96-
theme: {
97-
title: 'Appearance Settings',
98-
platformDisplayTheme: 'Platform Display Theme',
99-
customTheme: 'Custom Theme',
100-
platformLoginSettings: 'Platform Login Settings',
101-
custom: 'Custom',
102-
pagePreview: 'Page Preview',
103-
default: 'Default',
104-
restoreDefaults: 'Restore Defaults',
105-
orange: 'Orange',
106-
green: 'Green',
107-
purple: 'Purple',
108-
red: 'Red',
109-
loginBackground: 'Login Background Image',
110-
loginLogo: 'Login Logo',
111-
websiteLogo: 'Website Logo',
112-
replacePicture: 'Replace Image',
113-
websiteLogoTip:
114-
'Logo displayed at the top of the website. Recommended size: 48x48. Supports JPG, PNG, GIF. Maximum size: 10MB',
115-
loginLogoTip:
116-
'Logo on the right side of the login page. Recommended size: 204x52. Supports JPG, PNG, GIF. Maximum size: 10MB',
117-
loginBackgroundTip:
118-
'Left-side background image. Vector graphics recommended size: 576x900; Bitmap recommended size: 1152x1800. Supports JPG, PNG, GIF. Maximum size: 10MB',
119-
websiteName: 'Website Name',
120-
websiteNamePlaceholder: 'Please enter the website name',
121-
websiteNameTip: 'The platform name displayed in the web page tab',
122-
websiteSlogan: 'Welcome Slogan',
123-
websiteSloganPlaceholder: 'Please enter the welcome slogan',
124-
websiteSloganTip: 'The welcome slogan below the product logo',
125-
defaultSlogan: 'Ready-to-use, flexible RAG Chatbot',
126-
defaultTip: 'The default is the MaxKB platform interface, supports custom settings',
127-
logoDefaultTip: 'The default is the MaxKB login interface, supports custom settings',
128-
platformSetting: 'Platform Settings',
129-
showUserManual: 'Show User Manual',
130-
showForum: 'Show Forum Support',
131-
showProject: 'Show Project Address',
132-
urlPlaceholder: 'Please enter the URL address',
133-
abandonUpdate: 'Abandon Update',
134-
saveAndApply: 'Save and Apply',
135-
fileMessageError: 'File size exceeds 10MB',
136-
saveSuccess: 'Appearance settings successfully applied'
137-
},
13896
email: {
13997
title: 'Email Settings',
14098
smtpHost: 'SMTP Host',

0 commit comments

Comments
 (0)