notify.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>消息通知</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
  7. <meta name="apple-mobile-web-app-capable" content="yes">
  8. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  9. <link rel="stylesheet" type="text/css" href="../../../css/common/mui.min.css" />
  10. <link rel="stylesheet" href="../../../css/common/common.css">
  11. <link rel="stylesheet" type="text/css" href="../../../css/index/index-notice/notices.css" />
  12. </head>
  13. <body>
  14. <header id="header" class="mui-bar mui-bar-nav">
  15. <a class="mui-action-back mui-icon mui-icon-arrowleft">
  16. <span class="back">返回</span>
  17. </a>
  18. <h1 class="mui-title">消息通知</h1>
  19. </header>
  20. <div class="mui-content">
  21. <ul class="mui-table-view">
  22. <li class="mui-table-view-cell mui-media" type="4">
  23. <img class="mui-media-object mui-pull-left">
  24. <div class="mui-media-body">
  25. 审批通知
  26. <p class="mui-ellipsis b-mui-ellipsis"></p>
  27. <span class="b-time time"></span>
  28. <span class="item_count b-item_count"></span>
  29. </div>
  30. </li>
  31. <li class="mui-table-view-cell mui-media" type="2">
  32. <img class="mui-media-object mui-pull-left">
  33. <div class="mui-media-body">
  34. 日程通知
  35. <p class="mui-ellipsis a-mui-ellipsis"></p>
  36. <span class="a-time time"></span>
  37. <span class="item_count a-item_count"></span>
  38. </div>
  39. </li>
  40. </ul>
  41. </div>
  42. <script src="../../../libs/mui.min.js"></script>
  43. <script type="text/javascript">
  44. mui.plusReady(function() {
  45. var str = plus.storage.getItem('user');
  46. var user = JSON.parse(str);
  47. var token = user.Data.Token;
  48. for(var i = 0; i < mui('.mui-media-object').length; i++) {
  49. mui('.mui-media-object')[i].src = 'http://www.bosshand.cn' + user.Data.Picture;
  50. };
  51. MessageList(4);
  52. MessageList(2);
  53. /*
  54. * 消息列表
  55. */
  56. function MessageList(type) {
  57. mui.ajax('http://www.bosshand.cn/api/Customer/BackstageIndexMessage', {
  58. data: {
  59. "type": type
  60. },
  61. dataType: 'json',
  62. type: "post",
  63. contentType: "application/x-www-form-urlencoded",
  64. headers: {
  65. authorization: token
  66. },
  67. success: function(resp) {
  68. if(resp.Code == 200) {
  69. if(type == 4) {
  70. if(resp.Data.list.length > 0) {
  71. mui('.b-item_count')[0].style.display = 'block';
  72. mui('.b-time')[0].style.display = 'block';
  73. mui('.b-mui-ellipsis')[0].innerHTML = '您有新的通知';
  74. mui('.b-item_count')[0].innerHTML = resp.Data.list.length;
  75. mui('.b-time')[0].innerHTML = getLocalDate(resp.Data.list[resp.Data.list.length - 1].UpdateTime)
  76. } else {
  77. mui('.b-mui-ellipsis')[0].innerHTML = '暂无新的通知';
  78. mui('.b-item_count')[0].style.display = 'none';
  79. mui('.b-time')[0].style.display = 'none';
  80. }
  81. } else if(type == 2) {
  82. if(resp.Data.list.length > 0) {
  83. mui('.a-item_count')[0].style.display = 'block';
  84. mui('.a-time')[0].style.display = 'block';
  85. mui('.a-mui-ellipsis')[0].innerHTML = '您有新的通知';
  86. mui('.a-item_count')[0].innerHTML = resp.Data.list.length;
  87. mui('.a-time')[0].innerHTML = getLocalDate(resp.Data.list[resp.Data.list.length - 1].UpdateTime)
  88. } else {
  89. mui('.a-mui-ellipsis')[0].innerHTML = '暂无新的通知';
  90. mui('.a-item_count')[0].style.display = 'none';
  91. mui('.a-time')[0].style.display = 'none';
  92. }
  93. }
  94. }
  95. }
  96. });
  97. };
  98. mui(document.body).on('tap', 'li', function() {
  99. UpdateBackstageMessage(mui(this)[0].type);
  100. });
  101. /*
  102. *修改后台首页消息
  103. */
  104. function UpdateBackstageMessage(type) {
  105. //更新审批消息
  106. mui.ajax("http://www.bosshand.cn/api/Customer/UpdateBackstageMessage", {
  107. data: {
  108. "type": type
  109. },
  110. headers: {
  111. authorization: token
  112. },
  113. dataType: 'json',
  114. type: "post",
  115. contentType: "application/x-www-form-urlencoded",
  116. success: function(resp) {
  117. if(type == 4 && mui('.b-mui-ellipsis')[0].innerHTML != '暂无新的通知') {
  118. mui.openWindow({
  119. url: '../home-index-menu/approve.html',
  120. createNew: true, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
  121. show: {
  122. autoShow: true, //页面loaded事件发生后自动显示,默认为true
  123. },
  124. waiting: {
  125. autoShow: false, //自动显示等待框,默认为true
  126. }
  127. });
  128. } else if(type == 2 && mui('.a-mui-ellipsis')[0].innerHTML != '暂无新的通知') {
  129. mui.openWindow({
  130. url: '../home-index-menu/schedule.html',
  131. createNew: true, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
  132. show: {
  133. autoShow: true, //页面loaded事件发生后自动显示,默认为true
  134. },
  135. waiting: {
  136. autoShow: false, //自动显示等待框,默认为true
  137. }
  138. });
  139. };
  140. }
  141. })
  142. };
  143. //时间修改
  144. function getLocalDate(now) {
  145. var date = now.replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
  146. var arr = date.split(' ');
  147. //日期
  148. var arrDate = arr[0].split('-');
  149. //时间
  150. var arrTime = arr[1].split(':');
  151. return arrDate[0] + '年' + arrDate[1] + '月' + arrDate[2] + '日';
  152. }
  153. })
  154. </script>
  155. </body>
  156. </html>