Files
jobslink-user-clent/App.vue

64 lines
1.2 KiB
Vue
Raw Normal View History

2024-02-02 10:24:54 +08:00
<script>
import {
mapGetters
} from 'vuex'
// #ifdef H5
import {
setPlatformByHostName
} from '@/untils/customized.js'
// #endif
export default {
onLaunch: function() {
if (this.$store.state.user.token) {
this.$store.dispatch('startRefreshTokenTimer')
this.$store.dispatch('startRefreshNewsTimer')
this.$store.dispatch('refreshAuthState')
}
// #ifdef H5
// 企业定制
setPlatformByHostName(this.$store)
// #endif
},
onShow: function() {},
onHide: function() {},
computed: {
...mapGetters(['news']),
allUnread() {
return this.news.allUnread
}
},
watch: {
allUnread(value) {
if (!this.$store.state.user.token) {} else if (value > 0) {
uni.showTabBarRedDot({
index: 2
})
uni.$once('newsReadChange', () => {
uni.showTabBarRedDot({
index: 2
})
})
} else {
uni.hideTabBarRedDot({
index: 2
})
uni.$once('newsReadChange', () => {
uni.hideTabBarRedDot({
index: 2
})
})
}
}
}
};
</script>
<style>
/*每个页面公共css */
/* tabbar 字体大小 */
/* .uni-tabbar__label{
font-size: 14px !important;
} */
</style>