feat(addMember): 员工/家庭双tab完整改造,状态机控制查询展示
- 员工tab:编号输入+查询→三种状态(未查询/查不到/查到展示) - 家庭tab:familyInfo_卡片包裹,昵称/身份证/性别切换/出生年月/身高体重同行 - 切换tab或改编号即时清空查询结果 - 提交区分员工/家庭双模式校验,dataType写入payload Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
57950bd7c2
commit
4e4afd6958
@@ -129,7 +129,7 @@
|
||||
|
||||
.workNoInfo {
|
||||
width: 100%;
|
||||
padding-bottom: 100rpx;
|
||||
padding-bottom: 10rpx;
|
||||
|
||||
.workNoInfo_ {
|
||||
width: 100%;
|
||||
@@ -165,7 +165,34 @@
|
||||
}
|
||||
|
||||
.familyInfo {
|
||||
width: 100%;
|
||||
padding-bottom: 10rpx;
|
||||
|
||||
.familyInfo_ {
|
||||
width: 100%;
|
||||
border-radius: 16rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 0 30rpx 10rpx;
|
||||
margin-bottom: 40rpx;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.form-row {
|
||||
width: 100%;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
/* 身高体重同行 */
|
||||
.form-row-inline {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 24rpx;
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
.form-row-half {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-row {
|
||||
@@ -262,7 +289,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* 只读区域(单位 / 性别 / 年龄 / 出生年月) */
|
||||
/* 只读区域 */
|
||||
.form-readonly {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
@@ -319,19 +346,19 @@
|
||||
}
|
||||
|
||||
/* 从已有用户中选择(蓝色描边幽灵按钮) */
|
||||
// .ghost-btn {
|
||||
// color: #1385FA;
|
||||
// width: 580rpx;
|
||||
// height: 88rpx;
|
||||
// font-size: 32rpx;
|
||||
// font-weight: bold;
|
||||
// text-align: center;
|
||||
// line-height: 84rpx;
|
||||
// border-radius: 44rpx;
|
||||
// box-sizing: border-box;
|
||||
// border: 2rpx solid #1385FA;
|
||||
// margin: 0 auto;
|
||||
// }
|
||||
.ghost-btn {
|
||||
color: #1385FA;
|
||||
width: 580rpx;
|
||||
height: 88rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
line-height: 84rpx;
|
||||
border-radius: 44rpx;
|
||||
box-sizing: border-box;
|
||||
border: 2rpx solid #1385FA;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* 底部双按钮 */
|
||||
|
||||
@@ -44,18 +44,20 @@ interface UserInfoFromServer {
|
||||
interface MemberForm {
|
||||
/** 员工编号 */
|
||||
workNo: string
|
||||
/** 姓名 */
|
||||
/** 姓名 / 昵称 */
|
||||
name: string
|
||||
/** 身份证号 */
|
||||
idCard: string
|
||||
/** 性别(由身份证解析,只读) */
|
||||
/** 性别 */
|
||||
gender: string
|
||||
/** 年龄(由身份证解析,只读) */
|
||||
/** 年龄 */
|
||||
age: string
|
||||
/** 身高(cm) */
|
||||
height: string
|
||||
/** 体重(kg) */
|
||||
weight: string
|
||||
/** 1=男 2=女 */
|
||||
sex: number
|
||||
}
|
||||
|
||||
/** 身份证解析结果 */
|
||||
@@ -80,8 +82,9 @@ interface ExistingMember {
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑用户页
|
||||
* URL 参数含 userId 时为编辑模式,隐藏「从已有用户中选择」按钮并预填表单
|
||||
* 添加用户页
|
||||
* 员工 tab:员工编号查询 → 回填信息 → 补充身高体重
|
||||
* 家庭 tab:昵称/身份证/性别/出生年月/身高体重
|
||||
*/
|
||||
Page({
|
||||
data: {
|
||||
@@ -99,22 +102,31 @@ Page({
|
||||
gender: '',
|
||||
age: '',
|
||||
height: '',
|
||||
weight: ''
|
||||
weight: '',
|
||||
sex: 0,
|
||||
} as MemberForm,
|
||||
|
||||
/** 出生年月(家庭用户 date picker) */
|
||||
birthday: '',
|
||||
|
||||
/** 从抽屉选中的完整用户数据,提交时作为 base spread */
|
||||
selectedMember: null as ExistingMember | null,
|
||||
showSelectDrawer: false,
|
||||
/** 正在请求身份证查询接口 */
|
||||
querying: false,
|
||||
/** 是否已完成一次身份证查询(成功 200 即视为完成,无论 result 是否为 null) */
|
||||
/** 是否已完成一次身份证查询 */
|
||||
hasQueried: false,
|
||||
/** 接口返回的用户信息,姓名 + 身份证联动校正性别年龄 */
|
||||
/** 接口返回的用户信息 */
|
||||
serverResult: null as UserInfoFromServer | null,
|
||||
/** 表单只读状态(code=101 时置为 true) */
|
||||
readonly: false,
|
||||
/** 是否显示确认弹框 */
|
||||
showConfirmModal: false,
|
||||
|
||||
/** 员工编号是否已查询 */
|
||||
employeeQueried: false,
|
||||
/** 员工编号查询是否未找到 */
|
||||
employeeNotFound: false,
|
||||
},
|
||||
|
||||
onLoad(options: Record<string, string>) {
|
||||
@@ -141,24 +153,52 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
/** tabs 切换 */
|
||||
/** tabs 切换:清空查询结果、重置表单只读状态 */
|
||||
onTabTap(e: WechatMiniprogram.TouchEvent) {
|
||||
const tab = e.currentTarget.dataset.value as string
|
||||
this.setData({ userType: tab as 'employee' | 'family' })
|
||||
this.setData({
|
||||
userType: tab as 'employee' | 'family',
|
||||
employeeQueried: false,
|
||||
employeeNotFound: false,
|
||||
readonly: false,
|
||||
hasQueried: false,
|
||||
serverResult: null,
|
||||
'form.workNo': '',
|
||||
'form.name': '',
|
||||
'form.idCard': '',
|
||||
'form.gender': '',
|
||||
'form.age': '',
|
||||
'form.height': '',
|
||||
'form.weight': '',
|
||||
'form.sex': 0,
|
||||
birthday: '',
|
||||
selectedMember: null,
|
||||
})
|
||||
},
|
||||
|
||||
/** 员工编号变更即清空查询状态 */
|
||||
onWorkNoInput(e: WechatMiniprogram.Input) {
|
||||
this.setData({ 'form.workNo': e.detail.value })
|
||||
this.setData({
|
||||
'form.workNo': e.detail.value,
|
||||
employeeQueried: false,
|
||||
employeeNotFound: false,
|
||||
'form.name': '',
|
||||
'form.gender': '',
|
||||
'form.age': '',
|
||||
'form.height': '',
|
||||
'form.weight': '',
|
||||
})
|
||||
},
|
||||
|
||||
/** 员工编号查询(API 预留) */
|
||||
onQueryEmployee() {
|
||||
const workNo = this.data.form.workNo.trim()
|
||||
if (!workNo) {
|
||||
wx.showToast({ title: '请填写员工编号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
// TODO: 调用员工编号查询接口
|
||||
wx.showToast({ title: '员工编号查询功能待实现', icon: 'none' })
|
||||
// TODO: 接入员工编号查询接口
|
||||
wx.showToast({ title: '查询功能暂未开放', icon: 'none' })
|
||||
},
|
||||
|
||||
onNameInput(e: WechatMiniprogram.Input) {
|
||||
@@ -191,6 +231,21 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
/** 家庭用户性别切换 */
|
||||
onGenderTap(e: WechatMiniprogram.TouchEvent) {
|
||||
const value = e.currentTarget.dataset.value as string
|
||||
const sex = value === '男' ? 1 : 2
|
||||
this.setData({
|
||||
'form.gender': value,
|
||||
'form.sex': sex,
|
||||
})
|
||||
},
|
||||
|
||||
/** 出生年月变更 */
|
||||
onBirthdayChange(e: WechatMiniprogram.PickerChange) {
|
||||
this.setData({ birthday: e.detail.value as string })
|
||||
},
|
||||
|
||||
onHeightInput(e: WechatMiniprogram.Input) {
|
||||
this.setData({ 'form.height': e.detail.value })
|
||||
},
|
||||
@@ -199,6 +254,20 @@ Page({
|
||||
this.setData({ 'form.weight': e.detail.value })
|
||||
},
|
||||
|
||||
/** 从生日字符串计算周岁 */
|
||||
calcAge(birthday: string): number {
|
||||
if (!birthday) return 0
|
||||
const parts = birthday.split('-').map(Number)
|
||||
const [year, month, day] = parts
|
||||
if (!year || !month || !day) return 0
|
||||
const now = new Date()
|
||||
let age = now.getFullYear() - year
|
||||
const nowMonth = now.getMonth() + 1
|
||||
const nowDay = now.getDate()
|
||||
if (nowMonth < month || (nowMonth === month && nowDay < day)) age -= 1
|
||||
return Math.max(0, age)
|
||||
},
|
||||
|
||||
/**
|
||||
* 校验身份证格式:18 位,前 17 位数字,末位数字或 X
|
||||
*/
|
||||
@@ -233,10 +302,7 @@ Page({
|
||||
},
|
||||
|
||||
/**
|
||||
* 调用服务端接口校验身份证与姓名,成功后用接口返回的身份证重新计算性别年龄
|
||||
* result 为 null 视为「查无此人」,标记 hasQueried 允许新增提交
|
||||
* result.code 101 视为「信息已存在」,弹框提示并锁定表单
|
||||
* result.code 102 视为正常,走原有逻辑
|
||||
* 调用服务端接口校验身份证与姓名
|
||||
*/
|
||||
fetchUserInfoByIdCard(name: string, idCard: string) {
|
||||
if (this.data.querying) return
|
||||
@@ -250,7 +316,6 @@ Page({
|
||||
.then(res => {
|
||||
const serverResult = res.result
|
||||
if (!serverResult) {
|
||||
// 查无此人:用本地身份证解析补偿性别年龄
|
||||
wx.showToast({
|
||||
title: res.message || '未查询到用户信息',
|
||||
icon: 'none'
|
||||
@@ -297,7 +362,7 @@ Page({
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 查询失败保留本地解析结果,hasQueried 维持 false 以便用户重试时再次触发
|
||||
// 查询失败保留本地解析结果,hasQueried 维持 false
|
||||
})
|
||||
.finally(() => {
|
||||
this.setData({ querying: false })
|
||||
@@ -349,7 +414,8 @@ Page({
|
||||
gender: '',
|
||||
age: '',
|
||||
height: '',
|
||||
weight: ''
|
||||
weight: '',
|
||||
sex: 0,
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -359,68 +425,75 @@ Page({
|
||||
},
|
||||
|
||||
onSubmit() {
|
||||
const { name, idCard, gender, age, height, weight } = this.data.form
|
||||
const { name, idCard, gender, height, weight, sex } = this.data.form
|
||||
const { isEdit, userType } = this.data
|
||||
const heightNum = parseFloat(height)
|
||||
const weightNum = parseFloat(weight)
|
||||
|
||||
if (!name.trim()) {
|
||||
wx.showToast({ title: '请填写姓名', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (idCard.length !== 18) {
|
||||
wx.showToast({ title: '请填写正确的身份证号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!gender || !age) {
|
||||
wx.showToast({ title: '身份证号有误,请检查', icon: 'none' })
|
||||
if (userType === 'employee') {
|
||||
// 员工:必须查询成功
|
||||
if (!this.data.employeeQueried || this.data.employeeNotFound) {
|
||||
wx.showToast({ title: '请先查询员工信息', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!height || isNaN(heightNum) || heightNum <= 0) {
|
||||
wx.showToast({ title: '请填写身高', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!weight || isNaN(weightNum) || weightNum <= 0) {
|
||||
wx.showToast({ title: '请填写体重', icon: 'none' })
|
||||
} else {
|
||||
// 家庭用户
|
||||
if (!name.trim()) {
|
||||
wx.showToast({ title: '请填写昵称', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!this.data.hasQueried) {
|
||||
wx.showToast({ title: this.data.querying ? '身份信息验证中,请稍候' : '请检查姓名与身份证号', icon: 'none' })
|
||||
if (!gender) {
|
||||
wx.showToast({ title: '请选择性别', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!this.data.birthday.trim()) {
|
||||
wx.showToast({ title: '请填写出生年月', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!height || isNaN(heightNum) || heightNum <= 0) {
|
||||
wx.showToast({ title: '请填写身高', icon: 'none' })
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
const parsed = this.parseIdCard(idCard)
|
||||
const userInfo = wx.getStorageSync('userInfo')
|
||||
const connectDeviceInfoRaw = wx.getStorageSync('connectDeviceInfo')
|
||||
const serverResult = this.data.serverResult
|
||||
|
||||
// selectedMember(抽屉选中) → serverResult(接口校验,可能为 null) → 表单/本地解析(用户输入) 依次覆盖
|
||||
const baseSpread = userType === 'family' ? (this.data.selectedMember ?? {}) : {}
|
||||
const birthday = userType === 'family' ? this.data.birthday : ''
|
||||
const finalSex = userType === 'family' ? sex : this.data.form.sex
|
||||
|
||||
const payload: Record<string, any> = {
|
||||
...(this.data.selectedMember ?? {}),
|
||||
...(baseSpread),
|
||||
...(serverResult ?? {}),
|
||||
dataType: userType === 'family' ? 1 : 0,
|
||||
parentUserId: userInfo?.userId ?? '',
|
||||
sn: lefuService.deviceInfo?.serialNumber ?? '',
|
||||
scaleDeviceId: lefuService.deviceInfo?.serialNumber ?? '',
|
||||
workNo: this.data.form.workNo.trim(),
|
||||
realname: name.trim(),
|
||||
idCard,
|
||||
sex: parsed.sex,
|
||||
birthday: parsed.birthday,
|
||||
sex: finalSex,
|
||||
birthday,
|
||||
height: heightNum,
|
||||
weight: weightNum,
|
||||
weight: isNaN(weightNum) ? 0 : weightNum,
|
||||
connectDeviceInfo: connectDeviceInfoRaw ? JSON.stringify(connectDeviceInfoRaw) : '',
|
||||
}
|
||||
if (this.data.isEdit) {
|
||||
if (isEdit) {
|
||||
payload.id = this.data.userId
|
||||
}
|
||||
|
||||
const successMsg = this.data.isEdit ? '保存成功' : '添加成功'
|
||||
const failMsg = this.data.isEdit ? '保存失败,请重试' : '添加失败,请重试'
|
||||
const successMsg = isEdit ? '保存成功' : '添加成功'
|
||||
const failMsg = isEdit ? '保存失败,请重试' : '添加失败,请重试'
|
||||
|
||||
put('weighingScale/v3/edit/user', payload)
|
||||
.then(() => {
|
||||
wx.showToast({ title: successMsg, icon: 'success' })
|
||||
setTimeout(() => {
|
||||
// 通知上一页(equipmentMember)刷新用户列表
|
||||
const pages = getCurrentPages()
|
||||
const prevPage = pages[pages.length - 2] as any
|
||||
if (prevPage && prevPage.data?.sn) {
|
||||
|
||||
@@ -9,12 +9,17 @@
|
||||
<view class="form">
|
||||
<scroll-view scroll-y class="scrollView">
|
||||
<view class="scrollViewContent">
|
||||
<!-- 顶部胶囊式 tabs -->
|
||||
<view class="tabsDom">
|
||||
<view class="tabs">
|
||||
<view class="tab-item active">员工</view>
|
||||
<view class="tab-item">家庭用户</view>
|
||||
<view class="tab-item {{ userType === 'employee' ? 'active' : '' }}" bind:tap="onTabTap" data-value="employee">员工</view>
|
||||
<view class="tab-item {{ userType === 'family' ? 'active' : '' }}" bind:tap="onTabTap" data-value="family">家庭用户</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- ========== 员工 tab ========== -->
|
||||
<block wx:if="{{ userType === 'employee' }}">
|
||||
<!-- 员工编号输入 + 查询按钮 -->
|
||||
<view class="selectWorkNo">
|
||||
<view class="form-row">
|
||||
<view class="form-label">
|
||||
@@ -22,61 +27,48 @@
|
||||
<text class="label-star">*</text>
|
||||
</view>
|
||||
<view class="form-control">
|
||||
<view class="form-input-wrap">
|
||||
<input class="form-input" type="number" placeholder="请填写员工编号" placeholder-class="form-placeholder" />
|
||||
<input class="form-input" type="number" placeholder="请填写员工编号" placeholder-class="form-placeholder" value="{{ form.workNo }}" bind:input="onWorkNoInput" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="selectWorkNoBtn" bind:tap="onQueryEmployee">确认查询</view>
|
||||
</view>
|
||||
|
||||
<view class="selectWorkNoBtn">确认查询</view>
|
||||
</view>
|
||||
<!-- <view class="workNoDesc">输入员工编号后自动查询员工信息</view>
|
||||
<view class="workNoNull">未查询到员工信息,请确认员工编号是否正确</view> -->
|
||||
<view class="workNoInfo">
|
||||
<!-- 未查询 -->
|
||||
<view class="workNoDesc" wx:if="{{ !employeeQueried }}">输入员工编号后自动查询员工信息</view>
|
||||
|
||||
<!-- 查询未找到 -->
|
||||
<view class="workNoNull" wx:if="{{ employeeQueried && employeeNotFound }}">未查询到员工信息,请确认员工编号是否正确</view>
|
||||
|
||||
<!-- 查询成功 -->
|
||||
<view class="workNoInfo" wx:if="{{ employeeQueried && !employeeNotFound }}">
|
||||
<view class="workNoInfo_">
|
||||
<view class="workNoInfoTitle">用户信息</view>
|
||||
<view class="workNoInfoContent">
|
||||
<view>
|
||||
<view class="form-row">
|
||||
<view class="form-label">
|
||||
<text class="label-text">姓名</text>
|
||||
</view>
|
||||
<view class="form-label"><text class="label-text">姓名</text></view>
|
||||
<view class="form-control">
|
||||
<view class="form-readonly">
|
||||
<text class="readonly-text">{{ form.name }}</text>
|
||||
</view>
|
||||
<view class="form-readonly"><text class="readonly-text">{{ form.name }}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-row">
|
||||
<view class="form-label">
|
||||
<text class="label-text">单位</text>
|
||||
</view>
|
||||
<view class="form-label"><text class="label-text">单位</text></view>
|
||||
<view class="form-control">
|
||||
<view class="form-readonly">
|
||||
<text class="readonly-text">{{ form.name }}</text>
|
||||
</view>
|
||||
<view class="form-readonly"><text class="readonly-text">{{ form.workNo }}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view class="form-row" style="margin-bottom: 0;">
|
||||
<view class="form-label">
|
||||
<text class="label-text">性别</text>
|
||||
</view>
|
||||
<view class="form-label"><text class="label-text">性别</text></view>
|
||||
<view class="form-control">
|
||||
<view class="form-readonly">
|
||||
<text class="readonly-text">{{ form.name }}</text>
|
||||
</view>
|
||||
<view class="form-readonly"><text class="readonly-text">{{ form.gender }}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-row">
|
||||
<view class="form-label">
|
||||
<text class="label-text">年龄</text>
|
||||
</view>
|
||||
<view class="form-label"><text class="label-text">年龄</text></view>
|
||||
<view class="form-control">
|
||||
<view class="form-readonly">
|
||||
<text class="readonly-text">{{ form.name }}</text>
|
||||
</view>
|
||||
<view class="form-readonly"><text class="readonly-text">{{ form.age }}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -99,9 +91,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-row">
|
||||
<view class="form-label">
|
||||
<text class="label-text">体重</text>
|
||||
</view>
|
||||
<view class="form-label"><text class="label-text">体重</text></view>
|
||||
<view class="form-control">
|
||||
<view class="form-input-wrap">
|
||||
<input class="form-input form-input-with-suffix" type="digit" maxlength="6" placeholder="请填写体重" placeholder-class="form-placeholder" value="{{ form.weight }}" bind:input="onWeightInput" />
|
||||
@@ -113,12 +103,93 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="familyInfo"></view>
|
||||
</block>
|
||||
|
||||
<!-- ========== 家庭用户 tab ========== -->
|
||||
<block wx:else>
|
||||
<view class="familyInfo">
|
||||
<view class="familyInfo_">
|
||||
<!-- 昵称 -->
|
||||
<view class="form-row">
|
||||
<view class="form-label">
|
||||
<text class="label-text">昵称</text>
|
||||
<text class="label-star">*</text>
|
||||
</view>
|
||||
<view class="form-control">
|
||||
<input class="form-input" type="text" maxlength="20" placeholder="请填写昵称" placeholder-class="form-placeholder" value="{{ form.name }}" disabled="{{ readonly }}" bind:input="onNameInput" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 身份证号码 -->
|
||||
<view class="form-row">
|
||||
<view class="form-label"><text class="label-text">身份证号</text></view>
|
||||
<view class="form-control">
|
||||
<input class="form-input" type="idcard" maxlength="18" placeholder="请填写身份证号" placeholder-class="form-placeholder" value="{{ form.idCard }}" disabled="{{ readonly }}" bind:input="onIdCardInput" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 性别(左右切换) -->
|
||||
<view class="form-row">
|
||||
<view class="form-label">
|
||||
<text class="label-text">性别</text>
|
||||
<text class="label-star">*</text>
|
||||
</view>
|
||||
<view class="form-control">
|
||||
<view class="gender-toggle">
|
||||
<view class="gender-option {{ form.gender === '男' ? 'gender-option-active' : '' }}" data-value="男" bind:tap="onGenderTap">男</view>
|
||||
<view class="gender-option {{ form.gender === '女' ? 'gender-option-active' : '' }}" data-value="女" bind:tap="onGenderTap">女</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 出生年月 -->
|
||||
<view class="form-row">
|
||||
<view class="form-label">
|
||||
<text class="label-text">出生年月</text>
|
||||
<text class="label-star">*</text>
|
||||
</view>
|
||||
<view class="form-control">
|
||||
<picker mode="date" value="{{ birthday }}" bindchange="onBirthdayChange">
|
||||
<view class="form-picker {{ birthday ? '' : 'form-picker-placeholder' }}">{{ birthday || '请选择出生年月' }}</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 身高 + 体重 同行 -->
|
||||
<view class="form-row-inline">
|
||||
<view class="form-row-half">
|
||||
<view class="form-label">
|
||||
<text class="label-text">身高</text>
|
||||
<text class="label-star">*</text>
|
||||
</view>
|
||||
<view class="form-control">
|
||||
<view class="form-input-wrap">
|
||||
<input class="form-input form-input-with-suffix" type="digit" maxlength="5" placeholder="请填写身高" placeholder-class="form-placeholder" value="{{ form.height }}" bind:input="onHeightInput" />
|
||||
<text class="form-suffix form-suffix-inside">cm</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-row-half">
|
||||
<view class="form-label"><text class="label-text">体重</text></view>
|
||||
<view class="form-control">
|
||||
<view class="form-input-wrap">
|
||||
<input class="form-input form-input-with-suffix" type="digit" maxlength="6" placeholder="请填写体重" placeholder-class="form-placeholder" value="{{ form.weight }}" bind:input="onWeightInput" />
|
||||
<text class="form-suffix form-suffix-inside">kg</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 从已有用户中选择 -->
|
||||
<view class="ghost-btn" wx:if="{{ !isEdit }}" bind:tap="onTapSelectExisting">从已有用户中选择</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 底部双按钮:取消 / 保存用户信息 -->
|
||||
<!-- 底部双按钮 -->
|
||||
<view class="actions">
|
||||
<view class="btn-cancel" bind:tap="onCancel">取消</view>
|
||||
<view class="btn-primary" bind:tap="onSubmit">保存用户信息</view>
|
||||
|
||||
Reference in New Issue
Block a user