You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<script>
|
|
|
|
import { getMessageReminder } from '@/pages/api'
|
|
|
|
export default {
|
|
|
|
onLaunch: function() {
|
|
|
|
console.log('App Launch');
|
|
|
|
|
|
|
|
},
|
|
|
|
onShow: function() {
|
|
|
|
console.log('App Show')
|
|
|
|
// 全局刷新消息TabBar小红点(索引0)
|
|
|
|
// 延迟到页面栈稳定后调用,避免初次进入还未渲染tabBar
|
|
|
|
setTimeout(async () => {
|
|
|
|
try {
|
|
|
|
const res = await getMessageReminder()
|
|
|
|
if (res && res.code === 200 && Number(res.data) > 0) {
|
|
|
|
uni.showTabBarRedDot({ index: 0 })
|
|
|
|
} else {
|
|
|
|
uni.hideTabBarRedDot({ index: 0 })
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
console.warn('App onShow 获取消息提醒失败', e)
|
|
|
|
}
|
|
|
|
}, 0)
|
|
|
|
},
|
|
|
|
onHide: function() {
|
|
|
|
console.log('App Hide')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
|
|
|
|
@import "uview-ui/index.scss";
|
|
|
|
</style>
|
|
|
|
<style>
|
|
|
|
/*每个页面公共css */
|
|
|
|
@import "static/common.css";
|
|
|
|
</style>
|