个人中心修改密码 & 会员个人信息

This commit is contained in:
Eamon
2026-09-09 16:25:32 +08:00
parent 7f03dbfb56
commit 8d8c9deba7
4 changed files with 74 additions and 60 deletions

View File

@@ -1,8 +1,14 @@
import type { ApiResponse } from "@/lib/api" import type { ApiResponse } from "@/lib/api"
import type { UserItem, UserQueryParams } from "@/lib/models/user" import type {
PhpUserModel,
UpdateUserInfoParams,
UpdateUserPwdParams,
UserItem,
UserQueryParams,
} from "@/lib/models/user"
import { callByUser, callPublic } from "./base" import { callByUser, callPublic } from "./base"
// ==================== 用户管理(.NET /api/baseinfo/v1/user/*) ==================== // ==================== 用户管理 ====================
export async function fetchUserPage( export async function fetchUserPage(
params: UserQueryParams, params: UserQueryParams,
@@ -43,21 +49,16 @@ export async function updateUserProfile(
) )
} }
// ==================== 个人中心资料/密码(.NET /user/*,cookie 会话) ==================== // ==================== 个人中心资料/密码 ====================
export async function updateUserInfo(data: { export async function updateUserInfo(
QQ: string data: UpdateUserInfoParams,
Wx: string ): Promise<ApiResponse<undefined>> {
// TaoBao: string return await callPublic<undefined>("/user/ApiUpdateInfo", data)
Email: string
}): Promise<ApiResponse<undefined>> {
return await callPublic<undefined>("/user/UpdateInfo", data)
} }
export async function updateUserPwd(data: { export async function updateUserPwd(
OldPwd: string data: UpdateUserPwdParams,
NewPwd: string ): Promise<ApiResponse<PhpUserModel>> {
ConfirmPwd: string return await callPublic<PhpUserModel>("/user/UpdatePwd", data)
}): Promise<ApiResponse<undefined>> {
return await callPublic<undefined>("/user/UpdatePwd", data)
} }

View File

@@ -59,22 +59,20 @@ export default function LoginPage() {
<Button <Button
variant="ghost" variant="ghost"
onClick={() => setTab("login")} onClick={() => setTab("login")}
className={`flex-1 py-2 rounded-md transition-all ${ className={`flex-1 py-2 rounded-md transition-all ${tab === "login"
tab === "login"
? "bg-white shadow-sm text-blue-600 font-medium" ? "bg-white shadow-sm text-blue-600 font-medium"
: "text-gray-600 hover:text-gray-900" : "text-gray-600 hover:text-gray-900"
}`} }`}
> >
登录 登录
</Button> </Button>
<Button <Button
variant="ghost" variant="ghost"
onClick={() => setTab("register")} onClick={() => setTab("register")}
className={`flex-1 py-2 rounded-md transition-all ${ className={`flex-1 py-2 rounded-md transition-all ${tab === "register"
tab === "register"
? "bg-white shadow-sm text-blue-600 font-medium" ? "bg-white shadow-sm text-blue-600 font-medium"
: "text-gray-600 hover:text-gray-900" : "text-gray-600 hover:text-gray-900"
}`} }`}
> >
注册 注册
</Button> </Button>
@@ -174,9 +172,9 @@ function LoginForm() {
tabIndex={-1} tabIndex={-1}
> >
{showPassword ? ( {showPassword ? (
<EyeOffIcon className="size-4" />
) : (
<EyeIcon className="size-4" /> <EyeIcon className="size-4" />
) : (
<EyeOffIcon className="size-4" />
)} )}
</button> </button>
</div> </div>

View File

@@ -1,39 +1,8 @@
// ==================== /user/ApiIndex 账户总览接口返回结构 ==================== import type { PhpUserModel } from "@/lib/models/user"
export type ApiIndexUserModel = { // ==================== 账户总览接口返回结构 ====================
apikey: string
TenantId: number export type ApiIndexUserModel = PhpUserModel
agent_id: number
jgday: number
LoginCode: string
Password: string
Name: string
Phone: string
Enabled: number
LastLoginDate: string
Sex: number
CreateType: number
ProductAccountCount: number
ExpiredProductAccountCount: number
RestAmount: number
ju_money: number
ConsumeAmount: number
Wx: string
QQ: string
Email: string
TestCountLimit: number
UseTestCount: number
ManagerId: number
ManagerName: string
id_code: string
is_verify: number
is_agent: number
parent_id: number
CreateTime: string
UpdateTime: string
DeleteTag: number
Id: number
}
export type ApiIndexAccountModel = { export type ApiIndexAccountModel = {
TotalCount: number TotalCount: number

View File

@@ -1,4 +1,3 @@
// 用户(.NET /api/baseinfo/v1/user/*,对应 UserEntity)
export type UserItem = { export type UserItem = {
Id: number Id: number
LoginCode: string LoginCode: string
@@ -14,3 +13,50 @@ export type UserQueryParams = {
PageSize?: number PageSize?: number
KeyWord?: string KeyWord?: string
} }
export type PhpUserModel = {
apikey: string
TenantId: number
agent_id: number
jgday: number
LoginCode: string
Password: string
Name: string
Phone: string
Enabled: number
LastLoginDate: string
Sex: number
CreateType: number
ProductAccountCount: number
ExpiredProductAccountCount: number
RestAmount: number
ju_money: number
ConsumeAmount: number
Wx?: string
QQ?: string
Email?: string
TestCountLimit: number
UseTestCount: number
ManagerId: number
ManagerName: string
id_code: string
is_verify: number
is_agent: number
parent_id: number
CreateTime: string
UpdateTime: string
DeleteTag: number
Id: number
}
export type UpdateUserInfoParams = {
QQ: string
Wx: string
Email: string
}
export type UpdateUserPwdParams = {
OldPwd: string
NewPwd: string
ConfirmPwd: string
}