BluetoothDemo/pages/PCH0809/index.wxml

52 lines
2.1 KiB
Plaintext
Raw Normal View History

2021-12-08 09:18:31 +08:00
<wxs module="utils">
module.exports.max = function(n1, n2) {
return Math.max(n1, n2)
}
module.exports.len = function(arr) {
arr = arr || []
return arr.length
}
</wxs>
<view class="container">
<view class="header">
<button bindtap="openBluetoothAdapter">开始扫描</button>
<button bindtap="stopBluetoothDevicesDiscovery">停止扫描</button>
<button bindtap="closeBluetoothAdapter">结束流程</button>
<button bindtap="handleHeight" wx:if="{{isType}}" data-name="1">身高体脂模式(默认)</button>
<button bindtap="handleHeight" wx:if="{{isType}}" data-name="3">标定模式</button>
</view>
<view class="weight">
<view>{{weight}}</view>
<view>{{imp}}</view>
<view>{{height}}</view>
<view>{{text}}</view>
</view>
<view class="devices_summary">已发现 {{devices.length}} 个外围设备:</view>
<scroll-view class="device_list" scroll-y scroll-with-animation>
<view wx:for="{{devices}}" wx:key="index" data-device-id="{{item.deviceId}}"
data-name="{{item.name || item.localName}}" data-mac="{{item.mac}}" data-index="{{index}}"
bindtap="createBLEConnection" class="device_item" hover-class="device_item_hover">
<view style="font-size: 32rpx;">
<text style="color:#000;font-weight:bold">{{item.name}}</text>
<text style="font-size:26rpx">(信号强度: {{item.RSSI}}dBm</text>
</view>
<view style="font-size: 26rpx">mac地址: {{item.macAddr || item.deviceId}}</view>
<!-- <view style="font-size: 26rpx">广播数据:{{item.analyzeDataText}}</view> -->
</view>
</scroll-view>
</view>
<view wx:if="{{pwdModal}}" class="modal_wrapper {{pwdModal ? 'modal_wrapper_show': ''}}" catchtouchmove="stopAction">
<view class="remindModal">
<view class="remindModal_title">标定重量</view>
<view class="modal_input_wrap">
<input model:value='{{pwdInput}}' class="modal_input" placeholder="请输入"
placeholder-style="font-size:30rpx;color:#b4b4b4" />
</view>
<view class="remindModal_btn">
<view class="remindModal_cancel_btn" bindtap="closeModal" hover-class="hover_tap">取消</view>
<view class="confirm_btn" bindtap="confirmPwd">确定</view>
</view>
</view>
</view>