Merge pull request '定制专区访问路径优化以及相关bug修复' (#546) from Eeeros/forgeplus-react:cs_news into cs_news
This commit is contained in:
commit
f247ef8e68
10
src/App.js
10
src/App.js
|
|
@ -160,7 +160,7 @@ const Topic = Loadable({
|
|||
})
|
||||
|
||||
// 此处仅维护前端可能的一级路由,不用进行项目或者组织判断的字段。
|
||||
const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize", "login", "register", "resetPassword", "aboutus","educoder", "glcc","bindlogin", "softbot","zone","zone1"];
|
||||
const keyWord = ["explore", "settings", "setting", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email", "export", "nopage", "404", "403", "500", "501", "search", "organize", "login", "register", "resetPassword", "aboutus","educoder", "glcc","bindlogin", "softbot","zone"];
|
||||
|
||||
class App extends Component {
|
||||
constructor(props) {
|
||||
|
|
@ -388,14 +388,6 @@ class App extends Component {
|
|||
}
|
||||
}>
|
||||
</Route>
|
||||
<Route
|
||||
path={"/zone1/:deptId"}
|
||||
render={
|
||||
(props) => {
|
||||
return (<Information {...this.props} {...props} {...this.state} />)
|
||||
}
|
||||
}>
|
||||
</Route>
|
||||
<Route
|
||||
path={"/settings"}
|
||||
render={
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ function Contributor(props) {
|
|||
const [ showList, setShowList] = useState([]);
|
||||
|
||||
function initList() {
|
||||
if (personList.length !== 3) {
|
||||
if (personList.length % 3 !== 0) {
|
||||
setShowList([].concat(personList, new Array(personList.length % 3 - 1).fill({})))
|
||||
} else {
|
||||
setShowList( personList )
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ function Hot({list , title, deptId, temp}){
|
|||
return(
|
||||
<li>
|
||||
<span style={{opacity:k<3 ? `${1-((k+1)/10)}` :"0.3"}}>{k+1}</span>
|
||||
<Link to={`/${temp}/${deptId}/newdetail/${i.id}`}>{i.name}</Link>
|
||||
<Link to={`/zone/${deptId}/newdetail/${i.id}`}>{i.name}</Link>
|
||||
</li>
|
||||
)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -36,10 +36,11 @@ function MemberApply(props){
|
|||
width="650px"
|
||||
closable={false}
|
||||
destroyOnClose
|
||||
className="apply-modal"
|
||||
footer={
|
||||
<div className="flexCenterJustify">
|
||||
<Button className="mr20" type="default" onClick={onCancel}>取消</Button>
|
||||
<Button type="primary" onClick={onSure}>确定</Button>
|
||||
<Button className="mr20 cancel-button" type="default" onClick={onCancel}>取消</Button>
|
||||
<Button type="primary" className="sure-button" onClick={onSure}>确定</Button>
|
||||
</div>
|
||||
}
|
||||
centered
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ function PublicBanner(props){
|
|||
<div className="boxmain" style={{display:"flex"}}>
|
||||
<div className="zone_new_first">
|
||||
<img src={newsList[0].headImg || img1} alt="" height="302px" style={{width:"100%",objectFit:"cover"}} className="mb30"/>
|
||||
<Link to={`/${temp}/${deptId}/newdetail/${newsList[0].id}`} className="zone_n_title task-hide">{newsList[0].name}</Link>
|
||||
<Link to={`/zone/${deptId}/newdetail/${newsList[0].id}`} className="zone_n_title task-hide">{newsList[0].name}</Link>
|
||||
<p className="zone_n_desc task-hide-2">{newsList[0].summary}</p>
|
||||
<p className="font-13 mt10 flexCenter" style={{color:"#8d95a3"}}>
|
||||
<img src={shijian} alt="" className="mr3" />
|
||||
{newsList[0].publishTime}
|
||||
</p>
|
||||
<p className="mt15">
|
||||
<Link to={`/${temp}/${deptId}/newdetail/${newsList[0].id}`} className="color-blue flexCenter zone_btn">查看详情<img src={guideArrow} alt="" width="14px" className="ml3"/></Link>
|
||||
<Link to={`/zone/${deptId}/newdetail/${newsList[0].id}`} className="color-blue flexCenter zone_btn">查看详情<img src={guideArrow} alt="" width="14px" className="ml3"/></Link>
|
||||
</p>
|
||||
</div>
|
||||
<ul className={`zone_new_three ${newsList.length <4 ? "flexStart" : "spaceeTween"}`}>
|
||||
|
|
@ -29,14 +29,14 @@ function PublicBanner(props){
|
|||
newsList.map((i,k)=>{
|
||||
return(
|
||||
k > 0 && <li>
|
||||
<Link className="zone_n_title task-hide" to={`/${temp}/${deptId}/newdetail/${i.id}`}>{i.name}</Link>
|
||||
<Link className="zone_n_title task-hide" to={`/zone/${deptId}/newdetail/${i.id}`}>{i.name}</Link>
|
||||
<p className="zone_n_desc task-hide-2 mt10">{i.summary}</p>
|
||||
<p className="zone_n_value">
|
||||
<span className="font-13" style={{color:"#8d95a3"}}>
|
||||
<img src={shijian} alt="" className="mr3" />
|
||||
{i.publishTime}
|
||||
</span>
|
||||
<Link to={`/${temp}/${deptId}/newdetail/${i.id}`} className="color-blue flexCenter zone_btn">查看详情<img src={guideArrow} alt="" width="14px"/></Link>
|
||||
<Link to={`/zone/${deptId}/newdetail/${i.id}`} className="color-blue flexCenter zone_btn">查看详情<img src={guideArrow} alt="" width="14px"/></Link>
|
||||
</p>
|
||||
</li>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -10,9 +10,7 @@ function PublicBanner(props){
|
|||
const [ key , setKey ] = useState("1");
|
||||
const { deptId } = props.match.params;
|
||||
const { pathname } = props.history.location;
|
||||
const { data , adminUrl } = props;
|
||||
const temp = props.pathName
|
||||
|
||||
const { data , adminUrl, temp } = props;
|
||||
|
||||
useEffect(()=>{
|
||||
if(pathname){
|
||||
|
|
@ -20,7 +18,7 @@ function PublicBanner(props){
|
|||
const infodetail = /[A-Za-z0-9]{0,}\/newdetail/g;
|
||||
const project = /[A-Za-z0-9]{0,}\/projects/g;
|
||||
const vip = /[A-Za-z0-9]{0,}\/VIP/g;
|
||||
if(pathname === `/${temp}/${deptId}`){
|
||||
if(pathname === `/zone/${deptId}`){
|
||||
setKey("1");
|
||||
}
|
||||
else if(project.test(pathname)){
|
||||
|
|
@ -46,12 +44,12 @@ function PublicBanner(props){
|
|||
}
|
||||
<div className="bannerMenus">
|
||||
<Menu mode={"horizontal"} selectedKeys={[key]}>
|
||||
<Menu.Item key={"1"}><Link to={`/${temp}/${deptId}`}><img src={require(`../img/${temp}Menu1.png`)} alt="" width="29px"/>首页</Link></Menu.Item>
|
||||
<Menu.Item key={"2"}><Link to={`/${temp}/${deptId}/projects`}><img src={require(`../img/${temp}Menu2.png`)} alt="" width="34px"/>开源项目</Link></Menu.Item>
|
||||
<Menu.Item key={"1"}><Link to={`/zone/${deptId}`}><img src={require(`../img/${temp}Menu1.png`)} alt="" width="29px"/>首页</Link></Menu.Item>
|
||||
<Menu.Item key={"2"}><Link to={`/zone/${deptId}/projects`}><img src={require(`../img/${temp}Menu2.png`)} alt="" width="34px"/>开源项目</Link></Menu.Item>
|
||||
{/* <Menu.Item key={"3"}><img src={Menu3} alt="" width="33px"/>资源发布</Menu.Item> */}
|
||||
<Menu.Item key={"4"}><Link to={`/${temp}/${deptId}/news`}><img src={require(`../img/${temp}Menu4.png`)} alt="" width="32px"/>{ tempConfig[temp].mainTitle }</Link></Menu.Item>
|
||||
<Menu.Item key={"4"}><Link to={`/zone/${deptId}/news`}><img src={require(`../img/${temp}Menu4.png`)} alt="" width="32px"/>{ tempConfig[temp].mainTitle }</Link></Menu.Item>
|
||||
{/* <Menu.Item key={"5"}><img src={Menu5} alt="" width="27px"/>Sig小组</Menu.Item> */}
|
||||
<Menu.Item key={"6"}><Link to={`/${temp}/${deptId}/VIP`}><img src={require(`../img/${temp}Menu6.png`)} alt="" width="36px"/>{ tempConfig[temp].member }</Link></Menu.Item>
|
||||
<Menu.Item key={"6"}><Link to={`/zone/${deptId}/VIP`}><img src={require(`../img/${temp}Menu6.png`)} alt="" width="36px"/>{ tempConfig[temp].member }</Link></Menu.Item>
|
||||
{ adminUrl && <Menu.Item key={"7"}><a onClick={()=>{window.location.href=adminUrl}}><img src={require(`../img/${temp}Menu7.png`)} alt="" width="34px"/>后台管理</a></Menu.Item> }
|
||||
</Menu>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import React,{ useState, useEffect } from 'react';
|
||||
import img1 from '../img/img1.png';
|
||||
import img2 from '../img/img2.png';
|
||||
import { httpUrl } from '../fetch';
|
||||
import guideArrow from '../img/guideArrow.png';
|
||||
import { Link } from 'react-router-dom';
|
||||
import shijian from '../img/shijian.png';
|
||||
import { getHomePageList , gethomePageDocList , getAllList } from '../api';
|
||||
import axios from 'axios';
|
||||
import Nodata from '../../Nodata';
|
||||
import Partner from '../Component/partner';
|
||||
|
||||
function HeaderPage(props){
|
||||
|
|
@ -15,8 +14,7 @@ function HeaderPage(props){
|
|||
const [ newsList, setNewsList ] = useState(undefined);
|
||||
const [ partnerList, setParterList ] = useState(undefined);
|
||||
const { deptId } = props.match.params;
|
||||
const { data, id } = props;
|
||||
const temp = props.pathName
|
||||
const { data, id, temp } = props;
|
||||
|
||||
useEffect(()=>{
|
||||
if(id){
|
||||
|
|
@ -28,8 +26,7 @@ function HeaderPage(props){
|
|||
},[id])
|
||||
|
||||
function getPersonList(){
|
||||
const url = `${httpUrl}/zone/open/${id}/member/homePageList`;
|
||||
axios.get(url).then(result=>{
|
||||
getHomePageList(id).then(result=>{
|
||||
if(result){
|
||||
setPersonList(result.data.rows);
|
||||
}
|
||||
|
|
@ -37,8 +34,7 @@ function HeaderPage(props){
|
|||
}
|
||||
|
||||
function getNewsList(){
|
||||
const url = `${httpUrl}/cms/doc/open/zone/${id}/homePageDocList`;
|
||||
axios.get(url).then(result=>{
|
||||
gethomePageDocList(id).then(result=>{
|
||||
if(result){
|
||||
setNewsList(result.data.rows);
|
||||
}
|
||||
|
|
@ -46,10 +42,7 @@ function HeaderPage(props){
|
|||
}
|
||||
|
||||
function getProjectList(){
|
||||
const url = `${httpUrl}/zone/open/${id}/project/list`;
|
||||
axios.get(url,{params:{
|
||||
isHomepage:1
|
||||
}}).then(result=>{
|
||||
getAllList(id,{isHomepage:1}).then(result=>{
|
||||
if(result){
|
||||
setProjectList(result.data.rows);
|
||||
}
|
||||
|
|
@ -60,7 +53,6 @@ function HeaderPage(props){
|
|||
const url = `${httpUrl}/zone/open/${id}/partners/list`;
|
||||
axios.get(url).then(result=>{
|
||||
if(result){
|
||||
console.log(result)
|
||||
setParterList(result.data.rows);
|
||||
}
|
||||
}).catch(error=>{})
|
||||
|
|
@ -73,12 +65,12 @@ function HeaderPage(props){
|
|||
data && (data.introductionTitle || data.introductionContent || data.introductionImage) &&
|
||||
<div className="boxmain zone_infos">
|
||||
<div className="zone_infos_desc">
|
||||
<p className="z_name">{data.introductionTitle}</p>
|
||||
<p className="z_desc task-hide-2">{data.introductionContent}</p>
|
||||
{data.introductionTitle && <p className="z_name">{data.introductionTitle}</p>}
|
||||
<p className="z_desc task-hide-2" style={{WebkitLineClamp:data.introductionTitle?"4":"7"}}>{data.introductionContent}</p>
|
||||
</div>
|
||||
{
|
||||
data.introductionImage &&
|
||||
<img src={data.introductionImage} alt="" width="474px" height="277px"/>
|
||||
<img src={data.introductionImage} alt="" height="277px"/>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
|
@ -90,14 +82,14 @@ function HeaderPage(props){
|
|||
<div className="boxmain" style={{display:"flex"}}>
|
||||
<div className="zone_new_first">
|
||||
<img src={newsList[0].headImg || img1} alt="" height="302px" style={{width:"100%",objectFit:"cover"}} className="mb30"/>
|
||||
<Link to={`/${temp}/${deptId}/newdetail/${newsList[0].id}`} className="zone_n_title task-hide">{newsList[0].name}</Link>
|
||||
<Link to={`/zone/${deptId}/newdetail/${newsList[0].id}`} className="zone_n_title task-hide">{newsList[0].name}</Link>
|
||||
<p className="zone_n_desc task-hide-2">{newsList[0].summary}</p>
|
||||
<p className="font-13 mt10 flexCenter" style={{color:"#8d95a3"}}>
|
||||
<img src={shijian} alt="" className="mr3" />
|
||||
{newsList[0].publishTime}
|
||||
</p>
|
||||
<p className="mt15">
|
||||
<Link to={`/${temp}/${deptId}/newdetail/${newsList[0].id}`} className="color-blue flexCenter zone_btn">查看详情<img src={guideArrow} alt="" width="14px" className="ml3"/></Link>
|
||||
<Link to={`/zone/${deptId}/newdetail/${newsList[0].id}`} className="color-blue flexCenter zone_btn">查看详情<img src={guideArrow} alt="" width="14px" className="ml3"/></Link>
|
||||
</p>
|
||||
</div>
|
||||
<ul className={`zone_new_three ${newsList.length <4 ? "flexStart" : "spaceeTween"}`}>
|
||||
|
|
@ -105,14 +97,14 @@ function HeaderPage(props){
|
|||
newsList.map((i,k)=>{
|
||||
return(
|
||||
k > 0 && <li key={ k }>
|
||||
<Link className="zone_n_title task-hide" to={`/${temp}/${deptId}/newdetail/${i.id}`}>{i.name}</Link>
|
||||
<Link className="zone_n_title task-hide" to={`/zone/${deptId}/newdetail/${i.id}`}>{i.name}</Link>
|
||||
<p className="zone_n_desc task-hide-2 mt10">{i.summary}</p>
|
||||
<p className="zone_n_value">
|
||||
<span className="font-13" style={{color:"#8d95a3"}}>
|
||||
<img src={shijian} alt="" className="mr3" />
|
||||
{i.publishTime}
|
||||
</span>
|
||||
<Link to={`/${temp}/${deptId}/newdetail/${i.id}`} className="color-blue flexCenter zone_btn">查看详情<img src={guideArrow} alt="" width="14px"/></Link>
|
||||
<Link to={`/zone/${deptId}/newdetail/${i.id}`} className="color-blue flexCenter zone_btn">查看详情<img src={guideArrow} alt="" width="14px"/></Link>
|
||||
</p>
|
||||
</li>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -29,8 +29,7 @@ function HeaderPage(props){
|
|||
const [ newsList, setNewsList ] = useState(undefined);
|
||||
const [ partnerList, setParterList ] = useState(undefined);
|
||||
const { deptId } = props.match.params;
|
||||
const { data, id } = props;
|
||||
const temp = props.pathName
|
||||
const { data, id, temp } = props;
|
||||
|
||||
const vision = [
|
||||
{imageUrl: vision0, title: '促进技术创新和应用', content: '通过开源硬件社区的建设,可以让更多的人参与到硬件开发中来,激发大众的创造力和创新精神,从而推动硬件领域的技术创新和实际应用。'},
|
||||
|
|
@ -154,7 +153,7 @@ function HeaderPage(props){
|
|||
<div className="zone_new_first">
|
||||
<p className="task-hide">
|
||||
<span className="item_index">1</span>
|
||||
<Link to={`/${temp}/${deptId}/newdetail/${newsList[0].id}`} className="new_first_title task-hide">{newsList[0].name}</Link>
|
||||
<Link to={`/zone/${deptId}/newdetail/${newsList[0].id}`} className="new_first_title task-hide">{newsList[0].name}</Link>
|
||||
</p>
|
||||
<p className="new_first_desc mt20 task-hide-2">{newsList[0].summary}</p>
|
||||
<p className="font-13 zone_n_value mt20" style={{color:"#8d95a3"}}>
|
||||
|
|
@ -162,7 +161,7 @@ function HeaderPage(props){
|
|||
<img src={shijian} alt="" className="mr3" />
|
||||
{newsList[0].publishTime}
|
||||
</span>
|
||||
<Link to={`/${temp}/${deptId}/newdetail/${newsList[0].id}`} className="zone_btn">查看更多<img src={guideArrow} alt="" width="14px" className="ml3"/></Link>
|
||||
<Link to={`/zone/${deptId}/newdetail/${newsList[0].id}`} className="zone_btn">查看更多<img src={guideArrow} alt="" width="14px" className="ml3"/></Link>
|
||||
</p>
|
||||
</div>
|
||||
<ul className="zone_new_three">
|
||||
|
|
@ -170,11 +169,11 @@ function HeaderPage(props){
|
|||
newsList.map((i,k)=>{
|
||||
return(
|
||||
k > 0 &&
|
||||
<Link to={`/${temp}/${deptId}/newdetail/${i.id}`}>
|
||||
<Link to={`/zone/${deptId}/newdetail/${i.id}`}>
|
||||
<li className="new_item">
|
||||
<p className="task-hide">
|
||||
<span className="item_index">{k + 1}</span>
|
||||
<Link className="zone_n_title" to={`/${temp}/${deptId}/newdetail/${i.id}`}>{i.name}</Link>
|
||||
<Link className="zone_n_title" to={`/zone/${deptId}/newdetail/${i.id}`}>{i.name}</Link>
|
||||
</p>
|
||||
<p className="zone_n_desc task-hide-2">{i.summary}</p>
|
||||
<p className="zone_n_value">
|
||||
|
|
|
|||
|
|
@ -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 ?
|
||||
<Menu mode={"horizontal"} id="menus" selectedKeys={[cateId||"0"]} style={{justifyContent:menuH?"flex-start":"center"}}>
|
||||
<Menu.Item key={"0"}><Link to={`/${temp}/${deptId}/news`}>全部</Link></Menu.Item>
|
||||
<Menu.Item key={"0"}><Link to={`/zone/${deptId}/news`}>全部</Link></Menu.Item>
|
||||
{
|
||||
mainList.map((i,k)=>{
|
||||
return(
|
||||
<Menu.Item key={`${i.id}`}><Link to={`/${temp}/${deptId}/news/${i.id}`}>{i.name}</Link></Menu.Item>
|
||||
<Menu.Item key={`${i.id}`}><Link to={`/zone/${deptId}/news/${i.id}`}>{i.name}</Link></Menu.Item>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import liulan from '../img/liulan.png';
|
|||
import RenderHtml from '../../../components/render-html';
|
||||
import { Base64 } from 'js-base64';
|
||||
import axios from 'axios';
|
||||
import { httpUrl } from '../fetch';
|
||||
import { getNewsDetail } from '../api';
|
||||
import { tempConfig } from '../tempInfo';
|
||||
|
||||
function NewsDetail(props){
|
||||
|
|
@ -12,7 +12,7 @@ function NewsDetail(props){
|
|||
const [ detail , setDetail ] = useState(undefined);
|
||||
const [ cmsDir , setCmsDir ] = useState(undefined);
|
||||
const [ content , setContent]=useState(undefined);
|
||||
const temp = props.pathName
|
||||
const temp = props.temp
|
||||
|
||||
useEffect(()=>{
|
||||
if(id){
|
||||
|
|
@ -22,8 +22,7 @@ function NewsDetail(props){
|
|||
},[id])
|
||||
|
||||
function getDetails(){
|
||||
const url = `${httpUrl}/cms/doc/open/${id}`;
|
||||
axios.get(url).then(result=>{
|
||||
getNewsDetail(id).then(result=>{
|
||||
if(result){
|
||||
let data = result.data.data;
|
||||
setDetail(data);
|
||||
|
|
@ -38,8 +37,8 @@ function NewsDetail(props){
|
|||
detail &&
|
||||
<div style={{width:'1200px',margin:"0px auto",padding:"30px 0px"}}>
|
||||
<Breadcrumb separator=">">
|
||||
<Breadcrumb.Item href={`/${temp}/${deptId}/news`}>{tempConfig[temp].mainTitle}</Breadcrumb.Item>
|
||||
{ cmsDir && <Breadcrumb.Item href={`/${temp}/${deptId}/news/${cmsDir.id}`}>{cmsDir.name}</Breadcrumb.Item> }
|
||||
<Breadcrumb.Item href={`/zone/${deptId}/news`}>{tempConfig[temp].mainTitle}</Breadcrumb.Item>
|
||||
{ cmsDir && <Breadcrumb.Item href={`/zone/${deptId}/news/${cmsDir.id}`}>{cmsDir.name}</Breadcrumb.Item> }
|
||||
<Breadcrumb.Item>正文</Breadcrumb.Item>
|
||||
</Breadcrumb>
|
||||
<div className="info_text">
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import emptydata from '../../Images/nodata.png';
|
|||
import nodata from '../img/nodata.png';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { httpUrl } from '../fetch';
|
||||
import { tempEnum } from '../tempInfo';
|
||||
|
||||
function NewsList(props){
|
||||
const { deptId , cateId } = props.match.params;
|
||||
|
|
@ -22,8 +23,7 @@ function NewsList(props){
|
|||
const [ mainList , setMainList ] = useState(undefined);
|
||||
const [ details , setDetails ] = useState(undefined);
|
||||
const [ menuSpin , setMenuSpin ] = useState(true);
|
||||
const { id } = props;
|
||||
const temp = props.pathName
|
||||
const { id, temp } = props;
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
@ -121,7 +121,7 @@ function NewsList(props){
|
|||
mainList && mainList.length>0 &&
|
||||
mainList.map((i,k)=>{
|
||||
return(
|
||||
<div className="main_card_item" onClick={()=>{props.history.push(`/${temp}/${deptId}/newdetail/${i.id}`)}} key={k}>
|
||||
<div className="main_card_item" onClick={()=>{props.history.push(`/zone/${deptId}/newdetail/${i.id}`)}} key={k}>
|
||||
{
|
||||
i.headImg ?
|
||||
<img src={i.headImg} alt=""/>
|
||||
|
|
@ -129,7 +129,7 @@ function NewsList(props){
|
|||
<DefaultImg name="GitLink" title={details && details.name} />
|
||||
}
|
||||
<div style={{flex:1,width:0}}>
|
||||
<Link to={`/${temp}/${deptId}/newdetail/${i.id}`} className={`sub_name task-hide`}>{i.name}</Link>
|
||||
<Link to={`/zone/${deptId}/newdetail/${i.id}`} className={`sub_name task-hide`}>{i.name}</Link>
|
||||
<p className={`sub_desc task-hide-2`}>
|
||||
{i.summary}
|
||||
</p>
|
||||
|
|
@ -145,7 +145,7 @@ function NewsList(props){
|
|||
{
|
||||
mainList && mainList.length === 0 &&
|
||||
<div style={{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",height:500}}>
|
||||
<img src={ temp === 'zone1' ? nodata : emptydata } alt="" width="300"/>
|
||||
<img src={ temp === tempEnum.zone1 ? nodata : emptydata } alt="" width="300"/>
|
||||
<p className="font-15 color-grey-6 mt20">暂无数据~</p>
|
||||
</div>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@ import { Input , Menu , Pagination , Spin } from 'antd';
|
|||
import { Link } from 'react-router-dom';
|
||||
import Nodata from '../../Nodata';
|
||||
import axios from 'axios';
|
||||
import { httpUrl } from '../fetch';
|
||||
import { getProjectsLists , getProjectsTypeLists } from '../api';
|
||||
import nodata from '../img/nodata.png';
|
||||
import { tempEnum } from '../tempInfo';
|
||||
|
||||
const { Search } = Input;
|
||||
|
||||
|
|
@ -21,8 +22,7 @@ function ProjectSource(props){
|
|||
const [ searchName , setSearchName ] = useState(undefined);
|
||||
const [ value , setValue ] = useState(undefined);
|
||||
const [ loading , setLoading ] = useState(false);
|
||||
const { id } = props;
|
||||
const temp = props.pathName
|
||||
const { id, temp } = props;
|
||||
|
||||
useEffect(()=>{
|
||||
if(id){
|
||||
|
|
@ -38,14 +38,11 @@ function ProjectSource(props){
|
|||
},[id,typeId,page,searchName])
|
||||
|
||||
function getLists(){
|
||||
const url = `${httpUrl}/zone/open/${id}/project/list`;
|
||||
axios.get(url,{
|
||||
params:{
|
||||
pageNum:page,
|
||||
name:searchName,
|
||||
pageSize,
|
||||
projectTypeId:typeId===0?undefined:typeId
|
||||
}
|
||||
getProjectsLists(id,{
|
||||
pageNum:page,
|
||||
name:searchName,
|
||||
pageSize,
|
||||
projectTypeId:typeId===0?undefined:typeId
|
||||
}).then(result=>{
|
||||
if(result){
|
||||
setLists(result.data.rows);
|
||||
|
|
@ -57,8 +54,7 @@ function ProjectSource(props){
|
|||
|
||||
|
||||
function getTypeList(){
|
||||
const url = `${httpUrl}/zone/open/${id}/projectType/list`;
|
||||
axios.get(url).then(result=>{
|
||||
getProjectsTypeLists(id).then(result=>{
|
||||
if(result){
|
||||
setTypeList(result.data.rows);
|
||||
}
|
||||
|
|
@ -84,7 +80,7 @@ function ProjectSource(props){
|
|||
{/* <Banner {...props}/> */}
|
||||
<div className="boxmain" style={{paddingTop:"56px"}}>
|
||||
<p className="in_title">开源项目</p>
|
||||
{ temp === 'zone1' && <p className="project_sub_title">聚合开源特色项目,搭建硬件开源服务桥梁</p> }
|
||||
{ temp === tempEnum.zone1 && <p className="project_sub_title">聚合开源特色项目,搭建硬件开源服务桥梁</p> }
|
||||
<Box>
|
||||
<ul className="in_pro_menu">
|
||||
<li className="u_t"><i className="iconfont icon-muluicon font-15 mr10 mt2" style={{color:"#1f2329"}} />项目分类</li>
|
||||
|
|
@ -166,7 +162,7 @@ function ProjectSource(props){
|
|||
:""
|
||||
}
|
||||
{
|
||||
lists && lists.length === 0 && (temp === 'zone1' ? <Nodata _html="暂无数据" img={ nodata }/> : <Nodata _html="暂无数据" />)
|
||||
lists && lists.length === 0 && (temp === tempEnum.zone1 ? <Nodata _html="暂无数据" img={ nodata }/> : <Nodata _html="暂无数据" />)
|
||||
}
|
||||
</div>
|
||||
</Spin>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import Crown from '../img/crown.png';
|
|||
import Nodata from '../../Nodata';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Spin, Button, Icon } from 'antd';
|
||||
import { tempConfig } from '../tempInfo'
|
||||
import { tempConfig, tempEnum } from '../tempInfo'
|
||||
import MemberApply from '../Component/memberApply';
|
||||
import { getVIPLists, getAuditStatus, applyJoin } from '../api';
|
||||
import nodata from '../img/nodata.png';
|
||||
|
|
@ -22,8 +22,7 @@ function ZoneVIP(props){
|
|||
const [ isSpin , setIsSpin ] = useState(true);
|
||||
const [ applyVisible , setApplyVisible ] = useState(false);
|
||||
const [ memberStatus , setMemberStatus] = useState(memberStatusEnum.notMember);
|
||||
const { id, showNotification, checkIfLogin, showLoginDialog } = props;
|
||||
const temp = props.pathName
|
||||
const { id, showNotification, checkIfLogin, showLoginDialog, temp } = props;
|
||||
|
||||
useEffect(()=>{
|
||||
if(id){
|
||||
|
|
@ -36,7 +35,7 @@ function ZoneVIP(props){
|
|||
function getLists(){
|
||||
getVIPLists(id).then(response=>{
|
||||
if(response){
|
||||
setVIPLists(response.rows);
|
||||
setVIPLists(response.data.rows);
|
||||
setIsSpin(false);
|
||||
}
|
||||
}).catch(error=>{setIsSpin(false);})
|
||||
|
|
@ -44,8 +43,9 @@ function ZoneVIP(props){
|
|||
|
||||
function getMemberStatus() {
|
||||
getAuditStatus(id).then(res => {
|
||||
if (res && res.code === 200) {
|
||||
setMemberStatus(res.data)
|
||||
console.log(res)
|
||||
if (res && res.data && res.data.code === 200) {
|
||||
setMemberStatus(res.data.data)
|
||||
} else {
|
||||
setMemberStatus(memberStatusEnum.notMember)
|
||||
}
|
||||
|
|
@ -54,10 +54,10 @@ function ZoneVIP(props){
|
|||
|
||||
function onOk(e) {
|
||||
applyJoin(id, e).then(res => {
|
||||
if (res) {
|
||||
showNotification(res.msg)
|
||||
if (res && res.data) {
|
||||
showNotification(res.data.msg)
|
||||
setApplyVisible(!applyVisible)
|
||||
if (res.code === 200) {
|
||||
if (res.data.code === 200) {
|
||||
setMemberStatus(memberStatusEnum.applying)
|
||||
}
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ function ZoneVIP(props){
|
|||
<div>
|
||||
{i.typeName}
|
||||
</div>
|
||||
{ temp === 'zone1' && <div className="linear_gradient">{i.typeName}</div> }
|
||||
{ temp === tempEnum.zone1 && <div className="linear_gradient">{i.typeName}</div> }
|
||||
</div>
|
||||
</div>
|
||||
<p className="card_desc">{i.typeIntroduction}</p>
|
||||
|
|
@ -121,7 +121,7 @@ function ZoneVIP(props){
|
|||
</ul>
|
||||
:
|
||||
(
|
||||
temp === 'zone1' ? <Nodata _html="暂无数据" img={ nodata }/> : <Nodata _html="暂无数据" />
|
||||
temp === tempEnum.zone1 ? <Nodata _html="暂无数据" img={ nodata }/> : <Nodata _html="暂无数据" />
|
||||
)
|
||||
}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,44 @@
|
|||
import javaFetch from '../javaFetch';
|
||||
import axios from 'axios';
|
||||
import { message , notification } from 'antd';
|
||||
|
||||
function beforeFetch(actionUrl){
|
||||
if (window.location.href.indexOf('localhost') < 0) {
|
||||
axios.defaults.withCredentials = true;
|
||||
}
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: actionUrl,
|
||||
timeout: 1800000, // 请求超时时间
|
||||
});
|
||||
|
||||
service.interceptors.response.use(
|
||||
response => {
|
||||
const res = response||{};
|
||||
if(res && res.data && res.data.code === 404){
|
||||
message.error("错误链接!");
|
||||
window.location.href = '/nopage';
|
||||
return Promise.reject('error');
|
||||
}else if(res && res.data && res.data.code === 500){
|
||||
message.error(res.data.msg);
|
||||
return Promise.reject('error');
|
||||
}else{
|
||||
return response;
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
// notification.open({
|
||||
// message: "提示",
|
||||
// description: error.message,
|
||||
// });
|
||||
// return Promise.reject(error);
|
||||
}
|
||||
)
|
||||
return service;
|
||||
}
|
||||
let settings = localStorage.chromesetting&&JSON.parse(localStorage.chromesetting);
|
||||
let actionUrl = settings && settings.common.zone +"/api";
|
||||
let actionUrl = settings && settings.common.zone +'/api';
|
||||
|
||||
|
||||
const service = javaFetch(actionUrl);
|
||||
const service = beforeFetch(actionUrl);
|
||||
export const httpUrl = actionUrl;
|
||||
// export const main_site_url = settings && settings.common.main_site_url
|
||||
export default service;
|
||||
|
|
@ -13,6 +13,7 @@ import PublicBanner from "./Component/publicBanner";
|
|||
import './index.scss';
|
||||
import "slick-carousel/slick/slick.css";
|
||||
import "slick-carousel/slick/slick-theme.css";
|
||||
import { tempEnum } from "./tempInfo";
|
||||
|
||||
const VIP = Loadable({
|
||||
loader: () => import("./Pages/zoneVIP"),
|
||||
|
|
@ -51,7 +52,7 @@ function Index(props){
|
|||
const [ adminUrl , setAdminUrl ] = useState(undefined);
|
||||
const { deptId } = props.match.params;
|
||||
const [ id , setId ] = useState(undefined);
|
||||
const temp = props.pathName
|
||||
const [ temp , setTemp ] = useState(tempEnum.zone);
|
||||
|
||||
useEffect(()=>{
|
||||
if(deptId){
|
||||
|
|
@ -59,21 +60,28 @@ function Index(props){
|
|||
}
|
||||
},[deptId])
|
||||
|
||||
useEffect(() => {
|
||||
setTheme()
|
||||
}, [temp])
|
||||
|
||||
function setTheme() {
|
||||
document.getElementsByTagName("html")[0].dataset.theme = temp;
|
||||
}
|
||||
setTheme()
|
||||
|
||||
function getDetail(){
|
||||
getMainInfos(deptId, { template: temp }).then(result=>{
|
||||
getMainInfos(deptId).then(result=>{
|
||||
if(result){
|
||||
if (result.code === 404) {
|
||||
if (result.data.code === 404) {
|
||||
props.history.push('/nopage');
|
||||
return
|
||||
}
|
||||
let data = result.data;
|
||||
let data = result.data.data;
|
||||
if (data.template) {
|
||||
setTemp( data.template )
|
||||
}
|
||||
setData(data);
|
||||
document.title= data&& data.name;
|
||||
document.title= data && data.name;
|
||||
setId(data.id);
|
||||
if(data.id){
|
||||
getAdminUrl(data.id);
|
||||
|
|
@ -84,7 +92,7 @@ function Index(props){
|
|||
|
||||
function getAdminUrl(id){
|
||||
getCheckZoneRole(id).then(response=>{
|
||||
if(response){
|
||||
if(response && response.data.code === 200){
|
||||
setAdminUrl(response.data);
|
||||
}else{
|
||||
setAdminUrl(undefined);
|
||||
|
|
@ -93,42 +101,42 @@ function Index(props){
|
|||
}
|
||||
return(
|
||||
<div className="information_main">
|
||||
<PublicBanner {...props} data={data} adminUrl={adminUrl}/>
|
||||
{ id && <PublicBanner {...props} data={data} temp={ temp } adminUrl={adminUrl}/> }
|
||||
<Switch>
|
||||
<Route
|
||||
path="/:temp/:deptId/news/:cateId"
|
||||
path="/zone/:deptId/news/:cateId"
|
||||
render={(p) => (
|
||||
<Main {...props} {...p} id={id}/>
|
||||
<Main {...props} {...p} id={id} temp={ temp }/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/:temp/:deptId/newdetail/:id"
|
||||
path="/zone/:deptId/newdetail/:id"
|
||||
render={(p) => (
|
||||
<NewsDetail {...props} {...p} id={id}/>
|
||||
<NewsDetail {...props} {...p} id={id} temp={ temp }/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/:temp/:deptId/VIP"
|
||||
path="/zone/:deptId/VIP"
|
||||
render={(p) => (
|
||||
<VIP {...props} {...p} id={id}/>
|
||||
<VIP {...props} {...p} id={id} temp={ temp }/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/:temp/:deptId/projects"
|
||||
path="/zone/:deptId/projects"
|
||||
render={(p) => (
|
||||
<ProjectSource {...props} {...p} id={id}/>
|
||||
<ProjectSource {...props} {...p} id={id} temp={ temp }/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/:temp/:deptId/news"
|
||||
path="/zone/:deptId/news"
|
||||
render={(p) => (
|
||||
<Main {...props} {...p} id={id}/>
|
||||
<Main {...props} {...p} id={id} temp={ temp }/>
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/:temp/:deptId"
|
||||
path="/zone/:deptId"
|
||||
render={(p) => (
|
||||
temp === 'zone' ? <HeaderPage {...props} {...p} data={data} id={id}/> : <HeaderPageZone1 {...props} {...p} data={data} id={id}/>
|
||||
temp === tempEnum.zone ? <HeaderPage {...props} {...p} data={data} id={id} temp={ temp }/> : <HeaderPageZone1 {...props} {...p} data={data} id={id} temp={ temp }/>
|
||||
)}
|
||||
></Route>
|
||||
</Switch>
|
||||
|
|
|
|||
|
|
@ -648,7 +648,7 @@
|
|||
padding:27px 24px;
|
||||
&>img{
|
||||
border-radius: 4px;
|
||||
object-fit: cover;
|
||||
object-fit: contain;
|
||||
}
|
||||
.zone_infos_desc{
|
||||
padding:0px 34px 0px 10px;
|
||||
|
|
@ -774,15 +774,15 @@
|
|||
margin-right: 0px!important;
|
||||
}
|
||||
.imgBox{
|
||||
background-color: #E3E7F3;
|
||||
border-radius: 8px;
|
||||
// background-color: #E3E7F3;
|
||||
border-radius: 50%;
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
margin-right: 14px;
|
||||
img{
|
||||
width: 75px;
|
||||
height: 75px;
|
||||
border-radius: 8px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
.infosBox{
|
||||
|
|
@ -1049,6 +1049,12 @@
|
|||
margin: 25px 25px 25px 0;
|
||||
border-radius: 12px;
|
||||
}
|
||||
.informations_detail.markdown-body{
|
||||
&>p{
|
||||
line-height: 32px;
|
||||
margin-bottom: 8px!important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.zone_parter{
|
||||
background-color: #fff;
|
||||
|
|
@ -1097,4 +1103,19 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.apply-modal {
|
||||
.sure-button {
|
||||
background-color: var(--primary-color);
|
||||
border-color: var(--primary-color);
|
||||
&:hover {
|
||||
background-color: var(--light-color);
|
||||
}
|
||||
}
|
||||
.cancel-button {
|
||||
&:hover {
|
||||
color: var(--primary-color);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
padding:27px 24px;
|
||||
&>img{
|
||||
border-radius: 4px;
|
||||
object-fit: cover;
|
||||
object-fit: contain;
|
||||
}
|
||||
.zone_infos_desc{
|
||||
padding:0px 34px 0px 10px;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
export const tempEnum = {
|
||||
zone: 'zone',
|
||||
zone1: 'zone1'
|
||||
}
|
||||
export const tempConfig = {
|
||||
zone: {
|
||||
mainTitle: '领域资讯',
|
||||
|
|
|
|||
Loading…
Reference in New Issue