Merge branch 'fanpeng' into 'develop'
Fanpeng See merge request StarlockTeam/wx-starlock!51
This commit is contained in:
commit
bae82f76e7
@ -90,8 +90,10 @@
|
|||||||
})
|
})
|
||||||
if (addUserCode === 0) {
|
if (addUserCode === 0) {
|
||||||
this.closeBluetoothConnection()
|
this.closeBluetoothConnection()
|
||||||
|
// #ifdef MP
|
||||||
this.closeAllBluetooth()
|
this.closeAllBluetooth()
|
||||||
this.initAndListenBluetooth()
|
this.initAndListenBluetooth()
|
||||||
|
// #endif
|
||||||
} else if (addUserCode === -1) {
|
} else if (addUserCode === -1) {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|||||||
@ -116,15 +116,15 @@
|
|||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.button {
|
.button {
|
||||||
border-radius: 64rpx;
|
|
||||||
width: 686rpx;
|
width: 686rpx;
|
||||||
margin-left: 32rpx;
|
|
||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
line-height: 100rpx;
|
margin-left: 32rpx;
|
||||||
text-align: center;
|
|
||||||
background-color: #63b8af;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
line-height: 100rpx;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #63b8af;
|
||||||
|
border-radius: 64rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -422,7 +422,7 @@
|
|||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
$bluetooth
|
await $bluetooth
|
||||||
.syncRecord({
|
.syncRecord({
|
||||||
keyId: $bluetooth.currentLockInfo.keyId.toString(),
|
keyId: $bluetooth.currentLockInfo.keyId.toString(),
|
||||||
uid: $user.userInfo.uid.toString()
|
uid: $user.userInfo.uid.toString()
|
||||||
|
|||||||
@ -325,11 +325,20 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
const upgrade = () => {
|
const upgrade = () => {
|
||||||
|
// #ifdef MP
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '小程序暂不支持升级功能,请下载星星锁APP进行升级',
|
content: '小程序暂不支持升级功能,请下载星星锁APP进行升级',
|
||||||
showCancel: false
|
showCancel: false
|
||||||
})
|
})
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '星星锁Lite暂不支持升级功能,请下载星星锁APP进行升级',
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const asyncSetting = async () => {
|
const asyncSetting = async () => {
|
||||||
@ -338,7 +347,9 @@
|
|||||||
lockId: $bluetooth.currentLockInfo.lockName.toString(),
|
lockId: $bluetooth.currentLockInfo.lockName.toString(),
|
||||||
uid: $user.userInfo.uid.toString()
|
uid: $user.userInfo.uid.toString()
|
||||||
})
|
})
|
||||||
|
// #ifdef MP
|
||||||
$bluetooth.closeBluetoothConnection()
|
$bluetooth.closeBluetoothConnection()
|
||||||
|
// #endif
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
const { code: resultCode } = await lockDataUploadRequest({
|
const { code: resultCode } = await lockDataUploadRequest({
|
||||||
lockId: $bluetooth.currentLockInfo.lockId,
|
lockId: $bluetooth.currentLockInfo.lockId,
|
||||||
|
|||||||
@ -233,7 +233,7 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
fail(err) {
|
fail(err) {
|
||||||
console.log('蓝牙初始化失败', err)
|
console.log('蓝牙初始化失败', err)
|
||||||
// 系统蓝牙未打开
|
// 系统蓝牙未打开
|
||||||
if (err.errCode === 10001) {
|
if (err.errCode === 10001 || err.code === 10001) {
|
||||||
if (that.bluetoothStatus === 2) {
|
if (that.bluetoothStatus === 2) {
|
||||||
that.bluetoothStatus = 3
|
that.bluetoothStatus = 3
|
||||||
} else {
|
} else {
|
||||||
@ -249,7 +249,7 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 蓝牙已经初始化
|
// 蓝牙已经初始化
|
||||||
if (err.errMsg === 'openBluetoothAdapter:fail already opened') {
|
if (err.errMsg === 'openBluetoothAdapter:fail already opened' || err.code === -1) {
|
||||||
resolve(true)
|
resolve(true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -883,6 +883,7 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
if (this.bluetoothStatus === 1) {
|
if (this.bluetoothStatus === 1) {
|
||||||
const initResult = await this.initBluetooth()
|
const initResult = await this.initBluetooth()
|
||||||
if (!initResult) {
|
if (!initResult) {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '蓝牙尚未打开,请先打开蓝牙',
|
content: '蓝牙尚未打开,请先打开蓝牙',
|
||||||
@ -897,6 +898,23 @@ export const useBluetoothStore = defineStore('ble', {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
const systemInfo = uni.getSystemInfoSync()
|
||||||
|
if (systemInfo.platform === 'android') {
|
||||||
|
const main = plus.android.runtimeMainActivity()
|
||||||
|
const Intent = plus.android.importClass('android.content.Intent')
|
||||||
|
const BluetoothAdapter = plus.android.importClass('android.bluetooth.BluetoothAdapter')
|
||||||
|
const intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE)
|
||||||
|
main.startActivity(intent)
|
||||||
|
} else if (systemInfo.platform === 'ios') {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '蓝牙尚未打开,请先打开蓝牙',
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
} else if (this.bluetoothStatus === 2 || this.bluetoothStatus === 3) {
|
} else if (this.bluetoothStatus === 2 || this.bluetoothStatus === 3) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user