合入小程序修改内容

This commit is contained in:
HycJack
2026-05-06 03:37:08 +08:00
parent 326e4bac28
commit 1e7e7cc05e
16 changed files with 1072 additions and 450 deletions

View File

@@ -50,12 +50,6 @@
font-weight: 600;
color: #1A1A1A;
display: block;
margin-bottom: 8px;
}
.user-role {
font-size: 26px;
color: #666666;
}
}
@@ -300,6 +294,22 @@
overflow-y: auto;
}
.device-switch-footer {
margin-top: 20px;
}
.device-switch-add {
display: flex;
align-items: center;
justify-content: center;
height: 84px;
border-radius: 18px;
background: #FFF2E7;
font-size: 28px;
color: #FF8C42;
font-weight: 600;
}
.device-switch-item {
padding: 24px;
border-radius: 18px;

View File

@@ -1,7 +1,7 @@
import { View, Text, Image, Input } from '@tarojs/components'
import { useState } from 'react'
import Taro, { useDidShow } from '@tarojs/taro'
import { clearToken, getCurrentUserId, getToken } from '@/services/auth'
import { clearToken, getToken } from '@/services/auth'
import {
BindingListItem,
clearSelectedBindingDeviceId,
@@ -95,6 +95,11 @@ export default function Sleep() {
})
}
const handleOpenAddChildFromSwitch = () => {
setShowChildModal(false)
handleOpenModal('add')
}
const handleSubmitModal = async () => {
const normalizedName = childName.trim()
if (!normalizedName) {
@@ -181,6 +186,11 @@ export default function Sleep() {
return
}
if (item.name === '新增孩子') {
handleOpenModal('add')
return
}
if (item.name === '绑定设备') {
if (!currentChild) {
handleOpenModal('add')
@@ -209,7 +219,7 @@ export default function Sleep() {
)
}
const userId = getCurrentUserId()
const parentDisplayName = parentInfo.nickname?.trim() || '家长'
const menuItems: MenuItem[] = [
{
icon: require('../../assets/tab-icons/orange-robot.png'),
@@ -218,6 +228,13 @@ export default function Sleep() {
value: currentChildName,
arrow: true,
},
{
icon: require('../../assets/tab-icons/orange-robot.png'),
iconBgClass: 'orange',
name: '新增孩子',
value: '',
arrow: true,
},
{
icon: require('../../assets/tab-icons/orange-robot.png'),
iconBgClass: 'orange',
@@ -257,8 +274,7 @@ export default function Sleep() {
)}
</View>
<View className='user-info'>
<Text className='user-name'>{parentInfo.nickname || '家长用户'}</Text>
<Text className='user-role'> ID: {userId || '--'}</Text>
<Text className='user-name'>{parentDisplayName}</Text>
</View>
<View className='verified-badge'>
<Text>{currentChild ? '已选择当前孩子' : '未选择孩子'}</Text>
@@ -342,6 +358,11 @@ export default function Sleep() {
})}
</View>
)}
<View className='device-switch-footer'>
<Text className='device-switch-add' onClick={handleOpenAddChildFromSwitch}>
+
</Text>
</View>
<View className='modal-actions'>
<Text className='modal-action cancel' onClick={() => setShowChildModal(false)}>