修改 app问题
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
<GongCheng ref="gongCheng" :devCount="devCount" v-if="userInfo.authorities === 'engineering_user'" />
|
||||
<!-- 主用户 -->
|
||||
<ZhuYongHu :devCount="devCount" v-if="userInfo.authorities === 'app_vip_user'" />
|
||||
<!-- 游客 -->
|
||||
<!-- 游客 -->
|
||||
<YouKe :devCount="devCount" v-if="userInfo.authorities === 'tourist'"></YouKe>
|
||||
<template v-show="engineeringList.length">
|
||||
<view class="canneng-index-title mt20">设备列表</view>
|
||||
@@ -151,7 +151,7 @@ export default {
|
||||
return
|
||||
}
|
||||
getDevCount(this.select.engineeringId).then((res) => {
|
||||
// console.log(`12312`,res)
|
||||
// console.log(`12312`,res)
|
||||
// Object.assign(this.devCount, res.data)
|
||||
this.devCount = res.data
|
||||
this.devCount.currentOffLineDevs.forEach((item) => {
|
||||
@@ -175,7 +175,7 @@ export default {
|
||||
if (messagePage) {
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text: messagePage ? messagePage + '' : '',
|
||||
text:messagePage ? (messagePage > 99 ? '99+' : messagePage + '') : '',
|
||||
})
|
||||
} else {
|
||||
uni.removeTabBarBadge({
|
||||
@@ -215,7 +215,7 @@ export default {
|
||||
// #endif
|
||||
}, 1000)
|
||||
}
|
||||
this.timer = setInterval(this.getDevCount, 1000 *60) // 定时请求
|
||||
this.timer = setInterval(this.getDevCount, 1000 * 60) // 定时请求
|
||||
this.store = this.DataSource('/cs-device-boot/EquipmentDelivery/queryEquipmentByProject')
|
||||
// #ifdef APP-PLUS
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getDevCount } from '../../common/api/device.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -37,8 +38,10 @@ export default {
|
||||
userInfo: {},
|
||||
messageCount: {},
|
||||
timer: null,
|
||||
devCount: {},
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
init() {
|
||||
this.userInfo = uni.getStorageSync('userInfo')
|
||||
@@ -76,10 +79,58 @@ export default {
|
||||
break
|
||||
}
|
||||
},
|
||||
getDevCount() {
|
||||
if (uni.getStorageSync('projectList')[1] != undefined) {
|
||||
getDevCount(uni.getStorageSync('projectList')[1].engineeringId).then((res) => {
|
||||
this.devCount = res.data
|
||||
this.devCount.currentOffLineDevs.forEach((item) => {
|
||||
item.runStatus = 1
|
||||
})
|
||||
this.devCount.offLineDevs.forEach((item) => {
|
||||
item.runStatus = 1
|
||||
})
|
||||
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.feedBackCount
|
||||
|
||||
if (messagePage) {
|
||||
uni.setTabBarBadge({
|
||||
index: 1,
|
||||
text:messagePage ? (messagePage > 99 ? '99+' : messagePage + '') : '',
|
||||
})
|
||||
} else {
|
||||
uni.removeTabBarBadge({
|
||||
index: 1,
|
||||
})
|
||||
}
|
||||
if (minePage) {
|
||||
uni.setTabBarBadge({
|
||||
index: 2,
|
||||
text: minePage + '',
|
||||
})
|
||||
} else {
|
||||
uni.removeTabBarBadge({
|
||||
index: 2,
|
||||
})
|
||||
}
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.setBadgeNumber(messagePage + minePage)
|
||||
// #endif
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
onLoad(options) {},
|
||||
onShow() {
|
||||
this.init()
|
||||
this.getDevCount()
|
||||
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
|
||||
this.timer = setInterval(() => {
|
||||
this.messageCount = uni.getStorageSync(this.$cacheKey.messageCount) || {}
|
||||
|
||||
Reference in New Issue
Block a user