1008210523_edit.jsp 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <html>
  2. <head>
  3. <style>
  4. body{
  5. background-color: #f5f6fa;
  6. }
  7. #space-content{
  8. background-color: transparent;
  9. }
  10. .msg-list{
  11. box-sizing: border-box;
  12. width: 100%;
  13. padding: 20px;
  14. }
  15. .msg-list dl{
  16. margin-bottom: 20px;
  17. background-color: #fff;
  18. border-radius: 6px;
  19. overflow: hidden;
  20. }
  21. .msg-list dl:last-child{
  22. margin-bottom: 0;
  23. }
  24. .msg-list dt,
  25. .msg-list dt img{
  26. width: 100%;
  27. }
  28. .msg-list dt{
  29. text-align: center;
  30. }
  31. .msg-list dd{
  32. padding: 0 20px;
  33. color: #666;
  34. }
  35. .msg-list-title,
  36. .msg-list-desc{
  37. display: -webkit-box;
  38. -webkit-box-orient: vertical;
  39. -webkit-line-clamp: 2;
  40. overflow: hidden;
  41. }
  42. .msg-list .msg-list-title{
  43. font-size: 16px;
  44. color: #000;
  45. line-height: 24px;
  46. margin: 12px 0 6px;
  47. position: relative;
  48. }
  49. .msg-list-title i{
  50. display: inline-block;
  51. width: 6px;
  52. height: 6px;
  53. border-radius: 50%;
  54. background-color: #f56c6c;
  55. position: absolute;
  56. top: 10px;
  57. left: 10px;
  58. }
  59. .msg-list .msg-list-desc{
  60. -webkit-line-clamp: 2;
  61. line-height: 20px;
  62. font-size: 12px;
  63. }
  64. .msg-list .msg-list-time{
  65. margin-top: 10px;
  66. font-size: 14px;
  67. padding-top: 10px;
  68. padding-bottom: 10px;
  69. position: relative;
  70. overflow: hidden;
  71. }
  72. .msg-list .msg-list-time::before{
  73. content: "";
  74. position: absolute;
  75. top: 0;
  76. left: 15px;
  77. width: calc(100% - 30px);
  78. height: 1px;
  79. background-color: #eee;
  80. }
  81. .msg-list-time i{
  82. font-style: normal;
  83. float: right;
  84. margin-top: 1px;
  85. }
  86. .layui-laypage a, .layui-laypage span,
  87. .layui-laypage input, .layui-laypage button{
  88. background-color: transparent;
  89. }
  90. .image-slot{
  91. color: #ccc;
  92. }
  93. .image-slot i{
  94. font-size: 36px;
  95. padding-top: 20px;
  96. padding-bottom: 10px;
  97. }
  98. </style>
  99. </head>
  100. <body>
  101. <div id="space-content">
  102. <el-form action="@service{name:'system_message_list', page:'sys_msg.msg_list'}@" method="post" ref="obj" :model="obj">
  103. <div id="msgList" class="msg-list">
  104. <c:forEach items="${sysMsgList }" var="item">
  105. <c:if test="${item.jump_flag == 'true'}">
  106. <dl id="${item.smid}" style="cursor: pointer;" data-view="${item.isView}" onclick='@service{ name: "${item.name }", page: "${item.page }", nameTranslate: "false", pageTranslate: "false", show: "true", params: `${item.params}`}@'>
  107. </c:if>
  108. <c:if test="${item.jump_flag == 'false'}">
  109. <dl id="${item.smid}" data-view="${item.isView}">
  110. </c:if>
  111. <c:if test="${item.thumbnail != null}">
  112. <dt>
  113. <el-image src="${item.thumbnail}" >
  114. <div slot="error" class="image-slot">
  115. <i class="el-icon-picture-outline"></i>
  116. <p>图片加载失败</p>
  117. </div>
  118. </el-image>
  119. </dt>
  120. </c:if>
  121. <dd class="msg-list-title">
  122. <!-- 未读有i,已读没有i -->
  123. <i id="i_${item.smid}" v-if="!${item.isView}"></i>
  124. ${item.title}
  125. </dd>
  126. <dd class="msg-list-desc">
  127. ${item.desc}
  128. </dd>
  129. <dd class="msg-list-time">
  130. <span>${item.source}</span>
  131. <i>${item.create_time}</i>
  132. </dd>
  133. </dl>
  134. </c:forEach>
  135. <c:if test="${empty sysMsgList}">
  136. <div class="no-data"></div>
  137. </c:if>
  138. </div>
  139. </el-form>
  140. <app:appPage />
  141. </div>
  142. </body>
  143. <script type="text/javascript">
  144. space.vue = new Vue({
  145. el: space.appContent,
  146. data: function() {
  147. return {
  148. obj: {
  149. rowCountPerPage: "20"
  150. }
  151. }
  152. },
  153. methods: {
  154. clickFun: function(isView, name) {
  155. }
  156. },
  157. mounted: function() {
  158. $("#msgList").find("dl").on("click", function() {
  159. var view = $(this).attr("data-view");
  160. if(view == "true") {
  161. return;
  162. }
  163. var that = this;
  164. var id = $(this).attr("id");
  165. if(space.utils.isNull(id)) {
  166. console.error("未获取到消息ID")
  167. return;
  168. }
  169. space.utils.ajax({
  170. url: '@service{ name:`system_message_have_read` }@',
  171. data: {
  172. smid: id
  173. },
  174. dataType: 'json',
  175. callback: function(data) {
  176. if(data.code == "success") {
  177. $(that).attr("data-view", "true");
  178. $("#i_" + id).remove();
  179. }else{
  180. space.message.error(data.msg);
  181. }
  182. }
  183. });
  184. });
  185. }
  186. })
  187. </script>
  188. <script>
  189. function layReady(layIndex) {
  190. var readAllEle = document.createElement("i");
  191. readAllEle.className = 'spaceicon icon-quanbuyidu lay-window-icon';
  192. readAllEle.title = "全部已读";
  193. readAllEle.onclick = function() {
  194. var index = top.layer.confirm("标记所有消息为已读, 是否继续?", {
  195. anim: 5,
  196. isOutAnim: false,
  197. title: "提示",
  198. btn: ['确定', '取消'] //按钮
  199. }, function () {
  200. space.utils.ajax({
  201. url: '@service{ name:`system_message_all_have_read` }@',
  202. dataType: 'json',
  203. callback: function(data) {
  204. if(data.code == "success") {
  205. top.layer.close(index);
  206. space.forms.submit();
  207. }else{
  208. space.message.error(data.msg);
  209. }
  210. }
  211. });
  212. }, function () {
  213. });
  214. }
  215. var titleEle = top.$("#layui-layer" + layIndex).append(readAllEle);
  216. }
  217. </script>
  218. </html>