diff --git a/src/constants/httpMsg/register/EditStatusMsg.ts b/src/constants/httpMsg/register/EditStatusMsg.ts index aeb4b7dc..1328ab7f 100644 --- a/src/constants/httpMsg/register/EditStatusMsg.ts +++ b/src/constants/httpMsg/register/EditStatusMsg.ts @@ -6,6 +6,7 @@ export interface EditRequest { gender?: Gender; password?: string; email?: string; + qq_account?: string; } export type EditResponse = HttpRes<{ diff --git a/src/constants/httpMsg/register/InfoStatusMsg.ts b/src/constants/httpMsg/register/InfoStatusMsg.ts index b64d21ad..54a9d968 100644 --- a/src/constants/httpMsg/register/InfoStatusMsg.ts +++ b/src/constants/httpMsg/register/InfoStatusMsg.ts @@ -11,6 +11,7 @@ export interface InfoData { join_time: string; groups: string[]; lark_union_id: string; + qq_account: string; } export type getInfoResponse = HttpRes; diff --git a/src/constants/httpMsg/register/RegisterStatusMsg.ts b/src/constants/httpMsg/register/RegisterStatusMsg.ts index 21e8d92a..60189886 100644 --- a/src/constants/httpMsg/register/RegisterStatusMsg.ts +++ b/src/constants/httpMsg/register/RegisterStatusMsg.ts @@ -8,6 +8,7 @@ export interface RegisterRequest { password: string; validate_code: string; email: string; + qq_account: string; } export type RegisterResponse = HttpRes<{ diff --git a/src/views/login/components/register-form.vue b/src/views/login/components/register-form.vue index 6e3b8a5c..649598f5 100644 --- a/src/views/login/components/register-form.vue +++ b/src/views/login/components/register-form.vue @@ -79,6 +79,28 @@ + + + + + = register(oPostData); res.then((response) => { diff --git a/src/views/login/type/index.ts b/src/views/login/type/index.ts index 1a591478..d322e102 100644 --- a/src/views/login/type/index.ts +++ b/src/views/login/type/index.ts @@ -32,6 +32,7 @@ export interface RegisterFormInfo { password: string; validateCode: string; email: string; + qq: string; } export interface RegisterStore { diff --git a/src/views/user/editInfo/index.vue b/src/views/user/editInfo/index.vue index 4d7e75dc..4b225ace 100644 --- a/src/views/user/editInfo/index.vue +++ b/src/views/user/editInfo/index.vue @@ -147,6 +147,28 @@ + + + + + (() => [ label: t('edit.email'), value: userInfo.value.email, }, + { + label: t('edit.qq'), + value: userInfo.value.qq, + }, ]); const checkScreenSize = throttle( diff --git a/src/views/user/editInfo/store/useEdit.ts b/src/views/user/editInfo/store/useEdit.ts index ded94787..da580225 100644 --- a/src/views/user/editInfo/store/useEdit.ts +++ b/src/views/user/editInfo/store/useEdit.ts @@ -31,6 +31,7 @@ const useEditStore = defineStore('edit', () => { gender: null, password: '', email: '', + qq: '', }); const userInfo = reactive({ @@ -40,6 +41,7 @@ const useEditStore = defineStore('edit', () => { email: '', roles: [], groups: [], + qq: '', }); const avatarName = computed(() => userInfo.name.slice(0, 1)); @@ -59,7 +61,7 @@ const useEditStore = defineStore('edit', () => { const oPostData: EditRequest = {}; - const optionalSet = (key: keyof EditRequest) => { + const optionalSet = (key: keyof EditFormInfo) => { if (!editFormInfo[key]) return; if (key === 'password') { @@ -67,12 +69,21 @@ const useEditStore = defineStore('edit', () => { return; } + if (key === 'qq') { + if (editFormInfo.qq !== userInfo.qq) { + oPostData.qq_account = editFormInfo.qq; + } + return; + } + if (editFormInfo[key] !== userInfo[key]) { - oPostData[key] = editFormInfo[key] as any; + oPostData[key as keyof EditRequest] = editFormInfo[key] as any; } }; - (Object.keys(editFormInfo) as (keyof EditRequest)[]).forEach(optionalSet); + (Object.keys(editFormInfo) as (keyof EditFormInfo)[]).forEach( + optionalSet, + ); const res: Promise = edit(oPostData); res.then((response) => { @@ -104,10 +115,12 @@ const useEditStore = defineStore('edit', () => { userInfo.email = response.data.email; userInfo.roles = response.data.roles; userInfo.groups = response.data.groups; + userInfo.qq = response.data.qq_account; editFormInfo.name = userInfo.name; editFormInfo.gender = userInfo.gender; editFormInfo.email = userInfo.email; + editFormInfo.qq = userInfo.qq; resolve(response.data); } diff --git a/src/views/user/editInfo/type/index.ts b/src/views/user/editInfo/type/index.ts index f1691f31..abdc03d3 100644 --- a/src/views/user/editInfo/type/index.ts +++ b/src/views/user/editInfo/type/index.ts @@ -11,6 +11,7 @@ export interface EditFormInfo { gender: Gender | null; password: string; email: string; + qq: string; } export interface UserInfo { @@ -20,6 +21,7 @@ export interface UserInfo { email: InfoData['email']; roles: InfoData['roles']; groups: InfoData['groups']; + qq: InfoData['qq_account']; } export interface PermissionFormInfo {