定制专区访问路径优化
This commit is contained in:
parent
cc14ec2e21
commit
fbc0904eb3
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={
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -15,8 +15,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){
|
||||
|
|
@ -90,14 +89,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 +104,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">
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import liulan from '../img/liulan.png';
|
|||
import emptydata from '../../Images/nodata.png';
|
||||
import DefaultImg from '../Component/defaultImg';
|
||||
import { httpUrl } from '../fetch';
|
||||
import { tempConfig } from '../tempInfo';
|
||||
import { tempConfig, tempEnum } from '../tempInfo';
|
||||
|
||||
function Main(props){
|
||||
const [ key , setKey ] = useState("1");
|
||||
|
|
@ -22,14 +22,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();
|
||||
|
|
@ -50,7 +49,7 @@ function Main(props){
|
|||
if(result){
|
||||
let rows = result.data.rows;
|
||||
setMainList(rows);
|
||||
if (temp !== 'zone') {
|
||||
if (temp !== tempEnum.zone) {
|
||||
selectCate(rows[0].id)
|
||||
}
|
||||
setTimeout(() => {
|
||||
|
|
@ -71,7 +70,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);
|
||||
|
|
@ -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>
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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){
|
||||
|
|
@ -38,8 +38,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>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import Nodata from '../../Nodata';
|
|||
import axios from 'axios';
|
||||
import { httpUrl } from '../fetch';
|
||||
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){
|
||||
|
|
@ -84,7 +84,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 +166,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){
|
||||
|
|
@ -95,7 +94,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 +120,7 @@ function ZoneVIP(props){
|
|||
</ul>
|
||||
:
|
||||
(
|
||||
temp === 'zone1' ? <Nodata _html="暂无数据" img={ nodata }/> : <Nodata _html="暂无数据" />
|
||||
temp === tempEnum.zone1 ? <Nodata _html="暂无数据" img={ nodata }/> : <Nodata _html="暂无数据" />
|
||||
)
|
||||
}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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,29 @@ 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) {
|
||||
props.history.push('/nopage');
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
let data = result.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);
|
||||
|
|
@ -93,42 +102,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>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
export const tempEnum = {
|
||||
zone: 'zone',
|
||||
zone1: 'zone1'
|
||||
}
|
||||
export const tempConfig = {
|
||||
zone: {
|
||||
mainTitle: '领域资讯',
|
||||
|
|
|
|||
Loading…
Reference in New Issue