947047e5 by 田浩浩

添加新闻页读取

1 parent fb3d5c65
...@@ -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
......