diff --git a/src/forge/Main/projecthome/Index.jsx b/src/forge/Main/projecthome/Index.jsx index 3d214010..3b56b455 100644 --- a/src/forge/Main/projecthome/Index.jsx +++ b/src/forge/Main/projecthome/Index.jsx @@ -4,18 +4,21 @@ import SubBanner from './SubBanner'; import SubUnitBanner from './SubUnitBanner'; import Icon from '../img/index/icon.png'; import { Link } from 'react-router-dom'; -import { Spin } from 'antd'; +import { Spin , Input } from 'antd'; import SubList from './SubList'; import more from '../img/index/more.png'; import axios from 'axios'; import { getImageUrl } from 'educoder'; import Nodata from '../../Nodata'; +const { Search } = Input; + const LIMIT = 20; function Index() { const [ cateList , setCateList ] = useState(undefined); const [ projectsList , setProjectsList ] = useState(undefined); + const [ search , setSearch ] = useState(undefined); const [ cateID, setCateID ] = useState(undefined); const [ isSpin, setIsSpin ] = useState(true); @@ -37,13 +40,14 @@ function Index() { }).catch(error=>{}) } - function getProject() { + function getProject(searchValue) { const url = `/projects.json`; axios.get(url,{ params:{ pinned:"d", category_id:cateID, - limit:LIMIT + limit:LIMIT, + search:searchValue } }).then(result=>{ if(result && result.data){ @@ -52,6 +56,15 @@ function Index() { } }).catch(error=>{}) } + + function changeSearchValue(e){ + setSearch(e.target.value); + } + + function searchFun(value){ + setIsSpin(true); + getProject(value); + } return(
@@ -74,6 +87,18 @@ function Index() {
开源项目 + + 更多
diff --git a/src/forge/Main/projecthome/Index.scss b/src/forge/Main/projecthome/Index.scss index 80742234..fd4b604e 100644 --- a/src/forge/Main/projecthome/Index.scss +++ b/src/forge/Main/projecthome/Index.scss @@ -350,7 +350,15 @@ justify-content: space-between; border-bottom: 1px solid rgba(153, 153, 153, 0.16); padding:0px 20px; - span{ + .ant-btn-primary{ + background-color: #466AFF; + border-color: #466AFF; + &:hover,&:active{ + background-color: rgba(70,106,255,0.8); + border-color: rgba(70,106,255,0.8); + } + } + &>span{ font-size: 18px; font-weight: 500; color: #000000;