fix: 优化小程序家庭邀请和设备详情
This commit is contained in:
@@ -15,7 +15,16 @@ import {
|
||||
updateBindingCardName,
|
||||
unbindDevice,
|
||||
} from '@/services/binding'
|
||||
import { Child, clearSelectedChildId, deleteChild, setSelectedChildId, updateChild } from '@/services/child'
|
||||
import {
|
||||
Child,
|
||||
CHILD_NAME_RULE_MESSAGE,
|
||||
clearSelectedChildId,
|
||||
deleteChild,
|
||||
sanitizeChildNameInput,
|
||||
setSelectedChildId,
|
||||
updateChild,
|
||||
validateChildNameInput,
|
||||
} from '@/services/child'
|
||||
import {
|
||||
createFamilyInvitation,
|
||||
FamilyMember,
|
||||
@@ -427,16 +436,6 @@ export default function Sleep() {
|
||||
}
|
||||
}
|
||||
|
||||
const handleCopyFamilyInvite = () => {
|
||||
if (!familyInvitePath) return
|
||||
Taro.setClipboardData({
|
||||
data: familyInvitePath,
|
||||
success: () => {
|
||||
Taro.showToast({ title: '邀请路径已复制', icon: 'success' })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const handleRemoveFamilyMember = (member: FamilyMember) => {
|
||||
if (!binding?.device_id || member.is_owner || isUpdatingFamily) return
|
||||
|
||||
@@ -657,8 +656,9 @@ export default function Sleep() {
|
||||
|
||||
const handleSubmitModal = async () => {
|
||||
const normalizedName = childName.trim()
|
||||
if (!normalizedName) {
|
||||
Taro.showToast({ title: '请输入宝贝昵称', icon: 'none' })
|
||||
const childNameError = validateChildNameInput(normalizedName)
|
||||
if (childNameError) {
|
||||
Taro.showToast({ title: childNameError, icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1442,14 +1442,15 @@ export default function Sleep() {
|
||||
{showModal && (
|
||||
<View className='modal-mask'>
|
||||
<View className='modal-card'>
|
||||
<Text className='modal-title'>修改宝贝昵称</Text>
|
||||
<Text className='modal-title'>修改宝贝姓名</Text>
|
||||
<View className='modal-input-wrap'>
|
||||
<Input
|
||||
className='modal-input'
|
||||
value={childName}
|
||||
placeholder='请输入宝贝昵称'
|
||||
placeholder={CHILD_NAME_RULE_MESSAGE}
|
||||
focus
|
||||
onInput={(event) => setChildName(event.detail.value)}
|
||||
maxlength={5}
|
||||
onInput={(event) => setChildName(sanitizeChildNameInput(event.detail.value))}
|
||||
/>
|
||||
</View>
|
||||
<View className='modal-actions'>
|
||||
@@ -1615,9 +1616,6 @@ export default function Sleep() {
|
||||
<Text className='family-invite-tip'>
|
||||
邀请有效期至 {familyInviteExpiresAt ? familyInviteExpiresAt.replace('T', ' ').slice(0, 16) : '24 小时内'}
|
||||
</Text>
|
||||
<Text className='family-copy-action' onClick={handleCopyFamilyInvite}>
|
||||
复制邀请路径
|
||||
</Text>
|
||||
</>
|
||||
) : (
|
||||
<View
|
||||
|
||||
Reference in New Issue
Block a user