diff --git a/src/forge/Information/Pages/JCC/homePage.jsx b/src/forge/Information/Pages/JCC/homePage.jsx index 08b37d1fb..fcf364b2a 100644 --- a/src/forge/Information/Pages/JCC/homePage.jsx +++ b/src/forge/Information/Pages/JCC/homePage.jsx @@ -1,5 +1,6 @@ -import React,{ useState, useEffect } from 'react'; +import React,{ useState, useRef, useEffect } from 'react'; import { httpUrl } from '../../fetch'; +import img1 from '../../img/img1.png'; import visionFw from '../../img/vision-fw.png'; import visionYj from '../../img/vision-yj.png'; @@ -13,7 +14,7 @@ import Projects from '../../Component/projects'; import Partner from '../../Component/partner'; import '../../indexZone1.scss' import './index.scss' -import { Popover } from 'antd'; +import { Popover, Tabs } from 'antd'; function HeaderPageJCC(props){ const [ projectList , setProjectList ] = useState(undefined); @@ -22,7 +23,9 @@ function HeaderPageJCC(props){ const [ partnerList, setParterList ] = useState(undefined); const { deptId } = props.match.params; const { data, id, history } = props; + const [ activeKey, setActiveKey ] = useState(undefined); + let tabTimer = undefined; const vision = [ {imageUrl: visionFw, title: '服务无边界'}, {imageUrl: visionYj, title: '云间有协作'}, @@ -30,7 +33,6 @@ function HeaderPageJCC(props){ {imageUrl: visionJz, title: '价值可交换'} ] - useEffect(()=>{ if(id){ getProjectList(); @@ -54,6 +56,10 @@ function HeaderPageJCC(props){ axios.get(url).then(result=>{ if(result){ setNewsList(result.data.rows); + clearInterval(tabTimer) + tabTimer = setInterval(() => { + handle(result.data.rows && result.data.rows[0].id, result.data.rows) + }, 5000) } }).catch(error=>{}) } @@ -92,8 +98,54 @@ function HeaderPageJCC(props){ } }).catch(error=>{}) } + + function handle(value, rows){ + console.log("value",value) + console.log('newsList',rows) + // 获取新闻id的数组 + let idList = rows ? rows.map(obj => obj.id) : [] + console.log('idList',idList) + + + // 获取所有 tab节点 + let tabs = document.querySelectorAll('.zone_news .ant-tabs-tab') + const tabIndex = idList.indexOf(value) + console.log('tabIndex',tabIndex) + if(tabIndex !== -1 ){ + if(tabIndex !== idList.length -1){ + tabs[tabIndex + 1].click() + }else{ + tabs[0].click() + } + } + + // switch (value) { + // case "tabOne": + // this.tabs[1].click() + // break + // case "tabTwo": + // this.tabs[2].click() + // break + // case "tabThree": + // this.tabs[0].click() + // break + // default: + // break + // } + } + function handleTabChange(key) { + console.log('key',key) + setTimeout(()=>{ + setActiveKey(key) + },100) + clearInterval(tabTimer) + tabTimer = setInterval(() => { + handle(key, newsList) + }, 5000) + } + return( -
{ data.homepageCmsTitle }
-- 1 - {newsList[0].name} -
-{newsList[0].summary}
-
-
-
- {newsList[0].publishTime}
-
- 查看更多
-
- {k + 1} - {i.name} -
-{i.summary}
-
-
-
- {i.publishTime}
-
- 查看详情
-
{i.publishTime}
{i.summary || '-'}
+{data.firstTitle}
} - { - // 专区简介 - data && (data.introductionTitle || data.introductionContent || data.introductionImage) && -{data.introductionTitle}
} - + else if (key === 'tabThree') { + this.setState({activeKey:"tabThree"}) + } + },100) + this.tabTimer = setInterval(() => { + this.handle(this.state.activeKey) + }, 3000) + } + render() { + const {TabPane} = Tabs + return( +{ data.homepageCmsTitle }
-{newsList[0].summary}
-
-
- {newsList[0].publishTime}
-
- 查看详情
-
{i.summary}
-
-
-
- {i.publishTime}
-
- 查看详情
-
{ data.homepageProjectTitle }
- { -{i.projectProperties && i.projectProperties.description ? i.projectProperties.description : "暂无~"}
-{ data.homepageMemberTitle }
- { -{i.introduction || "暂无~"}
-{ data.homepagePartnersTitle }
-