添加新闻页读取
Showing
2 changed files
with
76 additions
and
139 deletions
... | @@ -18,5 +18,38 @@ $(function () { | ... | @@ -18,5 +18,38 @@ $(function () { |
18 | , theme: '#0091FF' | 18 | , theme: '#0091FF' |
19 | }); | 19 | }); |
20 | }) | 20 | }) |
21 | addTabs('#news') | ||
22 | }) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
21 | LoadNewsData(); | ||
22 | layui.use('laytpl', function () { | ||
23 | laytpl = layui.laytpl; | ||
24 | var getTpl = document.getElementById('demo').innerHTML | ||
25 | , view = document.getElementById('ulNews'); | ||
26 | laytpl(getTpl).render(data, function (html) { | ||
27 | view.innerHTML = html; | ||
28 | }); | ||
29 | }); | ||
30 | addTabs('#news'); | ||
31 | // | ||
32 | }); | ||
33 | |||
34 | |||
35 | |||
36 | //加载新闻列表数据 | ||
37 | function LoadNewsData() { | ||
38 | $.ajax({ | ||
39 | type: "get", //提交方式 | ||
40 | url: portal.api_url + "/hlwj/Mh/getNewsHotArticleList",//路径 | ||
41 | dataType: "json", | ||
42 | async: false, | ||
43 | //数据,这里使用的是Json格式进行传输 | ||
44 | success: function (result) {//返回数据根据结果进行相应的处理 | ||
45 | if (result.code == 200 && result.data != null) { | ||
46 | data.list = result.data; | ||
47 | } | ||
48 | } | ||
49 | }); | ||
50 | |||
51 | } | ||
52 | var data = { //数据 | ||
53 | "title": "Layui常用模块", | ||
54 | "list": [] | ||
55 | }; | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | <!DOCTYPE html | 1 | <!DOCTYPE html |
2 | PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 2 | PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
3 | <html xmlns="http://www.w3.org/1999/xhtml"> | 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
4 | |||
4 | <head> | 5 | <head> |
5 | <style> | 6 | <style> |
6 | </style> | 7 | </style> |
... | @@ -9,6 +10,7 @@ | ... | @@ -9,6 +10,7 @@ |
9 | <script type="text/javascript" src="../staticJs/head.js"></script> | 10 | <script type="text/javascript" src="../staticJs/head.js"></script> |
10 | <link rel="stylesheet" type="text/css" href="../staticCss/xwdt.css"> | 11 | <link rel="stylesheet" type="text/css" href="../staticCss/xwdt.css"> |
11 | </head> | 12 | </head> |
13 | |||
12 | <body> | 14 | <body> |
13 | <div class="navigation_crumbs"> | 15 | <div class="navigation_crumbs"> |
14 | <div class="contentBox"> | 16 | <div class="contentBox"> |
... | @@ -20,143 +22,8 @@ | ... | @@ -20,143 +22,8 @@ |
20 | </div> | 22 | </div> |
21 | <div class="leftandright"> | 23 | <div class="leftandright"> |
22 | <div class="left"> | 24 | <div class="left"> |
23 | <ul class="leftContainer"> | 25 | <ul class="leftContainer" id='ulNews'> |
24 | <li> | 26 | |
25 | <a class="left-top" title="前三季度主要指标由负转正 中国经济持续稳定恢复" href="./xwxq.html" target="_blank"> | ||
26 | 前三季度主要指标由负转正 中国经济持续稳定恢复 | ||
27 | </a> | ||
28 | <a class="xw" href="./xwxq.html" target="_blank"> | ||
29 | <div class="xw-left"> | ||
30 | <img | ||
31 | src="https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1938529415,777611275&fm=26&gp=0.jpg"> | ||
32 | </div> | ||
33 | <div class="xw-right"> | ||
34 | <div class="left-body"> | ||
35 | 10月21日,农业农村部举行新闻发布会,介绍2020年前三季度农业农村经济形式,农业农村部总经济师,发展 | ||
36 | 划司司长魏白刚介绍,今年农业收来之不易,农业农村经济保持了持续向好、稳中有进的态势,粮食丰收已成定局,预计产量达到历史最高水平 | ||
37 | </div> | ||
38 | <div class="left-buttom"> | ||
39 | <div> | ||
40 | <svg class="icon svg-icon" aria-hidden="true"> | ||
41 | <use xlink:href="#iconchakan"></use> | ||
42 | </svg> | ||
43 | <span>123</span> | ||
44 | </div> | ||
45 | <div> | ||
46 | <svg class="icon svg-icon" aria-hidden="true"> | ||
47 | <use xlink:href="#iconpinglun"></use> | ||
48 | </svg> | ||
49 | <span>456</span> | ||
50 | </div> | ||
51 | <div class="left-buttom-date"> | ||
52 | 2020-12-27 | ||
53 | </div> | ||
54 | </div> | ||
55 | </div> | ||
56 | </a> | ||
57 | </li> | ||
58 | <li> | ||
59 | <a class="left-top" title="前三季度主要指标由负转正 中国经济持续稳定恢复" href="./xwxq.html" target="_blank"> | ||
60 | 前三季度主要指标由负转正 中国经济持续稳定恢复 | ||
61 | </a> | ||
62 | <a class="xw" href="./xwxq.html" target="_blank"> | ||
63 | <div class="xw-left"> | ||
64 | <img | ||
65 | src="https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1938529415,777611275&fm=26&gp=0.jpg"> | ||
66 | </div> | ||
67 | <div class="xw-right"> | ||
68 | <div class="left-body"> | ||
69 | 10月21日,农业农村部举行新闻发布会,介绍2020年前三季度农业农村经济形式,农业农村部总经济师,发展 | ||
70 | 划司司长魏白刚介绍,今年农业收来之不易,农业农村经济保持了持续向好、稳中有进的态势,粮食丰收已成定局,预计产量达到历史最高水平 | ||
71 | </div> | ||
72 | <div class="left-buttom"> | ||
73 | <div> | ||
74 | <svg class="icon svg-icon" aria-hidden="true"> | ||
75 | <use xlink:href="#iconchakan"></use> | ||
76 | </svg> | ||
77 | <span>123</span> | ||
78 | </div> | ||
79 | <div> | ||
80 | <svg class="icon svg-icon" aria-hidden="true"> | ||
81 | <use xlink:href="#iconpinglun"></use> | ||
82 | </svg> | ||
83 | <span>456</span> | ||
84 | </div> | ||
85 | <div class="left-buttom-date"> | ||
86 | 2020-12-27 | ||
87 | </div> | ||
88 | </div> | ||
89 | </div> | ||
90 | </a> | ||
91 | </li> | ||
92 | <li> | ||
93 | <a class="left-top" title="前三季度主要指标由负转正 中国经济持续稳定恢复" href="./xwxq.html" target="_blank"> | ||
94 | 前三季度主要指标由负转正 中国经济持续稳定恢复 | ||
95 | </a> | ||
96 | <a class="xw" href="./xwxq.html" target="_blank"> | ||
97 | <div class="xw-left"> | ||
98 | <img | ||
99 | src="https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1938529415,777611275&fm=26&gp=0.jpg"> | ||
100 | </div> | ||
101 | <div class="xw-right"> | ||
102 | <div class="left-body"> | ||
103 | 10月21日,农业农村部举行新闻发布会,介绍2020年前三季度农业农村经济形式,农业农村部总经济师,发展 | ||
104 | 划司司长魏白刚介绍,今年农业收来之不易,农业农村经济保持了持续向好、稳中有进的态势,粮食丰收已成定局,预计产量达到历史最高水平 | ||
105 | </div> | ||
106 | <div class="left-buttom"> | ||
107 | <div> | ||
108 | <svg class="icon svg-icon" aria-hidden="true"> | ||
109 | <use xlink:href="#iconchakan"></use> | ||
110 | </svg> | ||
111 | <span>123</span> | ||
112 | </div> | ||
113 | <div> | ||
114 | <svg class="icon svg-icon" aria-hidden="true"> | ||
115 | <use xlink:href="#iconpinglun"></use> | ||
116 | </svg> | ||
117 | <span>456</span> | ||
118 | </div> | ||
119 | <div class="left-buttom-date"> | ||
120 | 2020-12-27 | ||
121 | </div> | ||
122 | </div> | ||
123 | </div> | ||
124 | </a> | ||
125 | </li> | ||
126 | <li> | ||
127 | <a class="left-top" title="前三季度主要指标由负转正 中国经济持续稳定恢复" href="./xwxq.html" target="_blank"> | ||
128 | 前三季度主要指标由负转正 中国经济持续稳定恢复 | ||
129 | </a> | ||
130 | <a class="xw" href="./xwxq.html" target="_blank"> | ||
131 | <div class="xw-left"> | ||
132 | <img | ||
133 | src="https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1938529415,777611275&fm=26&gp=0.jpg"> | ||
134 | </div> | ||
135 | <div class="xw-right"> | ||
136 | <div class="left-body"> | ||
137 | 10月21日,农业农村部举行新闻发布会,介绍2020年前三季度农业农村经济形式,农业农村部总经济师,发展 | ||
138 | 划司司长魏白刚介绍,今年农业收来之不易,农业农村经济保持了持续向好、稳中有进的态势,粮食丰收已成定局,预计产量达到历史最高水平 | ||
139 | </div> | ||
140 | <div class="left-buttom"> | ||
141 | <div> | ||
142 | <svg class="icon svg-icon" aria-hidden="true"> | ||
143 | <use xlink:href="#iconchakan"></use> | ||
144 | </svg> | ||
145 | <span>123</span> | ||
146 | </div> | ||
147 | <div> | ||
148 | <svg class="icon svg-icon" aria-hidden="true"> | ||
149 | <use xlink:href="#iconpinglun"></use> | ||
150 | </svg> | ||
151 | <span>456</span> | ||
152 | </div> | ||
153 | <div class="left-buttom-date"> | ||
154 | 2020-12-27 | ||
155 | </div> | ||
156 | </div> | ||
157 | </div> | ||
158 | </a> | ||
159 | </li> | ||
160 | </ul> | 27 | </ul> |
161 | <div id="page"></div> | 28 | <div id="page"></div> |
162 | </div> | 29 | </div> |
... | @@ -219,4 +86,41 @@ | ... | @@ -219,4 +86,41 @@ |
219 | <script type="text/javascript" src="../staticJs/common.js"></script> | 86 | <script type="text/javascript" src="../staticJs/common.js"></script> |
220 | <script type="text/javascript" src="../staticJs/down.js"></script> | 87 | <script type="text/javascript" src="../staticJs/down.js"></script> |
221 | <script type="text/javascript" src="../staticJs/xwdt.js"></script> | 88 | <script type="text/javascript" src="../staticJs/xwdt.js"></script> |
89 | <script id="demo" type="text/html"> | ||
90 | {{# layui.each(d.list, function(index, item){ }} | ||
91 | <li> | ||
92 | <a class="left-top" title="前三季度主要指标由负转正 中国经济持续稳定恢复" href="./xwxq.html" target="_blank"> | ||
93 | {{ item.headline }} | ||
94 | </a> | ||
95 | <a class="xw" href="./xwxq.html" target="_blank"> | ||
96 | <div class="xw-left"> | ||
97 | <img | ||
98 | src="https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1938529415,777611275&fm=26&gp=0.jpg"> | ||
99 | </div> | ||
100 | <div class="xw-right"> | ||
101 | <div class="left-body"> | ||
102 | {{ item.headline }} | ||
103 | </div> | ||
104 | <div class="left-buttom"> | ||
105 | <div> | ||
106 | <svg class="icon svg-icon" aria-hidden="true"> | ||
107 | <use xlink:href="#iconchakan"></use> | ||
108 | </svg> | ||
109 | <span> {{ item.pageviews }}</span> | ||
110 | </div> | ||
111 | <div> | ||
112 | <svg class="icon svg-icon" aria-hidden="true"> | ||
113 | <use xlink:href="#iconpinglun"></use> | ||
114 | </svg> | ||
115 | <span>{{ item.commentnum }}</span> | ||
116 | </div> | ||
117 | <div class="left-buttom-date"> | ||
118 | {{ item.publishTime }} | ||
119 | </div> | ||
120 | </div> | ||
121 | </div> | ||
122 | </a> | ||
123 | </li> | ||
124 | {{# }); }} | ||
125 | </script> | ||
222 | </html> | 126 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment