完善表单校验与公共数据逻辑

Co-Authored-By: Kimi-K3.1-Pro <noreply@moonshot.ai>
This commit is contained in:
lik
2026-10-24 18:49:02 +08:00
committed by trae-solo-agent
co-authored by Kimi-K3.1-Pro
parent d731fc1da3
commit a45a3d7a86
18 changed files with 496 additions and 336 deletions
+22 -6
View File
@@ -1,12 +1,23 @@
<view class="container">
<!-- 编辑模式先等待档案回填;加载失败时展示真实错误态,不露出可保存的空表单。 -->
<view class="page-state" wx:if="{{loading}}">
<t-loading size="48rpx" />
<text class="page-state-text">正在加载就诊人信息</text>
</view>
<view class="page-state" wx:if="{{isEdit && !loading && loadError}}">
<text class="page-state-text">{{loadError}}</text>
<view class="page-retry" bindtap="retryLoad">重新加载</view>
</view>
<!-- 基本信息:通栏白块(白面 + 上下 2rpx 发丝线 + 中性阴影,圆角 0),
行内标签左走 --muted、值右走 --ink 700,与「个人信息」「邮寄地址」同一表单语言 -->
<view class="form-card">
<view class="form-card" wx:if="{{!loading && !loadError}}">
<view class="form-row">
<text class="form-label">姓名</text>
<input class="form-input" value="{{form.name}}" placeholder="请输入就诊人姓名" placeholder-class="form-placeholder"
maxlength="20" data-field="name" bindinput="onFieldInput" />
<text class="field-error" wx:if="{{errors.name}}">{{errors.name}}</text>
</view>
<view class="form-row">
@@ -28,34 +39,39 @@
{{form.birth || '请选择出生年月'}}
</view>
</picker>
<text class="field-error" wx:if="{{errors.birth}}">{{errors.birth}}</text>
</view>
<view class="form-row">
<text class="form-label">联系电话</text>
<input class="form-input" value="{{form.mobile}}" type="number" placeholder="用于陪诊师联系您" placeholder-class="form-placeholder"
maxlength="11" data-field="mobile" bindinput="onFieldInput" />
<text class="field-error" wx:if="{{errors.mobile}}">{{errors.mobile}}</text>
</view>
<view class="form-row form-row-last">
<text class="form-label">证件号</text>
<input class="form-input" value="{{form.idnumber}}" placeholder="选填,用于医院建档取号" placeholder-class="form-placeholder"
maxlength="30" data-field="idnumber" bindinput="onFieldInput" />
maxlength="18" data-field="idnumber" bindinput="onFieldInput" />
<text class="field-error" wx:if="{{errors.idnumber}}">{{errors.idnumber}}</text>
</view>
</view>
<!-- 健康信息:身高/体重是短输入,沿用行内表单语言(标签左、值右);健康备注是多行输入,
无法与标签同排,故留在本块末尾单独一排——标签在上、文本域在下、字数右下 -->
<view class="form-card">
<view class="form-card" wx:if="{{!loading && !loadError}}">
<view class="form-row">
<text class="form-label">身高(cm)</text>
<input class="form-input" value="{{form.height}}" type="digit" placeholder="选填,单位 cm" placeholder-class="form-placeholder"
maxlength="5" data-field="height" bindinput="onFieldInput" />
<text class="field-error" wx:if="{{errors.height}}">{{errors.height}}</text>
</view>
<view class="form-row">
<text class="form-label">体重(kg)</text>
<input class="form-input" value="{{form.weight}}" type="digit" placeholder="选填,单位 kg" placeholder-class="form-placeholder"
maxlength="5" data-field="weight" bindinput="onFieldInput" />
<text class="field-error" wx:if="{{errors.weight}}">{{errors.weight}}</text>
</view>
<view class="form-remark">
@@ -66,14 +82,14 @@
</view>
</view>
<view class="tips">
<view class="tips" wx:if="{{!loading && !loadError}}">
<t-icon name="lock-on" class="tips-icon" size="26rpx" />
<text class="tips-text">信息仅用于陪诊服务,我们会严格保密</text>
</view>
<!-- 保存是本页唯一的实心暖橙块,独占「全页同类实心块不超过一处」的额度 -->
<view class="footer-bar">
<view class="footer-bar" wx:if="{{!loading && !loadError}}">
<button class="primary-btn {{saving ? 'primary-btn-disabled' : ''}}" bindtap="onSave">保存</button>
</view>
</view>
</view>