zhaoxiaohai 2 年 前
コミット
8a32756767
1 ファイル変更18 行追加18 行削除
  1. 18 18
      custom-tab-bar/index.js

+ 18 - 18
custom-tab-bar/index.js

@@ -1,12 +1,10 @@
+const _Http = getApp().globalData.http;
 Component({
     /**
      * 组件的属性列表
      */
     properties: {},
     lifetimes: {
-        attached() {
-            // 在组件实例进入页面节点树时执行
-        },
         ready: function () {
             if (this.data.count == 1) return;
             if (wx.getStorageSync('userauth') != 0) {
@@ -33,17 +31,6 @@ Component({
             }
         },
     },
-    /**
-     * 组件的初始数据
-     */
-
-    /* 
-           {
-               icon: 'icon-a-biaoqianlangongzuo',
-               text: '工作',
-               url: '/pages/tabbar/workbench/index'
-           }, 
-    */
     data: {
         active: 'home',
         Permission: ['首页'],
@@ -74,10 +61,6 @@ Component({
             }
         ],
     },
-
-    /**
-     * 组件的方法列表
-     */
     methods: {
         /* tabbar */
         onChange(event) {
@@ -96,6 +79,23 @@ Component({
             this.setData({
                 active: obj.name
             });
+            this.unReadMessageCount();
         },
+        /* 更新信息数量 */
+        unReadMessageCount() {
+            _Http.basic({
+                "classname": "system.message.Message",
+                "method": "unReadMessageCount",
+                "content": {
+                    nochace: true
+                }
+            }, false).then(res => {
+                if (res.msg != '成功') return;
+                if (res.data.fcount > 99) res.data.fcount = '99+';
+                this.setData({
+                    'tabbarList[1].fcount': res.data.fcount
+                })
+            })
+        }
     },
 })