设备消息

This commit is contained in:
仲么了
2023-09-21 15:15:17 +08:00
parent 4e11e2f2fd
commit 464831f206
14 changed files with 189 additions and 108 deletions

View File

@@ -71,6 +71,7 @@ export default {
},
engineeringList: [],
navTabHeight: 0,
timer: null,
}
},
computed: {
@@ -142,6 +143,7 @@ export default {
}
},
getDevCount() {
if (!this.select.engineeringId) return
getDevCount(this.select.engineeringId).then((res) => {
// Object.assign(this.devCount, res.data)
this.devCount = res.data
@@ -152,7 +154,24 @@ export default {
item.runStatus = 1
})
this.devCount.engineeringListLength = this.engineeringList.length
console.log(this.devCount)
uni.setStorage({
key: this.$cacheKey.messageCount,
data: this.devCount,
})
let messagePage =
this.devCount.runCount +
this.devCount.eventCount +
this.devCount.alarmCount +
this.devCount.harmonicCount
let minePage = this.devCount.harmonicCount
uni.setTabBarBadge({
index: 1,
text: messagePage ? messagePage + '' : '',
})
uni.setTabBarBadge({
index: 2,
text: minePage ? minePage + '' : '',
})
})
},
},
@@ -184,19 +203,13 @@ export default {
url: `/pages/user/login`,
})
} else {
if (
this.userInfo.authorities === 'app_vip_user' ||
this.userInfo.authorities == 5 ||
this.userInfo.authorities === 'tourist'
) {
// uni.setTabBarBadge({
// index: 1,
// text: '6',
// })
}
this.init()
this.timer = setInterval(this.getDevCount, 10000) // 定时请求
}
},
onHide() {
clearInterval(this.timer)
}
}
</script>
<style lang="scss">