123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- import '../../css/bootstrap.less';
- import 'bootstrap/dist/js/bootstrap.js';
- import 'css/newMenu/public.css';
- import 'css/newMenu/header.css'
- import '../../js/public.js';
- import '../../js/main_banner.js';
- import '../../css/thinkTank/policyList.css';
- import {
- provinceList
- } from '../../js/NewDicProvinceList';
- $(function () {
- //数据处理
- var theKeyword, pageSize, Province;
- var thePageNo = 1,
- thePageLength = 1,
- pageSize = 6;
- theKeyword = localStorage.getItem("indexKeyWord");
- localStorage.removeItem("indexKeyWord");
- jump();
- //一级界面跳转此页面
- function jump() {
- let hash = window.location.search;
- if (hash) {
- if (hash.indexOf('name') > -1) {
- let newHash = hash.substr(1, hash.length)
- if (newHash.indexOf('&') > -1) {
- let hashArr = newHash.split('&');
- hashArr.map(item => {
- if (item.indexOf('name') > -1) {
- let names = item.split('=')
- theKeyword = names[1]
- }
- })
- } else {
- if (newHash.indexOf('name') > -1) {
- let names = newHash.split('=')
- theKeyword = names[1]
- }
- }
- loadDate()
- }
- } else {
- theKeyword = "",
- loadDate();
- }
- }
- function loadDate(pageNo) {
- $('.loading').show();
- $.ajax({
- method: "get",
- dataType: "json",
- url: globalConfig.context + "/portal/news/list",
- data: {
- pageNo: pageNo || 1,
- pageSize: pageSize,
- keyword: theKeyword,
- provinceId: Province != 999 ? Province : undefined
- },
- success: function (data) {
- var theArr = [];
- thePageLength = data.data.totalCount ? Math.ceil(data.data.totalCount / pageSize) : 1;
- if (data.data && data.data.list) {
- for (let i = 0; i < data.data.list.length; i++) {
- let thisdata = data.data.list[i];
- var id = thisdata.id;
- var title = thisdata.title; //标题
- var time = thisdata.createTimeFormattedDate; //日期
- var day = time.substr(8, 2); //号
- var month = time.substr(0, 7) //年、月
- var summary = thisdata.summary; //简介
- if (summary == null) {
- summary == '暂无内容'
- };
- var sol = '';
- var srctt = globalConfig.context + '/portal/news/newsDetail.html?id=' + id;
- theArr.push([
- '<li value="' + id + '">',
- '<div class="policy_time">',
- '<p>' + day + '</p>',
- '<time>' + month + '</time>',
- '</div>',
- '<div class="policy_details">',
- '<h4><a href="' + srctt + '">' + title + '</a></h4>',
- '<p>' + summary + '</p>',
- '<a href="' + srctt + '">MORE+</a>',
- '</div>',
- '</li>',
- ].join(''));
- };
- };
- $('.loading').hide().stop(true,true);
- $('.policy ul').empty();
- $('.policy ul').append(theArr.join(''));
- if (data.data.list.length === 0) {
- $('.pagination_box').css('display', 'none')
- };
- if (data.data.list.length === 0) {
- $('.policy ul').html('<div class="imgbg"></div>')
- };
- $('.totalCount').html("共 " + thePageLength + " 页 " + data.data.totalCount + " 条数据");
- var pageArr = [],
- firstNo = 1,
- endNo = 5;
- if (thePageNo > 3) {
- firstNo = thePageNo - 2;
- endNo = Math.min((Number(thePageNo) + 2), thePageLength);
- } else {
- endNo = Math.min(thePageLength, 5);
- };
- for (let i = firstNo; i <= endNo; i++) {
- if (i == thePageNo) {
- pageArr.push(
- '<li class="pageNumber active"><a href="#" value=' + i + ' >' + i + '</a></li>'
- );
- } else {
- pageArr.push(
- '<li class="pageNumber"><a href="#" value=' + i + ' >' + i + '</a></li>'
- );
- }
- };
- $('.pageNumber').remove();
- $('.pagePre').after(pageArr.join(''));
- },
- });
- }
- //点击分页
- $('.pagination').on('click', 'li', function (e) {
- e.preventDefault();
- if (this.className === 'pagePre') {
- if (thePageNo > 1) {
- thePageNo = 1;
- loadDate(thePageNo);
- }
- } else if (this.className === 'pageNext') {
- if (thePageNo < thePageLength) {
- thePageNo = thePageLength;
- loadDate(thePageNo);
- }
- } else {
- var nextPageNo = $(this).children()[0].text;
- if (thePageNo != nextPageNo) {
- $(this).siblings("li").removeClass("active");
- $(this).addClass("active");
- thePageNo = nextPageNo;
- loadDate(thePageNo);
- };
- };
- });
- //链接详情
- $('.invest_imglist ul').on('click', 'li', function () {
- var theId = $(this).attr('value');
- window.open(globalConfig.context + '/portal/thinkTank/thinkerDetail.html?id=' + theId);
- })
- //导航城市添加
- var industryListArr = [],
- industryChildrenArr = [];
- industryListArr.push(['<li value="999" class="active">',
- '<span>',
- '不限',
- '</span>',
- '</li>',
- ].join(''));
- provinceList.map(function (item) {
- industryListArr.push(['<li value="' + item.id + '">',
- '<span>',
- item.name,
- '</span>',
- '</li>',
- ].join(''));
- });
- if (industryListArr && industryListArr.length) {
- $('#industryList').append(industryListArr.join(''));
- };
- //点击城市时
- $('#industryList li').click(function () {
- window.location.hash='';
- theKeyword = $('#search_on input').val();
- var theValue = this.value;
- $(this).siblings("li").removeClass("active");
- $(this).addClass("active");
- Province = theValue;
- loadDate();
- })
- //搜索时
- $('#btn_search').click(function (e) {
- e.preventDefault();
- var citys = $('#industryList .active').attr('value');
- var val_inp = $('#search_on input').val();
- Province = citys;
- theKeyword = val_inp;
- loadDate();
- })
- })
|