From 75eeae71de73dfea137d3fd6656da36f47a46410 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 18 Dec 2020 10:54:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E8=AF=B7=E6=B1=82=E8=B7=AF=E5=BE=84=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/complete/EditCompleteHTTPApi.vue | 15 ++++++--------- frontend/src/i18n/en-US.js | 2 +- frontend/src/i18n/zh-CN.js | 2 +- frontend/src/i18n/zh-TW.js | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue index bbb7d76635..cbfac1cf9f 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteHTTPApi.vue @@ -100,13 +100,18 @@ name: "MsAddCompleteHttpApi", components: {MsResponseText, MsApiRequestForm, MsJsr233Processor}, data() { + let validateURL = (rule, value, callback) => { + if (!this.httpForm.path.startsWith("/") || this.httpForm.path.match(/\s/) != null) { + callback(this.$t('api_test.definition.request.path_valid_info')); + } + }; return { rule: { name: [ {required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'}, {max: 50, message: this.$t('test_track.length_less_than') + '50', trigger: 'blur'} ], - path: [{required: true, message: this.$t('api_test.definition.request.path_info'), trigger: 'blur'}], + path: [{required: true, message: this.$t('api_test.definition.request.path_info'), trigger: 'blur'}, {validator: validateURL, trigger: 'blur'}], userId: [{required: true, message: this.$t('test_track.case.input_maintainer'), trigger: 'change'}], moduleId: [{required: true, message: this.$t('test_track.case.input_module'), trigger: 'change'}], status: [{required: true, message: this.$t('commons.please_select'), trigger: 'change'}], @@ -124,10 +129,6 @@ runTest() { this.$refs['httpForm'].validate((valid) => { if (valid) { - if(this.httpForm.path.match(/\s/)!=null){ - this.$error(this.$t("api_test.definition.request.path_valid_info")); - return false; - } this.setParameter(); this.$emit('runTest', this.httpForm); } else { @@ -150,10 +151,6 @@ saveApi() { this.$refs['httpForm'].validate((valid) => { if (valid) { - if(this.httpForm.path.match(/\s/)!=null){ - this.$error(this.$t("api_test.definition.request.path_valid_info")); - return false; - } this.setParameter(); this.$emit('saveApi', this.httpForm); } diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 98297db031..675c403610 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -543,7 +543,7 @@ export default { create_info: 'Create', update_info: 'Update', batch_edit: "Batch edit", - path_valid_info: "The request address cannot contain spaces", + path_valid_info: "The request path is invalid", } }, automation: { diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index e9bde643d8..465d4d9c9a 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -542,7 +542,7 @@ export default { create_info: '创建', update_info: '更新', batch_edit: "批量编辑", - path_valid_info: "请求地址不能包含空格", + path_valid_info: "请求路径无效", } }, automation: { diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 70711b87c7..c7c05280ed 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -542,7 +542,7 @@ export default { create_info: '創建', update_info: '更新', batch_edit: "批量編輯", - path_valid_info: "請求地址不能包含空格", + path_valid_info: "請求路径无效", } }, automation: {