优化了页面;增加了陪诊师页面
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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,21 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 健康备注:多行输入无法与标签同排,单独一块——标签在上、文本域在下、字数右下 -->
|
||||
<!-- 健康信息:身高/体重是短输入,沿用行内表单语言(标签左、值右);健康备注是多行输入,
|
||||
无法与标签同排,故留在本块末尾单独一排——标签在上、文本域在下、字数右下 -->
|
||||
<view class="form-card">
|
||||
<view class="form-row">
|
||||
<text class="form-label">身高</text>
|
||||
<input class="form-input" value="{{form.height}}" type="digit" placeholder="选填,单位 cm" placeholder-class="form-placeholder"
|
||||
maxlength="5" data-field="height" bindinput="onFieldInput" />
|
||||
</view>
|
||||
|
||||
<view class="form-row">
|
||||
<text class="form-label">体重</text>
|
||||
<input class="form-input" value="{{form.weight}}" type="digit" placeholder="选填,单位 kg" placeholder-class="form-placeholder"
|
||||
maxlength="5" data-field="weight" bindinput="onFieldInput" />
|
||||
</view>
|
||||
|
||||
<view class="form-remark">
|
||||
<text class="form-label">健康备注</text>
|
||||
<textarea class="form-textarea" value="{{form.remark}}" placeholder="选填,如过敏史、慢病、行动不便等情况,便于陪诊师提前准备"
|
||||
|
||||
Reference in New Issue
Block a user