diff --git a/src/App.js b/src/App.js index 094104ca6..7fa85f83f 100644 --- a/src/App.js +++ b/src/App.js @@ -323,7 +323,6 @@ class App extends Component { render() { const { pathType, pathName, mygetHelmetapi } = this.state; - console.log("dsf:",pathName); return ( diff --git a/src/home/TopEdition.jsx b/src/home/TopEdition.jsx index be243dd51..bb19619d7 100644 --- a/src/home/TopEdition.jsx +++ b/src/home/TopEdition.jsx @@ -26,27 +26,29 @@ function TopEdition({register,current_user}) { const [ bannerList , setBannerList ] = useState(undefined); useEffect(()=>{ - // getBanner(); - let list = [ - { - id: 1, - image: xingBanner1, - title: "星云协同开发", - url: "" - } - ] - setBannerList(list); + getBanner(); },[]) function getBanner() { const url = `/topics.json?topic_type=banner`; axios.get(url,{ params:{ - limit:5 + limit:1 } }).then(result=>{ if(result){ - setBannerList(result.data.topics); + let topic = result.data.topics; + let list = [ + { + id:"1", + image:xingBanner1, + local:true, + title:"CCF开源创新平台", + url:"" + } + ] + const data= topic && topic.length>0?topic:list; + setBannerList(data); } }).catch(error=>{}) } @@ -57,9 +59,9 @@ function TopEdition({register,current_user}) { bannerList.map((i,k)=>{ return(
- {/* style={{backgroundImage:`url(${getImageUrl(i.image)})`}} */} -
{if(i.url){window.location.href=i.url}}} style={{cursor: i.url ? 'pointer' : ''}}> - + {/* onClick={()=>{if(i.url){window.location.href=i.url}}} */} +
+ {/* { k +1 === bannerList.length && (!(current_user && current_user.login)) ?

立即注册