// 消息列表获取未读消息 function Message() { // 初始化 this.init = function () { if (!loginflag) return $('#noticed').show() this.getMessageList() } // 悬浮窗列表数据请求 this.getMessageList = function () { var params = { isColumn: false, // 是否需要栏目(消息中心需要) isColumnNewMsg: false, isMsgList: false, // 是否需要列表数据 isContainLetter: false, // 是否包含私信数 msgType: -1, // 消息类型,-1为全部 isRead: 0, // 是否已读 offset: 1, size: 0 } $.ajax({ url: '/jyapi/messageCenter/MessageList', type: 'POST', data: JSON.stringify(params), dataType: 'json', headers: {'Content-Type': 'application/json'}, success:function (res) { if (res.unread) { var unreadNum = res.unread; $('#tips').show(); $('#tips').html(unreadNum > 99 ? '99+' : unreadNum); } else { $('#tips').hide(); } }, error:function () {} }) } this.init() }