Commit 9136b592 by 梁建民

js

parent cf3ed074
......@@ -39,7 +39,7 @@
<script type="text/html" id="msgHtml">
<div class="notice_list">
{{# layui.each(d, function(index, item){ }}
<div class="notice_item clr" data-status="{{item.status}}">
<div class="notice_item clr" data-id="{{item.log_id}}" data-type="{{item.msg_type}}">
<div class="item_right fr">
<p>{{item.create_time}}</p>
</div>
......
......@@ -177,7 +177,11 @@
/**
* 获取会员活动通知
*/
userActmsg: user_url + '/user/actmsg'
userActmsg: user_url + '/user/actmsg',
/**
* 标记会员通知(已读)
*/
userMarkmsg: user_url + '/user/markmsg'
};
if (typeof define === "function" && define.amd) {
return apis;
......
......@@ -13,7 +13,7 @@
return this;
},
render: function (opt, params, curr, url) {
render: function (opt, params, curr, url, flag) {
var getTpl = msgHtml.innerHTML;
......@@ -40,35 +40,38 @@
}
layui.laytpl(getTpl).render(data.data, function (html) {
$("#notice").empty().html(html);
if (flag == undefined) {
layui.laypage.render({
elem: 'pagination',
theme: '#1080d0',
count: data.count,
limit: 10,
curr: curr,
jump: function (obj, first) {
if (!first) {
//分页回调调用
var json = {
page: obj.curr
};
var param = $.extend({}, params, json);
NoticeController.render(opt, param, obj.curr, url);
layui.laytpl(getTpl).render(data.data, function (html) {
$("#notice").empty().html(html);
layui.laypage.render({
elem: 'pagination',
theme: '#1080d0',
count: data.count,
limit: 10,
curr: curr,
jump: function (obj, first) {
if (!first) {
//分页回调调用
var json = {
page: obj.curr
};
var param = $.extend({}, params, json);
NoticeController.render(opt, param, obj.curr, url);
}
}
}
});
});
});
}
} else {
......@@ -101,6 +104,44 @@
}
});
//活动标记
$(document).on('click', '.notice_list .notice_item', function () {
var id = $(this).attr('data-id');
var type = $(this).attr('data-type');
IcController.getData(apis.userMarkmsg, 'GET', {token: opt.token, log_id: id}, function (res) {
if (res.errcode === 0) {
if (type === 2) {
opt.render(opt, {token: opt.token, page: 1, limit: 10}, 1, apis.userActmsg, false);
} else {
opt.render(opt, {token: opt.token, page: 1, limit: 10}, 1, apis.userSysmsg, false);
}
//顶部信息数量恭喜
IcController.getData(apis.userInfo, 'GET', {token: opt.token}, function (res) {
if (res.errcode === 0) {
//消息数量
$("#count_num").empty().html(res.data['msg_notification']);
}
});
}
});
});
return this;
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment