diff --git a/App.vue b/App.vue index 6d7b2f9..a6c7d0f 100644 --- a/App.vue +++ b/App.vue @@ -26,7 +26,7 @@ } else if(this.envVersion === 'trial') { return 'PRE' } else { - return 'PROD' + return 'XHJ' } } } diff --git a/pages/createPassword/createPassword.vue b/pages/createPassword/createPassword.vue index e45b153..4710779 100644 --- a/pages/createPassword/createPassword.vue +++ b/pages/createPassword/createPassword.vue @@ -70,7 +70,7 @@ export default { this.temporaryTime = this.setTime() }, methods: { - ...mapActions(useBasicStore, ['getDeviceInfo', 'backAndToast']), + ...mapActions(useBasicStore, ['getDeviceInfo', 'backAndToast', 'getNetworkType']), ...mapActions(useLockStore, ['getPasswordList', 'updatePasswordSearch']), setTime() { const now = new Date() @@ -89,6 +89,11 @@ export default { return } + const netWork = await this.getNetworkType() + if(!netWork) { + return + } + if(this.pending) { return } diff --git a/pages/lockDetail/lockDetail.vue b/pages/lockDetail/lockDetail.vue index 901c600..2c14044 100644 --- a/pages/lockDetail/lockDetail.vue +++ b/pages/lockDetail/lockDetail.vue @@ -143,10 +143,6 @@ export default { if(this.currentLockInfo.lockSetting.appUnlockOnline) { const netWork = await this.getNetworkType() if(!netWork) { - uni.showToast({ - title: '网络访问失败,请检查网络是否正常', - icon: 'none' - }) return } } diff --git a/pages/passwordDetail/passwordDetail.vue b/pages/passwordDetail/passwordDetail.vue index ca9feb0..f2d4002 100644 --- a/pages/passwordDetail/passwordDetail.vue +++ b/pages/passwordDetail/passwordDetail.vue @@ -54,8 +54,12 @@ export default { timeFormat, ...mapActions(useBluetoothStore, ['setLockPassword', 'closeBluetoothConnection']), ...mapActions(useLockStore, ['updatePasswordSearch', 'getPasswordList']), - ...mapActions(useBasicStore, ['backAndToast']), + ...mapActions(useBasicStore, ['backAndToast', 'getNetworkType']), async deletePassword () { + const netWork = await this.getNetworkType() + if(!netWork) { + return + } const that = this uni.showModal({ title: '提示', diff --git a/pages/passwordList/passwordList.vue b/pages/passwordList/passwordList.vue index 6efa56f..a380201 100644 --- a/pages/passwordList/passwordList.vue +++ b/pages/passwordList/passwordList.vue @@ -94,7 +94,7 @@ export default { this.clearList('password') }, methods: { - ...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo']), + ...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo', 'getNetworkType']), ...mapActions(useLockStore, ['getPasswordList', 'updateCurrentPasswordInfo', 'updatePasswordSearch', 'getPasswordStatus']), ...mapActions(useBluetoothStore, ['resetLockPassword', 'setLockPassword', 'closeBluetoothConnection']), toPasswordDetail(password) { @@ -104,6 +104,10 @@ export default { }) }, async deletePassword(data) { + const netWork = await this.getNetworkType() + if(!netWork) { + return + } const password = data const that = this let index = this.passwordList.findIndex(item => item.keyboardPwdId === password.keyboardPwdId) @@ -167,6 +171,10 @@ export default { }, async resetPassword() { const that = this + const netWork = await this.getNetworkType() + if(!netWork) { + return + } uni.showModal({ title: '提示', content: '确定要重置密码,该锁的所有密码都将被删除', diff --git a/pages/searchDevice/searchDevice.vue b/pages/searchDevice/searchDevice.vue index 3a33715..f9970d4 100644 --- a/pages/searchDevice/searchDevice.vue +++ b/pages/searchDevice/searchDevice.vue @@ -43,8 +43,12 @@ export default { methods: { ...mapActions(useBluetoothStore, ['getBluetoothDevices', 'stopGetBluetoothDevices', 'updateCurrentLockInfo', 'getPublicKey', 'getCommKey', 'connectBluetoothDevice', 'updateServerTimestamp', 'getLockStatus']), - ...mapActions(useBasicStore, ['getDeviceInfo', 'routeJump']), + ...mapActions(useBasicStore, ['getDeviceInfo', 'routeJump', 'getNetworkType']), async connect(device) { + const netWork = await this.getNetworkType() + if(!netWork) { + return + } uni.showLoading({ title: '连接中', mask: true diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue index 18eb25a..c15ee85 100644 --- a/pages/setting/setting.vue +++ b/pages/setting/setting.vue @@ -120,7 +120,7 @@ export default { timeFormat, ...mapActions(useBluetoothStore, ['resetDevice', 'updateCurrentLockInfo']), ...mapActions(useLockStore, ['getLockList', 'updateLockSearch', 'convertWeekDaysToChineseString']), - ...mapActions(useBasicStore, ['backAndToast']), + ...mapActions(useBasicStore, ['backAndToast', 'getNetworkType']), changeRadio() { this.checked = !this.checked }, @@ -182,7 +182,11 @@ export default { }) } }, - deleteLock() { + async deleteLock() { + const netWork = await this.getNetworkType() + if(!netWork) { + return + } const that = this if(this.currentLockInfo.userType !== 110301 && this.currentLockInfo.keyRight === 1) { this.showModal = true diff --git a/stores/basic.js b/stores/basic.js index 09e440a..8183c4c 100644 --- a/stores/basic.js +++ b/stores/basic.js @@ -140,6 +140,10 @@ export const useBasicStore = defineStore('basic', { uni.getNetworkType({ success: function (res) { if(res.networkType === 'none') { + uni.showToast({ + title: '网络访问失败,请检查网络是否正常', + icon: 'none' + }) resolve(false) return }