contents.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  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. .criteria.active {
  11. color: rgb(255, 255, 255);
  12. background: rgb(41, 118, 206);
  13. }
  14. .project-apply {
  15. display: inline-block;
  16. height: 30px;
  17. width: 76px;
  18. text-align: center;
  19. line-height: 30px;
  20. border-radius: 10px;
  21. background: #f60;
  22. color: #fff;
  23. padding: 0 10px;
  24. }
  25. .black-gray {
  26. background: #ccc;
  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. <div class="main list-main">
  38. <!--面包屑-->
  39. <div class="container projects">
  40. <div>
  41. <!--class="col-sm-6 col-md-6 col-lg-8 hidden-xs"-->
  42. <div style="padding-left: 0;">
  43. <ol class="breadcrumbFixed clearfix" style="border-bottom: 0px solid #fff;margin-bottom: 0;">
  44. <li>
  45. <a th:href="@{/home}">首页</a>
  46. </li>
  47. <li class="active"><a><cite>[[${navigation_name}]]</cite></a></li>
  48. </ol>
  49. </div>
  50. <!--搜索框-->
  51. <!--<div class="col-sm-6 col-md-6 col-lg-4 col-xs-12">-->
  52. <!--<div style="display: inline-block;float: right;padding-top: 10px;width: 100%;">-->
  53. <!--<span style="display: inline-block;width:100%">-->
  54. <!--<input type="text" name="keyword" lay-verify="required" placeholder="请输入关键字搜索"-->
  55. <!--autocomplete="off" class="layui-input" style="width: 100%;display: inline-block">-->
  56. <!--</span>-->
  57. <!--<button onclick="onInit(1)" id="keywordSearch"-->
  58. <!--style="display: inline-block;float: right;background:none;border:none;">-->
  59. <!--<i class=" iconfont icon-sousuo"></i>-->
  60. <!--</button>-->
  61. <!--</div>-->
  62. <!--</div>-->
  63. </div>
  64. </div>
  65. <div id="activity_box" class="container projects" hidden>
  66. <div class="kind-tip" id="type">
  67. </div>
  68. <div class="clearfix screen-box">
  69. <div class="pull-left sort-box" id="criteria">
  70. </div>
  71. <div class="pull-left screen-tj">
  72. <span class="right-line"><input id="valid" type="checkbox"/> 过滤失效活动</span>
  73. <a onclick="gotoCalendar()"><i class="iconfont" style="font-size: 20px;">&#xe643;</i>查看活动日历</a>
  74. </div>
  75. </div>
  76. <div class="activity-list">
  77. <ul id="activityContainer">
  78. </ul>
  79. </div>
  80. </div>
  81. <div id="project_box" class="container projects">
  82. <div id="projectSource">
  83. </div>
  84. <div class="activity-list">
  85. <ul id="projectsContent">
  86. </ul>
  87. </div>
  88. </div>
  89. <div id="news_box" class="container projects">
  90. <div class="row">
  91. <div class="col-sm-12 col-md-12 col-lg-12 activityList" id="centerContent"></div>
  92. </div>
  93. </div>
  94. <!--分页-->
  95. <div class="container projects">
  96. <div style="padding-top: 28px;">
  97. <div id="paging"></div>
  98. </div>
  99. </div>
  100. <input type="hidden" id="navigation_id" th:value="${navigation_id}"/>
  101. <input type="hidden" id="count" th:value="${count}"/>
  102. </div>
  103. <!--页底-->
  104. <div th:replace="~{home/common/footer :: footer}"></div>
  105. <script id="content" type="text/html">
  106. {{each contents content }}
  107. <div>
  108. <p style="display: inline-block;width: 80%" class="textEllipsis">
  109. <a href="{{pagePath}}/home/contentDetail/{{content.id}}" target="_blank">{{ content.title }}</a>
  110. </p>
  111. <p style="display: inline-block;margin: 0 0 10px;" class="fr textColor hidden-xs">{{ content.create_time }}</p>
  112. </div>
  113. <!--<p class="textEllipsis1">{{ content.brief }}</p>-->
  114. {{/each}}
  115. </script>
  116. <script id="project" type="text/html">
  117. {{each projects project }}
  118. <li class="clearfix row">
  119. <div class="col-sm-1 col-md-1 col-lg-1 col-xs-1">
  120. <span class="project-apply black-gray">申报中</span>
  121. </div>
  122. <div class="col-sm-11 col-md-11 col-lg-11 col-xs-11" style="display: inline-block;width: 80%">
  123. <p style="display: inline-block;width: 80%;" class="textEllipsis">
  124. <a href="{{pagePath}}/home/projectDetail/{{project.id}}/{{project.isFilling}}" target="_blank">【{{
  125. project.project_source_name }}】 {{
  126. project.project_name }}</a>
  127. </p>
  128. <p style="display: inline-block;margin: 0 0 10px;" class="fr textColor hidden-xs">{{ project.create_time
  129. }}</p>
  130. <p>申报截止日期:{{ project.apply_enddate }}</p>
  131. </div>
  132. </li>
  133. {{/each}}
  134. </script>
  135. <script th:inline="javascript">
  136. var fileUrl = [[${fileUrl}]];
  137. $(function () {
  138. var date = new Date();
  139. if ($("#navigation_id").val() == 1) {
  140. $("#activity_box").show();
  141. $("#news_box").hide();
  142. }
  143. else {
  144. $("#activity_box").hide();
  145. $("#news_box").show();
  146. }
  147. });
  148. $("li[role='presentation']").removeClass();
  149. var id = $("#navigation_id").val();
  150. $("#" + id).parent().attr("class", "active");
  151. var pagePath = $("meta[name='_ctx']").attr("content");
  152. pagePath = pagePath.substring(0, pagePath.length - 1);
  153. var type = "", criteria = "0", isinvalid = "0", status = "";
  154. layui.use('element', function () {
  155. var element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
  156. });
  157. onInit(1);
  158. function onInit(pageNo) {
  159. if ($("#navigation_id").val() == 69 || $("#navigation_id").val() == 77) {
  160. renderProject(pageNo);
  161. }else if ($("#navigation_id").val() == 78){
  162. window.location.href=pagePath + "/home/serverDetail/78";
  163. } else if ($("#navigation_id").val() != 1) {
  164. $.ajax({
  165. url: pagePath + "/home/contentList",
  166. type: "post",
  167. data: {
  168. 'id': $("#navigation_id").val(),
  169. 'page_no': pageNo,
  170. 'keyword': $.trim($("input[name='keyword']").val())
  171. },
  172. dataType: "json",
  173. success: function (result) {
  174. if (result.success) {
  175. result.obj.pagePath = pagePath;
  176. var html = template('content', result.obj);
  177. $('#centerContent').html(html);
  178. layui.use('laypage', function () {
  179. var laypage = layui.laypage;
  180. //执行一个laypage实例
  181. laypage.render({
  182. elem: 'paging',
  183. count: result.obj.counts,
  184. first: '1',
  185. last: Math.ceil(result.obj.counts/10),
  186. prev: '<em><</em>',
  187. next: '<em>></em>',
  188. curr: result.obj.page_no, //当前页
  189. jump: function (obj, first) { //触发分页后的回调
  190. //触发分页后的回调,并传递当前页obj.cuur
  191. if (!first) {
  192. var cuur = obj.curr; //获取当前页
  193. $("#pageNum").val(cuur);
  194. onInit(cuur);
  195. }
  196. }
  197. });
  198. });
  199. } else {
  200. errorMessage(result.message);
  201. }
  202. },
  203. error: function () {
  204. errorMessage('系统错误!');
  205. }
  206. });
  207. } else {
  208. render(pageNo);
  209. }
  210. }
  211. function render(pageNo) {
  212. $.ajax({
  213. url: pagePath + "/home/activityList",
  214. type: "post",
  215. data: {
  216. 'id': $("#navigation_id").val(),
  217. 'page_no': pageNo,
  218. 'keyword': $.trim($("input[name='keyword']").val()),
  219. 'type': type,
  220. 'criteria': criteria,
  221. 'isinvalid': isinvalid
  222. },
  223. dataType: "json",
  224. success: function (result) {
  225. if (result.success) {
  226. //result.obj.pagePath = pagePath;
  227. var list = result.obj.contents;
  228. var pangeNo = result.obj.page_no;
  229. var total = result.obj.counts;
  230. var startIndex = 10 * (pangeNo - 1);
  231. var endIndex = 10 * pangeNo;
  232. if (endIndex > total) endIndex = total;
  233. var typeList = result.obj.typeList;
  234. var newList = list.slice(startIndex, endIndex);
  235. var typeStr = "";
  236. $("#type").empty();
  237. typeStr += '<span>类别:</span>'
  238. if (type == '') {
  239. typeStr += '<a class="kind-box active">全部</a>'
  240. } else {
  241. typeStr += '<a class="kind-box">全部</a>'
  242. }
  243. for (var i = 0; i < typeList.length; i++) {
  244. if (type == typeList[i].value) {
  245. typeStr += '<a class="kind-box active" id="' + typeList[i].value + '">' + typeList[i].name + '</a>'
  246. } else {
  247. typeStr += '<a class="kind-box" id="' + typeList[i].value + '">' + typeList[i].name + '</a>'
  248. }
  249. }
  250. $("#type").append(typeStr);
  251. var criteriaStr = "";
  252. $("#criteria").empty();
  253. if (criteria == '0') {
  254. criteriaStr += '<span class="criteria active" id="0">综合排序</span>'
  255. } else {
  256. criteriaStr += '<span class="criteria" id="0">综合排序</span>'
  257. }
  258. if (criteria == '1') {
  259. criteriaStr += '<span class="criteria active" id="1">最新发布</span>'
  260. } else {
  261. criteriaStr += '<span class="criteria" id="1">最新发布</span>'
  262. }
  263. if (criteria == '2') {
  264. criteriaStr += '<span class="criteria active" id="2">热门活动</span>'
  265. } else {
  266. criteriaStr += '<span class="criteria" id="2">热门活动</span>'
  267. }
  268. $("#criteria").append(criteriaStr);
  269. var str = "";
  270. $("#activityContainer").empty();
  271. for (var i = 0; i < newList.length; i++) {
  272. str += '<li class="clearfix">'
  273. str += '<div class="notice-img-box">'
  274. str += '<img src="' + fileUrl + newList[i].fileDown.file_url + '" class="notice-img"/>'
  275. /* str += '<img src="' + newList[i].fileDown.download_uri + newList[i].fileDown.file_url + '" class="notice-img"/>' */
  276. str += '</div>'
  277. str += '<div class="activity-left">'
  278. if (newList[i].push_level == '1') {
  279. str += '<span style="float:right;border: 1px solid transparent;border-radius: 4px;color: #fff;background-color: #FF9900; border-color: #FF9900;padding: 0px 12px;">重要</span>'
  280. }
  281. str += '<h2 class="activity-title">' + newList[i].activity_title + '</h2>'
  282. str += '<p><i class="iconfont">&#xe62d;</i> ' + newList[i].activity_starttime.substring(0, 4) + '年' + newList[i].activity_starttime.substring(5, 7) + '月' + newList[i].activity_starttime.substring(8, 10) + '日' + newList[i].activity_starttime.substring(10, 16) + '</p>'
  283. str += '<p><i class="iconfont">&#xe6e5;</i> ' + newList[i].activity_location + '</p>'
  284. str += '<div>'
  285. if (newList[i].activity_deadline == '0') {
  286. str += '<a href="' + pagePath + '/home/activityDetail/' + newList[i].id + '" class="btn btn-success radius" onclick="" target="_blank">参与报名</a>'
  287. } else if (newList[i].activity_deadline == '1') {
  288. str += '<a href="' + pagePath + '/home/activityDetail/' + newList[i].id + '" class="btn btn-success radius" onclick="" target="_blank">活动详情</a>'
  289. }
  290. //str += '<span>本活动推送于 2018年3月10日 19:00:00</span>'
  291. str += '</div>'
  292. str += '</div>'
  293. str += '</li>'
  294. }
  295. $("#activityContainer").append(str);
  296. layui.use('laypage', function () {
  297. var laypage = layui.laypage;
  298. //执行一个laypage实例
  299. laypage.render({
  300. elem: 'paging',
  301. count: result.obj.counts,
  302. first: '首页',
  303. last: Math.ceil(result.obj.counts/10),
  304. prev: '<em><</em>',
  305. next: '<em>></em>',
  306. curr: result.obj.page_no, //当前页
  307. jump: function (obj, first) { //触发分页后的回调
  308. //触发分页后的回调,并传递当前页obj.cuur
  309. if (!first) {
  310. var cuur = obj.curr; //获取当前页
  311. $("#pageNum").val(cuur);
  312. onInit(cuur);
  313. }
  314. }
  315. });
  316. });
  317. $(".kind-box").click(function () {
  318. type = this.id;
  319. $(".kind-box").removeClass("active")
  320. $(this).addClass("active")
  321. render(pageNo);
  322. })
  323. $(".criteria").click(function () {
  324. criteria = this.id;
  325. $(".criteria").removeClass("active")
  326. $(this).addClass("active")
  327. render(pageNo);
  328. })
  329. document.getElementById('valid').onclick = function () {
  330. if (this.checked) {
  331. isinvalid = "1"
  332. } else {
  333. isinvalid = "0"
  334. }
  335. render(pageNo);
  336. }
  337. } else {
  338. errorMessage(result.message);
  339. }
  340. },
  341. error: function () {
  342. errorMessage('系统错误!');
  343. }
  344. });
  345. }
  346. function gotoCalendar() {
  347. location.href = pagePath + '/home/calendar'
  348. }
  349. function renderProject(pageNo) {
  350. $.ajax({
  351. url: pagePath + "/home/projectList",
  352. type: "post",
  353. data: {
  354. 'id': $("#navigation_id").val(),
  355. 'page_no': pageNo,
  356. 'keyword': $.trim($("input[name='keyword']").val()),
  357. 'type': type,
  358. 'status': status
  359. },
  360. dataType: "json",
  361. success: function (result) {
  362. if (result.success) {
  363. result.obj.pagePath = pagePath;
  364. //项目来源类型
  365. var typeList = result.obj.projectSourceList;
  366. var statusList = result.obj.projectStatusList;
  367. var typeStr = "";
  368. $("#projectSource").empty();
  369. typeStr += '<div class="kind-tip"><span>来源:</span>'
  370. if (type == '') {
  371. typeStr += '<a class="kind-box active">全部</a>'
  372. } else {
  373. typeStr += '<a class="kind-box">全部</a>'
  374. }
  375. for (var i = 0; i < typeList.length; i++) {
  376. if (type == typeList[i].value) {
  377. typeStr += '<a class="kind-box active" id="' + typeList[i].value + '">' + typeList[i].name + '</a>'
  378. } else {
  379. typeStr += '<a class="kind-box" id="' + typeList[i].value + '">' + typeList[i].name + '</a>'
  380. }
  381. }
  382. typeStr += '</div>'
  383. //statusStr
  384. // var statusStr = "";
  385. // statusStr += '<span>状态:</span>'
  386. // if (status == '') {
  387. // statusStr += '<a class="kind-box active">全部</a>'
  388. // } else {
  389. // statusStr += '<a class="kind-box">全部</a>'
  390. // }
  391. // for (var i = 0; i < statusList.length; i++) {
  392. // if (status == statusList[i].value) {
  393. // statusStr += '<a class="kind-box active" id="' + statusList[i].value + '">' + statusList[i].name + '</a>'
  394. // } else {
  395. // statusStr += '<a class="kind-box" id="' + statusList[i].value + '">' + statusList[i].name + '</a>'
  396. // }
  397. // }
  398. $("#projectSource").append(typeStr);
  399. // $("#projectStatus").append(statusStr);
  400. var projects = result.obj.projects;
  401. console.log(projects);
  402. // var html = template('project', result.obj);
  403. var html = '';
  404. var applyStatus = "";
  405. for (var i = 0; i< projects.length; i++){
  406. if(projects[i].apply_enddate){
  407. var tempTime = (projects[i].apply_enddate).replace(/-/g,'/');
  408. }
  409. var applyEnddate = new Date(Date.parse(tempTime)).getTime();
  410. // var applyEnddate = new Date(Date.parse(tempTime.replace(/-/g,"/"))).getTime();
  411. // var applyStartdate = new Date(Date.parse(projects[i].apply_startdate.replace(/-/g,"/"))).getTime();
  412. var newDate = new Date().getTime();
  413. if ( applyEnddate < newDate){
  414. applyStatus = "申报结束";
  415. html += '<li class="clearfix row">' +
  416. ' <div style="float:left; width:100px">' +
  417. ' <span class="project-apply black-gray" id="apply_status">'+ applyStatus +'</span>' +
  418. ' </div>' ;
  419. }
  420. // else if (applyEnddate > newDate){
  421. // if (applyStartdate > newDate){
  422. // applyStatus = "未开始";
  423. // }
  424. // }
  425. else {
  426. applyStatus = "申报中";
  427. html += '<li class="clearfix">' +
  428. ' <div style="float:left; width:100px">' +
  429. ' <span class="project-apply" id="apply_status">'+ applyStatus +'</span>' +
  430. ' </div>' ;
  431. }
  432. html += /*'<li class="clearfix row">' +
  433. ' <div class="col-sm-1 col-md-1 col-lg-1 col-xs-1">' +
  434. ' <span class="project-apply" id="apply_status">'+ applyStatus +'</span>' +
  435. ' </div>' +*/
  436. ' <div class="col-sm-11 col-md-11 col-lg-11 col-xs-11" style="display: inline-block;width: 100%">' +
  437. ' <p style="display: inline-block;width: 80%;" class="textEllipsis">' +
  438. ' <a href="'+ pagePath +'/home/projectDetail/'+ projects[i].id +'/'+ projects[i].isFilling +'" target="_blank">【' +
  439. ' '+ projects[i].project_source_name +'】 ' +
  440. ' '+ projects[i].project_name +'</a>' +
  441. ' </p>' +
  442. ' <p style="display: inline-block;" class="fr textColor hidden-xs">'+ projects[i].create_time +'</p>' +
  443. // ' <p>申报截止日期:'+ projects[i].apply_enddate +'</p>' +
  444. ' </div>' +
  445. ' </li>';
  446. }
  447. $('#projectsContent').html(html);
  448. layui.use('laypage', function () {
  449. var laypage = layui.laypage;
  450. //执行一个laypage实例
  451. laypage.render({
  452. elem: 'paging',
  453. count: result.obj.counts,
  454. first: '1',
  455. last: Math.ceil(result.obj.counts/10),
  456. prev: '<em><</em>',
  457. next: '<em>></em>',
  458. curr: result.obj.page_no, //当前页
  459. jump: function (obj, first) { //触发分页后的回调
  460. //触发分页后的回调,并传递当前页obj.cuur
  461. if (!first) {
  462. var cuur = obj.curr; //获取当前页
  463. $("#pageNum").val(cuur);
  464. onInit(cuur);
  465. }
  466. }
  467. });
  468. });
  469. $(".kind-box").click(function () {
  470. type = this.id;
  471. // status = this.id;
  472. $(".kind-box").removeClass("active")
  473. $(this).addClass("active")
  474. renderProject(pageNo);
  475. })
  476. } else {
  477. errorMessage(result.message);
  478. }
  479. },
  480. error: function () {
  481. errorMessage('系统错误!');
  482. }
  483. });
  484. }
  485. /**
  486. * 服务事项
  487. * @param pageNo
  488. */
  489. function renderMatters(pageNo) {
  490. $.ajax({
  491. url: pagePath + "/home/serverDetail",
  492. type: "get",
  493. data: {
  494. 'id': $("#navigation_id").val(),
  495. 'page_no': pageNo,
  496. 'keyword': $.trim($("input[name='keyword']").val()),
  497. 'type': type,
  498. 'status': status
  499. },
  500. dataType: "json",
  501. success: function (result) {
  502. if (result.success) {
  503. } else {
  504. errorMessage(result.message);
  505. }
  506. },
  507. error: function () {
  508. errorMessage('系统错误!');
  509. }
  510. });
  511. }
  512. $("input[name='keyword']").keyup(function () {
  513. if (event.keyCode == 13) {
  514. $("#keywordSearch").trigger("click");
  515. }
  516. });
  517. </script>
  518. </body>
  519. </html>
  520. <style type="text/css">
  521. /*轮播图样式*/
  522. .pagination {
  523. position: absolute;
  524. z-index: 20;
  525. bottom: 10px;
  526. width: 100%;
  527. text-align: center;
  528. }
  529. .swiper-pagination-bullet {
  530. display: inline-block;
  531. width: 12px;
  532. height: 12px;
  533. border-radius: 8px;
  534. background: #555;
  535. margin: 0 8px;
  536. opacity: 0.8;
  537. border: 1px solid #fff;
  538. cursor: pointer;
  539. }
  540. .swiper-pagination-bullet-active {
  541. background: #fff;
  542. }
  543. </style>