HHSLinkSLink/HSLink-app/App.vue

116 lines
1.9 KiB
Vue
Raw Normal View History

2020-09-16 09:25:13 +08:00
<script>
2020-10-10 10:44:32 +08:00
import request from "@/util/request.js";
2020-09-16 09:25:13 +08:00
export default {
2020-10-10 10:44:32 +08:00
data() {
return {
//未读消息数字
unreadNumber: ""
}
},
2020-09-16 09:25:13 +08:00
onLaunch: function() {
console.log('App Launch');
2020-10-10 10:44:32 +08:00
this.getTabBarNumber();
2020-09-23 18:53:25 +08:00
/**
* 主页面tab标签红标显示
*/
/* setTimeout(() => {
2020-09-16 09:25:13 +08:00
uni.setTabBarBadge({
index: 1,
text: '31'
});
uni.showTabBarRedDot({
index: 3
});
2020-09-23 18:53:25 +08:00
}, 1000); */
2020-09-16 09:25:13 +08:00
},
onShow: function() {
console.log('App Show');
},
onHide: function() {
console.log('App Hide');
2020-10-10 10:44:32 +08:00
},
methods: {
/**
* 获取tabBar数字
*/
getTabBarNumber() {
request.post("/hs/getTabBarNumber",{
userId: uni.getStorageSync("userInfo").user_id
}).then(res => {
console.log("获取tabBar数字",res);
if (res.data.unreadNumber > 0) {
uni.setTabBarBadge({
index: 3,
text: res.data.unreadNumber.toString()
});
} else {
uni.removeTabBarBadge({
index: 3
})
}
},err => {
console.log("err",err)
})
}
2020-09-16 09:25:13 +08:00
}
};
</script>
<style>
@import "colorui/main.css";
@import "colorui/icon.css";
/* 头条小程序需要把 iconfont 样式放到组件外 */
/*每个页面公共css */
page {
height: 100%;
width: 100%;
min-height: 100%;
/* display: flex; */
font-size: 16px;
}
2020-09-17 20:01:50 +08:00
.page{
margin: 20rpx;
border-radius: 10rpx;
padding-bottom: 100rpx;
}
2020-09-16 09:25:13 +08:00
/* #ifdef MP-BAIDU */
page {
/* width: 100%;
height: 100%;
display: block; */
}
swan-template {
width: 100%;
min-height: 100%;
display: flex;
}
/* 原生组件模式下需要注意组件外部样式 */
custom-component {
width: 100%;
min-height: 100%;
/* display: flex; */
}
/* #endif */
/* #ifdef MP-ALIPAY */
page {
min-height: 100vh;
}
/* #endif */
/* 原生组件模式下需要注意组件外部样式 */
m-input {
width: 100%;
/* min-height: 100%; */
/* display: flex;
flex: 1; */
}
</style>