fix:最新
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template>
|
||||
<view class="scan-page">
|
||||
<app-navbar title="扫描设备" />
|
||||
<page-scroll-view class="scan-page__scroll">
|
||||
@@ -6,8 +6,8 @@
|
||||
<bind-steps :steps="BIND_STEPS" :current="currentStep" />
|
||||
<scan-hero />
|
||||
<view class="scan-page__status">
|
||||
<text class="scan-page__title">正在扫描附近设备...</text>
|
||||
<view class="scan-page__hint">
|
||||
<text class="scan-page__title">{{ pageTitle }}</text>
|
||||
<view v-if="!bluetoothDisabled" class="scan-page__hint">
|
||||
<view class="scan-page__hint-dot" />
|
||||
<text class="scan-page__hint-text">{{ statusHint }}</text>
|
||||
</view>
|
||||
@@ -20,7 +20,18 @@
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view v-if="scanError" class="scan-page__empty">
|
||||
<view v-if="bluetoothDisabled" class="scan-page__empty scan-page__empty--bt">
|
||||
<text class="scan-page__empty-text">{{ scanError }}</text>
|
||||
<view class="scan-page__bt-actions">
|
||||
<view class="scan-page__bt-btn scan-page__bt-btn--primary" @tap="onOpenBluetoothSettings">
|
||||
<text class="scan-page__bt-btn-text">去开启蓝牙</text>
|
||||
</view>
|
||||
<view class="scan-page__bt-btn" @tap="onRetryScan">
|
||||
<text class="scan-page__bt-btn-text scan-page__bt-btn-text--muted">已开启,重试扫描</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else-if="scanError" class="scan-page__empty">
|
||||
<text class="scan-page__empty-text">{{ scanError }}</text>
|
||||
</view>
|
||||
<view v-else-if="devices.length === 0" class="scan-page__empty">
|
||||
@@ -47,6 +58,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import BindSteps from '../components/bind-steps/index.vue'
|
||||
import { BIND_STEPS } from '../use-add-device'
|
||||
import ScanDeviceItem from './components/scan-device-item/index.vue'
|
||||
@@ -61,10 +73,22 @@ const {
|
||||
secondsLeft,
|
||||
scanning,
|
||||
scanError,
|
||||
bluetoothDisabled,
|
||||
applyBindHomeId,
|
||||
onRetryScan,
|
||||
onOpenBluetoothSettings,
|
||||
onSelectDevice,
|
||||
onDeviceAction,
|
||||
} = useScanDevice()
|
||||
|
||||
onLoad((query) => {
|
||||
applyBindHomeId(query?.homeId)
|
||||
})
|
||||
|
||||
const pageTitle = computed(() =>
|
||||
bluetoothDisabled.value ? '蓝牙未开启' : '正在扫描附近设备...',
|
||||
)
|
||||
|
||||
const statusHint = computed(() => {
|
||||
const count = devices.value.length
|
||||
if (scanning.value) {
|
||||
|
||||
Reference in New Issue
Block a user