a3178cc7 by 任超

style:法律法规

1 parent afdb2759
$(function () {
let Mydate = new Date()
let year = Mydate.getFullYear();
let minutes = Mydate.getMinutes()
let hour = Mydate.getHours();
let date = Mydate.getDate()
let month = Mydate.getMonth();
$('.date div:first-child').text(year)
$('.date div:nth-child(2)').text(month + 1 + "/" + date)
$('.date div:last-child').text(hour + ":" + minutes)
LawsData()
HotArticle();
PolicyHotArticle();
newsDetail()
})
layui.use('element', function () {
var element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
//监听导航点击
element.on('nav(demo)', function (elem) {
});
});
// 新闻详情数据
function LawsData() {
var newsList = $("#newsList");
newsList.empty();
var li;
function newsDetail() {
var newsDetail = $("#newsDetail");
newsDetail.empty();
$.ajax({
type: "get", //提交方式
url: portal.api_url + "/hlwj/MhNews/getDetailById",//路径
data:{
"id":GetQueryString('id'),
},
data: {
"id": GetQueryString('id'),
},
dataType: "json",
//数据,这里使用的是Json格式进行传输
success: function (result) {//返回数据根据结果进行相应的处理
if (result.code == 200 && result.data != null) {
console.log(999,result.data)
$('.newsTitle').html(result.data.title)
newsList.append(result.data.content)
$('.releaseTime').html(result.data.addtime)
$('.source').html(result.data.source)
newsDetail.append(result.data.content)
}
}
});
}
// 获取新闻动态的推荐数据
function HotArticle() {
var recommend = $("#news_recommendation");
recommend.empty();
var li = '';
$.ajax({
type: "get", //提交方式
url: portal.api_url + "/hlwj/MhNews/getNewsHotArticleList",//路径
dataType: "json",
async: false,
//数据,这里使用的是Json格式进行传输
success: function (result) {//返回数据根据结果进行相应的处理
if (result.code == 200 && result.data != null) {
for (var i = 0; i < result.data.length; i++) {
li = '<li class="tj">';
li += '<img src="' + result.data[i].cover + '">';
li += '<span class="tj-title">'+result.data[i].headline+'</span>';
li += '<span class="tj-date">'+result.data[i].deadtime+'</span>';
li += '</li>';
recommend.append(li);
}
}
}
})
}
// 政策法规推荐
function PolicyHotArticle() {
var regulation = $("#regulation");
regulation.empty();
var li = '';
$.ajax({
type: "get", //提交方式
url: portal.api_url + "/hlwj/MhPolicy/getPolicyHotArticleList",//路径
dataType: "json",
async: false,
//数据,这里使用的是Json格式进行传输
success: function (result) {//返回数据根据结果进行相应的处理
if (result.code == 200 && result.data != null) {
for (var i = 0; i < result.data.length; i++) {
li = '<li class="zcfg">'
li += '<div class="zcfg-top">'+result.data[i].headline+'</div>'
li += '<p class="zcfg-body">'+result.data[i].summary+'</p>'
li += '<div class="zcfg-bottom">'+result.data[i].deadtime+'</div>'
li += '</li>'
regulation.append(li);
}
}
}
})
}
$(window).scroll(function () {
let juli = $(document).scrollTop();
if (juli > 360) {
$('.left-left').addClass('middle_active');
} else {
$('.left-left').removeClass('middle_active');
}
})
layui.use('element', function () {
var element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
//监听导航点击
element.on('nav(demo)', function (elem) {
layer.msg(elem.text());
});
});
function GetQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
......
......@@ -22,8 +22,8 @@
<div class="mainbody">
<div class="title newsTitle"></div>
<div class="release">
<div>发布单位:国土信息</div>
<div>发布日期:<p class="releaseTime">2020-20-15</p></div>
<div class="source"></div>
<div>发布日期:<p class="releaseTime"></p></div>
</div>
<div class="DividingLine"></div>
<div class="notice_content" id="newsDetail">
......@@ -32,5 +32,5 @@
</body>
<script type="text/javascript" src="../staticJs/common.js"></script>
<script type="text/javascript" src="../staticJs/down.js"></script>
<script type="text/javascript" src="../staticJs/ggxq.js"></script>
<script type="text/javascript" src="../staticJs/flfgxq.js"></script>
</html>
\ No newline at end of file
......