|
@@ -11,81 +11,185 @@ import 'css/newMenu/achievementList.css';
|
|
|
import 'js/public.js';
|
|
|
|
|
|
"use strict";
|
|
|
-$(function() {
|
|
|
+$(function () {
|
|
|
var thePageNo = 1,
|
|
|
thePageLength = 1,
|
|
|
- dataList={},
|
|
|
- pageSize =12;
|
|
|
+ dataList = {},
|
|
|
+ pageSize = 15;
|
|
|
init();
|
|
|
- function init(){
|
|
|
- loadDate();
|
|
|
+
|
|
|
+ function init() {
|
|
|
pages();
|
|
|
- onSelect();
|
|
|
inpFun();
|
|
|
- $('.onSelect .preFirst').css('display','none')
|
|
|
- $('.onSelect .next').css('display','none')
|
|
|
+ summary();
|
|
|
+ jump();
|
|
|
+ hotSearch();
|
|
|
+ $('.onSelect .preFirst').css('display', 'none')
|
|
|
+ $('.onSelect .next').css('display', 'none')
|
|
|
};
|
|
|
- function loadDate(pageNo) {
|
|
|
- console.log(dataList)
|
|
|
+ //一级界面跳转此页面
|
|
|
+ function jump() {
|
|
|
+ let hash = window.location.search;
|
|
|
+ if (hash) {
|
|
|
+ if (hash.indexOf('name') > -1 || hash.indexOf('topId') > -1 || hash.indexOf('secondId') > -1) {
|
|
|
+ let newHash = hash.substr(1, hash.length)
|
|
|
+ if (newHash.indexOf('&') > -1) {
|
|
|
+ let hashArr = newHash.split('&');
|
|
|
+ console.log(hashArr)
|
|
|
+ hashArr.map(item => {
|
|
|
+ if (item.indexOf('name') > -1) {
|
|
|
+ let names = item.split('=')
|
|
|
+ dataList.name = names[1]
|
|
|
+ }
|
|
|
+ if (item.indexOf('topId') > -1) {
|
|
|
+ let topIds = item.split('=')
|
|
|
+ dataList.topId = topIds[1]
|
|
|
+ }
|
|
|
+ if (item.indexOf('secondId') > -1) {
|
|
|
+ let secondIds = item.split('=')
|
|
|
+ dataList.secondId = secondIds[1]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ if (newHash.indexOf('name') > -1) {
|
|
|
+ let names = newHash.split('=')
|
|
|
+ dataList.name = names[1]
|
|
|
+ }
|
|
|
+ if (newHash.indexOf('topId') > -1) {
|
|
|
+ let topIds = newHash.split('=')
|
|
|
+ dataList.topId = topIds[1]
|
|
|
+ }
|
|
|
+ if (newHash.indexOf('secondId') > -1) {
|
|
|
+ let secondIds = newHash.split('=')
|
|
|
+ dataList.secondId = secondIds[1]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ loadDate()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ dataList.name = "",
|
|
|
+ dataList.topId = "", //行业
|
|
|
+ dataList.secondId = "" //类型
|
|
|
+ loadDate();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //热搜
|
|
|
+ function hotSearch() {
|
|
|
+ $('.searchMain ol li').click(function () {
|
|
|
+ $(this).addClass('active').siblings().removeClass('active');
|
|
|
+ $('.searchMain ol li').eq(0).addClass('active');
|
|
|
+ dataList.name = $(this).text().trim();
|
|
|
+ let index = $(this).index();
|
|
|
+ $('.productionType ol').html(`<li data-id=''>不限</li>`);
|
|
|
+ $('.industryList ul li').removeClass('active');
|
|
|
+ $('.productionType ol li').removeClass('active')
|
|
|
+ heightFun();
|
|
|
+ if (index) {
|
|
|
+ dataList.topId = '';
|
|
|
+ dataList.secondId = '';
|
|
|
+ loadDate();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function summary() {
|
|
|
+ let hash = window.location.search;
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ url: globalConfig.context + "/open/industryList",
|
|
|
+ data: {
|
|
|
+
|
|
|
+ },
|
|
|
+ success: function (data) {
|
|
|
+ var theArrs = [];
|
|
|
+ if (data.data && data.data.length) {
|
|
|
+ let thisdata = data.data;
|
|
|
+ thisdata.unshift({
|
|
|
+ id: '',
|
|
|
+ name: '不限',
|
|
|
+ children: [{
|
|
|
+ id: '',
|
|
|
+ name: '不限'
|
|
|
+ }]
|
|
|
+ })
|
|
|
+ thisdata.map((item, index) => {
|
|
|
+ if (index || hash) {
|
|
|
+ theArrs.push(`
|
|
|
+ <li data-id=${item.id}>${item.name}</li>
|
|
|
+ `)
|
|
|
+ } else {
|
|
|
+ theArrs.push(`
|
|
|
+ <li class="active" data-id=${item.id}>${item.name}</li>
|
|
|
+ `)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ $('.industryList ul').html(theArrs);
|
|
|
+ $('.industryList ul li').eq(0).className = "active";
|
|
|
+ $('.productionType ol').html(`<li data-id=''>不限</li>`);
|
|
|
+ $('.productionType ol li ').eq(0).addClass = "active";
|
|
|
+ heightFun();
|
|
|
+ onSelect(thisdata);
|
|
|
+ };
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ function heightFun(){
|
|
|
+ let proH = $('.productionType ol').height();
|
|
|
+ $('.productionType p').css({height:proH+'px',lineHeight:proH+'px'})
|
|
|
+ $('.productionType').css({height:proH+'px',lineHeight:proH+'px'})
|
|
|
+ }
|
|
|
+ function loadDate(pageNo) {
|
|
|
$.ajax({
|
|
|
method: "get",
|
|
|
dataType: "json",
|
|
|
- //url: globalConfig.context + "/portal/search/achievementList",
|
|
|
- url:"https://www.apiopen.top/satinApi",
|
|
|
+ url: globalConfig.context + "/open/demandList",
|
|
|
data: {
|
|
|
- //page:1
|
|
|
pageNo: pageNo || 1,
|
|
|
- pageSize: 12,
|
|
|
- // keyword: theKeyword,
|
|
|
- fieldA: dataList.industryVal, //行业
|
|
|
- fieldB: dataList.productionVal //类型
|
|
|
+ pageSize: 15,
|
|
|
+ name: dataList.name,
|
|
|
+ industryCategoryA: dataList.topId, //行业
|
|
|
+ industryCategoryB: dataList.secondId //类型
|
|
|
},
|
|
|
success: function (data) {
|
|
|
- console.log(data)
|
|
|
var theArrs = [];
|
|
|
- data.data.totalCount=400;
|
|
|
- if (data.data&&data.data.length) {
|
|
|
- for (let i = 0; i < 12; i++) {
|
|
|
- let thisdata = data.data[i];
|
|
|
+ if (data.data && data.data.list.length) {
|
|
|
+ let nub = data.data.list.length;
|
|
|
+ for (let i = 0; i < nub; i++) {
|
|
|
+ let thisdata = data.data.list[i];
|
|
|
+ console.log(thisdata.fieldAS)
|
|
|
theArrs.push(`
|
|
|
<li>
|
|
|
- <div class="img">
|
|
|
- <img src="${thisdata.cdn_img}" alt="">
|
|
|
- <span></span>
|
|
|
- </div>
|
|
|
- <div class="txtIntroduce">
|
|
|
- <div class="txts">
|
|
|
- <h5>高压电极加热技术哈...</h5>
|
|
|
- <p><span>实用技术</span><span>联合生产</span><span class="hotImg"></span></p>
|
|
|
+ <a href="${globalConfig.context}/portal/technologyTrading/demandDetail?id=${thisdata.id}&type=${thisdata.dataCategory}">
|
|
|
+ <div class="img">
|
|
|
+ <img src="${thisdata.pictureUrl}" alt="">
|
|
|
</div>
|
|
|
- <div class="hr"></div>
|
|
|
- <div class="btnTxt">
|
|
|
- <span class="float-left">环保</span>
|
|
|
- <span class="float-left">医疗</span>
|
|
|
+ <div class="txtIntroduce">
|
|
|
+ <div class="txts">
|
|
|
+ <h5 title="${thisdata.name}">${thisdata.name}</h5>
|
|
|
+ <p><span>${thisdata.demandTypeS?thisdata.demandTypeS:'实用技术'}</span><span style="display:${thisdata.isHot&&thisdata.isHot!='null'?'block':'none'}" class="hotImg"></span></p>
|
|
|
+ </div>
|
|
|
+ <div class="hr"></div>
|
|
|
+ <div class="btnTxt">
|
|
|
+ <span class="float-left" style="display:${thisdata.industryCategory1!=null?'block':'none'}">${thisdata.industryCategory1}</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </li>`
|
|
|
- );
|
|
|
+ </a>
|
|
|
+ </li>`);
|
|
|
};
|
|
|
};
|
|
|
$('.achievementHot .hotList').empty();
|
|
|
$('.achievementHot .hotList').append(theArrs.join(''));
|
|
|
-
|
|
|
- //页面里面的详情链接
|
|
|
- $(".achievementHot .hotList li").on('click', function () {
|
|
|
- var theId = $(this).parents('.list').attr('val');
|
|
|
- var thetype=$(this).parents('.list').attr('typ');
|
|
|
- window.open(globalConfig.context + '/portal/technologyTrading/achievementDetail?id=' + theId+'&type='+thetype );
|
|
|
- });
|
|
|
- $('.pagination_box').css('display','block');
|
|
|
- $('.inp').css('display','block');
|
|
|
- if(data.data.length===0){
|
|
|
- $('.achievementHot .hotList').html("<div class='list_none'></div>") ;
|
|
|
- $('.pagination_box').css('display','none')
|
|
|
- $('.inp').css('display','none');
|
|
|
+ $('.pagination_box').css('display', 'block');
|
|
|
+ $('.inp').css('display', 'block');
|
|
|
+ if (data.data.list.length === 0) {
|
|
|
+ $('.achievementHot .hotList').html("<div class='list_none'></div>");
|
|
|
+ $('.pagination_box').css('display', 'none')
|
|
|
+ $('.inp').css('display', 'none');
|
|
|
};
|
|
|
thePageLength = data.data.totalCount ? Math.ceil(data.data.totalCount / pageSize) : 1;
|
|
|
- $('.totalCount').html(`共${data.data.totalCount}条数据 ${thePageLength}页`)
|
|
|
+ console.log(thePageLength)
|
|
|
+ $('.totalCount').html(`共${data.data.totalCount}条数据 ${thePageLength}页`)
|
|
|
var pageArr = [],
|
|
|
firstNo = 1,
|
|
|
endNo = 5;
|
|
@@ -112,7 +216,7 @@ $(function() {
|
|
|
});
|
|
|
}
|
|
|
//f分页
|
|
|
- function pages(){
|
|
|
+ function pages() {
|
|
|
$('.pagination').on('click', 'li', function (e) {
|
|
|
e.preventDefault();
|
|
|
if (this.className === 'pagePre') {
|
|
@@ -137,44 +241,83 @@ $(function() {
|
|
|
});
|
|
|
}
|
|
|
//输入跳转
|
|
|
- function inpFun(){
|
|
|
- $('.inp .btn').on('click',function(){
|
|
|
+ function inpFun() {
|
|
|
+ $('.inp .btn').on('click', function () {
|
|
|
let val = $(this).siblings().val();
|
|
|
- if(!isNaN(val)&&val<thePageLength&&val>0){
|
|
|
- thePageNo=val;
|
|
|
+ if (!isNaN(val) && val <=thePageLength && val > 0) {
|
|
|
+ thePageNo = val;
|
|
|
loadDate(thePageNo);
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
//已选类型
|
|
|
- function onSelect(){
|
|
|
- $('.industryList ul li').on('click',function(){
|
|
|
- dataList.industryVal = $(this).attr('value');
|
|
|
- let txt = $(this).text();
|
|
|
- $('.onSelect .preFirst').css('display','block').html(`
|
|
|
+ function onSelect(data) {
|
|
|
+ $('.industryList ul li').on('click', function () {
|
|
|
+ $('.searchMain ol li').removeClass('active');
|
|
|
+ $('.searchMain ol li').eq(0).addClass('active');
|
|
|
+ let secondTxt = [],
|
|
|
+ scondHtml = [];
|
|
|
+ $(this).addClass('active').siblings().removeClass('active')
|
|
|
+ dataList.topId = $(this).attr('data-id');
|
|
|
+ dataList.name = '';
|
|
|
+ dataList.secondId = '';
|
|
|
+ $('.next').css('display', 'none')
|
|
|
+ data.map(item => {
|
|
|
+ if (item.id == dataList.topId) {
|
|
|
+ secondTxt = item.children
|
|
|
+ }
|
|
|
+ })
|
|
|
+ secondTxt.map(item => {
|
|
|
+ scondHtml.push(`
|
|
|
+ <li data-id=${item.id}>${item.name}</li>
|
|
|
+ `)
|
|
|
+ })
|
|
|
+ if (!dataList.topId) {
|
|
|
+ dataList.topId = '';
|
|
|
+ dataList.secondId = '';
|
|
|
+ $('.preFirst').html('不限');
|
|
|
+ $('.next').css('display', 'none')
|
|
|
+ scondHtml = ['<li>不限</li>'];
|
|
|
+ }
|
|
|
+ $('.productionType ol').html(scondHtml);
|
|
|
+ heightFun();
|
|
|
+ let txt = $(this).text();
|
|
|
+ $('.onSelect .preFirst').css('display', 'block').html(`
|
|
|
<span>${txt}</span>
|
|
|
- <span class="typeClose">x</span>
|
|
|
- `)
|
|
|
- loadDate();
|
|
|
- }) ;
|
|
|
- $('.productionType ol li').on('click',function(){
|
|
|
- dataList.productionVal = $(this).attr('value');
|
|
|
- let txt = $(this).text();
|
|
|
- $('.onSelect .next').css('display','block').html(`
|
|
|
- <span>${txt}</span>
|
|
|
- <span class="typeClose">x</span>
|
|
|
- `)
|
|
|
- loadDate();
|
|
|
- })
|
|
|
+ `)
|
|
|
+ loadDate();
|
|
|
+ $('.productionType ol li').on('click', function () {
|
|
|
+ dataList.name = '';
|
|
|
+ dataList.topId = $('.industryList ul li.active').attr('data-id');
|
|
|
+ $(this).addClass('active').siblings().removeClass('active');
|
|
|
+ dataList.secondId = $(this).attr('data-id');
|
|
|
+ if (!dataList.secondId) return;
|
|
|
+
|
|
|
+ let txt = $(this).text();
|
|
|
+ $('.onSelect .next').css('display', 'block').html(`
|
|
|
+ <span>${txt}</span>
|
|
|
+ `)
|
|
|
+ loadDate();
|
|
|
+ })
|
|
|
+ });
|
|
|
}
|
|
|
+ $('.searchBtn').click(function () {
|
|
|
+ let val = $('.demandSearch').val();
|
|
|
+ if (val) {
|
|
|
+ dataList.name = val;
|
|
|
+ dataList.topId = '';
|
|
|
+ dataList.secondId = '';
|
|
|
+ loadDate();
|
|
|
+ }
|
|
|
+ })
|
|
|
/* 提示 */
|
|
|
//提示框渐隐函数
|
|
|
- function msg() {
|
|
|
+ function msg() {
|
|
|
$('.smg').addClass('active');
|
|
|
var lit = $('#msg').val();
|
|
|
setTimeout(function () {
|
|
|
$('.smg').removeClass('active')
|
|
|
$('#msg').val('');
|
|
|
}, 2000)
|
|
|
- }
|
|
|
+ }
|
|
|
})
|