部分操作添加无网提示

This commit is contained in:
范鹏 2024-09-06 18:10:50 +08:00
parent a882dc9fc6
commit d4c216b635
8 changed files with 36 additions and 11 deletions

View File

@ -26,7 +26,7 @@
} else if(this.envVersion === 'trial') {
return 'PRE'
} else {
return 'PROD'
return 'XHJ'
}
}
}

View File

@ -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
}

View File

@ -143,10 +143,6 @@ export default {
if(this.currentLockInfo.lockSetting.appUnlockOnline) {
const netWork = await this.getNetworkType()
if(!netWork) {
uni.showToast({
title: '网络访问失败,请检查网络是否正常',
icon: 'none'
})
return
}
}

View File

@ -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: '提示',

View File

@ -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: '确定要重置密码,该锁的所有密码都将被删除',

View File

@ -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

View File

@ -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

View File

@ -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
}