diff --git a/src/api/user/index.ts b/src/api/user/index.ts index 43c2d904..5339d0c2 100644 --- a/src/api/user/index.ts +++ b/src/api/user/index.ts @@ -20,3 +20,10 @@ export async function updateUserBioApi(request: User.UserUpdateBioRequestData) { const response = await fetchPut(url, request) return response } + +// 获取用户邮箱 +export async function getUserEmailApi(uid: number) { + const url = `/user/${uid}/email` + const response = await fetchGet(url) + return response +} diff --git a/src/api/user/types/user.ts b/src/api/user/types/user.ts index b43cfade..be6b0599 100644 --- a/src/api/user/types/user.ts +++ b/src/api/user/types/user.ts @@ -25,3 +25,7 @@ export interface UserUpdateBioRequestData { export type UserInfoResponseData = KUNGalgameResponseData export type UserUpdateBioResponseData = KUNGalgameResponseData<{}> + +export type UserGetUserEmailResponseData = KUNGalgameResponseData<{ + email: string +}> diff --git a/src/store/modules/kungalgamer.ts b/src/store/modules/kungalgamer.ts index fdcb4c32..f3373c85 100644 --- a/src/store/modules/kungalgamer.ts +++ b/src/store/modules/kungalgamer.ts @@ -20,9 +20,10 @@ import type { UserInfoResponseData, UserUpdateBioRequestData, UserUpdateBioResponseData, + UserGetUserEmailResponseData, } from '@/api' -import { getUserByUidApi, updateUserBioApi } from '@/api' +import { getUserByUidApi, updateUserBioApi, getUserEmailApi } from '@/api' // kungalgame store 类型 import { KUNGalgamerStore } from '../types/kungalgamer' @@ -125,5 +126,11 @@ export const useKUNGalgameUserStore = defineStore({ } return updateUserBioApi(request) }, + + // 获取用户邮箱 + async getEmail(): Promise { + const uid = this.uid + return getUserEmailApi(uid) + }, }, }) diff --git a/src/views/kungalgamer/content/Password.vue b/src/views/kungalgamer/content/Password.vue index 97c0714e..9201002d 100644 --- a/src/views/kungalgamer/content/Password.vue +++ b/src/views/kungalgamer/content/Password.vue @@ -1,34 +1,46 @@ @@ -36,48 +48,11 @@ const props = defineProps<{