diff --git a/manifest.json b/manifest.json index 54b76d7..49f5a2f 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "appid" : "__UNI__933D519", "description" : "", "versionName" : "1.0.0", - "versionCode" : "9", + "versionCode" : "12", "transformPx" : false, /* 小程序特有相关 */ "mp-weixin" : { diff --git a/pages/lockDetail/lockDetail.vue b/pages/lockDetail/lockDetail.vue index 2c14044..42802ec 100644 --- a/pages/lockDetail/lockDetail.vue +++ b/pages/lockDetail/lockDetail.vue @@ -137,6 +137,16 @@ export default { } }, async openDoorOperate(type) { + if(this.currentLockInfo.faceAuthentication === 1 && + ((this.currentLockInfo.nextFaceValidateTime <= new Date().getTime() + this.time * 1000) && + this.currentLockInfo.nextFaceValidateTime !== 0)) { + uni.showModal({ + title: '提示', + content: '开门前需进行实名认证,小程序暂不支持,请使用APP认证开门', + showCancel: false + }) + return + } if(this.pending) { return } diff --git a/pages/passwordList/passwordList.vue b/pages/passwordList/passwordList.vue index a380201..3ed0ea8 100644 --- a/pages/passwordList/passwordList.vue +++ b/pages/passwordList/passwordList.vue @@ -95,7 +95,8 @@ export default { }, methods: { ...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo', 'getNetworkType']), - ...mapActions(useLockStore, ['getPasswordList', 'updateCurrentPasswordInfo', 'updatePasswordSearch', 'getPasswordStatus']), + ...mapActions(useLockStore, ['getPasswordList', 'updateCurrentPasswordInfo', 'updatePasswordSearch', + 'getPasswordStatus', 'clearList']), ...mapActions(useBluetoothStore, ['resetLockPassword', 'setLockPassword', 'closeBluetoothConnection']), toPasswordDetail(password) { this.updateCurrentPasswordInfo(password) diff --git a/pages/safeQuestion/safeQuestion.vue b/pages/safeQuestion/safeQuestion.vue index cc662c1..fc67494 100644 --- a/pages/safeQuestion/safeQuestion.vue +++ b/pages/safeQuestion/safeQuestion.vue @@ -45,7 +45,11 @@ export default { }) } }, - updateAnswer() { + async updateAnswer() { + const netWork = await this.getNetworkType() + if(!netWork) { + return + } this.routeJump({ type: 'redirectTo', name: 'updateSafeQuestion' diff --git a/pages/searchDevice/searchDevice.vue b/pages/searchDevice/searchDevice.vue index a489930..b58d5da 100644 --- a/pages/searchDevice/searchDevice.vue +++ b/pages/searchDevice/searchDevice.vue @@ -66,51 +66,59 @@ export default { name: device.name, deviceId: device.deviceId }) - const result = await this.connectBluetoothDevice() - if(result) { - this.stopGetBluetoothDevices() - const { code: getPublicKeyCode } = await this.getPublicKey(this.currentLockInfo.name) - console.log('获取公钥返回', getPublicKeyCode, [...this.currentLockInfo.publicKey]) - if(getPublicKeyCode !== 0) { + try { + const result = await this.connectBluetoothDevice() + if(result) { + this.stopGetBluetoothDevices() + const { code: getPublicKeyCode } = await this.getPublicKey(this.currentLockInfo.name) + console.log('获取公钥返回', getPublicKeyCode, [...this.currentLockInfo.publicKey]) + if(getPublicKeyCode !== 0) { + uni.hideLoading() + uni.showToast({ + title: '连接失败,请靠近设备并保持设备处于唤醒状态', + icon: 'none' + }) + return + } + const { code: getCommKeyCode } = await this.getCommKey(this.currentLockInfo.name, this.keyId, + this.userInfo.uid.toString(), this.serverTimestamp) + console.log('获取私钥返回', getCommKeyCode) + if(getCommKeyCode !== 0) { + uni.hideLoading() + uni.showToast({ + title: '连接失败,请靠近设备并保持设备处于唤醒状态', + icon: 'none' + }) + return + } + const date = new Date() + const timestamp = parseInt(date.getTime() / 1000) - date.getTimezoneOffset() * 60 + const { code } = await this.getLockStatus({ + name: this.currentLockInfo.name, + uid: this.userInfo.uid, + nowTime: this.serverTimestamp, + localTime: timestamp + }) + if (code !== 0) { + uni.hideLoading() + uni.showToast({ + title: '连接失败,请靠近设备并保持设备处于唤醒状态', + icon: 'none' + }) + return + } + this.routeJump({ + type: 'redirectTo', + name: 'selectAddress' + }) + } else { uni.hideLoading() uni.showToast({ title: '连接失败,请靠近设备并保持设备处于唤醒状态', icon: 'none' }) - return } - const { code: getCommKeyCode } = await this.getCommKey(this.currentLockInfo.name, this.keyId, - this.userInfo.uid.toString(), this.serverTimestamp) - console.log('获取私钥返回', getCommKeyCode) - if(getCommKeyCode !== 0) { - uni.hideLoading() - uni.showToast({ - title: '连接失败,请靠近设备并保持设备处于唤醒状态', - icon: 'none' - }) - return - } - const date = new Date() - const timestamp = parseInt(date.getTime() / 1000) - date.getTimezoneOffset() * 60 - const { code } = await this.getLockStatus({ - name: this.currentLockInfo.name, - uid: this.userInfo.uid, - nowTime: this.serverTimestamp, - localTime: timestamp - }) - if (code !== 0) { - uni.hideLoading() - uni.showToast({ - title: '连接失败,请靠近设备并保持设备处于唤醒状态', - icon: 'none' - }) - return - } - this.routeJump({ - type: 'redirectTo', - name: 'selectAddress' - }) - } else { + } catch (res) { uni.hideLoading() uni.showToast({ title: '连接失败,请靠近设备并保持设备处于唤醒状态', diff --git a/pages/selectAddress/selectAddress.vue b/pages/selectAddress/selectAddress.vue index c9d4096..7f728e5 100644 --- a/pages/selectAddress/selectAddress.vue +++ b/pages/selectAddress/selectAddress.vue @@ -3,7 +3,7 @@ 地理位置 + :enable-zoom="true" :enable-scroll="true"> 检查以确保以下地址是正确的 diff --git a/stores/bluetooth.js b/stores/bluetooth.js index c97d811..e28f2de 100644 --- a/stores/bluetooth.js +++ b/stores/bluetooth.js @@ -618,6 +618,7 @@ export const useBluetoothStore = defineStore('ble', { } uni.createBLEConnection({ deviceId: that.currentLockInfo.deviceId, + timeout: 10000, success(res) { console.log('连接成功', res) // 获取设备服务