dashboard.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. 'use strict';
  2. /**
  3. * 待办页js
  4. *
  5. * @author EllisRan.
  6. * @date 2019/3/19
  7. * @version
  8. */
  9. $(document).ready(() => {
  10. // $('a[href="#view-msg"]').on('click', function () {
  11. // const id = $(this).attr('msg-id');
  12. // const msgInfo = _.find(msgList,{ id: parseInt(id) });
  13. // $('#title').html(msgInfo.title);
  14. // $('#creator').html(msgInfo.creator);
  15. // $('#release_time').html(moment(msgInfo.release_time*1000).format('YYYY-MM-DD'));
  16. // $('#content').html(msgInfo.content);
  17. // $('#user_permission').html('');
  18. // if (userMsgPermission && parseInt(uid) === msgInfo.create_uid ) {
  19. // const permissionHtml = '<a href="/dashboard/msg/add/' + msgInfo.id +'" class="btn btn-sm btn-outline-primary">编辑</a>';
  20. // $('#user_permission').html(permissionHtml);
  21. // }
  22. // });
  23. $('.list-group-item a').on('click', function () {
  24. const id = $(this).attr('msg-id');
  25. const msgInfo = _.find(msgList, {id: parseInt(id)});
  26. $('.msg-height-list li').removeClass('list-waring');
  27. $(this).parents('.list-group-item').addClass('list-waring');
  28. $('#title').html(msgInfo.title);
  29. $('#release_time').html(moment(msgInfo.release_time * 1000).format('YYYY-MM-DD'));
  30. $('#content').html(msgInfo.content);
  31. $('#user_permission').html('');
  32. if (type && parseInt(type) === 1) {
  33. $('#creator').html(msgInfo.creator);
  34. $('#view-msg .modal-title').text('项目通知');
  35. if (userMsgPermission && parseInt(uid) === msgInfo.create_uid) {
  36. const permissionHtml = '<a href="/dashboard/msg/add/' + msgInfo.id + '" class="btn btn-sm btn-outline-primary">编辑</a>';
  37. $('#user_permission').html(permissionHtml);
  38. }
  39. } else {
  40. $('#creator').html('');
  41. $('#view-msg .modal-title').text('系统通知');
  42. }
  43. });
  44. $('.system-msg').on('click', function () {
  45. const id = $(this).attr('msg-id');
  46. const msgInfo = _.find(sysMsgList, {id: parseInt(id)});
  47. $('#title').html(msgInfo.title);
  48. $('#creator').html('');
  49. $('#release_time').html(moment(msgInfo.release_time * 1000).format('YYYY-MM-DD'));
  50. $('#content').html(msgInfo.content);
  51. $('#view-msg .modal-title').text('系统通知');
  52. $('#user_permission').html('');
  53. })
  54. // $('#notice').on('click', 'li a', function() {
  55. // const id = $(this).data('id')
  56. // postData(window.location.pathname + '/push', {id}, function() {
  57. // return
  58. // })
  59. // })
  60. });