diff --git a/src/apis/auth/type.ts b/src/apis/auth/type.ts index 22bbf3b..45b5a2c 100644 --- a/src/apis/auth/type.ts +++ b/src/apis/auth/type.ts @@ -7,6 +7,7 @@ export interface UserInfo { email: string phone: string avatar: string + pwdResetTime: string registrationDate: string deptName: string roles: string[] diff --git a/src/apis/system/index.ts b/src/apis/system/index.ts index d4310b5..6f38158 100644 --- a/src/apis/system/index.ts +++ b/src/apis/system/index.ts @@ -2,9 +2,9 @@ export * from './user' export * from './role' export * from './menu' export * from './dept' -export * from '../monitor/log' +export * from './announcement' export * from './dict' export * from './file' export * from './storage' export * from './option' -export * from './announcement' +export * from './user-center' diff --git a/src/apis/system/user-center.ts b/src/apis/system/user-center.ts new file mode 100644 index 0000000..3b179e0 --- /dev/null +++ b/src/apis/system/user-center.ts @@ -0,0 +1,39 @@ +import http from '@/utils/http' +import type * as System from '@/apis/system/type' + +const BASE_URL = '/system/user' + +/** @desc 修改用户基本信息 */ +export function updateUserBaseInfo(data: { nickname: string; gender: number }) { + return http.patch(`${BASE_URL}/basic/info`, data) +} + +/** @desc 修改密码 */ +export function updateUserPassword(data: { oldPassword: string; newPassword: string }) { + return http.patch(`${BASE_URL}/password`, data) +} + +/** @desc 修改手机号 */ +export function updateUserPhone(data: { newPhone: string; captcha: string; currentPassword: string }) { + return http.patch(`${BASE_URL}/phone`, data) +} + +/** @desc 修改邮箱 */ +export function updateUserEmail(data: { newEmail: string; captcha: string; currentPassword: string }) { + return http.patch(`${BASE_URL}/email`, data) +} + +/** @desc 获取绑定的三方账号 */ +export function listUserSocial() { + return http.get(`${BASE_URL}/social`) +} + +/** @desc 绑定三方账号 */ +export function bindSocialAccount(source: string, data: any) { + return http.post(`${BASE_URL}/social/${source}`, data) +} + +/** @desc 解绑三方账号 */ +export function unbindSocialAccount(source: string) { + return http.del(`${BASE_URL}/social/${source}`) +} diff --git a/src/apis/system/user.ts b/src/apis/system/user.ts index 547a574..2832bbb 100644 --- a/src/apis/system/user.ts +++ b/src/apis/system/user.ts @@ -37,25 +37,3 @@ export function exportUser(query: System.UserQuery) { export function resetUserPwd(data: any, id: string) { return http.patch(`${BASE_URL}/${id}/password`, data) } - -/** @desc 修改用户基础信息 */ -export function updateUserBaseInfo(data: { nickname?: string; gender?: number }) { - return http.patch(`${BASE_URL}/basic/info`, data) -} - -/** @desc 修改邮箱 */ -export function updateUserEmail(data: { newEmail: string; captcha: string; currentPassword: string }) { - return http.patch(`${BASE_URL}/email`, data) -} -/**@desc 绑定三方账号 */ -export function bindSocialAccount(source: string, data: any) { - return http.post(`${BASE_URL}/social/${source}`, data) -} -/**@desc 获取绑定的三方账号 */ -export function getSocialAccount() { - return http.get(`${BASE_URL}/social`) -} -/**@desc 解绑三方账号 */ -export function unbindSocialAccount(source: string) { - return http.del(`${BASE_URL}/social/${source}`) -} diff --git a/src/stores/modules/user.ts b/src/stores/modules/user.ts index 7d809e9..45c3081 100644 --- a/src/stores/modules/user.ts +++ b/src/stores/modules/user.ts @@ -26,6 +26,7 @@ const storeSetup = () => { email: '', phone: '', avatar: '', + pwdResetTime: '', registrationDate: '', deptName: '', roles: [], diff --git a/src/styles/global.scss b/src/styles/global.scss index 5b4bfe4..3823bc1 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -313,6 +313,12 @@ .btn { height: 28px; width: 56px; + &:hover { + -webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, .15); + box-shadow: 0 2px 3px rgba(0, 0, 0, .15); + border-color: rgb(var(--primary-5)); + color: var(--color-text-2); + } } } } diff --git a/src/views/login/components/email/index.vue b/src/views/login/components/email/index.vue index c0449e3..47dd6b1 100644 --- a/src/views/login/components/email/index.vue +++ b/src/views/login/components/email/index.vue @@ -74,8 +74,10 @@ const handleLogin = async () => { } } -const captchaTime = ref(60) const captchaTimer = ref() +const captchaTime = ref(60) +const captchaBtnName = ref('获取验证码') +const captchaDisable = ref(false) // 重置验证码 const resetCaptcha = () => { window.clearInterval(captchaTimer.value) @@ -84,15 +86,13 @@ const resetCaptcha = () => { captchaDisable.value = false } -const captchaBtnName = ref('获取验证码') const captchaLoading = ref(false) -const captchaDisable = ref(false) // 获取验证码 const onCaptcha = async () => { + if (captchaLoading.value) return + const isInvalid = await formRef.value?.validateField('email') + if (isInvalid) return try { - if (captchaLoading.value) return - const isInvalid = await formRef.value?.validateField('email') - if (isInvalid) return captchaLoading.value = true captchaBtnName.value = '发送中...' // await getEmailCaptcha({ diff --git a/src/views/login/components/phone/index.vue b/src/views/login/components/phone/index.vue index 025d18c..0a2d29f 100644 --- a/src/views/login/components/phone/index.vue +++ b/src/views/login/components/phone/index.vue @@ -77,8 +77,10 @@ const handleLogin = async () => { } } -const captchaTime = ref(60) const captchaTimer = ref() +const captchaTime = ref(60) +const captchaBtnName = ref('获取验证码') +const captchaDisable = ref(false) // 重置验证码 const resetCaptcha = () => { window.clearInterval(captchaTimer.value) @@ -87,15 +89,13 @@ const resetCaptcha = () => { captchaDisable.value = false } -const captchaBtnName = ref('获取验证码') const captchaLoading = ref(false) -const captchaDisable = ref(false) // 获取验证码 const onCaptcha = async () => { + if (captchaLoading.value) return + const isInvalid = await formRef.value?.validateField('phone') + if (isInvalid) return try { - if (captchaLoading.value) return - const isInvalid = await formRef.value?.validateField('phone') - if (isInvalid) return captchaLoading.value = true captchaBtnName.value = '发送中...' // await getSmsCaptcha({ diff --git a/src/views/setting/components/Card.vue b/src/views/setting/components/Card.vue deleted file mode 100644 index 0cd061e..0000000 --- a/src/views/setting/components/Card.vue +++ /dev/null @@ -1,43 +0,0 @@ - - diff --git a/src/views/setting/components/VerifyModel.vue b/src/views/setting/components/VerifyModel.vue index 1c16398..fe8fb4b 100644 --- a/src/views/setting/components/VerifyModel.vue +++ b/src/views/setting/components/VerifyModel.vue @@ -1,107 +1,184 @@ + + diff --git a/src/views/setting/profile/LeftBox.vue b/src/views/setting/profile/LeftBox.vue index bc80448..47960c5 100644 --- a/src/views/setting/profile/LeftBox.vue +++ b/src/views/setting/profile/LeftBox.vue @@ -7,7 +7,7 @@
{{ userInfo.nickname }} - +
@@ -43,22 +43,81 @@
- + + + + diff --git a/src/views/setting/profile/RightBox.vue b/src/views/setting/profile/RightBox.vue index 32f4808..4365c97 100644 --- a/src/views/setting/profile/RightBox.vue +++ b/src/views/setting/profile/RightBox.vue @@ -24,7 +24,7 @@ v-if="item.jumpMode == 'modal'" class="btn" :type="item.status ? 'secondary' : 'primary'" - @click="openVerifyModel(item.type, item.status)" + @click="onUpdate(item.type, item.status)" > {{ item.status ? '修改' : '绑定' }} @@ -44,19 +44,15 @@ +