File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 99 this . fnInitMoment ( ) ;
1010 this . fnNetVerifyAccessToken ( ) ;
1111 } ,
12+ // 获取未读消息数量
13+ fnNetGetUnreadMessageCount ( ) {
14+ // 显示标题栏加载效果
15+ wx . showNavigationBarLoading ( ) ;
16+ wx . dc . message
17+ . count ( )
18+ . then ( res => {
19+ if ( res && res . data ) {
20+ wx . setTabBarBadge ( {
21+ index : 1 ,
22+ text : `${ res . data } `
23+ } ) ;
24+ }
25+ wx . hideNavigationBarLoading ( ) ;
26+ } )
27+ . catch ( err => {
28+ wx . hideNavigationBarLoading ( ) ;
29+ } ) ;
30+ } ,
1231 // 验证access token有效性
1332 fnNetVerifyAccessToken ( ) {
33+ // sAccessToken不存在时,终止执行
34+ if ( ! wx . getStorageSync ( 'sAccessToken' ) ) {
35+ return ;
36+ }
1437 // 显示标题栏加载效果
1538 wx . showNavigationBarLoading ( ) ;
1639 wx . dc . user
2144 }
2245 // access token有效,更新用户登录状态
2346 this . globalData . bIsLogin = true ;
47+ // 获取用户未读消息数量
48+ this . fnNetGetUnreadMessageCount ( ) ;
2449 wx . hideNavigationBarLoading ( ) ;
2550 } )
2651 . catch ( err => {
You can’t perform that action at this time.
0 commit comments