fix:蓝牙bug解决

This commit is contained in:
李伊帆
2026-10-29 10:09:43 +08:00
parent 91bca314ba
commit 98402548eb
28 changed files with 1018 additions and 186 deletions

View File

@@ -5,12 +5,14 @@ import { createLocation, fetchRoomList } from '@/api/location'
import { getErrorMessage } from '@/utils/api-error'
import { parseId, sameId } from '@/utils/device-id'
import type { RoomOption } from '@/types/location'
import { stashRoomSelection } from '../../device-list-patch'
import type { DeviceRoomRouteQuery } from './room.types'
let openerEventChannel: UniApp.EventChannel | undefined
export function useDeviceRoom() {
const homeId = ref('')
const deviceId = ref('')
const selectedLocationId = ref('')
const pendingLocationName = ref<string>()
const roomOptions = ref<RoomOption[]>([])
@@ -20,6 +22,7 @@ export function useDeviceRoom() {
const initialized = ref(false)
function applyQuery(query?: DeviceRoomRouteQuery) {
if (query?.deviceId) deviceId.value = String(query.deviceId)
const locationId = parseId(query?.locationId)
if (locationId) {
selectedLocationId.value = locationId
@@ -124,10 +127,16 @@ export function useDeviceRoom() {
selectedLocationId.value = String(room.locationId)
pendingLocationName.value = room.name
openerEventChannel?.emit('roomSelected', {
const payload = {
locationId: room.locationId,
name: room.name,
}
stashRoomSelection({
deviceId: deviceId.value,
locationId: payload.locationId,
name: payload.name,
})
openerEventChannel?.emit('roomSelected', payload)
uni.navigateBack()
}