7d769f21 by 任超

style:新闻详情

1 parent ff4f0d82
...@@ -140,6 +140,7 @@ div.subject { ...@@ -140,6 +140,7 @@ div.subject {
140 border-right: 1px solid #DEDEDE; 140 border-right: 1px solid #DEDEDE;
141 margin-top: 41px; 141 margin-top: 41px;
142 padding-bottom: 60px; 142 padding-bottom: 60px;
143 min-height: 800px;
143 } 144 }
144 .leftContainer li { 145 .leftContainer li {
145 border-bottom: 1px solid #EAEAEA; 146 border-bottom: 1px solid #EAEAEA;
...@@ -209,6 +210,7 @@ div.subject { ...@@ -209,6 +210,7 @@ div.subject {
209 width: 200px; 210 width: 200px;
210 margin-top: 20px; 211 margin-top: 20px;
211 margin-left: 10px; 212 margin-left: 10px;
213 margin-bottom: 10px;
212 } 214 }
213 215
214 .right-top { 216 .right-top {
......
...@@ -41,7 +41,7 @@ function initData() { ...@@ -41,7 +41,7 @@ function initData() {
41 url: portal.api_url + "/hlwj/MhNotice/getNoticeList",//路径 41 url: portal.api_url + "/hlwj/MhNotice/getNoticeList",//路径
42 data:{ 42 data:{
43 "currentPage":1, 43 "currentPage":1,
44 "pageSize":10 44 "pageSize":6
45 }, 45 },
46 dataType: "json", 46 dataType: "json",
47 async: false, 47 async: false,
...@@ -56,5 +56,6 @@ function initData() { ...@@ -56,5 +56,6 @@ function initData() {
56 } 56 }
57 57
58 var data = { //数据 58 var data = { //数据
59 "list": [] 59 "list": [],
60 total: undefined
60 }; 61 };
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -7,53 +7,53 @@ $(function () { ...@@ -7,53 +7,53 @@ $(function () {
7 layer.msg(elem.text()); 7 layer.msg(elem.text());
8 }); 8 });
9 }); 9 });
10 layui.use('laypage', function () {
11 let laypage = layui.laypage;
12 //执行一个laypage实例
13 laypage.render({
14 elem: 'page' //注意,这里的 test1 是 ID,不用加 # 号
15 , count: 50 //数据总数,从服务端得到
16 , prev: '<'
17 , next: '>'
18 , theme: '#0091FF'
19 });
20 })
21 LoadNewsData(); 10 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'); 11 addTabs('#news');
31 //
32 }); 12 });
33
34
35
36 //加载新闻列表数据 13 //加载新闻列表数据
37 function LoadNewsData() { 14 function LoadNewsData(currentPage=1) {
38 $.ajax({ 15 $.ajax({
39 type: "get", //提交方式 16 type: "get", //提交方式
40 url: portal.api_url + "/hlwj/MhNews/getNewsArticleList",//路径 17 url: portal.api_url + "/hlwj/MhNews/getNewsArticleList",//路径
41 data:{ 18 data:{
42 "currentPage":1, 19 "currentPage":currentPage,
43 "pageSize":10 20 "pageSize":5
44 }, 21 },
45 dataType: "json", 22 dataType: "json",
46 async: false, 23 async: false,
47 //数据,这里使用的是Json格式进行传输 24 //数据,这里使用的是Json格式进行传输
48 success: function (result) {//返回数据根据结果进行相应的处理 25 success: function (result) {//返回数据根据结果进行相应的处理
26 data.total = result.data.total
49 if (result.code == 200 && result.data != null) { 27 if (result.code == 200 && result.data != null) {
50 data.list = result.data.records; 28 data.list = result.data.records;
51 } 29 }
52 } 30 }
31 })
32 layui.use('laytpl', function () {
33 laytpl = layui.laytpl;
34 var getTpl = document.getElementById('demo').innerHTML
35 , view = document.getElementById('ulNews');
36 laytpl(getTpl).render(data, function (html) {
37 view.innerHTML = html;
38 });
53 }); 39 });
54
55 } 40 }
41 layui.use('laypage', function () {
42 let laypage = layui.laypage;
43 //执行一个laypage实例
44 laypage.render({
45 elem: 'page' //注意,这里的 test1 是 ID,不用加 # 号
46 , count: data.total //数据总数,从服务端得到
47 , limit: 5
48 , prev: '<'
49 , next: '>'
50 , theme: '#0091FF'
51 , jump: function(obj, first){
52 LoadNewsData(obj.curr);
53 }
54 });
55 })
56 var data = { //数据 56 var data = { //数据
57 "title": "Layui常用模块", 57 "list": [],
58 "list": [] 58 total: undefined
59 }; 59 };
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -44,30 +44,6 @@ ...@@ -44,30 +44,6 @@
44 <div class="listArea"> 44 <div class="listArea">
45 <div class="announcement_list"> 45 <div class="announcement_list">
46 <ul class="gglist" id="notice-list"> 46 <ul class="gglist" id="notice-list">
47 <!-- <li>
48 <a href="./ggxq.html" target="_blank">
49 <div class="gg">
50 <svg class="icon svg-icon" aria-hidden="true">
51 <use xlink:href="#icongonggao1"></use>
52 </svg>
53 <p class="item_list">
54 党的十八大以来双拥工作综述:为实现中国梦强军梦凝聚强大力量 前三季度主要指标由负转正
55 </p>
56 </div>
57 </a>
58 </li>
59 <li>
60 <a href="./ggxq.html" target="_blank">
61 <div class="gg">
62 <svg class="icon svg-icon" aria-hidden="true">
63 <use xlink:href="#icongongshi"></use>
64 </svg>
65 <p class="item_list">
66 党的十八大以来双拥工作综述:为实现中国梦强军梦凝聚强大力量 前三季度主要指标由负转正
67 </p>
68 </div>
69 </a>
70 </li> -->
71 </ul> 47 </ul>
72 <div id="test1"></div> 48 <div id="test1"></div>
73 </div> 49 </div>
...@@ -129,9 +105,16 @@ ...@@ -129,9 +105,16 @@
129 <li> 105 <li>
130 <a href='./ggxq.html?id="{{item.id}}"' target="_blank"> 106 <a href='./ggxq.html?id="{{item.id}}"' target="_blank">
131 <div class="gg"> 107 <div class="gg">
108 {{# if(item.noticeType == 1){ }}
109 <svg class="icon svg-icon" aria-hidden="true">
110 <use xlink:href="#icongongshi"></use>
111 </svg>
112 {{# } }}
113 {{# if(item.noticeType == 2){ }}
132 <svg class="icon svg-icon" aria-hidden="true"> 114 <svg class="icon svg-icon" aria-hidden="true">
133 <use xlink:href="#icongonggao1"></use> 115 <use xlink:href="#icongonggao1"></use>
134 </svg> 116 </svg>
117 {{# } }}
135 <p class="item_list"> 118 <p class="item_list">
136 {{item.title}} 119 {{item.title}}
137 </p> 120 </p>
......
...@@ -90,17 +90,17 @@ ...@@ -90,17 +90,17 @@
90 <script id="demo" type="text/html"> 90 <script id="demo" type="text/html">
91 {{# layui.each(d.list, function(index, item){ }} 91 {{# layui.each(d.list, function(index, item){ }}
92 <li> 92 <li>
93 <a class="left-top" title=" {{ item.headline }}" href="./xwxq.html" target="_blank"> 93 <a class="left-top" title=" {{ item.headline }}" href='./xwxq.html?id="{{item.id}}"' target="_blank">
94 {{ item.headline }} 94 {{ item.headline }}
95 </a> 95 </a>
96 <a class="xw" href="./news/xwxq.html" target="_blank"> 96 <a class="xw" href='./xwxq.html?id="{{item.id}}"' target="_blank">
97 <div class="xw-left"> 97 <div class="xw-left">
98 {{# if(item.cover != null){ }}
99 <img src="{{ item.cover }}">
100 {{# } }}
101 {{# if(item.cover == null){ }} 98 {{# if(item.cover == null){ }}
102 <img src="../staticImages/news_demo.jpg"> 99 <img src="../staticImages/news_demo.jpg">
103 {{# } }} 100 {{# } }}
101 {{# if(item.cover != null){ }}
102 <img src="{{ item.cover }}">
103 {{# } }}
104 </div> 104 </div>
105 <div class="xw-right"> 105 <div class="xw-right">
106 <div class="left-body"> 106 <div class="left-body">
......