diff --git a/src/forge/Main/projecthome/Index.jsx b/src/forge/Main/projecthome/Index.jsx index 3d2140103..3b56b455a 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(