暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

users_notice_index.js 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // 管理相关
  2. var relatedContent = $('.related-content');
  3. var managementButton = $('#management-button');
  4. function handleClick() {
  5. if (relatedContent.is(':hidden')) {
  6. relatedContent.show();
  7. managementButton.text('完成');
  8. } else {
  9. relatedContent.hide();
  10. managementButton.text('管理');
  11. }
  12. }
  13. managementButton.on('click', handleClick);
  14. $(function() {
  15. $('input[name*=ids]').click(function() {
  16. if ($('input[name*=ids]').length == $('input[name*=ids]:checked').length) {
  17. $('#checkboxAll').prop('checked', true);
  18. } else {
  19. $('#checkboxAll').prop('checked', false);
  20. }
  21. });
  22. $('#checkboxAll').click(function() {
  23. $('input[type=checkbox]').prop('checked', this.checked);
  24. });
  25. });
  26. function readNotice(obj) {
  27. var id = $(obj).attr('data-id');
  28. var read = $(obj).attr('data-read');
  29. if (0 === parseInt(read)) {
  30. $.ajax({
  31. url : eyou_basefile + "?m=api&c=Ajax&a=notice_read",
  32. data: {id: id, _ajax: 1},
  33. type: 'get',
  34. dataType: 'json',
  35. success: function(res) {
  36. if (res.code == 1) {
  37. $(obj).attr('data-read', 1);
  38. $('.unread_' + id).removeClass('red').addClass('cor9').html('[已读]');
  39. if (parseInt(res.data.unread_num) < 1) {
  40. $("#users_unread_num").remove();
  41. } else {
  42. $("#users_unread_num").html(res.data.unread_num);
  43. }
  44. }
  45. }
  46. });
  47. }
  48. layer.open({
  49. title: $(obj).attr('data-title'),
  50. type: 1,
  51. skin: 'z_pl', //加上边框
  52. area: ['80%', '80%'], //宽高
  53. content: $(obj).attr('data-content')
  54. });
  55. }
  56. // 批量删除文档
  57. function batchDelNotice(obj) {
  58. var ids = [];
  59. $('input[name*=ids]').each(function(i, o) {
  60. if ($(o).is(':checked')) ids.push($(o).val());
  61. });
  62. if (0 === parseInt(ids.length)) {
  63. showLayerMsg('请选择需要删除的消息');
  64. return false;
  65. }
  66. showConfirmBox('确认删除选中消息?', null, function() {
  67. showLayerLoad();
  68. $.ajax({
  69. url : $(obj).attr('data-url'),
  70. data: {del_id: ids},
  71. type: "POST",
  72. dataType: 'json',
  73. success: function (res) {
  74. layer.closeAll();
  75. if (1 === parseInt(res.code)) {
  76. for (var i = 0; i < ids.length; i++) {
  77. $('#notice_' + ids[i]).remove();
  78. }
  79. showLayerMsg(res.msg, 2, function() {
  80. window.location.reload();
  81. });
  82. } else {
  83. showLayerAlert(res.msg);
  84. }
  85. },
  86. error: function(e) {
  87. layer.closeAll();
  88. showLayerAlert(e.responseText);
  89. }
  90. });
  91. });
  92. }