合入小程序修改内容
This commit is contained in:
@@ -27,19 +27,39 @@
|
||||
|
||||
.bind-header {
|
||||
padding: 80px 32px 32px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
|
||||
.back-btn {
|
||||
position: absolute;
|
||||
left: 32px;
|
||||
top: 80px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12px 18px;
|
||||
border-radius: 999px;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.back-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.back-text {
|
||||
font-size: 26px;
|
||||
color: #1A1A1A;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 44px;
|
||||
font-weight: 700;
|
||||
color: #1A1A1A;
|
||||
display: block;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 28px;
|
||||
color: #666666;
|
||||
padding: 0 120px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +116,14 @@ export default function Bind() {
|
||||
Taro.reLaunch({ url: '/pages/device/index' })
|
||||
}
|
||||
|
||||
const handleBack = () => {
|
||||
if (getCurrentPages().length > 1) {
|
||||
Taro.navigateBack()
|
||||
return
|
||||
}
|
||||
Taro.switchTab({ url: '/pages/device/index' })
|
||||
}
|
||||
|
||||
const stopPolling = () => {
|
||||
if (pollingRef.current) {
|
||||
clearTimeout(pollingRef.current)
|
||||
@@ -123,10 +131,10 @@ export default function Bind() {
|
||||
}
|
||||
}
|
||||
|
||||
const schedulePoll = () => {
|
||||
const schedulePoll = (nextBindToken?: string) => {
|
||||
stopPolling()
|
||||
pollingRef.current = setTimeout(() => {
|
||||
void pollBindSession()
|
||||
void pollBindSession(nextBindToken)
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
@@ -138,17 +146,18 @@ export default function Bind() {
|
||||
setBindHint('')
|
||||
}
|
||||
|
||||
const pollBindSession = async () => {
|
||||
if (!bindToken) return
|
||||
const pollBindSession = async (nextBindToken?: string) => {
|
||||
const activeBindToken = (nextBindToken || bindToken).trim()
|
||||
if (!activeBindToken) return
|
||||
|
||||
try {
|
||||
const session = await getNFCBindSession(bindToken)
|
||||
const session = await getNFCBindSession(activeBindToken)
|
||||
setBindStatus(session.status)
|
||||
setCardUUID(session.card_uuid || '')
|
||||
|
||||
if (session.status === SESSION_STATUS_PENDING) {
|
||||
setBindHint('已发送绑卡指令,请拿自己的卡去设备上贴一下')
|
||||
schedulePoll()
|
||||
schedulePoll(activeBindToken)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -303,7 +312,7 @@ export default function Bind() {
|
||||
setBindToken(session.bind_token)
|
||||
setBindStatus(session.status)
|
||||
setBindHint('已发送绑卡指令,请去设备上贴自己的卡')
|
||||
schedulePoll()
|
||||
schedulePoll(session.bind_token)
|
||||
Taro.showToast({ title: '请去设备上贴卡', icon: 'none' })
|
||||
} catch (error: any) {
|
||||
console.error('[bind] submit failed:', error)
|
||||
@@ -331,12 +340,11 @@ export default function Bind() {
|
||||
return (
|
||||
<View className='bind-page'>
|
||||
<View className='bind-header'>
|
||||
<View className='back-btn' onClick={handleBack}>
|
||||
<Image className='back-icon' src={require('../../assets/tab-icons/arrow-left.png')} mode='aspectFit' />
|
||||
<Text className='back-text'>返回</Text>
|
||||
</View>
|
||||
<Text className='title'>{isPendingBinding ? '补全绑定' : '扫码贴卡绑定设备'}</Text>
|
||||
<Text className='subtitle'>
|
||||
{isPendingBinding
|
||||
? '当前设备已存在待补全关系,请先补充儿童资料'
|
||||
: '先选择儿童,再扫码设备,系统会下发绑卡指令,随后去设备上贴卡确认'}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View className='scan-area'>
|
||||
|
||||
Reference in New Issue
Block a user