|
@@ -11,48 +11,122 @@ import 'css/newMenu/serviceList.css';
|
|
|
import 'js/public.js';
|
|
|
|
|
|
"use strict";
|
|
|
-$(function() {
|
|
|
+$(function () {
|
|
|
var thePageNo = 1,
|
|
|
thePageLength = 1,
|
|
|
- dataList={},
|
|
|
- globalConfig={context:''},
|
|
|
- pageSize =15;
|
|
|
+ dataList = {},
|
|
|
+ projectList = [],
|
|
|
+ pageSize = 15;
|
|
|
init();
|
|
|
- function init(){
|
|
|
+ function init() {
|
|
|
loadDate();
|
|
|
pages();
|
|
|
- onSelect();
|
|
|
inpFun();
|
|
|
- $('.onSelect .preFirst').css('display','none')
|
|
|
- $('.onSelect .next').css('display','none')
|
|
|
+ summary();
|
|
|
+ search();
|
|
|
+ jump();
|
|
|
+ $('.onSelect .preFirst').css('display', 'none');
|
|
|
+ $('.onSelect .next').css('display', 'none');
|
|
|
};
|
|
|
- function loadDate(pageNo) {
|
|
|
+ //一级界面跳转此页面
|
|
|
+ function jump(){
|
|
|
+ let hash = window.location.search;
|
|
|
+
|
|
|
+ if(hash.indexOf('name')>-1||hash.indexOf('topId')>-1||hash.indexOf('secondId')>-1){
|
|
|
+ console.log(hash)
|
|
|
+ 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()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ function summary() {
|
|
|
+ $.ajax({
|
|
|
+ method: "get",
|
|
|
+ dataType: "json",
|
|
|
+ url: globalConfig.context + "/portal/service/jtBusiness/getCategoryList",
|
|
|
+ data: {
|
|
|
+
|
|
|
+ },
|
|
|
+ success: function (data) {
|
|
|
+ var theArrs = [];
|
|
|
+ if (data.data && data.data.length) {
|
|
|
+ let thisdata = data.data;
|
|
|
+ thisdata.unshift({
|
|
|
+ topLevelId: '',
|
|
|
+ topLevel: '不限',
|
|
|
+ children: [{
|
|
|
+ id: '',
|
|
|
+ name: '不限'
|
|
|
+ }]
|
|
|
+ })
|
|
|
+ thisdata.map(item => {
|
|
|
+ theArrs.push(`
|
|
|
+ <li data-id=${item.topLevelId}>${item.topLevel}</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";
|
|
|
+ onSelect(thisdata);
|
|
|
+ };
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function loadDate(pageNo) {
|
|
|
$.ajax({
|
|
|
method: "get",
|
|
|
dataType: "json",
|
|
|
- //url: globalConfig.context + "/portal/search/achievementList",
|
|
|
- url:"https://www.apiopen.top/satinApi",
|
|
|
+ url: globalConfig.context + "/portal/service/jtProject/list",
|
|
|
data: {
|
|
|
- //page:1
|
|
|
pageNo: pageNo || 1,
|
|
|
pageSize: 15,
|
|
|
- // keyword: theKeyword,
|
|
|
- fieldA: dataList.industryVal, //行业
|
|
|
- fieldB: dataList.productionVal //类型
|
|
|
+ name:dataList.name,
|
|
|
+ topId: dataList.topId, //行业
|
|
|
+ secondId: 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];
|
|
|
- console.log(thisdata)
|
|
|
+ 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];
|
|
|
theArrs.push(`
|
|
|
<li>
|
|
|
- <a href="${globalConfig.context}/portal/technologyTrading/achievementDetail?id=${thisdata.user_id}&type=${thisdata.type}">
|
|
|
+ <a href="${globalConfig.context}/portal/service/serviceDetail?id=${thisdata.id?thisdata.id:''}">
|
|
|
<div class="img">
|
|
|
- <img src="${thisdata.cdn_img}" alt="">
|
|
|
+ <img src="${thisdata.maxImgUrl}" alt="">
|
|
|
<span></span>
|
|
|
</div>
|
|
|
<div class="txtIntroduce">
|
|
@@ -61,26 +135,25 @@ $(function() {
|
|
|
</div>
|
|
|
<div class="hr"></div>
|
|
|
<div class="btnTxt">
|
|
|
- <p>${thisdata.text}</p>
|
|
|
+ <p>${thisdata.introduce}</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</a>
|
|
|
- </li>`
|
|
|
- );
|
|
|
+ </li>`);
|
|
|
};
|
|
|
};
|
|
|
$('.achievementHot .hotList').empty();
|
|
|
$('.achievementHot .hotList').append(theArrs.join(''));
|
|
|
-
|
|
|
- $('.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}页`)
|
|
|
+ $('.totalCount').html(`共${data.data.totalCount}条数据 ${thePageLength}页`)
|
|
|
var pageArr = [],
|
|
|
firstNo = 1,
|
|
|
endNo = 5;
|
|
@@ -107,7 +180,7 @@ $(function() {
|
|
|
});
|
|
|
}
|
|
|
//f分页
|
|
|
- function pages(){
|
|
|
+ function pages() {
|
|
|
$('.pagination').on('click', 'li', function (e) {
|
|
|
e.preventDefault();
|
|
|
if (this.className === 'pagePre') {
|
|
@@ -132,35 +205,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(`
|
|
|
- <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>
|
|
|
- `)
|
|
|
+ function onSelect(data) {
|
|
|
+ $('.industryList ul li').on('click', function () {
|
|
|
+ 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.topLevelId == 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);
|
|
|
+ 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.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>
|
|
|
+ <span class="typeClose">x</span>
|
|
|
+ `)
|
|
|
+ loadDate();
|
|
|
+ })
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //搜索
|
|
|
+ function search(){
|
|
|
+ $('.hot ul li').click(function(){
|
|
|
+ dataList.name = $(this).text();
|
|
|
+ dataList.topId='';
|
|
|
+ dataList.secondId='';
|
|
|
+ loadDate();
|
|
|
+ });
|
|
|
+ $('.searchBtn').click(function(){
|
|
|
+ let val = $('.demandSearch').val();
|
|
|
+ if(val){
|
|
|
+ dataList.name=val;
|
|
|
+ dataList.topId='';
|
|
|
+ dataList.secondId='';
|
|
|
loadDate();
|
|
|
- })
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
+
|
|
|
})
|