123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487 |
- import '../css/bootstrap.less';
- import 'bootstrap/dist/js/bootstrap.js';
- import 'css/newMenu/public.css';
- import 'css/newMenu/header.css';
- import '../css/main_banner.css';
- import './public.js';
- import './main_banner.js';
- import '../css/thinkTank.css';
- import {
- provinceList
- } from './NewDicProvinceList';
- import {
- industry
- } from './dataDic';
- $(function() {
- //初始智者智政切换描点
- var theKeyword, province, dataObj={};
- var thePageNo = 1,
- thePageLength = 1,
- pageSize = 12;
- let hash=window.location.hash
- if(hash=="#zizone"){
- $('.zone_right').addClass('actives').siblings().removeClass('actives')
- $(".sanjiao").css({ left: "895px" });
- $('.wiseman_list').show();
- $('.tab_zizone').hide();
- }
- //智库、智者切换
- $('.zizone .col-md-6').click(function() {
- $(this).addClass('actives').siblings().removeClass('actives')
- })
- $('.zone_left').click(function() {
- $('.wiseman_list').hide();
- $('.tab_zizone').show();
- $('.searchs').hide();
- $(".sanjiao").animate({ left: "295px" });
- })
- $('.zone_right').click(function() {
- $('.wiseman_list').show();
- $('.tab_zizone').hide();
- $('.searchs').show();
- $(".sanjiao").animate({ left: "895px" });
- })
- //刷新判断搜索框是否存在
- if($('.zone_right').hasClass('actives')){
- $('.searchs').show();
- }
- //初始北京第一页新闻
- $('.place_city ul li').eq(0).addClass('thon').siblings().removeClass('thon');
- var thePageNos = 1;
- var pageNos = 1;
- var thePageLengths = 1;
- var pageSizes = 4;
- var provinces;
- function datt(provinces, pageNos) {
- $.ajax({
- method: "get",
- dataType: "json",
- url: globalConfig.context + "/portal/news/list",
- data: {
- provinceId: provinces,
- hot: 1,
- pageNo: pageNos || 1,
- type: 5,
- pageSize: pageSizes
- },
- success: function(result) {
- var totlepage = Math.ceil(result.data.totalCount / 4);
- var policy_li = '';
- for(var i = 0; i < result.data.list.length; i++) {
- var id = result.data.list[i].id;
- var title = result.data.list[i].title; //标题
- var time = result.data.list[i].createTimeFormattedDate; //日期
- var day = time.substr(8, 2); //号
- var month = time.substr(0, 7) //年、月
- var summary = result.data.list[i].summary; //简介
- var totle = result.data.totalCount;
- var pages = Math.ceil(totle / 4);
- var sol = '';
- if(summary == null) {
- summary = ''
- };
- var srctt = globalConfig.context + '/portal/news/newsDetail.html?id=' + id;
- policy_li += "<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>"
- }
- if(result.data.list.length === 0) {
- $('.policy ol').hide();
- $('.policy ul').html('<div class="imgbg"></div>');
- } else {
- $('.policy ol').show();
- $('.policy ul').html(policy_li)
- }
- }.bind(this)
- })
- }
- datt(1, 1);
- //点击省份时刷新页面新闻
- $('.place_city ul li').click(function() {
- $(this).addClass('thon').siblings().removeClass('thon')
- $('.policy ol li').eq(0).addClass('active_of').siblings().removeClass('active_of');
- $('.more_city .inp').removeClass('thon');
- $('.more_city .inp').text('更多省份 +')
- //新闻刷新
- var t_val = $(this).prop('value');
- provinces = t_val;
- datt(provinces, 1);
- });
- //智政新闻小点切换宽度设置及点击刷新
- var cirle = $('.policy ol li').length;
- var ind_circle = 0;
- $('.policy ol li').click(function() {
- $(this).addClass('active_of').siblings().removeClass('active_of');
- var place_on = $('.place_city ul li.thon').prop('value')
- var h_ind = $(this).index() + 1;
- if(place_on == undefined) {
- place_on = $('.inp').attr('value');
- }
- provinces = place_on;
- pageNos = h_ind;
- $.ajax({
- method: "get",
- dataType: "json",
- url: globalConfig.context + "/portal/news/list",
- data: {
- provinceId: provinces,
- hot: 1,
- pageNo: pageNos || 1,
- type: 5,
- pageSize: pageSizes
- },
- success: function(result) {
- var totlepage = Math.ceil(result.data.totalCount / 4);
- var policy_li = '';
- for(var i = 0; i < result.data.list.length; i++) {
- var id = result.data.list[i].id;
- var title = result.data.list[i].title; //标题
- var time = result.data.list[i].createTimeFormattedDate; //日期
- var day = time.substr(8, 2); //号
- var month = time.substr(0, 7) //年、月
- var summary = result.data.list[i].summary; //简介
- var totle = result.data.totalCount;
- var pages = Math.ceil(totle / 4);
- var sol = '';
- var srctt = globalConfig.context + '/portal/news/newsDetail.html?id=' + id;
- policy_li += "<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>"
- }
- $('.policy ol').show();
- $('.policy ul').html(policy_li);
- if(result.data.list.length === 0) {
- $('.policy ul').html('<div class="imgbgs"></div>');
- }
- }.bind(this)
- })
- })
- //中央政策跳转
- $('.main_zizone ul').on('click', 'li', function() {
- var theId = $(this).attr('value');
- window.open(globalConfig.context + '/portal/news/newsDetail.html?id=' + theId);
- })
-
- //中央政策点击刷新
- var t=1;
- $('.zizone_left').click(function(){
- t--;
- if(t<=1){
- t=1
- }
- pageNos=t;
- mids(1,pageNos);
- })
- //智者数据交互
- function loadDate(pageNo) {
- $('.loading').show();
- $('.pagination_box').show()
- $.ajax({
- method: "get",
- dataType: "json",
- url: globalConfig.context + "/portal/search/subscriberList",
- data: {
- pageNo: pageNo || 1,
- pageSize: pageSize,
- field: dataObj.theFieldA?dataObj.theFieldA:'',
- international:dataObj.international,
- name:dataObj.theKeyword,
- province:dataObj.province
- },
- success: function (data) {
- var theArr = [];
- console.log(data)
- if(data&&data.error.length){
- msg(data.error[0].message)
- $('.pagination_box').hide();
- }
- if (data&&data.data && data.data.list) {
- for (let i = 0; i < data.data.list.length; i++) {
- let thisdata = data.data.list[i];
- let achievementNumText=(thisdata.achievementNum==null)?"":thisdata.achievementNum;
- if(thisdata.username==null||thisdata.username==''){
- thisdata.username='佚名'
- }
- theArr.push(`
- <li value="${thisdata.uid}">
- <div class="noImg">
- ${thisdata.personPortraitUrl&&thisdata.personPortraitUrl!=null?'<img src="'+globalConfig.avatarHost+'/upload'+thisdata.personPortraitUrl+'"/>':''}
- </div>
- <div class="list_text">
- <p class="bulr">${thisdata.username}</p>
- <p class="orange">${thisdata.position?thisdata.position:'未知职位'}</p>
- <p class="text_on">${achievementNumText}</p>
- </div>
- <div class="shadow_text">
- <p class="bulr">${thisdata.username }</p>
- <p class="orange">${thisdata.position?thisdata.position:'未知职位'}</p>
- <p class="text_on">${achievementNumText}</p>
- <span> <img src="${globalConfig.portalHost}/img/search_txt.png "/></span>
- </div>
- </li>
- `);
- };
- }
- $('.loading').hide();
- $('#subscriberList').empty();
- $('#subscriberList').append(theArr.join(''));
- if(data.data.list.length===0){
- $('#subscriberList').html('<div class="imgbg"></div>') ;
- }
- $('.totalCount').html("共" + data.data.totalCount + "条数据");
- thePageLength = data.data.totalCount ? Math.ceil(data.data.totalCount / pageSize) : 1;
- 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>'
- );
- }
- };
- if(!data.data.totalCount){
- $('.pagination_box').hide()
- }else{
- $('.pageNumber').remove();
- $('.pagePre').after(pageArr.join(''));
- }
-
- }
- });
- }
- //搜索城市下拉
- var addlength = provinceList.length;
- var soption = '';
- var sol = '';
- for(var i = 0; i < addlength; i++) {
- sol += "<p value='" + provinceList[i].id + "'>" + provinceList[i].name + "</p>";
- };
- for(var i = 0; i < addlength; i++) {
- soption += "<option value='" + provinceList[i].id + "'>" + provinceList[i].name + "</option>";
- };
- $('.list_city').html(sol);
- $('#selt').html(soption);
- //智政城市下拉切换
- $('.list_city').hide();
- $('.more_city .inp').click(function() {
- $('.list_city').slideToggle(500)
- })
- $('.more_city').mouseleave(function() {
- $('.list_city').hide();
- })
- //选择城市及新闻页面刷新
- $('.list_city p').click(function() {
- var ptxt = $(this).text();
- var pval = $(this).attr('value');
- $('.more_city .inp').text(ptxt);
- $('.more_city .inp').attr('value', pval);
- $('.list_city').hide();
- $('.more_city .inp').addClass('thon');
- $('.place_city ul li').removeClass('thon');
- $('.policy ol li').eq(0).addClass('active_of').siblings().removeClass('active_of');
- var p_val = $(this).attr('value');
- provinces = p_val;
- datt(provinces, 1);
- });
- //初始化内容
- function mids(provinces, pageNos) {
- $.ajax({
- method: "get",
- dataType: "json",
- url: globalConfig.context + "/portal/news/list",
- data: {
- provinceId: null,
- hot: 1,
- pageNo: pageNos || 1,
- type: 4,
- pageSize: pageSizes
- },
- success: function(result) {
- thePageLengths = result.data.totalCount ? Math.ceil(result.data.totalCount / pageSizes) : 1;
- var policy_img = '';
- var totle = Math.ceil(result.data.totalCount / 4);
- for(var i = 0; i < result.data.list.length; i++) {
- var id = result.data.list[i].id;
- var title = result.data.list[i].title; //标题
- var titleImg = result.data.list[i].titleImg; //图片
- if(titleImg == null) {
- titleImg = ''
- }
- var summary = result.data.list[i].summary; //简介
- if(summary == null) {
- summary = ''
- };
- var imgUrls = titleImg != '' ? globalConfig.avatarHost + '/upload' + titleImg : globalConfig.avatarHost + '/upload/default/news.jpg';
- policy_img +=
- "<li value='" + id + "'>" +
- "<img src='" + imgUrls + "' alt=''/>" +
- "<div class='zizone_text'><h4><a href='#'>" +
- title + "</a></h3><p>" +
- summary + "</p><a href='#'>MORE+</a>" +
- "<input type='hidden' value='" + totle + "'/></div></li>"
- }
- $('.main_zizone ul').html(policy_img)
- }.bind(this)
- })
- }
- mids(1, 1)
- //点击时left
- var t = 1;
- //点击时right
- $('.zizone_right').click(function() {
- var tot = $('.main_zizone ul').find('input').val()
- t++;
- if(t > tot) {
- t = tot
- }
- pageNos = t;
- mids(1, pageNos);
- })
- //智者数据交互
-
- if(window.location.search) {
- let theUrl = window.location.search
- theKeyword = theUrl.substring(1, theUrl.length);
- theKeyword = decodeURIComponent(theKeyword);
- $('#searchInput').val(theKeyword);
- };
- loadDate();
- var industryListArr = [];
- industryListArr.push(['<li value="" class="active">',
- '<span>',
- '不限',
- '</span>',
- '</li>',
- ].join(''));
- industry.map(function(item) {
- industryListArr.push(['<li value="' + item.value + '">',
- '<span>',
- item.key,
- '</span>',
- '</li>',
- ].join(''));
- });
- if(industryListArr && industryListArr.length) {
- $('#industryList').append(industryListArr.join(''));
- };
- $('#industryList').on('click', 'li', function() {
- var theValue = this.value;
- $(this).siblings("li").removeClass("active");
- $(this).addClass("active");
- dataObj.province ='';
- dataObj.theKeyword='';
- dataObj.theFieldA=theValue;
- loadDate();
- });
- $('.searchs button').click(function(e) {
- e.preventDefault();
- theKeyword = $('#search_on input').val();
- province = $('#selt option:checked').attr('value');
- dataObj.theFieldA ='';
- dataObj.province = province;
- dataObj.theKeyword=theKeyword;
- if(theKeyword){
- loadDate();
- $('#industryList li').removeClass('active');
- $('#selectInt li').eq(0).addClass('active');
- $('#isInt').prop('checked', false);
- $('#noInt').prop('checked', false);
- $('#noInt,#isInt').parent().addClass('demand').removeClass('patent');
- }
-
- });
- $('.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);
- };
- };
- });
- $('#subscriberList').on('click', 'li', function() {
- var theId = $(this).attr('value');
- window.open(globalConfig.context + '/portal/subscriberDetail.html?uid=' + theId + '&type=0');
- });
- //是否国际单选
- $('#isInt').prop('checked', false);
- $('#selectInt li:first-child').click(function() {
- $(this).addClass('active');
- $('#isInt').prop('checked', false);
- $('#noInt').prop('checked', false);
- $('#noInt,#isInt').parent().addClass('demand').removeClass('patent');
- dataObj.international = null;
- dataObj.province = '';
- dataObj.theKeyword='';
- loadDate();
- })
- $('#isInt').click(function() {
- $('#selectInt li').eq(0).removeClass('active')
- $(this).prop('checked', true);
- $(this).parent().addClass('patent').removeClass('demand');
- $('#noInt').attr('checked', false);
- $('#noInt').parent().addClass('demand').removeClass('patent');
- dataObj.international = 1;
- dataObj.province = '';
- dataObj.theKeyword='';
- loadDate();
- })
- $('#noInt').click(function() {
- $('#selectInt li').eq(0).removeClass('active')
- $(this).prop('checked', true);
- $(this).parent().addClass('patent').removeClass('demand');
- $('#isInt').attr('checked', false);
- $('#isInt').parent().addClass('demand').removeClass('patent');
- dataObj.international = 0;
- dataObj.province = '';
- dataObj.theKeyword='';
- loadDate();
- })
- //提示框渐隐函数
- function msg(txt) {
- if($('.smg').hasClass('active')){
- return ;
- }
- $('.smg').addClass('active');
- var lit = $('#msg').val(txt);
- setTimeout(function () {
- $('.smg').removeClass('active');
- $('#msg').val('');
- }, 2000)
- }
- })
|