Skip to content

Commit 99498a3

Browse files
committed
feat: 新增修改手机号、修改邮箱、修改密码、修改基本信息
1 parent 136f07c commit 99498a3

File tree

14 files changed

+393
-187
lines changed

14 files changed

+393
-187
lines changed

src/apis/auth/type.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface UserInfo {
77
email: string
88
phone: string
99
avatar: string
10+
pwdResetTime: string
1011
registrationDate: string
1112
deptName: string
1213
roles: string[]

src/apis/system/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ export * from './user'
22
export * from './role'
33
export * from './menu'
44
export * from './dept'
5-
export * from '../monitor/log'
5+
export * from './announcement'
66
export * from './dict'
77
export * from './file'
88
export * from './storage'
99
export * from './option'
10-
export * from './announcement'
10+
export * from './user-center'

src/apis/system/user-center.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import http from '@/utils/http'
2+
import type * as System from '@/apis/system/type'
3+
4+
const BASE_URL = '/system/user'
5+
6+
/** @desc 修改用户基本信息 */
7+
export function updateUserBaseInfo(data: { nickname: string; gender: number }) {
8+
return http.patch(`${BASE_URL}/basic/info`, data)
9+
}
10+
11+
/** @desc 修改密码 */
12+
export function updateUserPassword(data: { oldPassword: string; newPassword: string }) {
13+
return http.patch(`${BASE_URL}/password`, data)
14+
}
15+
16+
/** @desc 修改手机号 */
17+
export function updateUserPhone(data: { newPhone: string; captcha: string; currentPassword: string }) {
18+
return http.patch(`${BASE_URL}/phone`, data)
19+
}
20+
21+
/** @desc 修改邮箱 */
22+
export function updateUserEmail(data: { newEmail: string; captcha: string; currentPassword: string }) {
23+
return http.patch(`${BASE_URL}/email`, data)
24+
}
25+
26+
/** @desc 获取绑定的三方账号 */
27+
export function listUserSocial() {
28+
return http.get<System.BindSocialAccountRes[]>(`${BASE_URL}/social`)
29+
}
30+
31+
/** @desc 绑定三方账号 */
32+
export function bindSocialAccount(source: string, data: any) {
33+
return http.post(`${BASE_URL}/social/${source}`, data)
34+
}
35+
36+
/** @desc 解绑三方账号 */
37+
export function unbindSocialAccount(source: string) {
38+
return http.del(`${BASE_URL}/social/${source}`)
39+
}

src/apis/system/user.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,3 @@ export function exportUser(query: System.UserQuery) {
3737
export function resetUserPwd(data: any, id: string) {
3838
return http.patch(`${BASE_URL}/${id}/password`, data)
3939
}
40-
41-
/** @desc 修改用户基础信息 */
42-
export function updateUserBaseInfo(data: { nickname?: string; gender?: number }) {
43-
return http.patch(`${BASE_URL}/basic/info`, data)
44-
}
45-
46-
/** @desc 修改邮箱 */
47-
export function updateUserEmail(data: { newEmail: string; captcha: string; currentPassword: string }) {
48-
return http.patch(`${BASE_URL}/email`, data)
49-
}
50-
/**@desc 绑定三方账号 */
51-
export function bindSocialAccount(source: string, data: any) {
52-
return http.post(`${BASE_URL}/social/${source}`, data)
53-
}
54-
/**@desc 获取绑定的三方账号 */
55-
export function getSocialAccount() {
56-
return http.get<System.BindSocialAccountRes[]>(`${BASE_URL}/social`)
57-
}
58-
/**@desc 解绑三方账号 */
59-
export function unbindSocialAccount(source: string) {
60-
return http.del(`${BASE_URL}/social/${source}`)
61-
}

src/stores/modules/user.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const storeSetup = () => {
2626
email: '',
2727
phone: '',
2828
avatar: '',
29+
pwdResetTime: '',
2930
registrationDate: '',
3031
deptName: '',
3132
roles: [],

src/styles/global.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,12 @@
313313
.btn {
314314
height: 28px;
315315
width: 56px;
316+
&:hover {
317+
-webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, .15);
318+
box-shadow: 0 2px 3px rgba(0, 0, 0, .15);
319+
border-color: rgb(var(--primary-5));
320+
color: var(--color-text-2);
321+
}
316322
}
317323
}
318324
}

src/views/login/components/email/index.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ const handleLogin = async () => {
7474
}
7575
}
7676
77-
const captchaTime = ref(60)
7877
const captchaTimer = ref()
78+
const captchaTime = ref(60)
79+
const captchaBtnName = ref('获取验证码')
80+
const captchaDisable = ref(false)
7981
// 重置验证码
8082
const resetCaptcha = () => {
8183
window.clearInterval(captchaTimer.value)
@@ -84,15 +86,13 @@ const resetCaptcha = () => {
8486
captchaDisable.value = false
8587
}
8688
87-
const captchaBtnName = ref('获取验证码')
8889
const captchaLoading = ref(false)
89-
const captchaDisable = ref(false)
9090
// 获取验证码
9191
const onCaptcha = async () => {
92+
if (captchaLoading.value) return
93+
const isInvalid = await formRef.value?.validateField('email')
94+
if (isInvalid) return
9295
try {
93-
if (captchaLoading.value) return
94-
const isInvalid = await formRef.value?.validateField('email')
95-
if (isInvalid) return
9696
captchaLoading.value = true
9797
captchaBtnName.value = '发送中...'
9898
// await getEmailCaptcha({

src/views/login/components/phone/index.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ const handleLogin = async () => {
7777
}
7878
}
7979
80-
const captchaTime = ref(60)
8180
const captchaTimer = ref()
81+
const captchaTime = ref(60)
82+
const captchaBtnName = ref('获取验证码')
83+
const captchaDisable = ref(false)
8284
// 重置验证码
8385
const resetCaptcha = () => {
8486
window.clearInterval(captchaTimer.value)
@@ -87,15 +89,13 @@ const resetCaptcha = () => {
8789
captchaDisable.value = false
8890
}
8991
90-
const captchaBtnName = ref('获取验证码')
9192
const captchaLoading = ref(false)
92-
const captchaDisable = ref(false)
9393
// 获取验证码
9494
const onCaptcha = async () => {
95+
if (captchaLoading.value) return
96+
const isInvalid = await formRef.value?.validateField('phone')
97+
if (isInvalid) return
9598
try {
96-
if (captchaLoading.value) return
97-
const isInvalid = await formRef.value?.validateField('phone')
98-
if (isInvalid) return
9999
captchaLoading.value = true
100100
captchaBtnName.value = '发送中...'
101101
// await getSmsCaptcha({

src/views/setting/components/Card.vue

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

0 commit comments

Comments
 (0)