feat: 完成水电充值功能
This commit is contained in:
parent
904c0bf247
commit
a254039d5e
15
basic.js
15
basic.js
@ -257,21 +257,12 @@ function openBluetoothAdapter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 关闭蓝牙模块
|
// 关闭蓝牙模块
|
||||||
function closeBluetoothAdapter() {
|
export function closeBluetoothAdapter() {
|
||||||
return new Promise(resolve => {
|
uni.closeBluetoothAdapter()
|
||||||
uni.closeBluetoothAdapter({
|
|
||||||
success() {
|
|
||||||
resolve(Result.Success)
|
|
||||||
},
|
|
||||||
async fail(err) {
|
|
||||||
resolve(await handleError(err))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 移除蓝牙适配器的全部监听
|
// 移除蓝牙适配器的全部监听
|
||||||
function offBluetoothAdapterStateChange() {
|
export function offBluetoothAdapterStateChange() {
|
||||||
uni.offBluetoothAdapterStateChange()
|
uni.offBluetoothAdapterStateChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,8 +18,10 @@ import {
|
|||||||
import { getStorage, removeStorage, setStorage } from '@/starCloud/storage'
|
import { getStorage, removeStorage, setStorage } from '@/starCloud/storage'
|
||||||
import {
|
import {
|
||||||
closeBLEConnection,
|
closeBLEConnection,
|
||||||
|
closeBluetoothAdapter,
|
||||||
createBLEConnection,
|
createBLEConnection,
|
||||||
getBluetoothDevices,
|
getBluetoothDevices,
|
||||||
|
offBluetoothAdapterStateChange,
|
||||||
onBLECharacteristicValueChange,
|
onBLECharacteristicValueChange,
|
||||||
Result,
|
Result,
|
||||||
searchAndConnectDevice,
|
searchAndConnectDevice,
|
||||||
@ -659,6 +661,10 @@ export const useStarCloudStore = defineStore('starCloud', {
|
|||||||
if (addUserResult.code !== Result.Success.code) {
|
if (addUserResult.code !== Result.Success.code) {
|
||||||
return addUserResult
|
return addUserResult
|
||||||
}
|
}
|
||||||
|
|
||||||
|
offBluetoothAdapterStateChange()
|
||||||
|
closeBluetoothAdapter()
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
lockAlias: this.lockInfo.bluetooth.bluetoothDeviceName,
|
lockAlias: this.lockInfo.bluetooth.bluetoothDeviceName,
|
||||||
lockInfo: {
|
lockInfo: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user