开源中心专区
This commit is contained in:
parent
1af4d27957
commit
9dc709dd7e
|
@ -0,0 +1,286 @@
|
|||
import React, { useState, useEffect } from 'react';
|
||||
import img1 from '../img/img1.png';
|
||||
import { httpUrl } from '../fetch';
|
||||
import { Link } from 'react-router-dom';
|
||||
import shijian from '../img/shijian.png';
|
||||
import xuexi from '../img/xuexiguanli.png';
|
||||
import { getHomePageList, gethomePageDocList, getAllList, getNewsAllList, getVIPLists } from '../api';
|
||||
import axios from 'axios';
|
||||
import Partner from '../Component/partner';
|
||||
import MemberList from '../Component/memberList';
|
||||
import '../indexZonebyCCF.scss';
|
||||
import '../indexZone1.scss';
|
||||
import "slick-carousel/slick/slick.css";
|
||||
import "slick-carousel/slick/slick-theme.css";
|
||||
import Slider from 'react-slick';
|
||||
import Left from '../../../home/Img/left.png';
|
||||
import Right from '../../../home/Img/right.png';
|
||||
|
||||
|
||||
function HeaderPageCCF(props) {
|
||||
const [projectList, setProjectList] = useState(undefined);
|
||||
const [personList, setPersonList] = useState(undefined);
|
||||
const [newsList, setNewsList] = useState(undefined);
|
||||
const [partnerList, setParterList] = useState(undefined);
|
||||
const { deptId, cateId } = props.match.params;
|
||||
const { data, id, temp } = props;
|
||||
const [mainList, setMainList] = useState(undefined);
|
||||
const [tag,setTag] = useState(0);
|
||||
const setting = {
|
||||
dots: true,
|
||||
infinite: true,
|
||||
speed: 2000,
|
||||
slidesToShow: 1,
|
||||
slidesToScroll: 1,
|
||||
pauseOnDotsHover: true,
|
||||
autoplaySpeed: 5000,
|
||||
pauseOnFocus: true,
|
||||
autoplay: true,
|
||||
arrows: true,
|
||||
prevArrow: <img className='slick-prev slick-arrow' src={Left} width="70px" alt="" />,
|
||||
nextArrow: <img className='slick-prev slick-arrow' src={Right} width="70px" alt="" />,
|
||||
afterChange: (index)=> setTag(index)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (id||cateId) {
|
||||
getProjectList();
|
||||
getNewsList();
|
||||
getPersonList();
|
||||
getPartnerList();
|
||||
getMainList();
|
||||
}
|
||||
}, [id,cateId])
|
||||
|
||||
function getPersonList() {
|
||||
// 不分类
|
||||
// getHomePageList(id).then(result => {
|
||||
// if (result) {
|
||||
// setPersonList(result.data.rows);
|
||||
// }
|
||||
// }).catch(error => { })
|
||||
// 分类获取首页推荐的会员列表
|
||||
getVIPLists(id, {isHomepage: 1}).then(response=>{
|
||||
if(response){
|
||||
const list = response.data.rows && response.data.rows.filter(item=>item.zoneMemberList);
|
||||
setPersonList(list);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getNewsList() {
|
||||
gethomePageDocList(id).then(result => {
|
||||
if (result) {
|
||||
setNewsList(result.data.rows);
|
||||
}
|
||||
}).catch(error => { })
|
||||
}
|
||||
|
||||
function getProjectList() {
|
||||
getAllList(id, { isHomepage: 1 }).then(result => {
|
||||
if (result) {
|
||||
setProjectList(result.data.rows);
|
||||
}
|
||||
}).catch(console.error())
|
||||
}
|
||||
|
||||
function getPartnerList() {
|
||||
const url = `${httpUrl}/zone/open/${id}/partners/list`;
|
||||
axios.get(url).then(result => {
|
||||
if (result) {
|
||||
const array = result.data.rows;
|
||||
const newArray = [];
|
||||
for (let i in array) {
|
||||
let e = array[i]
|
||||
if (e.zonePartnersList && e.zonePartnersList.length > 0) {
|
||||
e.zonePartnersList[0].typeName = e.typeName;
|
||||
}
|
||||
if (e.zonePartnersList.length > 0) {
|
||||
newArray.push(e.zonePartnersList);
|
||||
}
|
||||
}
|
||||
setParterList(newArray);
|
||||
}
|
||||
}).catch(error => { })
|
||||
}
|
||||
function getMainList() {
|
||||
getNewsAllList(id).then(result => {
|
||||
if (result) {
|
||||
let rows = result.data.rows;
|
||||
setMainList(rows);
|
||||
}
|
||||
}).catch(error => { })
|
||||
}
|
||||
return (
|
||||
<div className="zone_box pb100">
|
||||
{
|
||||
// 新闻动态
|
||||
data && data.cmsShow === 1 && newsList && newsList.length >= 0 &&
|
||||
<div className="zone_news zone_news_ccf">
|
||||
<p className="in_title mb50">{data.homepageCmsTitle}</p>
|
||||
<div className="boxmain mb100" style={{ display: "flex" }}>
|
||||
<div className="zone_new_first">
|
||||
<Slider {...setting}>
|
||||
{
|
||||
newsList && newsList.length > 0 ?
|
||||
newsList.map((i, k) => {
|
||||
return (
|
||||
<div className="regform" key={k}>
|
||||
<div className="newsBannerBox">
|
||||
<img src={i.headImg || img1} alt="" className='newsImg' onClick={()=>{window.location.href=`/zone/${deptId}/newdetail/${i.id}`}} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
:
|
||||
""
|
||||
}
|
||||
</Slider>
|
||||
</div>
|
||||
<ul className={`zone_new_three_ccf ${newsList.length < 4 ? "flexStart" : "spaceeTween"}`}>
|
||||
{
|
||||
newsList.map((i, k) => {
|
||||
return (
|
||||
<li key={k} style={{boxShadow:"0px 0px 20px rgba(35, 54, 185, 0.06)"}}>
|
||||
<Link className="zone_n_title" to={`/zone/${deptId}/newdetail/${i.id}`} style={{color:k===tag?"#466aff":""}} >{i.name}</Link>
|
||||
<p className="zone_n_value">
|
||||
<span className="font-15" style={{ color: "#8d95a3" }}>
|
||||
<img src={shijian} alt="" className="mr3 photo" />
|
||||
{i.publishTime}
|
||||
</span>
|
||||
<p className="font-15 flexCenter zone_btn" style={{ color: '#8d95a3' }} key={k} ><i className="iconfont icon-liulan font-15 lg ml7 mr5 lh26 icontianjiadaohangcolors" style={{ color: "#8d95a3" }} ></i>{i.visits}</p>
|
||||
</p>
|
||||
</li>
|
||||
)
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
{/* 图片下三个栏目 */}
|
||||
<div className="List">
|
||||
{
|
||||
mainList && mainList.length > 0 ?
|
||||
mainList.map((i, k) => {
|
||||
if (i.name === "开源业内资讯" || i.name === "开源战略工作组" || i.name === "开源活动")
|
||||
return (
|
||||
<ul className="mainlist radius4">
|
||||
<p className="font-17">
|
||||
<img src={xuexi} alt="" className="mr10"></img>
|
||||
{i.name}
|
||||
<Link to={`/zone/${deptId}/news/${i.id}`}><i className="iconfont icon-youhua font-12 lg lh26 icontianjiadaohangcolors you " ></i></Link></p>
|
||||
{
|
||||
i.cmsDocList && i.cmsDocList.length > 0 ?
|
||||
i.cmsDocList.map((j, k) => {
|
||||
return (
|
||||
<li key={k} className="task-hide font-14">
|
||||
<Link to={`/zone/${deptId}/newdetail/${j.id}`} className="mt10">{j.name}</Link>
|
||||
</li>
|
||||
)
|
||||
})
|
||||
: ""
|
||||
}
|
||||
</ul>
|
||||
)
|
||||
})
|
||||
:
|
||||
""
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
{
|
||||
// 精选项目
|
||||
data && data.projectShow === 1 && projectList && projectList.length > 0 &&
|
||||
<div className="zone_projects">
|
||||
<p className="in_title mb40">{data.homepageProjectTitle}</p>
|
||||
{
|
||||
<div className="boxmain zone_p_lists">
|
||||
{
|
||||
projectList.map((i, k) => {
|
||||
return (
|
||||
<li key={k}>
|
||||
<div className="imgBox">{i.projectProperties && i.projectProperties.authorImageUrl && <img src={i.projectProperties.authorImageUrl} alt="" />}</div>
|
||||
<div className="infosBox">
|
||||
<a onClick={() => window.open(i.projectURL)} className="z_p_title task-hide">{i.projectProperties && i.projectProperties.name}</a>
|
||||
<p className="z_p_desc task-hide-2">{i.projectProperties && i.projectProperties.description ? i.projectProperties.description : "暂无~"}</p>
|
||||
<div className="z_p_language">
|
||||
{
|
||||
i.projectProperties.topics &&
|
||||
<ul className="tag task-hide" key={k}>
|
||||
{
|
||||
i.projectProperties.topics.split(",").map(t => {
|
||||
return (
|
||||
<li className="tag_li">{t}</li>
|
||||
)
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
})
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
{data && <p className="in_title_a">{data.firstTitle}</p>}
|
||||
{
|
||||
// 专区简介
|
||||
data && (data.introductionTitle || data.introductionContent || data.introductionImage) &&
|
||||
<div className="boxmain zone_infos">
|
||||
<div className="zone_infos_desc">
|
||||
{data.introductionTitle && <p className="z_name">{data.introductionTitle}</p>}
|
||||
<p className="z_desc task-hide-2" style={{ WebkitLineClamp: data.introductionTitle ? "4" : "7" }} dangerouslySetInnerHTML={{ __html: data.introductionContent }} ></p>
|
||||
</div>
|
||||
{
|
||||
data.introductionImage &&
|
||||
<img src={data.introductionImage} alt="" width="300px" />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
{
|
||||
// 核心贡献者
|
||||
data && data.memberShow === 1 && personList && personList.length > 0 &&
|
||||
<div className={`zone_contributor boxmain ${temp}_VIP_box`}>
|
||||
<p className="in_title mb50">{data.homepageMemberTitle}</p>
|
||||
{/* <MemberList vipLists={personList} temp={temp}/> */}
|
||||
{personList && personList.map(item=>{
|
||||
return <div>
|
||||
<p className='font-18'>{item.typeName}</p>
|
||||
<ul className="boxmain zone_c_lists mt20">
|
||||
{
|
||||
item.zoneMemberList.map((i, k) => {
|
||||
return (
|
||||
<li key={k}>
|
||||
<Link to={`/${i.login}`}><img src={i.imageUrl} alt="" /></Link>
|
||||
<div className='mb10'>
|
||||
<span>{i.name}</span>
|
||||
{i.memberLevel && <span className="memberLevel_tag ml10">{i.memberLevel}</span> }
|
||||
</div>
|
||||
<p className="task-hide-2" style={{ display: i.introduction ? "" : "flex" }}>{i.introduction || "暂无~"}</p>
|
||||
</li>
|
||||
)
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
})}
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
// 合作伙伴
|
||||
data && data.partnersShow === 1 && partnerList && partnerList.length > 0 &&
|
||||
<div className="zone_parter">
|
||||
<p className="in_title">{data.homepagePartnersTitle}</p>
|
||||
<Partner id={id} partnerList={partnerList}></Partner>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default HeaderPageCCF;
|
|
@ -59,6 +59,11 @@ const HeaderPageCCF = Loadable({
|
|||
loading : Loading,
|
||||
});
|
||||
|
||||
const HeaderPageKyzx = Loadable({
|
||||
loader : () => import("./Pages/headerPagebyKyzx"),
|
||||
loading : Loading,
|
||||
});
|
||||
|
||||
const ProjectSource = Loadable({
|
||||
loader: () => import("./Pages/projectSource"),
|
||||
loading: Loading,
|
||||
|
@ -292,6 +297,7 @@ function Index(props){
|
|||
deptId==="CCF-ODC" ? <HeaderPageCCF {...props} {...p} data={data} id={id} temp={ temp } />:
|
||||
deptId === "JCC" ? <HomePageByJCC {...props} {...p} data={data} id={id}/>:
|
||||
deptId === "uos" ? <HomePageByUos {...props} {...p} data={data} id={id}/>:
|
||||
deptId==="xjykyzx" ? <HeaderPageKyzx {...props} {...p} data={data} id={id} temp={ temp } />:
|
||||
temp === tempEnum.zone ? <HeaderPage {...props} {...p} data={data} id={id} temp={ temp }/>:
|
||||
<HeaderPageZone1 {...props} {...p} data={data} id={id} temp={ temp }/>
|
||||
)}
|
||||
|
|
Loading…
Reference in New Issue