mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-09 05:00:30 +08:00
fix: 修复接口全部删除后添加按钮也消失了
This commit is contained in:
parent
3223184a53
commit
4441dc4a8f
@ -79,6 +79,7 @@ class Interface extends Component {
|
||||
render() {
|
||||
const { action } = this.props.match.params;
|
||||
const activeKey = action === 'api' ? 'api' : 'colOrCase';
|
||||
// console.log(matchPath(this.props.location.pathname, contentRouter));
|
||||
return <div className="web-content g-row" style={{ marginBottom: "15px" }}>
|
||||
<Row gutter={16} >
|
||||
<Col span={6}>
|
||||
|
@ -14,7 +14,9 @@ const TreeNode = Tree.TreeNode;
|
||||
|
||||
|
||||
@connect(
|
||||
|
||||
state => {
|
||||
|
||||
return {
|
||||
list: state.inter.list,
|
||||
inter: state.inter.curdata,
|
||||
@ -213,8 +215,38 @@ class InterfaceMenu extends Component {
|
||||
render() {
|
||||
const matchParams = this.props.match.params;
|
||||
let menuList = this.props.list;
|
||||
const searchBox = <div className="interface-filter">
|
||||
<Input onChange={this.onFilter} value={this.state.filter} placeholder="Filter by name" style={{ width: "70%" }} />
|
||||
<Tag color="#108ee9" onClick={() => this.changeModal('add_cat_modal_visible', true)} style={{ marginLeft: "15px" }} ><Icon type="plus" /></Tag>
|
||||
<Modal
|
||||
title="添加接口"
|
||||
visible={this.state.visible}
|
||||
onCancel={() => this.changeModal('visible', false)}
|
||||
footer={null}
|
||||
>
|
||||
<AddInterfaceForm catdata={this.props.curProject.cat} catid={this.state.curCatid} onCancel={() => this.changeModal('visible', false)} onSubmit={this.handleAddInterface} />
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title="添加分类"
|
||||
visible={this.state.add_cat_modal_visible}
|
||||
onCancel={() => this.changeModal('add_cat_modal_visible', false)}
|
||||
footer={null}
|
||||
>
|
||||
<AddInterfaceCatForm onCancel={() => this.changeModal('add_cat_modal_visible', false)} onSubmit={this.handleAddInterfaceCat} />
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title="修改分类"
|
||||
visible={this.state.change_cat_modal_visible}
|
||||
onCancel={() => this.changeModal('change_cat_modal_visible', false)}
|
||||
footer={null}
|
||||
>
|
||||
<AddInterfaceCatForm catdata={this.state.curCatdata} onCancel={() => this.changeModal('change_cat_modal_visible', false)} onSubmit={this.handleChangeInterfaceCat} />
|
||||
</Modal>
|
||||
</div>
|
||||
if(menuList.length === 0){
|
||||
return null;
|
||||
return searchBox;
|
||||
}
|
||||
const defaultExpandedKeys = () => {
|
||||
const { router, inter, list } = this.props, rNull = { expands: [], selects: [] };
|
||||
@ -307,36 +339,7 @@ class InterfaceMenu extends Component {
|
||||
}
|
||||
}
|
||||
return <div>
|
||||
<div className="interface-filter">
|
||||
<Input onChange={this.onFilter} value={this.state.filter} placeholder="Filter by name" style={{ width: "70%" }} />
|
||||
<Tag color="#108ee9" onClick={() => this.changeModal('add_cat_modal_visible', true)} style={{ marginLeft: "15px" }} ><Icon type="plus" /></Tag>
|
||||
<Modal
|
||||
title="添加接口"
|
||||
visible={this.state.visible}
|
||||
onCancel={() => this.changeModal('visible', false)}
|
||||
footer={null}
|
||||
>
|
||||
<AddInterfaceForm catdata={this.props.curProject.cat} catid={this.state.curCatid} onCancel={() => this.changeModal('visible', false)} onSubmit={this.handleAddInterface} />
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title="添加分类"
|
||||
visible={this.state.add_cat_modal_visible}
|
||||
onCancel={() => this.changeModal('add_cat_modal_visible', false)}
|
||||
footer={null}
|
||||
>
|
||||
<AddInterfaceCatForm onCancel={() => this.changeModal('add_cat_modal_visible', false)} onSubmit={this.handleAddInterfaceCat} />
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title="修改分类"
|
||||
visible={this.state.change_cat_modal_visible}
|
||||
onCancel={() => this.changeModal('change_cat_modal_visible', false)}
|
||||
footer={null}
|
||||
>
|
||||
<AddInterfaceCatForm catdata={this.state.curCatdata} onCancel={() => this.changeModal('change_cat_modal_visible', false)} onSubmit={this.handleChangeInterfaceCat} />
|
||||
</Modal>
|
||||
</div>
|
||||
{searchBox}
|
||||
{menuList.length > 0 ?
|
||||
<Tree
|
||||
className="interface-list"
|
||||
|
Loading…
Reference in New Issue
Block a user