消息修改

This commit is contained in:
仲么了
2023-09-22 13:39:19 +08:00
parent a17e785d3e
commit 525e7e6f04
11 changed files with 223 additions and 142 deletions

View File

@@ -144,6 +144,9 @@ export default {
},
getDevCount() {
if (!this.select.engineeringId) return
if (!uni.getStorageSync(this.$cacheKey.access_token)) {
clearInterval(this.timer)
}
getDevCount(this.select.engineeringId).then((res) => {
// Object.assign(this.devCount, res.data)
this.devCount = res.data
@@ -163,15 +166,28 @@ export default {
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 + '' : '',
})
let minePage = this.devCount.feedBackCount
if (messagePage) {
uni.setTabBarBadge({
index: 1,
text: messagePage ? messagePage + '' : '',
})
} else {
uni.removeTabBarBadge({
index: 1,
})
}
if (minePage) {
uni.setTabBarBadge({
index: 2,
text: minePage + '',
})
} else {
uni.removeTabBarBadge({
index: 2,
})
}
})
},
},
@@ -181,6 +197,7 @@ export default {
url: '/pages/user/login',
})
}
this.timer = setInterval(this.getDevCount, 3000) // 定时请求
this.store = this.DataSource('/cs-device-boot/EquipmentDelivery/queryEquipmentByProject')
// #ifdef APP-PLUS
setTimeout(() => {
@@ -204,12 +221,8 @@ export default {
})
} else {
this.init()
this.timer = setInterval(this.getDevCount, 10000) // 定时请求
}
},
onHide() {
clearInterval(this.timer)
}
}
</script>
<style lang="scss">

View File

@@ -36,6 +36,7 @@ export default {
loading: false,
userInfo: {},
messageCount: {},
timer: null,
}
},
methods: {
@@ -72,15 +73,17 @@ export default {
}
},
},
onLoad(options) {
setInterval(() => {
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
}, 10000) // 定时请求
},
onLoad(options) {},
onShow() {
this.init()
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
this.timer = setInterval(() => {
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
}, 3000) // 定时请求
},
onHide() {
clearInterval(this.timer)
}
}
</script>

View File

@@ -114,6 +114,7 @@ export default {
loading: true,
userInfo: {},
messageCount: {},
timer: null,
}
},
computed: {
@@ -143,7 +144,7 @@ export default {
this.init()
setInterval(() => {
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
}, 10000) // 定时请求
}, 3000) // 定时请求
},
methods: {
init() {},
@@ -248,6 +249,12 @@ export default {
this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
this.loading = false
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
this.timer = setInterval(() => {
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
}, 3000) // 定时请求
},
onHide() {
clearInterval(this.timer)
},
}
</script>