{newsList[0].summary}
{newsList[0].publishTime}
- 查看详情
+ 查看详情
{i.summary}
{i.publishTime}
- 查看详情
+ 查看详情
{data.introductionTitle}
-{data.introductionContent}
+ {data.introductionTitle &&{data.introductionTitle}
} +{data.introductionContent}
{newsList[0].summary}
{newsList[0].publishTime}
- 查看详情
+ 查看详情
{i.summary}
{i.publishTime}
- 查看详情
+ 查看详情
1 - {newsList[0].name} + {newsList[0].name}
{newsList[0].summary}
@@ -162,7 +161,7 @@ function HeaderPage(props){
{newsList[0].publishTime}
- 查看更多
+ 查看更多
{k + 1} - {i.name} + {i.name}
{i.summary}
diff --git a/src/forge/Information/Pages/main.jsx b/src/forge/Information/Pages/main.jsx index 89c38d930..04d33aa19 100644 --- a/src/forge/Information/Pages/main.jsx +++ b/src/forge/Information/Pages/main.jsx @@ -10,8 +10,10 @@ import shijian from '../img/shijian.png'; import liulan from '../img/liulan.png'; import emptydata from '../../Images/nodata.png'; import DefaultImg from '../Component/defaultImg'; +import { getNewsAllList , getNewsHotList } from '../api'; +import { tempConfig, tempEnum } from '../tempInfo'; import { httpUrl } from '../fetch'; -import { tempConfig } from '../tempInfo'; + function Main(props){ const [ key , setKey ] = useState("1"); @@ -22,14 +24,13 @@ function Main(props){ const [ isSpin , setIsSpin ] = useState(true); const [ newCateId , setNewCateId ] = useState(undefined); const { deptId , cateId } = props.match.params; - const { id } = props; - const temp = props.pathName + const { id, temp } = props; useEffect(()=>{ if(id) { setIsSpin(true); - if (temp === 'zone') { + if (temp === tempEnum.zone) { getMainList(); } else { getCateList(); @@ -45,12 +46,11 @@ function Main(props){ }, [newCateId]) function getMainList(){ - const url = `${httpUrl}/cms/doc/open/zone/${id}/docOverviewList`; - axios.get(url).then(result=>{ + getNewsAllList(id).then(result=>{ if(result){ let rows = result.data.rows; setMainList(rows); - if (temp !== 'zone') { + if (temp !== tempEnum.zone) { selectCate(rows[0].id) } setTimeout(() => { @@ -71,7 +71,7 @@ function Main(props){ if(result){ let rows = result.data.rows; setMainList(rows); - if (temp !== 'zone') { + if (temp !== tempEnum.zone) { selectCate(rows[0].id) } setIsSpin(false); @@ -80,9 +80,8 @@ function Main(props){ } function getHotList(){ - const url = `${httpUrl}/cms/doc/open/zone/${id}/hotDocList`; - axios.get(url,{ - params:{pageSize:15,pageNum:1} + getNewsHotList(id,{ + pageSize:15,pageNum:1 }).then(result=>{ if(result){ setHotList(result.data.rows); @@ -103,7 +102,7 @@ function Main(props){ function selectCate(id) { setNewCateId(id) - props.history.push(`/${temp}/${deptId}/news/${id}`) + props.history.push(`/zone/${deptId}/news/${id}`) } return( @@ -114,13 +113,13 @@ function Main(props){ { mainList && mainList.length>0 && ( - temp === 'zone' ? + temp === tempEnum.zone ?