slave.wxml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <import src="../../../../common/head.wxml" />
  2. <import src="../../../../common/foot.wxml" />
  3. <view class="container page" data-weui-theme="{{theme}}">
  4. <template is="head" data="{{title: 'bluetooth'}}"/>
  5. <view class="page-body" style="display: flex; flex-direction: column">
  6. <text style="text-align: center; margin: 16px">当前 serverId {{serverId}}</text>
  7. <view class="action-area">
  8. <button type="primary" bindtap="openBluetoothAdapter">创建server</button>
  9. <button type="primary" bindtap="closeServer">关闭server</button>
  10. </view>
  11. <view class="action-area">
  12. <button type="primary" bindtap="addService">创建服务</button>
  13. <button type="primary" bindtap="removeService">关闭服务</button>
  14. </view>
  15. <view class="action-area">
  16. <button type="primary" bindtap="startAdvertising">开启广播</button>
  17. <button type="primary" bindtap="stopAdvertising">关闭广播</button>
  18. </view>
  19. <view class="action-area">
  20. <button type="primary" bindtap="showInput">写数据</button>
  21. <button type="primary" bindtap="closeBluetoothAdapter">结束流程</button>
  22. </view>
  23. <button type="primary" bindtap="chaneMode">返回主机模式</button>
  24. <block wx:if="{{input}}">
  25. <input style="width: 200px;margin: 0 auto;background: var(--weui-BG-2);padding: 5px;"
  26. placeholder="写个数字"
  27. bindconfirm="onConfirm"
  28. ></input>
  29. </block>
  30. <view>
  31. <view wx:for="{{connects}}" wx:if="{{connects.length > 0}}">
  32. <view>
  33. <text>{{item.deviceId}} : {{item.serverId}}</text>
  34. <text>{{item.connected ? "已连接" : "断开"}}</text>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <template is="foot"></template>
  40. </view>