|
@@ -146,39 +146,39 @@ export default {
|
|
|
//打开 扫描二维码
|
|
|
open_scan() {
|
|
|
//
|
|
|
- // wx.scanCode({
|
|
|
- // onlyFromCamera: true,
|
|
|
- // success: (res) => {
|
|
|
- // let $data = res
|
|
|
- // if ($data.result) {
|
|
|
- // let url = decodeURIComponent($data.result)
|
|
|
- // let $code = url.match(/\?code=(.*)/)[1];
|
|
|
- // $this.code = $code
|
|
|
- //打开蓝牙设备
|
|
|
- wx.openBluetoothAdapter({
|
|
|
- success(res) {
|
|
|
- //判断已经打开连接了
|
|
|
- if (res['errMsg'] == "openBluetoothAdapter:ok") {
|
|
|
- console.log('openBluetoothAdapter success', res)
|
|
|
- $this.startBluetoothDevicesDiscovery()
|
|
|
- }
|
|
|
- },
|
|
|
- fail(err) {
|
|
|
- if (err['errCode'] == 10001) {
|
|
|
- Toast.fail({
|
|
|
- message: "请连接蓝牙"
|
|
|
- })
|
|
|
- } else {
|
|
|
- Toast.fail({
|
|
|
- message: "蓝牙连接失败"
|
|
|
+ wx.scanCode({
|
|
|
+ onlyFromCamera: true,
|
|
|
+ success: (res) => {
|
|
|
+ let $data = res
|
|
|
+ if ($data.result) {
|
|
|
+ let url = decodeURIComponent($data.result)
|
|
|
+ let $code = url.match(/\?code=(.*)/)[1];
|
|
|
+ $this.code = $code
|
|
|
+ //打开蓝牙设备
|
|
|
+ wx.openBluetoothAdapter({
|
|
|
+ success(res) {
|
|
|
+ //判断已经打开连接了
|
|
|
+ if (res['errMsg'] == "openBluetoothAdapter:ok") {
|
|
|
+ console.log('openBluetoothAdapter success', res)
|
|
|
+ $this.startBluetoothDevicesDiscovery()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail(err) {
|
|
|
+ if (err['errCode'] == 10001) {
|
|
|
+ Toast.fail({
|
|
|
+ message: "请连接蓝牙"
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ Toast.fail({
|
|
|
+ message: "蓝牙连接失败"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- //
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
},
|
|
|
//关闭窗口的方法
|
|
|
on_close() {
|
|
@@ -334,13 +334,6 @@ export default {
|
|
|
},
|
|
|
onShow() {
|
|
|
//判断是否游戏中
|
|
|
- let $game_status = game_store.getters.getGameStatus
|
|
|
- console.log('choose_ok_game_status', $game_status)
|
|
|
- if ($game_status == 1) {
|
|
|
- $this.connect_toy = 4
|
|
|
- } else {
|
|
|
- $this.connect_toy = 2
|
|
|
- }
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
// 原有的code
|