Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 个人中心email与phone验证 #1934

Merged
merged 30 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3c175ef
fix:修复表格organization页面下表格未铺满时,数据和分页器之间空了一大段的问题
Aug 27, 2024
72604a2
feat:个人中心修改 phone 和 email 需要进行验证码验证(完成UI)
Aug 29, 2024
12052f5
feat:封装倒计时hook,用于button倒计时
Aug 29, 2024
b812ab5
feat:增加postPersonalCenterUserPhoneCaptcha和
Aug 30, 2024
24698c3
feat:移除验证icon及字体
Aug 30, 2024
ad45b98
refactor: 将个人中心-修改验证邮箱手机号逻辑迁移至
Aug 30, 2024
747b090
feat:个人中心-修改验证邮箱手机号增加校验
Aug 30, 2024
c158f69
feat:个人中心email phone验证UI基本完成,准备开始接口调试
Sep 2, 2024
f1689df
feat: 个人中心代码遗漏
Sep 2, 2024
cf8c9e8
feat:补充个人中心index遗失的代码
Sep 2, 2024
06570bd
feat:完善验证Dialog的验证ui,并在打开dialog时同步区号、邮箱、电话
Sep 2, 2024
aab1311
feat:接口联调基本完毕
Sep 3, 2024
377433e
fix:修复editable_directly自定义修改邮箱[204]成功后,重新请求数据,发现邮箱
Sep 3, 2024
9a943e7
Merge branch 'main' into feat/personal-center-validate
Sep 4, 2024
0de67be
Merge branch 'main' into feat/personal-center-validate
Sep 6, 2024
8808d8b
style: 处理unknown word
Sep 6, 2024
b2b6dae
fix: 修复手机号更新后,切换option时不同步新手机号的问题
Sep 9, 2024
e66dd05
Merge branch 'main' into feat/personal-center-validate
Sep 10, 2024
88fa404
Merge branch 'main' into feat/personal-center-validate
Sep 10, 2024
8df84f7
style: 修改bk-select line-height对其bk-input,并使二者贴合
Sep 10, 2024
e21617e
feat:验证码错误不再直接关闭dialog,去除修改、验证失败的infobox
Sep 10, 2024
5dd4d2f
feat:优化验证码错误展示逻辑,调整select与input的间隙
Sep 10, 2024
c66eb2c
refactor: 优化patchUsersEmail,patchUsersPhone写法
Sep 10, 2024
021d1fa
fix:修复个人中心验证码若干问题
Sep 11, 2024
a018cc6
Merge branch 'main' into feat/personal-center-validate
Sep 11, 2024
d09797a
Merge branch 'main' into feat/personal-center-validate
Sep 11, 2024
a1a6daf
Merge branch 'main' into feat/personal-center-validate
Sep 13, 2024
47483b0
Merge branch 'main' into feat/personal-center-validate
Sep 13, 2024
f59b5d3
fix:修改完自定义手机号,点击编辑邮箱,邮箱的数据会变成手机号
Sep 13, 2024
ed10756
fix:修改完手机号,邮箱,不展示最新数据
Sep 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions src/pages/src/views/personal-center/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,9 @@
:current-verify-config="currentVerifyConfig"
:user-id="currentUserInfo.id"
:cur-email-text="curEmail"
:cur-phone-text="curPhone">
:cur-phone-text="curPhone"
@confirm-verify-email="verifyEmail"
@confirm-verify-phone="verifyPhone">
</verifyIdentityInfoDialog>
</template>
</bk-resize-layout>
Expand Down Expand Up @@ -714,11 +716,19 @@ const changeEmail = async () => {
Message({ theme: 'success', message: t('保存成功') });
});
};

const verifyEmail = (data: any) => {
isEditEmail.value = false;
isEditing();
isInheritedEmail.value = false;
customEmail.value = data.custom_email;
currentUserInfo.value.custom_email = data.custom_email;
};

