style:法律法规
Showing
2 changed files
with
20 additions
and
90 deletions
1 | $(function () { | 1 | $(function () { |
2 | let Mydate = new Date() | 2 | newsDetail() |
3 | let year = Mydate.getFullYear(); | ||
4 | let minutes = Mydate.getMinutes() | ||
5 | let hour = Mydate.getHours(); | ||
6 | let date = Mydate.getDate() | ||
7 | let month = Mydate.getMonth(); | ||
8 | $('.date div:first-child').text(year) | ||
9 | $('.date div:nth-child(2)').text(month + 1 + "/" + date) | ||
10 | $('.date div:last-child').text(hour + ":" + minutes) | ||
11 | LawsData() | ||
12 | HotArticle(); | ||
13 | PolicyHotArticle(); | ||
14 | }) | 3 | }) |
4 | |||
5 | layui.use('element', function () { | ||
6 | var element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块 | ||
7 | //监听导航点击 | ||
8 | element.on('nav(demo)', function (elem) { | ||
9 | }); | ||
10 | }); | ||
15 | // 新闻详情数据 | 11 | // 新闻详情数据 |
16 | function LawsData() { | 12 | function newsDetail() { |
17 | var newsList = $("#newsList"); | 13 | var newsDetail = $("#newsDetail"); |
18 | newsList.empty(); | 14 | newsDetail.empty(); |
19 | var li; | ||
20 | $.ajax({ | 15 | $.ajax({ |
21 | type: "get", //提交方式 | 16 | type: "get", //提交方式 |
22 | url: portal.api_url + "/hlwj/MhNews/getDetailById",//路径 | 17 | url: portal.api_url + "/hlwj/MhNews/getDetailById",//路径 |
23 | data:{ | 18 | data: { |
24 | "id":GetQueryString('id'), | 19 | "id": GetQueryString('id'), |
25 | }, | 20 | }, |
26 | dataType: "json", | 21 | dataType: "json", |
27 | //数据,这里使用的是Json格式进行传输 | 22 | //数据,这里使用的是Json格式进行传输 |
28 | success: function (result) {//返回数据根据结果进行相应的处理 | 23 | success: function (result) {//返回数据根据结果进行相应的处理 |
29 | if (result.code == 200 && result.data != null) { | 24 | if (result.code == 200 && result.data != null) { |
30 | console.log(999,result.data) | ||
31 | $('.newsTitle').html(result.data.title) | 25 | $('.newsTitle').html(result.data.title) |
32 | newsList.append(result.data.content) | 26 | $('.releaseTime').html(result.data.addtime) |
27 | $('.source').html(result.data.source) | ||
28 | newsDetail.append(result.data.content) | ||
33 | } | 29 | } |
34 | } | 30 | } |
35 | }); | 31 | }); |
36 | } | 32 | } |
37 | 33 | ||
38 | // 获取新闻动态的推荐数据 | ||
39 | function HotArticle() { | ||
40 | var recommend = $("#news_recommendation"); | ||
41 | recommend.empty(); | ||
42 | var li = ''; | ||
43 | $.ajax({ | ||
44 | type: "get", //提交方式 | ||
45 | url: portal.api_url + "/hlwj/MhNews/getNewsHotArticleList",//路径 | ||
46 | dataType: "json", | ||
47 | async: false, | ||
48 | //数据,这里使用的是Json格式进行传输 | ||
49 | success: function (result) {//返回数据根据结果进行相应的处理 | ||
50 | if (result.code == 200 && result.data != null) { | ||
51 | for (var i = 0; i < result.data.length; i++) { | ||
52 | li = '<li class="tj">'; | ||
53 | li += '<img src="' + result.data[i].cover + '">'; | ||
54 | li += '<span class="tj-title">'+result.data[i].headline+'</span>'; | ||
55 | li += '<span class="tj-date">'+result.data[i].deadtime+'</span>'; | ||
56 | li += '</li>'; | ||
57 | recommend.append(li); | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | }) | ||
62 | } | ||
63 | // 政策法规推荐 | ||
64 | function PolicyHotArticle() { | ||
65 | var regulation = $("#regulation"); | ||
66 | regulation.empty(); | ||
67 | var li = ''; | ||
68 | $.ajax({ | ||
69 | type: "get", //提交方式 | ||
70 | url: portal.api_url + "/hlwj/MhPolicy/getPolicyHotArticleList",//路径 | ||
71 | dataType: "json", | ||
72 | async: false, | ||
73 | //数据,这里使用的是Json格式进行传输 | ||
74 | success: function (result) {//返回数据根据结果进行相应的处理 | ||
75 | if (result.code == 200 && result.data != null) { | ||
76 | for (var i = 0; i < result.data.length; i++) { | ||
77 | li = '<li class="zcfg">' | ||
78 | li += '<div class="zcfg-top">'+result.data[i].headline+'</div>' | ||
79 | li += '<p class="zcfg-body">'+result.data[i].summary+'</p>' | ||
80 | li += '<div class="zcfg-bottom">'+result.data[i].deadtime+'</div>' | ||
81 | li += '</li>' | ||
82 | regulation.append(li); | ||
83 | } | ||
84 | } | ||
85 | } | ||
86 | }) | ||
87 | } | ||
88 | |||
89 | $(window).scroll(function () { | ||
90 | let juli = $(document).scrollTop(); | ||
91 | if (juli > 360) { | ||
92 | $('.left-left').addClass('middle_active'); | ||
93 | } else { | ||
94 | $('.left-left').removeClass('middle_active'); | ||
95 | } | ||
96 | }) | ||
97 | layui.use('element', function () { | ||
98 | var element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块 | ||
99 | //监听导航点击 | ||
100 | element.on('nav(demo)', function (elem) { | ||
101 | layer.msg(elem.text()); | ||
102 | }); | ||
103 | }); | ||
104 | function GetQueryString(name) { | 34 | function GetQueryString(name) { |
105 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); | 35 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); |
106 | var r = window.location.search.substr(1).match(reg); | 36 | var r = window.location.search.substr(1).match(reg); | ... | ... |
... | @@ -22,8 +22,8 @@ | ... | @@ -22,8 +22,8 @@ |
22 | <div class="mainbody"> | 22 | <div class="mainbody"> |
23 | <div class="title newsTitle"></div> | 23 | <div class="title newsTitle"></div> |
24 | <div class="release"> | 24 | <div class="release"> |
25 | <div>发布单位:国土信息</div> | 25 | <div class="source"></div> |
26 | <div>发布日期:<p class="releaseTime">2020-20-15</p></div> | 26 | <div>发布日期:<p class="releaseTime"></p></div> |
27 | </div> | 27 | </div> |
28 | <div class="DividingLine"></div> | 28 | <div class="DividingLine"></div> |
29 | <div class="notice_content" id="newsDetail"> | 29 | <div class="notice_content" id="newsDetail"> |
... | @@ -32,5 +32,5 @@ | ... | @@ -32,5 +32,5 @@ |
32 | </body> | 32 | </body> |
33 | <script type="text/javascript" src="../staticJs/common.js"></script> | 33 | <script type="text/javascript" src="../staticJs/common.js"></script> |
34 | <script type="text/javascript" src="../staticJs/down.js"></script> | 34 | <script type="text/javascript" src="../staticJs/down.js"></script> |
35 | <script type="text/javascript" src="../staticJs/ggxq.js"></script> | 35 | <script type="text/javascript" src="../staticJs/flfgxq.js"></script> |
36 | </html> | 36 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment