calendar.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <!DOCTYPE html>
  2. <html lang="en"
  3. xmlns:th="http://www.thymeleaf.org"
  4. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  5. layout:decorate="~{home/common/common}">
  6. <head>
  7. <meta charset="UTF-8">
  8. <title th:text="${navigation_name}"></title>
  9. <style>
  10. .bFind-wrapper-top {
  11. background: #fff;
  12. border-color: #ccc #aaa #aaa #ccc;
  13. border-style: solid;
  14. border-width: 1px;
  15. height: 25px !important;
  16. padding: 4px;
  17. margin: 0;
  18. }
  19. .bsBox {
  20. width: auto !important;
  21. height: auto !important;
  22. }
  23. .text-overflow {
  24. overflow: hidden;
  25. text-overflow: ellipsis;
  26. white-space: nowrap;
  27. }
  28. </style>
  29. </head>
  30. <body layout:fragment="content">
  31. <!-- 头部导航 -->
  32. <div th:replace="~{home/common/header :: header}"></div>
  33. <!--nav-->
  34. <div class="center_nav">
  35. <div th:replace="~{home/common/header :: nav}"></div>
  36. </div>
  37. <!-- 主体内容 -->
  38. <div class="main">
  39. <div class="container projects">
  40. <div class="row">
  41. <div class="col-sm-6 col-md-6 col-lg-9 hidden-xs" style="padding-left: 0;">
  42. <ol class="breadcrumb clearfix"
  43. style="padding-top: 15px;border-bottom: 0px solid #fff;margin-bottom: 0;">
  44. <li>
  45. <a th:href="@{/home}">首页</a>
  46. </li>
  47. <li th:if="${navigation_id!=2}" class="active"><a th:href="@{'/home/informList/'+${navigation_id}}">[[${navigation_name}]]</a>
  48. </li>
  49. <li th:if="${navigation_id==2}" class="active"><a th:href="@{/home/unionCompany}">[[${navigation_name}]]</a>
  50. </li>
  51. <li class="active"><a><cite>活动列表</cite></a></li>
  52. </ol>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="container projects" style="margin-top: 20px;">
  57. <div class="row cl">
  58. <div class="col-xs-3 col-sm-3">
  59. <div id="datebox" style="width: 250px;height: 250px;"></div>
  60. </div>
  61. <div class="col-xs-9 col-sm-9">
  62. <div class="cl pd-5 bg-1 bk-gray">
  63. <span class="l">
  64. <span id="currentTime"></span>
  65. </span>
  66. <span class="r">共有数据:<strong id="total">0</strong> 条</span><!-- -->
  67. </div>
  68. <table class="table table-border table-bordered table-bg table-hover">
  69. <thead>
  70. <tr>
  71. <th style="text-align: center">活动</th>
  72. </tr>
  73. </thead>
  74. <tbody id="dataTable">
  75. </tbody>
  76. </table>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <!--页底-->
  82. <div th:replace="~{home/common/footer :: footer}"></div>
  83. <script th:inline="javascript">
  84. var mark = {};
  85. var arr = new Array();
  86. var total = 0;
  87. var pagePath = $("meta[name='_ctx']").attr("content");
  88. pagePath = pagePath.substring(0, pagePath.length - 1);
  89. $(function () {
  90. getAllEvents();
  91. })
  92. //获取有活动的日期
  93. function getAllEvents() {
  94. $.ajax({
  95. url: pagePath + "/government/activity/getAllEvents",
  96. type: "get",
  97. dataType: "json",
  98. success: function (result) {
  99. if (result.success) {
  100. var list = result.obj;
  101. if (list.length > 0) {
  102. for (var i = 0; i < list.length; i++) {
  103. /*mark[list[i]] = "";*/
  104. //console.log(list[i])
  105. arr.push(list[i])
  106. }
  107. }
  108. renderDate();
  109. } else {
  110. errorMessage(result.message);
  111. }
  112. },
  113. error: function () {
  114. errorMessage('系统错误!');
  115. }
  116. });
  117. }
  118. //初始化日期插件
  119. function renderDate() {
  120. /*laydate.render({
  121. elem: '#datebox',
  122. position: 'static',
  123. mark: mark,
  124. ready: function (date) {
  125. var year = date.year;
  126. var month = date.month;
  127. var date = date.date;
  128. if (month <= 9) {
  129. month = "0" + month;
  130. }
  131. if (date <= 9) {
  132. date = "0" + date;
  133. }
  134. var value = year + "-" + month + "-" + date;
  135. getEventList(value);
  136. $("#currentTime").html(value);
  137. },
  138. change: function (value, date, endDate) {
  139. //console.log(value); //得到日期生成的值,如:2017-08-18
  140. //console.log(date); //得到日期时间对象:{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
  141. //console.log(endDate); //得结束的日期时间对象,开启范围选择(range: true)才会返回。对象成员同上。
  142. getEventList(value);
  143. $("#currentTime").html(value);
  144. }
  145. });*/
  146. WdatePicker({
  147. eCont: 'datebox', onpicked: function (dp) {
  148. //alert('你选择的日期是:' + dp.cal.getDateStr())
  149. var date = dp.cal.getDateStr();
  150. getEventList(date);
  151. },
  152. specialDates: arr/*['2018-06-01', '2018-06-13']*/
  153. })
  154. }
  155. function getEventList(value) {
  156. $.ajax({
  157. url: pagePath + "/government/activity/getEventList",
  158. type: "post",
  159. dataType: "json",
  160. data: {
  161. activity_starttime: value
  162. },
  163. success: function (result) {
  164. if (result.success) {
  165. var list = result.obj;
  166. renderList(list);
  167. } else {
  168. errorMessage(result.message);
  169. }
  170. },
  171. error: function () {
  172. errorMessage('系统错误!');
  173. }
  174. });
  175. }
  176. function renderList(obj) {
  177. $("#dataTable").empty();
  178. var str = '';
  179. total = obj.length;
  180. if (obj.length > 0) {
  181. for (var i = 0; i < obj.length; i++) {
  182. str += '<tr>'
  183. str += '<td style="text-align: center"><a onclick="gotoDetail(' + obj[i].id + ')">' + obj[i].activity_title + '</a></td>'
  184. str += '</tr>'
  185. }
  186. }
  187. $("#total").html(total)
  188. $("#dataTable").append(str);
  189. }
  190. function gotoDetail(id) {
  191. top.location.href = pagePath + "/home/activityDetail/" + id;
  192. }
  193. </script>
  194. </body>
  195. </html>