From f00ac15be3014ce27fc267e0374ae524c6c0d359 Mon Sep 17 00:00:00 2001 From: lihuacai Date: Sat, 27 Jan 2024 18:39:40 +0800 Subject: [PATCH] fix(API,Case): add friendly alter when run api or case without config --- web/src/pages/fastrunner/api/components/ApiBody.vue | 8 ++++++++ web/src/pages/fastrunner/api/components/ApiList.vue | 5 +++++ web/src/pages/fastrunner/case/components/EditTest.vue | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/web/src/pages/fastrunner/api/components/ApiBody.vue b/web/src/pages/fastrunner/api/components/ApiBody.vue index 241619e6..b13a82db 100644 --- a/web/src/pages/fastrunner/api/components/ApiBody.vue +++ b/web/src/pages/fastrunner/api/components/ApiBody.vue @@ -218,6 +218,14 @@ export default { }, methods: { reverseStatus() { + console.log(this.url) + console.log(this.config) + console.log(this.host) + // 如果没有选择配置的时候,并且api的不是http开头的, 并且不是变量的时候,提示用户选择配置 + if (this.config.name === '请选择' && this.host === '请选择' && !this.url.startsWith("http") && !this.url.startsWith("$")){ + this.$message.warning("请先在左上角选择配置再运行哦~") + return + } this.save = !this.save; this.run = true; }, diff --git a/web/src/pages/fastrunner/api/components/ApiList.vue b/web/src/pages/fastrunner/api/components/ApiList.vue index cec543ed..6fab1fb7 100644 --- a/web/src/pages/fastrunner/api/components/ApiList.vue +++ b/web/src/pages/fastrunner/api/components/ApiList.vue @@ -755,6 +755,11 @@ export default { }, // 运行API handleRunAPI(id) { + // 如果没有选择配置的时候,并且api的不是http开头的, 并且不是变量的时候,提示用户选择配置 + if (this.config === '请选择' && this.host === '请选择' && !this.currentRow.url.startsWith("http") && !this.currentRow.url.startsWith("$")){ + this.$message.warning("请先在左上角选择配置再运行哦~") + return + } this.loading = true; this.$api.runAPIByPk(id, { params: { diff --git a/web/src/pages/fastrunner/case/components/EditTest.vue b/web/src/pages/fastrunner/case/components/EditTest.vue index 7e988fdc..53d24223 100644 --- a/web/src/pages/fastrunner/case/components/EditTest.vue +++ b/web/src/pages/fastrunner/case/components/EditTest.vue @@ -514,7 +514,7 @@ export default { this.$notify.warning({ title: '提示', duration: this.$store.state.duration, - message: '测试用例必须包含配置' + message: '请先在左上角选择配置后,再运行用例哦~' }); return false }