mirror of
https://github.com/YMFE/yapi.git
synced 2025-03-07 14:16:52 +08:00
fix: tab切换
This commit is contained in:
parent
01d889932f
commit
326e84a033
@ -83,12 +83,9 @@ export default class InterfaceCaseContent extends Component {
|
||||
async componentWillReceiveProps(nextProps) {
|
||||
const oldCaseId = this.props.match.params.actionId
|
||||
const newCaseId = nextProps.match.params.actionId
|
||||
const id = this.props.match.params.id;
|
||||
const { interfaceColList } = nextProps;
|
||||
let currColId = this.getColId(interfaceColList, newCaseId);
|
||||
if(!currColId) {
|
||||
this.props.history.push('/project/' + id + '/interface/col/' + interfaceColList[0]._id)
|
||||
} else if (oldCaseId !== newCaseId) {
|
||||
if (oldCaseId !== newCaseId) {
|
||||
await this.props.fetchCaseData(newCaseId);
|
||||
this.props.setColData({currCaseId: +newCaseId, currColId, isShowCol: false})
|
||||
this.setState({editCasename: this.props.currCase.casename})
|
||||
|
@ -171,6 +171,7 @@ export default class InterfaceColMenu extends Component {
|
||||
}
|
||||
showDelCaseConfirm = (caseId) => {
|
||||
let that = this;
|
||||
const params = this.props.match.params;
|
||||
confirm({
|
||||
title: '您确认删除此测试用例',
|
||||
content: '温馨提示:用例删除后无法恢复',
|
||||
@ -178,7 +179,13 @@ export default class InterfaceColMenu extends Component {
|
||||
const res = await axios.get('/api/col/del_case?caseid=' + caseId)
|
||||
if (!res.data.errcode) {
|
||||
message.success('删除用例成功');
|
||||
await that.props.fetchInterfaceColList(that.props.match.params.id);
|
||||
|
||||
// 如果删除当前选中 case,切换路由到集合
|
||||
if (+caseId === +that.props.currCaseId) {
|
||||
that.props.history.push('/project/' + params.id + '/interface/col/')
|
||||
} else {
|
||||
that.props.fetchInterfaceColList(that.props.match.params.id);
|
||||
}
|
||||
} else {
|
||||
message.error(res.data.errmsg);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user