feat:绑定设备和设备详情

This commit is contained in:
李伊帆
2026-10-10 11:11:44 +08:00
parent 179bd3b66c
commit d4b02745e1
64 changed files with 3526 additions and 221 deletions

View File

@@ -2,8 +2,10 @@
<view class="device-page">
<device-header
:home-name="homeName"
@home="onHomePicker"
@manage="onHomeManage"
@notify="onNotify"
@add-device="onStartBind"
@scan="onScan"
/>
<room-tabs
:rooms="rooms"
@@ -11,8 +13,25 @@
@select="selectRoom"
@add="onAddRoom"
/>
<device-empty :step-hint="bindStepHint" @bind="onStartBind" />
<hot-devices :items="hotDevices" @mall="onGoMall" />
<device-list
v-if="hasDevices"
:devices="devices"
:online-count="onlineCount"
@manage="onManageDevices"
@select="onSelectDevice"
/>
<template v-else-if="!loading">
<device-empty :step-hint="bindStepHint" @bind="onStartBind" />
<hot-devices :items="hotDevices" @mall="onGoMall" />
</template>
<room-location-dialog
v-model:visible="roomDialogVisible"
@confirm="onConfirmAddRoom"
/>
<operation-success-toast v-model:visible="successToastVisible" />
<app-tab-bar :current="tabCurrent" />
</view>
</template>
@@ -21,7 +40,10 @@
import { useTabPage } from '@/hooks/use-tab-page'
import DeviceEmpty from './components/device-empty/index.vue'
import DeviceHeader from './components/device-header/index.vue'
import DeviceList from './components/device-list/index.vue'
import HotDevices from './components/hot-devices/index.vue'
import OperationSuccessToast from './components/operation-success-toast/index.vue'
import RoomLocationDialog from './components/room-location-dialog/index.vue'
import RoomTabs from './components/room-tabs/index.vue'
import { useDevice } from './use-device'
@@ -31,14 +53,24 @@ const {
homeName,
rooms,
activeRoomId,
devices,
onlineCount,
hasDevices,
loading,
hotDevices,
bindStepHint,
roomDialogVisible,
successToastVisible,
selectRoom,
onAddRoom,
onConfirmAddRoom,
onStartBind,
onScan,
onGoMall,
onNotify,
onHomePicker,
onHomeManage,
onManageDevices,
onSelectDevice,
} = useDevice()
</script>