分支issue

This commit is contained in:
谢思 2023-02-15 10:29:04 +08:00
parent 5cf16bc829
commit bbfa6fd1da
2 changed files with 17 additions and 4 deletions

View File

@ -21,6 +21,7 @@ function Index(props) {
const [newBranchName, setNewBranchName] = useState(undefined);
const [newFormBranchName, setNewFormBranchName] = useState(undefined);
const [newBranchError, setNewBranchError] = useState(undefined);
const [branchList, setBranchList] = useState([]);//
//
const [name, setName] = useState(undefined);
//
@ -259,14 +260,26 @@ function Index(props) {
setCurrent(page);
}
//
function addBranchBtn(){
setAddBranch(true);
const url = `/v1/${owner}/${projectsId}/branches.json`;
Axios.get(url).then(result=>{
if(result){
const {branches} = result.data;
setBranchList(branches);
}
}).catch(error=>{console.log('error', error);})
}
return(
<Spin spinning={isSpin}>
<div style={{paddingTop:"10px",minHeight:"400px",paddingBottom:"30px"}}>
<div className='branchListActionBox'>
<Input.Search placeholder='请输入分支名称' style={{width: '354px'}} className='searchBranch' onSearch={(value)=>{setName(value)}} allowClear/>
<Input.Search placeholder='请输入分支名称' style={{width: '354px'}} className='searchBranch' onSearch={(value)=>{setCurrent(1);setName(value)}} allowClear/>
<div>
{isManager && <Link to={`/${owner}/${projectsId}/settings/branches`} className="btn-83" style={{width: '102px'}}><i className="iconfont icon-xuanzhongjibenshezhiicon font-14 mr5"></i>分支设置</Link>}
<Button type='primary' onClick={()=>{setAddBranch(true);}}>+ 新建分支</Button>
<Button type='primary' onClick={addBranchBtn}>+ 新建分支</Button>
</div>
</div>
<Table
@ -376,7 +389,7 @@ function Index(props) {
<div className='newBranchError mt5'>{newBranchError}</div>
<div className='font-15 createBranchLabel mt20'>分支起点</div>
<Select showSearch style={{width: '340px'}} className='createBranchInput' defaultValue={list[0] && list[0].name} onChange={(value)=>{setNewFormBranchName(value)}} getPopupContainer={triggerNode => triggerNode.parentNode}>
{list && list.map((item, index)=>{
{branchList && branchList.map((item, index)=>{
return <Select.Option value={item.name} key={index}>{item.name}</Select.Option>
})}
</Select>

View File

@ -18,7 +18,7 @@ export default (props) => {
{item.type == 1 && <p>
<span className="search-icon"><i className="iconfont icon-dianjiliang mr3 font-12" />{item.watchersCount}</span>
<span className="search-icon"><i className="iconfont icon-kongxing mr3 font-16" />{item.praisesCount}</span>
<span className="search-icon"><i className="iconfont icon-fork mr3 font-16" />{item.forkedCount}</span>
<span className="search-icon"><i className="iconfont icon-fork mr3 font-16" />{item.forkedCount || 0}</span>
</p>}
</div >