refactor(项目设置): 优化页面交互,提示无可用端口号之后,状态开关变回关闭
--bug=1014028 --user=宋天阳 【接口测试】开启TCP Mock时,默认端口号为0未随机一个可用端口号 https://www.tapd.cn/55049933/s/1182215
This commit is contained in:
parent
ba8b017ab9
commit
406610fd15
|
@ -224,12 +224,17 @@ export default {
|
|||
methods: {
|
||||
tcpMockSwitchChange(value, other) {
|
||||
if (value && this.config.mockTcpPort === 0) {
|
||||
this.result = this.$get('/project/genTcpMockPort/' + this.projectId, res => {
|
||||
let port = res.data;
|
||||
this.$get('/project/genTcpMockPort/' + this.projectId).then(res => {
|
||||
let port = res.data.data;
|
||||
this.config.mockTcpPort = port;
|
||||
this.$nextTick(() => {
|
||||
this.switchChange("MOCK_TCP_OPEN", value, ['MOCK_TCP_PORT', this.config.mockTcpPort]);
|
||||
})
|
||||
}).catch(resp => {
|
||||
this.config.mockTcpOpen = false;
|
||||
if (resp.response && resp.response.data && resp.response.data.message) {
|
||||
this.$error(resp.response.data.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.switchChange("MOCK_TCP_OPEN", value, other);
|
||||
|
@ -245,11 +250,14 @@ export default {
|
|||
// 后台按照顺序先校验其它数据合法性,如tcp端口合法性,合法后保存是否开启
|
||||
configs.push({projectId: this.projectId, typeValue: value, type});
|
||||
let params = {configs};
|
||||
this.$post("/project_application/update/batch", params, () => {
|
||||
this.$post("/project_application/update/batch", params).then(() => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.init();
|
||||
}, () => {
|
||||
}).catch(resp => {
|
||||
this.init();
|
||||
if (resp.response && resp.response.data && resp.response.data.message) {
|
||||
this.$error(resp.response.data.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
init() {
|
||||
|
|
Loading…
Reference in New Issue