From 406610fd159f94469532a25e59df0f2535e23216 Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 15 Jun 2022 12:23:33 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E9=A1=B9=E7=9B=AE=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E9=A1=B5=E9=9D=A2=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E7=A4=BA=E6=97=A0=E5=8F=AF=E7=94=A8=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=E5=8F=B7=E4=B9=8B=E5=90=8E=EF=BC=8C=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=BC=80=E5=85=B3=E5=8F=98=E5=9B=9E=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1014028 --user=宋天阳 【接口测试】开启TCP Mock时,默认端口号为0未随机一个可用端口号 https://www.tapd.cn/55049933/s/1182215 --- .../project/menu/appmanage/AppManage.vue | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/project/menu/appmanage/AppManage.vue b/frontend/src/business/components/project/menu/appmanage/AppManage.vue index b56e0dc9f6..5c86e44aea 100644 --- a/frontend/src/business/components/project/menu/appmanage/AppManage.vue +++ b/frontend/src/business/components/project/menu/appmanage/AppManage.vue @@ -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() {