|
|
@@ -118,7 +118,31 @@ App({
|
|
|
{
|
|
|
return util.$h;
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
+ setUnread: function(newVal)
|
|
|
+ {
|
|
|
+ this.globalData.unread = newVal
|
|
|
+ this.updateUnread();
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * update unread message tip
|
|
|
+ * @param {int} newval
|
|
|
+ */
|
|
|
+ updateUnread: function()
|
|
|
+ {
|
|
|
+ if (this.globalData.unread != undefined && this.globalData.unread > 0) {
|
|
|
+ wx.setTabBarBadge({
|
|
|
+ index: 2,
|
|
|
+ text: this.globalData.unread.toString(),
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ wx.removeTabBarBadge({
|
|
|
+ index: 2,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
/*
|
|
|
* 合并数组
|
|
|
* @param array list 请求返回数据
|