// 取消编辑邮箱
const cancelEditEmail = () => {
currentUserInfo.value.is_inherited_email = isInheritedEmail.value;
currentUserInfo.value.custom_email = customEmail.value;
emailSelect.value = isInheritedEmail.value ? OpenDialogSelect.inherit : OpenDialogSelect.custom
isEditEmail.value = false;
isEditing();
};
Expand All @@ -731,13 +741,13 @@ watch(() => isEditPhone.value, (val) => {
}
});

const emailSelect = ref(currentUserInfo.value.is_inherited_email === false
const emailSelect = computed(() => (currentUserInfo.value.is_inherited_email === false
? OpenDialogSelect.custom
: OpenDialogSelect.inherit);
: OpenDialogSelect.inherit));

const phoneSelect = ref(currentUserInfo.value.is_inherited_phone === false
const phoneSelect = computed(() => (currentUserInfo.value.is_inherited_phone === false
? OpenDialogSelect.custom
: OpenDialogSelect.inherit);
: OpenDialogSelect.inherit));

// 切换手机号
const togglePhone = (value: OpenDialogSelect) => {
Expand All @@ -762,16 +772,26 @@ const changePhone = () => {
isEditPhone.value = false;
isEditing();
isInheritedPhone.value = currentUserInfo.value.is_inherited_phone;
customEmail.value = currentUserInfo.value.custom_phone;
customPhone.value = currentUserInfo.value.custom_phone;
Message({ theme: 'success', message: t('保存成功') });
});
};

const verifyPhone = (data: any) => {
isEditPhone.value = false;
isEditing();
isInheritedPhone.value = false;
customPhone.value = data.custom_phone;
currentUserInfo.value.custom_phone = data.custom_phone;
customPhoneCode.value = data.custom_phone_country_code;
currentUserInfo.value.custom_phone_country_code = data.custom_phone_country_code;
};

// 取消编辑手机号
const cancelEditPhone = () => {
currentUserInfo.value.is_inherited_phone = isInheritedPhone.value;
currentUserInfo.value.custom_phone = customPhone.value;
currentUserInfo.value.custom_phone_country_code = customPhoneCode.value;
phoneSelect.value = isInheritedPhone.value ? OpenDialogSelect.inherit : OpenDialogSelect.custom
isEditPhone.value = false;
telError.value = false;
isEditing();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { InfoBox, Message, overflowTitle } from 'bkui-vue';
import type { Props as BkInfoBoxConfig } from 'bkui-vue/lib/info-box/info-box';
import { computed, defineModel, defineProps, PropType, reactive, ref, watch } from 'vue';
import { computed, defineEmits, defineModel, defineProps, PropType, reactive, ref, watch } from 'vue';

import { formItemPropName, openDialogResult, OpenDialogType } from './openDialogType';

Expand Down Expand Up @@ -119,6 +119,7 @@ const props = defineProps({
},
});

const emit = defineEmits(['confirmVerifyEmail', 'confirmVerifyPhone']);
const isShow = defineModel<boolean>('isShow', { required: true });
const telError = ref(false);

Expand Down Expand Up @@ -282,6 +283,7 @@ const handleSubmitVerifyForm = async () => {
verification_code: verifyForm.captcha,
}, { globalError: false });
infoBoxConfig.title = t('邮箱验证成功');
emit('confirmVerifyEmail', { custom_email: verifyForm.email });
} catch (err: any) {
captchaMessage.value = err.response.data?.error?.message;
infoBoxConfig.type = fail;
Expand All @@ -298,6 +300,10 @@ const handleSubmitVerifyForm = async () => {
verification_code: verifyForm.captcha,
}, { globalError: false });
infoBoxConfig.title = t('手机号验证成功');
emit('confirmVerifyPhone', {
custom_phone: verifyForm.custom_phone,
custom_phone_country_code: verifyForm.custom_phone_country_code,
});
} catch (err: any) {
captchaMessage.value = err.response.data?.error?.message;
infoBoxConfig.type = fail;
Expand Down