Authored by yyq

message ajax

... ... @@ -248,7 +248,7 @@ const readMessage = (uid, mid) => {
const pickBirthCoupon = (uid, id) => {
return getBirthCouponAsync(uid, id);
}
};
module.exports = {
getMessageList,
... ...
... ... @@ -5,6 +5,8 @@
*/
var $ = require('yoho-jquery');
var Dialog = require('../common/dialog');
var $container = $('#message-main-container'),
$msgCheck = $container.find('.msg-check'),
$readBtn = $container.find('.read-choose-btn'),
... ... @@ -16,6 +18,9 @@ var operationId = [];
var pickBusy = false;
var Alert = Dialog.Alert,
Confirm = Dialog.confirm;
require('./message-content');
function hasNew() {
... ... @@ -50,6 +55,8 @@ function msgOperation(type, data) {
case 'read':
url = '/home/message/read';
break;
default:
break;
}
if (!url) {
... ... @@ -67,10 +74,10 @@ function msgOperation(type, data) {
$checked.parent().parent().removeClass('new-msg');
hasNew();
} else {
window.location.reload()
window.location.reload();
}
} else {
alert(jsonData.message);
new Alert(jsonData.message);
}
});
}
... ... @@ -89,22 +96,30 @@ $container.on('change', 'input[type="checkbox"]', function() {
});
$container.on('click', '.del-btn', function() {
if (confirm('您确定要删除这条短消息?')) {
msgOperation('del', $(this).data());
}
var data = $(this).data();
new Confirm({
content: '您确定要删除这条短消息?',
cb: function() {
msgOperation('del', data);
}
}).show();
});
$container.on('click', '.del-choose-btn', function() {
if (!operationId.length) {
alert('请选中您要删除的消息');
new Alert('请选中您要删除的消息');
return;
}
if (confirm('确定要删除您选中的消息')) {
msgOperation('del', {
id: operationId.join(',')
});
}
new Confirm({
content: '确定要删除您选中的消息?',
cb: function() {
msgOperation('del', {
id: operationId.join(',')
});
}
}).show();
});
$container.on('click', '.read-choose-btn', function() {
... ... @@ -136,6 +151,6 @@ $pickBtn.click(function() {
pickBusy = false;
alert(msg);
new Alert(msg);
});
});
\ No newline at end of file
});
... ...