1. 在部分蓝牙操作后断开蓝牙连接
2. 绑定设备成功后延迟1秒退回首页
This commit is contained in:
parent
78c3c43f7b
commit
1c79f736a3
@ -33,7 +33,7 @@ export default {
|
||||
console.log(this.name)
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useBluetoothStore, ['addLockUser']),
|
||||
...mapActions(useBluetoothStore, ['addLockUser', 'closeBluetoothConnection']),
|
||||
...mapActions(useLockStore, ['getLockList', 'updateLockSearch']),
|
||||
...mapActions(useBasicStore, ['backAndToast']),
|
||||
uopdateName(data) {
|
||||
@ -73,6 +73,7 @@ export default {
|
||||
password
|
||||
})
|
||||
if(addUserCode === 0) {
|
||||
this.closeBluetoothConnection()
|
||||
} else if(addUserCode === -1) {
|
||||
uni.hideLoading()
|
||||
this.backAndToast('添加失败,请重试')
|
||||
@ -120,8 +121,10 @@ export default {
|
||||
pageNo: 1
|
||||
})
|
||||
this.getLockList(this.lockSearch)
|
||||
uni.hideLoading()
|
||||
this.backAndToast('添加成功')
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
this.backAndToast('添加成功')
|
||||
}, 1000)
|
||||
} else {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
|
||||
@ -86,7 +86,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useLockStore, ['getRole', 'updateLockSearch', 'getLockList', 'getPowerIcon']),
|
||||
...mapActions(useBluetoothStore, ['openDoor', 'updateServerTimestamp']),
|
||||
...mapActions(useBluetoothStore, ['openDoor', 'updateServerTimestamp', 'closeBluetoothConnection']),
|
||||
...mapActions(useBasicStore, ['routeJump', 'backAndToast']),
|
||||
powerTip() {
|
||||
const that = this
|
||||
@ -152,6 +152,7 @@ export default {
|
||||
onlineToken: this.onlineToken
|
||||
})
|
||||
if(code === 0) {
|
||||
this.closeBluetoothConnection()
|
||||
uni.showToast({
|
||||
title: `${type === 'close' ? '关' : '开'}锁成功`,
|
||||
icon: 'none'
|
||||
|
||||
@ -52,7 +52,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
timeFormat,
|
||||
...mapActions(useBluetoothStore, ['setLockPassword']),
|
||||
...mapActions(useBluetoothStore, ['setLockPassword', 'closeBluetoothConnection']),
|
||||
...mapActions(useLockStore, ['updatePasswordSearch', 'getPasswordList']),
|
||||
...mapActions(useBasicStore, ['backAndToast']),
|
||||
async deletePassword () {
|
||||
@ -79,6 +79,7 @@ export default {
|
||||
endTime: timestamp
|
||||
})
|
||||
if(code === 0) {
|
||||
that.closeBluetoothConnection()
|
||||
const { code: requestCode, message } = await deletePsaawordRequest({
|
||||
lockId: that.currentLockInfo.lockId,
|
||||
keyboardPwdId: that.currentPasswordInfo.keyboardPwdId,
|
||||
|
||||
@ -87,7 +87,7 @@ export default {
|
||||
methods: {
|
||||
...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo']),
|
||||
...mapActions(useLockStore, ['getPasswordList', 'updateCurrentPasswordInfo', 'updatePasswordSearch', 'getPasswordStatus']),
|
||||
...mapActions(useBluetoothStore, ['resetLockPassword', 'setLockPassword']),
|
||||
...mapActions(useBluetoothStore, ['resetLockPassword', 'setLockPassword', 'closeBluetoothConnection']),
|
||||
toPasswordDetail(password) {
|
||||
this.updateCurrentPasswordInfo(password)
|
||||
this.routeJump({
|
||||
@ -121,6 +121,7 @@ export default {
|
||||
endTime: timestamp
|
||||
})
|
||||
if(code === 0) {
|
||||
that.closeBluetoothConnection()
|
||||
const { code: requestCode, message } = await deletePsaawordRequest({
|
||||
lockId: that.currentLockInfo.lockId,
|
||||
keyboardPwdId: password.keyboardPwdId,
|
||||
@ -180,6 +181,7 @@ export default {
|
||||
keyId: that.currentLockInfo.keyId.toString()
|
||||
})
|
||||
if(code === 0) {
|
||||
that.closeBluetoothConnection()
|
||||
const { code: requestCode, message } = await resetPsaawordListRequest({
|
||||
lockId: that.currentLockInfo.lockId,
|
||||
passwordKey: that.currentLockInfo.bluetooth.passwordKey
|
||||
|
||||
@ -220,7 +220,7 @@ export default {
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
} else if(code === -1) {
|
||||
} else if(resetDeviceCode === -1) {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '删除失败,请保持在锁附近',
|
||||
|
||||
@ -746,6 +746,7 @@ export const useBluetoothStore = defineStore('ble', {
|
||||
for(let i = 0; i < deviceList.length; i++) {
|
||||
if(deviceList[i]?.name === that.currentLockInfo.name) {
|
||||
const uuid = deviceList[i]?.advertisServiceUUIDs[0]
|
||||
console.log('设备UUID', uuid, uuid.slice(2,8), uuid.slice(30,32))
|
||||
if(uuid && uuid.slice(2,8)==='758824' && uuid.slice(30,32)==='01') {
|
||||
uni.stopBluetoothDevicesDiscovery()
|
||||
clearTimeout(timer2)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user