<!-- pages/basics/BluetoothDebugging/BluetoothDebugging.wxml -->
<view class="container">
  <!-- 顶部导航栏 -->
  <cu-custom bgColor="bg-gradual-blue" isBack="true">
    <view slot="content">{{Hotelinfo.HotelName}}({{Hotelinfo.Code}})</view>
  </cu-custom>

  <!-- 内容栏顶部 -->
  <view class="content-header">
    <!-- 左侧导航栏 -->
    <view class="nav-tabs">
      <view 
        class="nav-tab {{activeTab === 'host' ? 'active' : ''}}" 
        data-tab="host"
        bindtap="switchTab"
      >
        主机
      </view>
      <view 
        class="nav-tab {{activeTab === 'W13' ? 'active' : ''}}" 
        data-tab="W13"
        bindtap="switchTab"
      >
        W13
      </view>
    </view>
    
    <!-- 右侧搜索按钮 -->
    <view class="search-btn" bindtap="searchBluetooth">
      搜索蓝牙
    </view>
  </view>

  <!-- 蓝牙设备列表 -->
  <scroll-view class="device-scroll" scroll-y="true">
    <view class="device-card {{item.connected ? 'connected' : ''}}" wx:for="{{deviceList}}" wx:key="id" data-index="{{index}}" bindtap="onDeviceTap">
      <view class="device-avatar {{item.connected ? 'online' : ''}}">
        <image class="avatar-img" src="/img/lanya.png" mode="aspectFit"></image>
      </view>

      <view class="device-content">
        <view class="device-top">
          <view class="device-name-group">
            <text class="device-name">{{item.name || '未命名设备'}}</text>
            <text class="device-mac">{{item.mac || item.localName || '未知MAC地址'}}</text>
          </view>

          <view class="signal-chip {{item.RSSI >= -60 ? 'strong' : (item.RSSI >= -80 ? 'medium' : 'weak')}}">
            <image class="signal-img" src="{{item.RSSI >= -60 ? '/img/xinhaogao.png' : (item.RSSI >= -80 ? '/img/xinhaozhong.png' : '/img/xinhaodi.png')}}" mode="aspectFit"></image>
          </view>
        </view>

        <view class="device-bottom">
          <text class="device-state">Bluetooth · {{item.connected ? '已连接' : '未连接'}}</text>
          <text class="rssi">{{item.RSSI || 0}} dBm</text>
        </view>
      </view>
    </view>
  </scroll-view>
</view>