Files
bodyWeight/miniprogram/api/user.ts
T

54 lines
1.5 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
secondDepart: string | null
thirdDepart: string | null
remark: string | null
relationType: string | null
sex_dictText: string
connectDeviceInfo: string
flag?: number | null
}
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/v6/getUserInfoByIdcard', params, { loading: true, loadingTitle: '正在查询用户信息' })
/** 更新当前登录微信用户信息 */
export const updateUser = (data: Record<string, any>) =>
put<UserInfo>('weighingScale/v6/update/user', data)