Merge branch 'dev' of gitlab.corp.qunar.com:mfe/yapi into dev

This commit is contained in:
suxiaoxin 2017-10-05 09:13:47 +08:00
commit 47e4463cce
3 changed files with 11 additions and 7 deletions

View File

@ -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})

View File

@ -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);
}

View File

@ -477,8 +477,8 @@ class interfaceController extends baseController {
try {
let result = await this.Model.up(id, data);
let username = this.getUsername();
if (params.catid) {
this.catModel.get(+params.catid).then((cate) => {
if (data.catid) {
this.catModel.get(+data.catid).then((cate) => {
yapi.commons.saveLog({
content: `用户 "${username}" 更新了分类 "${cate.name}" 下的接口 "${data.title}"`,
type: 'project',