style:新闻详情
Showing
5 changed files
with
85 additions
and
79 deletions
... | @@ -13,16 +13,30 @@ $(function () { | ... | @@ -13,16 +13,30 @@ $(function () { |
13 | elem: '#date' | 13 | elem: '#date' |
14 | }); | 14 | }); |
15 | }) | 15 | }) |
16 | initData() | ||
17 | HotArticle() | ||
18 | PolicyHotArticle() | ||
19 | }) | ||
16 | 20 | ||
17 | layui.use('laypage', function () { | 21 | //门户公示公告列表 |
18 | var laypage = layui.laypage; | 22 | function initData(currentPage=1) { |
19 | //执行一个laypage实例 | 23 | $.ajax({ |
20 | laypage.render({ | 24 | type: "get", //提交方式 |
21 | elem: 'test1' //注意,这里的 test1 是 ID,不用加 # 号 | 25 | url: portal.api_url + "/hlwj/MhNotice/getNoticeList",//路径 |
22 | , count: 50 //数据总数,从服务端得到 | 26 | data: { |
23 | }); | 27 | "currentPage": currentPage, |
28 | "pageSize": data.limit | ||
29 | }, | ||
30 | dataType: "json", | ||
31 | async: false, | ||
32 | //数据,这里使用的是Json格式进行传输 | ||
33 | success: function (result) {//返回数据根据结果进行相应的处理 | ||
34 | if (result.code == 200 && result.data != null) { | ||
35 | data.list = result.data.records; | ||
36 | data.total = result.data.total; | ||
37 | } | ||
38 | } | ||
24 | }); | 39 | }); |
25 | |||
26 | layui.use('laytpl', function () { | 40 | layui.use('laytpl', function () { |
27 | laytpl = layui.laytpl; | 41 | laytpl = layui.laytpl; |
28 | var getTpl = document.getElementById('demo').innerHTML | 42 | var getTpl = document.getElementById('demo').innerHTML |
... | @@ -31,31 +45,78 @@ $(function () { | ... | @@ -31,31 +45,78 @@ $(function () { |
31 | view.innerHTML = html; | 45 | view.innerHTML = html; |
32 | }); | 46 | }); |
33 | }); | 47 | }); |
34 | initData() | 48 | } |
35 | }) | ||
36 | 49 | ||
37 | //门户公示公告列表 | 50 | // 获取新闻动态的推荐数据 |
38 | function initData() { | 51 | function HotArticle() { |
52 | var recommend = $(".news_recommendation"); | ||
53 | recommend.empty(); | ||
54 | var li = ''; | ||
39 | $.ajax({ | 55 | $.ajax({ |
40 | type: "get", //提交方式 | 56 | type: "get", //提交方式 |
41 | url: portal.api_url + "/hlwj/MhNotice/getNoticeList",//路径 | 57 | url: portal.api_url + "/hlwj/MhNews/getNewsHotArticleList",//路径 |
42 | data:{ | ||
43 | "currentPage":1, | ||
44 | "pageSize":6 | ||
45 | }, | ||
46 | dataType: "json", | 58 | dataType: "json", |
47 | async: false, | 59 | async: false, |
48 | //数据,这里使用的是Json格式进行传输 | 60 | //数据,这里使用的是Json格式进行传输 |
49 | success: function (result) {//返回数据根据结果进行相应的处理 | 61 | success: function (result) {//返回数据根据结果进行相应的处理 |
50 | if (result.code == 200 && result.data != null) { | 62 | if (result.code == 200 && result.data != null) { |
51 | data.list = result.data.records; | 63 | console.log(result.data) |
64 | for (var i = 0; i < result.data.length; i++) { | ||
65 | li = '<li class="tj">'; | ||
66 | li += '<img src="' + result.data[i].cover + '">'; | ||
67 | li += '<span class="tj-title">' + result.data[i].headline + '</span>'; | ||
68 | li += '<span class="tj-date">' + result.data[i].deadtime + '</span>'; | ||
69 | li += '</li>'; | ||
70 | recommend.append(li); | ||
52 | } | 71 | } |
53 | } | 72 | } |
54 | }); | 73 | } |
55 | 74 | }) | |
56 | } | 75 | } |
76 | // 政策法规推荐 | ||
77 | function PolicyHotArticle() { | ||
78 | var regulation = $("#regulation"); | ||
79 | regulation.empty(); | ||
80 | var li = ''; | ||
81 | $.ajax({ | ||
82 | type: "get", //提交方式 | ||
83 | url: portal.api_url + "/hlwj/MhPolicy/getPolicyHotArticleList",//路径 | ||
84 | dataType: "json", | ||
85 | async: false, | ||
86 | //数据,这里使用的是Json格式进行传输 | ||
87 | success: function (result) {//返回数据根据结果进行相应的处理 | ||
88 | if (result.code == 200 && result.data != null) { | ||
89 | for (var i = 0; i < result.data.length; i++) { | ||
90 | li = '<li class="zcfg">' | ||
91 | li += '<div class="zcfg-top">' + result.data[i].headline + '</div>' | ||
92 | li += '<p class="zcfg-body">' + result.data[i].summary + '</p>' | ||
93 | li += '<div class="zcfg-bottom">' + result.data[i].deadtime + '</div>' | ||
94 | li += '</li>' | ||
95 | regulation.append(li); | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | }) | ||
100 | } | ||
101 | |||
102 | layui.use('laypage', function () { | ||
103 | var laypage = layui.laypage; | ||
104 | //执行一个laypage实例 | ||
105 | laypage.render({ | ||
106 | elem: 'test1' //注意,这里的 test1 是 ID,不用加 # 号 | ||
107 | , count: data.total //数据总数,从服务端得到 | ||
108 | , limit: data.limit | ||
109 | , prev: '<' | ||
110 | , next: '>' | ||
111 | , theme: '#0091FF' | ||
112 | , jump: function (obj, first) { | ||
113 | initData(obj.curr); | ||
114 | } | ||
115 | }); | ||
116 | }); | ||
57 | 117 | ||
58 | var data = { //数据 | 118 | var data = { //数据 |
59 | "list": [], | 119 | "list": [], |
120 | limit: 10, | ||
60 | total: undefined | 121 | total: undefined |
61 | }; | 122 | }; |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -83,7 +83,7 @@ function PolicyHotArticle() { | ... | @@ -83,7 +83,7 @@ function PolicyHotArticle() { |
83 | for (var i = 0; i < result.data.length; i++) { | 83 | for (var i = 0; i < result.data.length; i++) { |
84 | li = '<li class="zcfg">' | 84 | li = '<li class="zcfg">' |
85 | li += '<div class="zcfg-top">'+result.data[i].headline+'</div>' | 85 | li += '<div class="zcfg-top">'+result.data[i].headline+'</div>' |
86 | li += '<p class="zcfg-body">'+result.data[i].content+'</p>' | 86 | li += '<p class="zcfg-body">'+result.data[i].summary+'</p>' |
87 | li += '<div class="zcfg-bottom">'+result.data[i].deadtime+'</div>' | 87 | li += '<div class="zcfg-bottom">'+result.data[i].deadtime+'</div>' |
88 | li += '</li>' | 88 | li += '</li>' |
89 | regulation.append(li); | 89 | regulation.append(li); | ... | ... |
... | @@ -50,48 +50,15 @@ | ... | @@ -50,48 +50,15 @@ |
50 | <div class="listArea_right"> | 50 | <div class="listArea_right"> |
51 | <ul class="rightcontainer"> | 51 | <ul class="rightcontainer"> |
52 | <h2 class="right-top">新闻推荐</h2> | 52 | <h2 class="right-top">新闻推荐</h2> |
53 | <li class="tj"> | 53 | <div class="news_recommendation"></div> |
54 | <img src="https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1938529415,777611275&fm=26&gp=0.jpg"> | ||
55 | <span class="tj-title"> 爬山虎国土空间信息化解决方案</span> | ||
56 | <span class="tj-date">2020-12-12</span> | ||
57 | </li> | ||
58 | <li class="tj"> | ||
59 | <img src="https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1938529415,777611275&fm=26&gp=0.jpg"> | ||
60 | <span class="tj-title"> 爬山虎国土空间信息化解决方案</span> | ||
61 | <span class="tj-date">2020-12-12</span> | ||
62 | </li> | ||
63 | </ul> | 54 | </ul> |
64 | <ul class="diver"> | 55 | <ul class="diver"> |
65 | <li></li> | 56 | <li></li> |
66 | </ul> | 57 | </ul> |
67 | <ul class="rightcontainer"> | 58 | <ul class="rightcontainer"> |
68 | <h2 class="zc-top">政策法规</h2> | 59 | <h2 class="zc-top">政策法规</h2> |
69 | <li> | 60 | <div id="regulation"> |
70 | <div class="zcfg"> | ||
71 | <div class="zcfg-top"> | ||
72 | 爬山虎国土空间规划信息化解决 | ||
73 | </div> | ||
74 | <div class="zcfg-body"> | ||
75 | 10月21日,农业农村部举行新闻发布会,介绍2020年前三季度农业农村经济形势。 | ||
76 | </div> | 61 | </div> |
77 | <div class="zcfg-bottom"> | ||
78 | 2020-10-28 | ||
79 | </div> | ||
80 | </div> | ||
81 | </li> | ||
82 | <li> | ||
83 | <div class="zcfg"> | ||
84 | <div class="zcfg-top"> | ||
85 | 爬山虎国土空间规划信息化解决 | ||
86 | </div> | ||
87 | <div class="zcfg-body"> | ||
88 | 10月21日,农业农村部举行新闻发布会,介绍2020年前三季度农业农村经济形势。 | ||
89 | </div> | ||
90 | <div class="zcfg-bottom"> | ||
91 | 2020-10-28 | ||
92 | </div> | ||
93 | </div> | ||
94 | </li> | ||
95 | </ul> | 62 | </ul> |
96 | </div> | 63 | </div> |
97 | </div> | 64 | </div> | ... | ... |
... | @@ -37,28 +37,6 @@ | ... | @@ -37,28 +37,6 @@ |
37 | <span>政策法规推荐</span> | 37 | <span>政策法规推荐</span> |
38 | </div> | 38 | </div> |
39 | <div id="regulation"> | 39 | <div id="regulation"> |
40 | <li class="zcfg"> | ||
41 | <div class="zcfg-top"> | ||
42 | 爬山虎国土空间规划信息化解决 | ||
43 | </div> | ||
44 | <div class="zcfg-body"> | ||
45 | 10月21日,农业农村部举行新闻发布会,介绍2020年前三季度农业农村经济形势。 | ||
46 | </div> | ||
47 | <div class="zcfg-bottom"> | ||
48 | 2020-10-28 | ||
49 | </div> | ||
50 | </li> | ||
51 | <li class="zcfg"> | ||
52 | <div class="zcfg-top"> | ||
53 | 爬山虎国土空间规划信息化解决 | ||
54 | </div> | ||
55 | <div class="zcfg-body"> | ||
56 | 10月21日,农业农村部举行新闻发布会,介绍2020年前三季度农业农村经济形势 | ||
57 | </div> | ||
58 | <div class="zcfg-bottom"> | ||
59 | 2020-10-28 | ||
60 | </div> | ||
61 | </li> | ||
62 | </div> | 40 | </div> |
63 | </ul> | 41 | </ul> |
64 | </div> | 42 | </div> | ... | ... |
-
Please register or sign in to post a comment