From ff3e980fed4f38129d511091756e7f5fbee7737e Mon Sep 17 00:00:00 2001 From: liudan <18634735655@163.com> Date: Tue, 20 Dec 2022 14:14:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/index.css | 18 +++- index.html | 51 ++---------- js/index.js | 213 +++++++++++++++++++++++------------------------- js/service12.js | 12 +-- 4 files changed, 134 insertions(+), 160 deletions(-) diff --git a/css/index.css b/css/index.css index 91c9e29..6de0dbd 100644 --- a/css/index.css +++ b/css/index.css @@ -542,7 +542,8 @@ a:active{ .middleContent .imgcontainer img{ width:100%; - height:100%; + /* height:100%; */ + height: 140px } .middleContent .contenttitle{ color:#000000; @@ -552,8 +553,8 @@ a:active{ overflow: hidden; text-overflow: ellipsis; display: -webkit-box; - -webkit-line-clamp: 2; - line-clamp: 2; + -webkit-line-clamp: 1; + line-clamp: 1; -webkit-box-orient: vertical; margin: 30px 0; } @@ -562,6 +563,17 @@ a:active{ padding:0; color:#747474; margin-bottom:30px; + display: -webkit-box; + display: -moz-box; + white-space: pre-wrap; + word-wrap: break-word; + overflow: hidden; + text-overflow: ellipsis; + -webkit-box-orient: vertical; + -webkit-line-clamp: 4; + height: 100px; + margin-right: 10px; + overflow: hidden; } .contentText .time{ color:#747474; diff --git a/index.html b/index.html index 942c133..1c555ab 100644 --- a/index.html +++ b/index.html @@ -233,7 +233,8 @@

电子信息

- + +
+
@@ -241,7 +242,7 @@

装备制造

- +
+
@@ -249,7 +250,7 @@

医药生物

- +
+
@@ -257,7 +258,7 @@

先进材料

- +
+
@@ -279,48 +280,12 @@
-
集团要闻
+
@@ -332,7 +297,7 @@
-
+

上市企业

diff --git a/js/index.js b/js/index.js index 982dd69..f306ddc 100644 --- a/js/index.js +++ b/js/index.js @@ -41,7 +41,28 @@ $(function(){ var w = $(window); return !(w.scrollTop() > (of.top + o.outerHeight()) || (w.scrollTop() + w.height()) < of.top); } - + // $('.brand__slider').owlCarousel({ + // loop:true, + // margin:30, + // autoplay:false, + // autoplayTimeout:3000, + // smartSpeed:500, + // items:3, + // navText:['',''], + // nav:false, + // dots:false, + // responsive:{ + // 0:{ + // items:1 + // }, + // 576:{ + // items:2 + // }, + // 767:{ + // items:3 + // }, + // }, + // }) $('.index_banner').slick({ autoplay: true, arrows: false, @@ -60,29 +81,6 @@ $(function(){ } ] }); - $('.brand__slider').owlCarousel({ - loop:true, - margin:30, - autoplay:false, - autoplayTimeout:3000, - smartSpeed:500, - items:3, - navText:['',''], - nav:false, - dots:false, - responsive:{ - 0:{ - items:1 - }, - 576:{ - items:2 - }, - 767:{ - items:3 - }, - } - }); - // $($('.electricItem>button')[0]).css('display','block') // $($('.electricItem>.addIon')[0]).css('display','none') // $($('.electricItem')[0]).css('background','rgba(19,75,161,0.8)') @@ -137,18 +135,6 @@ $(function(){ }) } }) - $('.titleContent .titleItem').click(function(){ - $(this).addClass('titleItemActive').siblings().removeClass('titleItemActive'); - if($('.titleItemActive')[0].innerHTML=='企业动态'){ - $('.newsLeftContent>a').attr('href','http://sct.njrenzhou.cn/news/news02.html') - } - if($('.titleItemActive')[0].innerHTML=='集团要闻'){ - $('.newsLeftContent>a').attr('href','http://sct.njrenzhou.cn/news/news01.html') - } - if($('.titleItemActive')[0].innerHTML=='媒体聚焦'){ - $('.newsLeftContent>a').attr('href','http://sct.njrenzhou.cn/news/news03.html') - } - }) $('.index_banner').init(function(slick){ $('.index_banner .item.slick-current').addClass('active').siblings().removeClass('active') }) @@ -228,7 +214,6 @@ $(function(){ continuousHorizontal:true, scrollingSpeed:500, showActiveTooltip :true, - anchors: ['hero', 'one', 'two', 'three','four','five'], loopHorizontal: true, afterLoad: function(anchorLink, index){ console.log(index) @@ -269,14 +254,6 @@ $(function(){ if(index == 6){ $('header').addClass('on').addClass("animation"); } - // var wow = new WOW({ - // boxClass: 'wow', - // animateClass: 'animated', - // offset: 0, - // mobile: true, - // live: true - // }); - // wow.init(); }, afterSlideLoad:function(){ }, @@ -296,86 +273,104 @@ $(function(){ } }) $.ajax({ - url: "https://suzhou.njrenzhou.cn/api.php/index/menuList", + url: "https://suzhou.njrenzhou.cn/api.php/index/cateGory", type: "POST", data: {}, - success: function (res) { - console.log(res,"999"); - // if(res.code==200){ - // let data = res.data; - // let html = '' - // data.forEach(item=>{ - // if(item.children&&item.children.length==0){ - // html+=`
  • - // 党建工作 - //
  • ` - // } - // html+=`` - // }) - // } + success: function (res) { + let html = '' + let data = res.data + data.forEach((item,index)=>{ + if(index==0){ + html+=`
    ${item.title}
    ` + news01_render(item.id) + }else{ + html+=`
    ${item.title}
    ` + } + }) + $(".titleContent").append(html) + $('.newsLeftContent>a').attr('href','http://sct.njrenzhou.cn/news/news01.html') + + $('.titleContent .titleItem').click(function(){ + console.log($(this)) + if($(this).attr('class').indexOf('titleItemActive')!=-1){ + // news01_render($(this)[0].dataset.id) + }else{ + $(this).addClass('titleItemActive').siblings().removeClass('titleItemActive'); + news01_render($(this)[0].dataset.id) + } + + if($('.titleItemActive')[0].dataset.id==11){ + $('.newsLeftContent>a').attr('href','http://sct.njrenzhou.cn/news/news01.html') + } + if($('.titleItemActive')[0].dataset.id==13){ + $('.newsLeftContent>a').attr('href','http://sct.njrenzhou.cn/news/news02.html') + } + if($('.titleItemActive')[0].dataset.id==35){ + $('.newsLeftContent>a').attr('href','http://sct.njrenzhou.cn/news/news03.html') + } + }) }, - error: function (err) { - console.log(err); - } + error: function (err) { + console.log(err); + } }) + }) - -let pageCurrent = 1; -// 新闻列表-集团要闻 -function news01_render(pageCurrent){ - console.log(pageCurrent); +function news01_render(categoryId){ $.ajax({ type: 'post', - url: 'https://suzhou.njrenzhou.cn/api.php/news/articleList', + url: 'https://suzhou.njrenzhou.cn/api.php/index/articleList', data:{ - category_id:11, - page:pageCurrent + category_id:categoryId, }, dataType: 'json', - success: function (res) { - if(res.code==200){ - let item = res.data.data; - let html = ''; - let page = ''; - console.log(item); - $('.news_wrap').empty(); - // $('.pageNum_wrap').empty(); - - $.each(item,function(index){ - var title = item[index].title; - var subtitle = item[index].subtitle; - var time = item[index].publish_time_text.substr(0,11); - var thumb = item[index].thumb; - var id = item[index].id; - - // html += "
    "; - // html += "
    "; - // html += "
    "; - // html += "
    " + title + "

    " + time + "

    "; - // html += "

    " + subtitle + "

    "; - }) - $('.news_wrap').append(html); - - } + if(res.code==200){ + let html = '' + let data = res.data.data; + data.forEach((item,index)=>{ + html+=`
    +
    + +
    +
    +
    ${item.title}
    +

    ${item.subtitle}

    +
    ${item.publish_time_text}
    +
    +
    ` + }) + $('.brand__slider').empty().append(html) + $(".brand__slider").trigger("destroy.owl.carousel") + $('.brand__slider').owlCarousel({ + loop:true, + margin:30, + autoplay:false, + autoplayTimeout:3000, + smartSpeed:500, + items:3, + navText:['',''], + nav:false, + dots:false, + responsive:{ + 0:{ + items:1 + }, + 576:{ + items:2 + }, + 767:{ + items:3 + }, + }, + }) + } }, error: function (err) { console.log(err); } }); - + } -news01_render(pageCurrent); diff --git a/js/service12.js b/js/service12.js index 495d0ad..51bb041 100644 --- a/js/service12.js +++ b/js/service12.js @@ -2,10 +2,11 @@ //banner $(function(){ let url = window.location.href; - if(url.split('?').length!=0&&url.split('?')[1]){ - $(`.section${url.split('?')[1].slice(3)}`).addClass('active') + $(`.section${url.split('?')[1].slice(3)}`).addClass('active'); + console.log(url.split('?')[1].slice(3)) // $('header').css('display','none !important') + $("#header").css('display','none') } $('#header').load('../public/header1.html',function(){ @@ -42,12 +43,13 @@ // anchors: ['hero', 'one', 'two', 'three','four','five'], loopHorizontal: true, afterLoad: function(anchorLink, index){ - console.log(index) - $('header').addClass('on').addClass("animation"); + if(index==1){ + $("#header").css('display','block'); $('header').css('display','flex'); - + $('header').addClass('on').addClass("animation"); }else{ + // $("#header").css('display','none'); $('header').css('display','none') } },