Merge branch 'gitlink_ssr_head' of https://gitlink.org.cn/Gitlink/forgeplus-react into pre_gitlink_ssr
This commit is contained in:
commit
55bd79d245
|
@ -10,6 +10,7 @@ import "slick-carousel/slick/slick.css";
|
||||||
import "slick-carousel/slick/slick-theme.css";
|
import "slick-carousel/slick/slick-theme.css";
|
||||||
import Slider from "react-slick";
|
import Slider from "react-slick";
|
||||||
import RightContent from "./rightContent";
|
import RightContent from "./rightContent";
|
||||||
|
import { getNewsAllList } from '../../../Information/api';
|
||||||
|
|
||||||
// let focuseWorkList = [
|
// let focuseWorkList = [
|
||||||
// {
|
// {
|
||||||
|
@ -68,19 +69,32 @@ const setting = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function Home(props) {
|
function Home(props) {
|
||||||
const { newsList,timeObj,dayMap,weekMap,monthMap,weatherObj,currentMonth } = props;
|
const {id, newsList,timeObj,dayMap,weekMap,monthMap,weatherObj,currentMonth } = props;
|
||||||
const [firstNews, setFirstNews] = useState({});
|
const [firstNews, setFirstNews] = useState({});
|
||||||
const [focuseWorkList, setFocuseWorkList] = useState([]);
|
const [focuseWorkList, setFocuseWorkList] = useState([]);
|
||||||
const rightContentDom = React.useRef(null)
|
const rightContentDom = React.useRef(null)
|
||||||
|
|
||||||
// const [focuseWorkList, setFocuseWorkList] = useState([]);
|
// const [focuseWorkList, setFocuseWorkList] = useState([]);
|
||||||
|
useEffect(()=>{
|
||||||
|
let timer = null
|
||||||
|
if(id){
|
||||||
|
getNewsList()
|
||||||
|
timer = setInterval(()=>{
|
||||||
|
getNewsList()
|
||||||
|
},Number(localStorage.getItem('apiTime')) || 300000)
|
||||||
|
return () =>{
|
||||||
|
clearInterval(timer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},[id])
|
||||||
|
|
||||||
|
function getNewsList() {
|
||||||
useEffect(() => {
|
getNewsAllList(id).then(result => {
|
||||||
if (newsList && newsList.length) {
|
if (result && result.data.rows && result.data.rows.length) {
|
||||||
// //重点工作
|
let rows = result.data.rows;
|
||||||
|
// //重点工作
|
||||||
let allList = [];
|
let allList = [];
|
||||||
newsList.map((item) => {
|
rows.map((item) => {
|
||||||
if (item.name === "开源中心要闻") {
|
if (item.name === "开源中心要闻") {
|
||||||
item.cmsDocList.map((item) => {
|
item.cmsDocList.map((item) => {
|
||||||
allList.push(item);
|
allList.push(item);
|
||||||
|
@ -114,9 +128,9 @@ function Home(props) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setFocuseWorkList(finalList);
|
setFocuseWorkList(finalList);
|
||||||
}
|
}
|
||||||
}, newsList);
|
}).catch(error => { })
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="home-wrap">
|
<div className="home-wrap">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
.project-wrap {
|
.project-wrap {
|
||||||
width: 1920px;
|
width: 1920px;
|
||||||
height: 1080px;
|
height: 1080px;
|
||||||
overflow-x: scroll;
|
// overflow-x: scroll;
|
||||||
background-image: url(../../img/bj2.png);
|
background-image: url(../../img/bj2.png);
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { withRouter } from "react-router";
|
||||||
import { ImageLayerOfCommentHOC } from "../../modules/page/layers/ImageLayerOfCommentHOC";
|
import { ImageLayerOfCommentHOC } from "../../modules/page/layers/ImageLayerOfCommentHOC";
|
||||||
import Home from './components/Home/index'
|
import Home from './components/Home/index'
|
||||||
import ProjectStatus from './components/ProjectStatus/index'
|
import ProjectStatus from './components/ProjectStatus/index'
|
||||||
import { getNewsAllList, getMainInfos } from '../Information/api';
|
import { getMainInfos } from '../Information/api';
|
||||||
import next from "./img/next.png";
|
import next from "./img/next.png";
|
||||||
import Slider from "react-slick";
|
import Slider from "react-slick";
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
|
@ -69,27 +69,6 @@ function Index(props){
|
||||||
};
|
};
|
||||||
},[])
|
},[])
|
||||||
|
|
||||||
useEffect(()=>{
|
|
||||||
let timer = null
|
|
||||||
if(id){
|
|
||||||
getNewsList()
|
|
||||||
timer = setInterval(()=>{
|
|
||||||
getNewsList()
|
|
||||||
},Number(localStorage.getItem('apiTime')) || 300000)
|
|
||||||
return () =>{
|
|
||||||
clearInterval(timer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},[id])
|
|
||||||
|
|
||||||
function getNewsList() {
|
|
||||||
getNewsAllList(id).then(result => {
|
|
||||||
if (result) {
|
|
||||||
let rows = result.data.rows;
|
|
||||||
setNewsList(rows);
|
|
||||||
}
|
|
||||||
}).catch(error => { })
|
|
||||||
}
|
|
||||||
|
|
||||||
function getId(){
|
function getId(){
|
||||||
getMainInfos('xjykyzx').then(result=>{
|
getMainInfos('xjykyzx').then(result=>{
|
||||||
|
@ -198,7 +177,7 @@ function Index(props){
|
||||||
|
|
||||||
return (<div className="softFc-wrap">
|
return (<div className="softFc-wrap">
|
||||||
<Slider {...setting} >
|
<Slider {...setting} >
|
||||||
<Home newsList={newsList} timeObj={timeObj} dayMap={dayMap} weekMap={weekMap} monthMap={monthMap} weatherObj={weatherObj} currentMonth={currentMonth} key="home" ref={homeDom}/>
|
<Home id={id} newsList={newsList} timeObj={timeObj} dayMap={dayMap} weekMap={weekMap} monthMap={monthMap} weatherObj={weatherObj} currentMonth={currentMonth} key="home" ref={homeDom}/>
|
||||||
<ProjectStatus key="project" ref={proDom} projectList={projectList}/>
|
<ProjectStatus key="project" ref={proDom} projectList={projectList}/>
|
||||||
</Slider>
|
</Slider>
|
||||||
</div>)
|
</div>)
|
||||||
|
|
Loading…
Reference in New Issue