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