Files
bodyWeight/miniprogram/api/user.ts
T
17792275749andClaude Sonnet 4.6 83d909b95b refactor: 项目重构,仅保留 login 和 supplementPersonal 页面
删除 11 个旧页面、组件、lefu SDK、旧资源文件。
新增 request 封装(GET/POST/PUT)、api 层、utils/common 身份证工具。
重写 login(登录流程提取到 app.ts) 和 supplementPersonal(简化表单逻辑)。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-10 14:21:00 +08:00

51 lines
1.3 KiB
TypeScript

import { get, post, put } from '../utils/request/index'
export interface UserInfo {
id: string
userId: string
parentUserId: string | null
scaleDeviceId: string
deviceId: string | null
deviceType: string
dataType: number
userType: string | null
idCard: string
height: number
weight: number
birthday: string
sex: number
avatar: string | null
phone: string | null
thirdId: string
realname: string
bmi: number
createBy: string
createTime: string
updateBy: string | null
updateTime: string | null
delFlag: number
sn: string | null
workNo: string | null
remark: string | null
relationType: string | null
sex_dictText: string
connectDeviceInfo: string
}
export interface LoginResult {
user: UserInfo | null
token: string
}
/** OpenID 登录 */
export const checkOpenIdLogin = (code: string) =>
post<LoginResult>('weighingScale/v2/checkOpenIdLogin', { code })
/** 根据身份证号查询用户信息 */
export const getUserInfoByIdCard = (params: { sn: string; idCard: string; realname: string }) =>
get<UserInfo | null>('weighingScale/v3/getUserInfoByIdcard', params, { loading: false })
/** 更新用户信息 */
export const updateUser = (data: Record<string, any>) =>
put<UserInfo>('weighingScale/v3/update/user', data)