Refine device-first baby management
This commit is contained in:
@@ -201,7 +201,7 @@ export default function Bind() {
|
||||
const isExpiredBind = bindStatus === SESSION_STATUS_EXPIRED
|
||||
const canEditDeviceFields = !isPendingBinding && !isPollingBind
|
||||
const canSubmit = isPendingBinding ? hasSelectedOrNewChild : isExpiredBind ? true : !isPollingBind
|
||||
const pageTitle = isPendingBinding ? '补全绑定' : isAddingCard ? '添加设备卡' : '扫码贴卡绑定设备'
|
||||
const pageTitle = isPendingBinding ? '补全绑定' : isAddingCard ? '添加设备卡片' : '扫码贴卡绑定设备'
|
||||
|
||||
const goDevicePage = () => {
|
||||
Taro.reLaunch({ url: '/pages/device/index' })
|
||||
@@ -286,7 +286,7 @@ export default function Bind() {
|
||||
if (parsed.serialNumber) setSerialNumber(parsed.serialNumber)
|
||||
setBindHint(
|
||||
parsed.serialNumber
|
||||
? '已读取设备二维码信息,请选择儿童后发送绑卡指令'
|
||||
? '已读取设备二维码信息,请选择宝贝后发送绑卡指令'
|
||||
: '已读取设备号,请补充设备序列号'
|
||||
)
|
||||
return true
|
||||
@@ -364,7 +364,7 @@ export default function Bind() {
|
||||
? session.card_uuid ? `新卡添加完成,卡号 ${session.card_uuid}` : '新卡添加完成'
|
||||
: session.child_id
|
||||
? session.card_uuid ? `绑定完成,卡号 ${session.card_uuid}` : '绑定完成'
|
||||
: session.card_uuid ? `绑定完成,卡号 ${session.card_uuid},稍后可关联孩子` : '绑定完成,稍后可关联孩子'
|
||||
: session.card_uuid ? `绑定完成,卡号 ${session.card_uuid},稍后可关联宝贝` : '绑定完成,稍后可关联宝贝'
|
||||
)
|
||||
Taro.showToast({ title: isAddingCard ? '新卡添加成功' : '设备绑定成功', icon: 'success' })
|
||||
setTimeout(() => {
|
||||
@@ -500,7 +500,7 @@ export default function Bind() {
|
||||
|
||||
if (isPendingBinding) {
|
||||
if (!childId) {
|
||||
throw new Error('请先选择儿童或填写新的儿童昵称')
|
||||
throw new Error('请先选择宝贝或填写新的宝贝昵称')
|
||||
}
|
||||
await setBindingChild(pendingDeviceId!, { child_id: childId })
|
||||
setSelectedBindingDeviceId(pendingDeviceId)
|
||||
@@ -585,7 +585,7 @@ export default function Bind() {
|
||||
<View className='icon-bg orange'>
|
||||
<Image className='control-icon-img' src={require('../../assets/tab-icons/rings.png')} mode='aspectFit' />
|
||||
</View>
|
||||
<Text className='pending-device-title'>给当前设备添加卡</Text>
|
||||
<Text className='pending-device-title'>给当前设备添加卡片</Text>
|
||||
<Text className='pending-device-id'>{deviceId}</Text>
|
||||
<Text className='pending-device-desc'>新卡添加后会和已有卡具备相同功能</Text>
|
||||
</View>
|
||||
@@ -596,7 +596,7 @@ export default function Bind() {
|
||||
</View>
|
||||
<Text className='pending-device-title'>关联现有设备</Text>
|
||||
<Text className='pending-device-id'>{pendingDeviceId}</Text>
|
||||
<Text className='pending-device-desc'>选择已有孩子,或新建孩子后完成关联</Text>
|
||||
<Text className='pending-device-desc'>选择已有宝贝,或新建宝贝后完成关联</Text>
|
||||
</View>
|
||||
) : (
|
||||
<View className='scan-area'>
|
||||
@@ -622,7 +622,7 @@ export default function Bind() {
|
||||
<View className='bind-form'>
|
||||
{!isAddingCard && (
|
||||
<View className='form-card'>
|
||||
<Text className='form-title'>儿童资料</Text>
|
||||
<Text className='form-title'>宝贝资料</Text>
|
||||
|
||||
{children.length > 0 && (
|
||||
<View className='child-list'>
|
||||
@@ -635,7 +635,7 @@ export default function Bind() {
|
||||
setNewChildName('')
|
||||
}}
|
||||
>
|
||||
<Text className='child-item-text'>暂不关联孩子</Text>
|
||||
<Text className='child-item-text'>暂不关联宝贝</Text>
|
||||
</View>
|
||||
)}
|
||||
{children.map((child) => (
|
||||
@@ -658,14 +658,14 @@ export default function Bind() {
|
||||
)}
|
||||
|
||||
<View className='field-item'>
|
||||
<Text className='field-label'>{isPendingBinding ? '新建儿童昵称' : '新建儿童昵称(可选)'}</Text>
|
||||
<Text className='field-label'>{isPendingBinding ? '新建宝贝昵称' : '新建宝贝昵称(可选)'}</Text>
|
||||
<Input
|
||||
className='field-input'
|
||||
value={newChildName}
|
||||
placeholder={
|
||||
isPendingBinding
|
||||
? children.length > 0 ? '不选已有儿童时,可填写新昵称' : '请输入儿童昵称'
|
||||
: children.length > 0 ? '不选已有儿童时,可填写新昵称' : '可不填,稍后再关联孩子'
|
||||
? children.length > 0 ? '不选已有宝贝时,可填写新昵称' : '请输入宝贝昵称'
|
||||
: children.length > 0 ? '不选已有宝贝时,可填写新昵称' : '可不填,稍后再关联宝贝'
|
||||
}
|
||||
onInput={(event) => {
|
||||
setNewChildName(event.detail.value)
|
||||
@@ -680,11 +680,11 @@ export default function Bind() {
|
||||
<Text className='field-hint'>
|
||||
{isPendingBinding
|
||||
? children.length > 0
|
||||
? '可以选已有儿童,也可以新建一个儿童后关联当前设备'
|
||||
: '当前还没有儿童资料,请先创建一个儿童资料后关联设备'
|
||||
? '可以选已有宝贝,也可以新建一个宝贝后关联当前设备'
|
||||
: '当前还没有宝贝资料,请先创建一个宝贝资料后关联设备'
|
||||
: children.length > 0
|
||||
? '儿童资料可选;不选择时,设备会先绑定到账号,稍后可关联孩子'
|
||||
: '也可以先不创建儿童,直接绑定设备,稍后再关联孩子'}
|
||||
? '宝贝资料可选;不选择时,设备会先绑定到账号,稍后可关联宝贝'
|
||||
: '也可以先不创建宝贝,直接绑定设备,稍后再关联宝贝'}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
@@ -742,7 +742,7 @@ export default function Bind() {
|
||||
onClick={isExpiredBind && !isPendingBinding && !isAddingCard ? handleScanCode : handleSubmit}
|
||||
>
|
||||
{isPendingBinding
|
||||
? '完成儿童关联'
|
||||
? '完成宝贝关联'
|
||||
: isPollingBind
|
||||
? '等待贴卡确认'
|
||||
: isExpiredBind
|
||||
@@ -755,15 +755,15 @@ export default function Bind() {
|
||||
<Text className='tips-title'>绑定帮助</Text>
|
||||
<View className='tip-item'>
|
||||
<Text className='tip-number'>1</Text>
|
||||
<Text className='tip-text'>{isAddingCard ? '确认当前设备号正确' : isPendingBinding ? '先选择已有儿童,或者在本页新建一个儿童' : '儿童资料可选,不选择时设备会先进入待关联状态'}</Text>
|
||||
<Text className='tip-text'>{isAddingCard ? '确认当前设备号正确' : isPendingBinding ? '先选择已有宝贝,或者在本页新建一个宝贝' : '宝贝资料可选,不选择时设备会先进入待关联状态'}</Text>
|
||||
</View>
|
||||
<View className='tip-item'>
|
||||
<Text className='tip-number'>2</Text>
|
||||
<Text className='tip-text'>{isAddingCard ? '点击发送加卡指令后,在设备上贴新卡' : isPendingBinding ? '确认当前待关联设备,再选择要关联的孩子' : '扫描设备二维码,确认设备号和序列号正确'}</Text>
|
||||
<Text className='tip-text'>{isAddingCard ? '点击发送加卡指令后,在设备上贴新卡' : isPendingBinding ? '确认当前待关联设备,再选择要关联的宝贝' : '扫描设备二维码,确认设备号和序列号正确'}</Text>
|
||||
</View>
|
||||
<View className='tip-item'>
|
||||
<Text className='tip-number'>3</Text>
|
||||
<Text className='tip-text'>{isAddingCard ? '加卡成功后,新卡和原来的卡可以执行相同功能' : isPendingBinding ? '点击完成儿童关联,设备会出现在该孩子下面' : '点击发送绑卡指令,然后在 10 分钟内去设备上贴自己的卡完成确认'}</Text>
|
||||
<Text className='tip-text'>{isAddingCard ? '加卡成功后,新卡和原来的卡可以执行相同功能' : isPendingBinding ? '点击完成宝贝关联,设备会出现在该宝贝下面' : '点击发送绑卡指令,然后在 10 分钟内去设备上贴自己的卡完成确认'}</Text>
|
||||
</View>
|
||||
</View>
|
||||
{systemBanner}
|
||||
|
||||
Reference in New Issue
Block a user