fix: 测试用例退出到某个项目,再次点击测试集会定位到上一个测试用例的url; 测试集接口导入没有复制到 reqBodyType 和 reqBodyOther

This commit is contained in:
喻希里 2017-10-20 16:27:09 +08:00
parent f01c95a45a
commit f6a9eb98ff
5 changed files with 13 additions and 7 deletions

View File

@ -15,6 +15,7 @@ import InterfaceColMenu from './InterfaceCol/InterfaceColMenu.js'
import InterfaceColContent from './InterfaceCol/InterfaceColContent.js'
import InterfaceCaseContent from './InterfaceCol/InterfaceCaseContent.js'
import { getProject } from '../../../reducer/modules/project';
import { setColData } from '../../../reducer/modules/interfaceCol.js';
const contentRouter = {
path: '/project/:id/interface/:action/:actionId',
exact: true
@ -48,6 +49,7 @@ InterfaceRoute.propTypes = {
isShowCol: state.interfaceCol.isShowCol
}
},{
setColData,
getProject
}
)
@ -57,7 +59,8 @@ class Interface extends Component {
history: PropTypes.object,
location: PropTypes.object,
isShowCol: PropTypes.bool,
getProject: PropTypes.func
getProject: PropTypes.func,
setColData: PropTypes.func
}
constructor(props) {
@ -75,6 +78,9 @@ class Interface extends Component {
this.props.history.push('/project/' + params.id + '/interface/' + action)
}
componentWillMount(){
this.props.setColData({
isShowCol: true
})
this.props.getProject(this.props.match.params.id)
}
render() {

View File

@ -375,7 +375,7 @@ class InterfaceColContent extends Component {
const { interfaceColList } = nextProps;
const { actionId: oldColId, id } = this.props.match.params
let newColId = nextProps.match.params.actionId
if (!interfaceColList.find(item => +item._id === +newColId)) {
if (!interfaceColList.find(item => +item._id === +newColId)&&interfaceColList[0]._id) {
this.props.history.push('/project/' + id + '/interface/col/' + interfaceColList[0]._id)
} else if ((oldColId !== newColId) || interfaceColList !== this.props.interfaceColList) {
if (newColId && newColId != 0) {

View File

@ -257,7 +257,7 @@ export default class InterfaceColMenu extends Component {
}
render() {
let { currColId, currCaseId, isShowCol } = this.props;
const { currColId, currCaseId, isShowCol } = this.props;
const { colModalType, colModalVisible, filterValue, importInterVisible } = this.state;
// const menu = (col) => {
@ -288,9 +288,7 @@ export default class InterfaceColMenu extends Component {
// this.props.interfaceColList.caseList = caseList;
// }
// console.log(this.props.match);
console.log(currColId)
// currColId = this.props.match.params.id?this.props.match.params.id:currColId;
return (
<div>
<div className="interface-filter">

View File

@ -278,6 +278,8 @@ class interfaceColController extends baseController{
let interfaceData = await this.interfaceModel.getBaseinfo(params.interface_list[i]);
data.interface_id = params.interface_list[i];
data.casename = interfaceData.title;
data.req_body_other = interfaceData.req_body_other;
data.req_body_type = interfaceData.req_body_type;
await this.caseModel.save(data);
let username = this.getUsername();
this.colModel.get(params.col_id).then((col)=>{

View File

@ -80,7 +80,7 @@ class interfaceModel extends baseModel {
getBaseinfo(id){
return this.model.findOne({
_id: id
}).select('path method uid title project_id cat_id status').exec()
}).select('path method uid title project_id cat_id status req_body_other req_body_type').exec()
}
getVar(project_id, method){