From f6b812dc88fc4098b7056efe584ccba0b8e10d04 Mon Sep 17 00:00:00 2001 From: "wenbo.dong" Date: Tue, 26 Sep 2017 18:37:39 +0800 Subject: [PATCH] =?UTF-8?q?opti:=20=E6=8E=A5=E5=8F=A3=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=92=8C=E6=B5=8B=E8=AF=95=E9=9B=86=E5=90=88=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E8=8F=9C=E5=8D=95=E6=8C=89=E9=92=AE=E5=B1=95=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/containers/Group/Group.js | 2 +- .../containers/Project/Interface/Interface.js | 2 +- .../InterfaceCol/InterfaceColMenu.js | 40 ++++--- .../InterfaceCol/InterfaceColMenu.scss | 6 + .../Interface/InterfaceList/InterfaceMenu.js | 109 ++++++++++-------- .../Project/Interface/interface.scss | 21 +++- 6 files changed, 114 insertions(+), 66 deletions(-) diff --git a/client/containers/Group/Group.js b/client/containers/Group/Group.js index 7b1cc820..3a27fd39 100755 --- a/client/containers/Group/Group.js +++ b/client/containers/Group/Group.js @@ -19,7 +19,7 @@ export default class Group extends Component { const GroupContent = ( - +
diff --git a/client/containers/Project/Interface/Interface.js b/client/containers/Project/Interface/Interface.js index 20204f9b..8cbe4e6f 100755 --- a/client/containers/Project/Interface/Interface.js +++ b/client/containers/Project/Interface/Interface.js @@ -83,7 +83,7 @@ class Interface extends Component { // console.log(matchPath(this.props.location.pathname, contentRouter)); return ( - +
diff --git a/client/containers/Project/Interface/InterfaceCol/InterfaceColMenu.js b/client/containers/Project/Interface/InterfaceCol/InterfaceColMenu.js index 342d6b9b..3029c858 100755 --- a/client/containers/Project/Interface/InterfaceCol/InterfaceColMenu.js +++ b/client/containers/Project/Interface/InterfaceCol/InterfaceColMenu.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types' import { fetchInterfaceColList, fetchInterfaceCaseList, setColData } from '../../../../reducer/modules/interfaceCol' import { autobind } from 'core-decorators'; import axios from 'axios'; -import { Input, Icon, Button, Modal, message, Tooltip, Tree, Dropdown, Menu, Form } from 'antd'; +import { Input, Icon, Button, Modal, message, Tooltip, Tree, Form } from 'antd'; const TreeNode = Tree.TreeNode; const FormItem = Form.Item; @@ -197,20 +197,20 @@ export default class InterfaceColMenu extends Component { const { currColId, currCaseId, isShowCol } = this.props; const { colModalType, colModalVisible, filterValue } = this.state; - const menu = (col) => { - return ( - - - this.showColModal('edit', col)}>修改集合 - - - { - this.showDelColConfirm(col._id) - }}>删除集合 - - - ) - }; + // const menu = (col) => { + // return ( + // + // + // this.showColModal('edit', col)}>修改集合 + // + // + // { + // this.showDelColConfirm(col._id) + // }}>删除集合 + // + // + // ) + // }; let isFilterCat = false; @@ -237,7 +237,7 @@ export default class InterfaceColMenu extends Component { return true; } isFilterCat = false; - + let caseList = col.caseList.filter(item=>{ return item.casename.indexOf(filterValue) !== -1 }) @@ -248,9 +248,13 @@ export default class InterfaceColMenu extends Component { title={
{col.name} - e.stopPropagation()}> +
+ {this.showDelColConfirm(col._id)}} /> + {this.showColModal('edit', col)}} /> +
+ {/* e.stopPropagation()}> - +
*/}
} > diff --git a/client/containers/Project/Interface/InterfaceCol/InterfaceColMenu.scss b/client/containers/Project/Interface/InterfaceCol/InterfaceColMenu.scss index 8df3e6b7..be9c5436 100755 --- a/client/containers/Project/Interface/InterfaceCol/InterfaceColMenu.scss +++ b/client/containers/Project/Interface/InterfaceCol/InterfaceColMenu.scss @@ -22,11 +22,17 @@ margin-left: 5px; display: none; } + .btns { + display: none; + } } .menu-title:hover { .case-delete-icon { display: block; } + .btns { + display: block; + } } } diff --git a/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js b/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js index cf665639..de399bc5 100755 --- a/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js +++ b/client/containers/Project/Interface/InterfaceList/InterfaceMenu.js @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import PropTypes from 'prop-types' import { fetchInterfaceList, fetchInterfaceData, deleteInterfaceData, deleteInterfaceCatData, initInterface } from '../../../../reducer/modules/interface.js'; import { getProject } from '../../../../reducer/modules/project.js'; -import { Menu, Input, Icon, Button, Modal, message, Tree, Dropdown } from 'antd'; +import { Input, Icon, Button, Modal, message, Tree } from 'antd'; import AddInterfaceForm from './AddInterfaceForm'; import AddInterfaceCatForm from './AddInterfaceCatForm'; import axios from 'axios' @@ -322,56 +322,59 @@ class InterfaceMenu extends Component { // case 'DELETE': color = 'red'; break; // default: color = "yellow"; // } - const menu = (item) => { - return - - { this.showConfirm(item._id) }}>删除接口 - - - { - this.copyInterface(item) - }}>复制接口 - - - }; + // const menu = (item) => { + // return + // + // { this.showConfirm(item._id) }}>删除接口 + // + // + // { + // this.copyInterface(item) + // }}>复制接口 + // + // + // }; return this.enterItem(item._id)} onMouseLeave={this.leaveItem} > + title={
this.enterItem(item._id)} onMouseLeave={this.leaveItem} > {item.title} - {/* { this.showConfirm(item._id) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} />*/} - e.stopPropagation()}> +
+ { this.showConfirm(item._id) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} /> + { this.copyInterface(item) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }} /> +
+ {/* e.stopPropagation()}> - +
*/}
} key={'' + item._id} /> } - const menu = (item) => { - return - - { - this.changeModal('visible', true); - this.setState({ - curCatid: item._id - }) - }}>添加接口 - - - { - this.changeModal('change_cat_modal_visible', true); - this.setState({ - curCatdata: item - }) - }}>修改分类 - - - { - this.showDelCatConfirm(item._id) - }}>删除分类 - - - }; + // const menu = (item) => { + // return + // + // { + // this.changeModal('visible', true); + // this.setState({ + // curCatid: item._id + // }) + // }}>添加接口 + // + // + // { + // this.changeModal('change_cat_modal_visible', true); + // this.setState({ + // curCatdata: item + // }) + // }}>修改分类 + // + // + // { + // this.showDelCatConfirm(item._id) + // }}>删除分类 + // + // + // }; @@ -414,11 +417,27 @@ class InterfaceMenu extends Component { > 全部接口} key="root" /> {menuList.map((item) => { - return + return this.enterItem(item._id)} onMouseLeave={this.leaveItem} > {item.name} - e.stopPropagation()}> +
+ { this.showDelCatConfirm(item._id) }} style={{ display: this.state.delIcon == item._id ? 'block' : 'none' }}/> + { + this.changeModal('change_cat_modal_visible', true); + this.setState({ + curCatdata: item + }) + }} /> + { + this.changeModal('visible', true); + this.setState({ + curCatid: item._id + }); + }} /> +
+ + {/* e.stopPropagation()}> - +
*/}
} key={'cat_' + item._id} className={`interface-item-nav ${item.list.length?"":"cat_switch_hidden"}`} diff --git a/client/containers/Project/Interface/interface.scss b/client/containers/Project/Interface/interface.scss index 93dc5666..d91f68ea 100755 --- a/client/containers/Project/Interface/interface.scss +++ b/client/containers/Project/Interface/interface.scss @@ -71,6 +71,25 @@ .ant-tree li .ant-tree-node-content-wrapper { width: calc(100% - 28px); position: relative; + .container-title { + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; + } + .btns { + background-color: #eef7fe; + position: absolute; + top: 50%; + right: 0; + transform: translateY(-60%); + transition: all .2s; + } + } + .ant-tree li .ant-tree-node-selected { + .btns { + background-color: #d5ebfc; + transition: all .2s; + } } .interface-delete-icon{ @@ -78,7 +97,7 @@ right: 0; float: right; line-height: 25px; - width: 30px; + width: 24px; font-weight: bold; } .anticon-ellipsis {