feat(user): 补充个人信息页接入身份证已存在复用弹框与登录引导
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
9911dea32f
commit
90f84cc7df
@@ -1,47 +1,4 @@
|
||||
/** 身份证解析结果 */
|
||||
export interface IdCardParsed {
|
||||
/** 性别文本(男/女),解析失败返回空字符串 */
|
||||
gender: string
|
||||
/** 年龄文本,解析失败返回空字符串 */
|
||||
age: string
|
||||
/** 生日 YYYY-MM-DD */
|
||||
birthday: string
|
||||
/** 性别 1=男 2=女 */
|
||||
sex: number
|
||||
}
|
||||
|
||||
/** storage 中 userInfo 的类型 */
|
||||
export interface StorageUserInfo {
|
||||
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
|
||||
}
|
||||
import type { IdCardParsed } from './types'
|
||||
|
||||
/** 校验身份证号格式是否合法 */
|
||||
export const isIdCardValid = (idCard: string): boolean => {
|
||||
@@ -69,7 +26,6 @@ export const parseIdCard = (idCard: string): IdCardParsed => {
|
||||
|
||||
// 计算年龄
|
||||
const now = new Date()
|
||||
const birth = new Date(year, month - 1, day)
|
||||
let age = now.getFullYear() - year
|
||||
if (now.getMonth() < month - 1 || (now.getMonth() === month - 1 && now.getDate() < day)) {
|
||||
age--
|
||||
@@ -0,0 +1,11 @@
|
||||
/** 身份证解析结果 */
|
||||
export interface IdCardParsed {
|
||||
/** 性别文本(男/女),解析失败返回空字符串 */
|
||||
gender: string
|
||||
/** 年龄文本,解析失败返回空字符串 */
|
||||
age: string
|
||||
/** 生日 YYYY-MM-DD */
|
||||
birthday: string
|
||||
/** 性别 1=男 2=女 */
|
||||
sex: number
|
||||
}
|
||||
@@ -27,7 +27,7 @@ const request = <T = any>(
|
||||
|
||||
const header: Record<string, string> = { 'content-type': contentType }
|
||||
const token = wx.getStorageSync('token') as string
|
||||
if (token) header['abtoken'] = token
|
||||
if (token) header['X-Access-Token'] = token
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.request({
|
||||
|
||||
Reference in New Issue
Block a user