7d769f21 by 任超

style:新闻详情

1 parent ff4f0d82
......@@ -140,6 +140,7 @@ div.subject {
border-right: 1px solid #DEDEDE;
margin-top: 41px;
padding-bottom: 60px;
min-height: 800px;
}
.leftContainer li {
border-bottom: 1px solid #EAEAEA;
......@@ -209,6 +210,7 @@ div.subject {
width: 200px;
margin-top: 20px;
margin-left: 10px;
margin-bottom: 10px;
}
.right-top {
......
......@@ -41,7 +41,7 @@ function initData() {
url: portal.api_url + "/hlwj/MhNotice/getNoticeList",//路径
data:{
"currentPage":1,
"pageSize":10
"pageSize":6
},
dataType: "json",
async: false,
......@@ -56,5 +56,6 @@ function initData() {
}
var data = { //数据
"list": []
"list": [],
total: undefined
};
\ No newline at end of file
......
......@@ -7,53 +7,53 @@ $(function () {
layer.msg(elem.text());
});
});
layui.use('laypage', function () {
let laypage = layui.laypage;
//执行一个laypage实例
laypage.render({
elem: 'page' //注意,这里的 test1 是 ID,不用加 # 号
, count: 50 //数据总数,从服务端得到
, prev: '<'
, next: '>'
, theme: '#0091FF'
});
})
LoadNewsData();
layui.use('laytpl', function () {
laytpl = layui.laytpl;
var getTpl = document.getElementById('demo').innerHTML
, view = document.getElementById('ulNews');
laytpl(getTpl).render(data, function (html) {
view.innerHTML = html;
});
});
addTabs('#news');
//
});
//加载新闻列表数据
function LoadNewsData() {
function LoadNewsData(currentPage=1) {
$.ajax({
type: "get", //提交方式
url: portal.api_url + "/hlwj/MhNews/getNewsArticleList",//路径
data:{
"currentPage":1,
"pageSize":10
"currentPage":currentPage,
"pageSize":5
},
dataType: "json",
async: false,
//数据,这里使用的是Json格式进行传输
success: function (result) {//返回数据根据结果进行相应的处理
data.total = result.data.total
if (result.code == 200 && result.data != null) {
data.list = result.data.records;
}
}
})
layui.use('laytpl', function () {
laytpl = layui.laytpl;
var getTpl = document.getElementById('demo').innerHTML
, view = document.getElementById('ulNews');
laytpl(getTpl).render(data, function (html) {
view.innerHTML = html;
});
});
}
layui.use('laypage', function () {
let laypage = layui.laypage;
//执行一个laypage实例
laypage.render({
elem: 'page' //注意,这里的 test1 是 ID,不用加 # 号
, count: data.total //数据总数,从服务端得到
, limit: 5
, prev: '<'
, next: '>'
, theme: '#0091FF'
, jump: function(obj, first){
LoadNewsData(obj.curr);
}
});
})
var data = { //数据
"title": "Layui常用模块",
"list": []
"list": [],
total: undefined
};
\ No newline at end of file
......
......@@ -44,30 +44,6 @@
<div class="listArea">
<div class="announcement_list">
<ul class="gglist" id="notice-list">
<!-- <li>
<a href="./ggxq.html" target="_blank">
<div class="gg">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icongonggao1"></use>
</svg>
<p class="item_list">
党的十八大以来双拥工作综述:为实现中国梦强军梦凝聚强大力量 前三季度主要指标由负转正
</p>
</div>
</a>
</li>
<li>
<a href="./ggxq.html" target="_blank">
<div class="gg">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icongongshi"></use>
</svg>
<p class="item_list">
党的十八大以来双拥工作综述:为实现中国梦强军梦凝聚强大力量 前三季度主要指标由负转正
</p>
</div>
</a>
</li> -->
</ul>
<div id="test1"></div>
</div>
......@@ -129,9 +105,16 @@
<li>
<a href='./ggxq.html?id="{{item.id}}"' target="_blank">
<div class="gg">
{{# if(item.noticeType == 1){ }}
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icongongshi"></use>
</svg>
{{# } }}
{{# if(item.noticeType == 2){ }}
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icongonggao1"></use>
</svg>
{{# } }}
<p class="item_list">
{{item.title}}
</p>
......
......@@ -90,17 +90,17 @@
<script id="demo" type="text/html">
{{# layui.each(d.list, function(index, item){ }}
<li>
<a class="left-top" title=" {{ item.headline }}" href="./xwxq.html" target="_blank">
<a class="left-top" title=" {{ item.headline }}" href='./xwxq.html?id="{{item.id}}"' target="_blank">
{{ item.headline }}
</a>
<a class="xw" href="./news/xwxq.html" target="_blank">
<a class="xw" href='./xwxq.html?id="{{item.id}}"' target="_blank">
<div class="xw-left">
{{# if(item.cover != null){ }}
<img src="{{ item.cover }}">
{{# } }}
{{# if(item.cover == null){ }}
<img src="../staticImages/news_demo.jpg">
{{# } }}
{{# if(item.cover != null){ }}
<img src="{{ item.cover }}">
{{# } }}
</div>
<div class="xw-right">
<div class="left-body">
......