123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- $(function () {
- var enterprisedynamic = '/nx/article/enterprisedynamic';//企业宣传
- var industrynews = '/nx/article/industrynews'; //行业动态
- var policies = '/nx/article/policies'; //政策法规
- var url = enterprisedynamic;
- var getNews = function (url, p) {
- p = p || 1;
- $.ajax({
- url: getServerHttp('cp') + url,
- type: 'post',
- cache: false,
- dataType: 'json',
- data: {
- p: p
- },
- success: function (data) {
- var data = ajaxDataParames(data);
- var dom = '';
- for (var i = 0; i < data.rows.length; i++) {
- var _href = './component/news.html?kid=' + data.rows[i].kid;
- dom += '<li><a href="' + _href + '" target="_blank" title="' + data.rows[i].title + '">' + data.rows[i].title + '<span>' + data.rows[i].date + '</span></a></li>'
- }
- $('.lists ul').html(dom);
- layui.laypage.render({
- elem: 'paging',
- count: data.number,
- limit: 20,
- first: '首页',
- last: '尾页',
- curr: data.p,
- groups: 5,
- jump: function (obj, first) {
- if (!first) {
- console.log('第' + obj.curr + '页')
- getNews(url, obj.curr)
- }
- }
- });
- }
- })
- }
- $('.option').on('click', function (e) {
- if (e.target.name === 'enterprisedynamic') {
- url = enterprisedynamic;
- } else if (e.target.name === 'industrynews') {
- url = industrynews;
- } else if (e.target.name === 'policies') {
- url = policies;
- }
- getNews(url);
- });
- getNews(url);
- });
|