Commit 9136b592 by 梁建民

js

parent cf3ed074
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<script type="text/html" id="msgHtml"> <script type="text/html" id="msgHtml">
<div class="notice_list"> <div class="notice_list">
{{# layui.each(d, function(index, item){ }} {{# 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"> <div class="item_right fr">
<p>{{item.create_time}}</p> <p>{{item.create_time}}</p>
</div> </div>
......
...@@ -177,7 +177,11 @@ ...@@ -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) { if (typeof define === "function" && define.amd) {
return apis; return apis;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
return this; return this;
}, },
render: function (opt, params, curr, url) { render: function (opt, params, curr, url, flag) {
var getTpl = msgHtml.innerHTML; var getTpl = msgHtml.innerHTML;
...@@ -40,35 +40,38 @@ ...@@ -40,35 +40,38 @@
} }
if (flag == undefined) {
layui.laytpl(getTpl).render(data.data, function (html) {
$("#notice").empty().html(html);
layui.laypage.render({ layui.laytpl(getTpl).render(data.data, function (html) {
elem: 'pagination',
theme: '#1080d0', $("#notice").empty().html(html);
count: data.count,
limit: 10, layui.laypage.render({
curr: curr, elem: 'pagination',
jump: function (obj, first) { theme: '#1080d0',
count: data.count,
if (!first) { limit: 10,
curr: curr,
//分页回调调用 jump: function (obj, first) {
var json = {
page: obj.curr
};
var param = $.extend({}, params, json);
NoticeController.render(opt, param, obj.curr, url);
if (!first) {
//分页回调调用
var json = {
page: obj.curr
};
var param = $.extend({}, params, json);
NoticeController.render(opt, param, obj.curr, url);
}
} }
} });
}); });
}); }
} else { } else {
...@@ -101,6 +104,44 @@ ...@@ -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; 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