fix(接口测试): 修复api测试后更新接口刷新问题
--bug=1009997 --user=赵勇 【接口测试】接口定义-test,更新接口没有及时刷新 https://www.tapd.cn/55049933/s/1099254
This commit is contained in:
parent
e1c614b6d7
commit
4374f42aa3
|
@ -329,14 +329,38 @@
|
||||||
this.showMock = true;
|
this.showMock = true;
|
||||||
this.$store.state.currentApiCase = undefined;
|
this.$store.state.currentApiCase = undefined;
|
||||||
} else {
|
} else {
|
||||||
|
this.syncApi();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
changeApi() {
|
||||||
this.showApiList = true;
|
this.showApiList = true;
|
||||||
this.showTestCaseList = false;
|
this.showTestCaseList = false;
|
||||||
this.showTest = false;
|
this.showTest = false;
|
||||||
this.showMock = false;
|
this.showMock = false;
|
||||||
this.$store.state.currentApiCase = undefined;
|
this.$store.state.currentApiCase = undefined;
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
syncApi() {
|
||||||
|
if (this.syncTabs && this.syncTabs.length > 0 && this.syncTabs.includes(this.currentApi.id)) {
|
||||||
|
// 标示接口在其他地方更新过,当前页面需要同步
|
||||||
|
let url = "/api/definition/get/";
|
||||||
|
this.$get(url + this.currentApi.id, response => {
|
||||||
|
if (response.data) {
|
||||||
|
let request = JSON.parse(response.data.request);
|
||||||
|
let index = this.syncTabs.findIndex(item => {
|
||||||
|
if (item === this.currentApi.id) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.syncTabs.splice(index, 1);
|
||||||
|
this.currentApi.request = request;
|
||||||
|
this.changeApi();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.changeApi();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue