优化了页面;增加了陪诊师页面
This commit is contained in:
@@ -26,6 +26,8 @@ Page({
|
||||
birth: '',
|
||||
mobile: '',
|
||||
idnumber: '',
|
||||
height: '',
|
||||
weight: '',
|
||||
remark: ''
|
||||
}
|
||||
},
|
||||
@@ -77,6 +79,9 @@ Page({
|
||||
birth: profile.birth || '',
|
||||
mobile: profile.mobile || '',
|
||||
idnumber: profile.idnumber || '',
|
||||
// 身高的 schema 默认值是 0,0 视为未填写,回填成空串而不是 "0"
|
||||
height: health.height ? String(health.height) : '',
|
||||
weight: health.weight ? String(health.weight) : '',
|
||||
remark: health.remark || ''
|
||||
}
|
||||
})
|
||||
@@ -150,9 +155,15 @@ Page({
|
||||
birth,
|
||||
mobile,
|
||||
idnumber,
|
||||
height,
|
||||
weight,
|
||||
remark
|
||||
} = this.data.form
|
||||
|
||||
// schema 里身高/体重是 Number,未填按 0(Number('') 即 0,非法输入 NaN 也回落 0)
|
||||
const heightNum = Number(height) || 0
|
||||
const weightNum = Number(weight) || 0
|
||||
|
||||
// 新增用嵌套对象(schema 的 new Model 需要嵌套结构);
|
||||
// 更新用点号路径(schema 更新姓名时会额外写 profile.pinyin,整体替换 profile 会冲突)
|
||||
const payload = this.data.isEdit ? {
|
||||
@@ -161,6 +172,8 @@ Page({
|
||||
'profile.birth': birth,
|
||||
'profile.mobile': mobile.trim(),
|
||||
'profile.idnumber': idnumber.trim(),
|
||||
'health.height': heightNum,
|
||||
'health.weight': weightNum,
|
||||
'health.remark': remark.trim()
|
||||
} : {
|
||||
profile: {
|
||||
@@ -171,6 +184,8 @@ Page({
|
||||
idnumber: idnumber.trim()
|
||||
},
|
||||
health: {
|
||||
height: heightNum,
|
||||
weight: weightNum,
|
||||
remark: remark.trim()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user