From c0ace12cb200f2df0be8d831df2d4afa520e31e0 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Tue, 19 Mar 2024 10:48:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20c?= =?UTF-8?q?ase=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E6=8E=A5=E5=8F=A3id?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E5=B9=B6=E6=94=AF=E6=8C=81=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --story=1014523 --user=王孝刚 github#29206 接口CASE页面增加接口ID展示,并支持跳转 https://www.tapd.cn/55049933/s/1477402 --- .../components/case/ApiCaseHeader.vue | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/api-test/frontend/src/business/definition/components/case/ApiCaseHeader.vue b/api-test/frontend/src/business/definition/components/case/ApiCaseHeader.vue index 1a115a3a2d..81f6b5a194 100644 --- a/api-test/frontend/src/business/definition/components/case/ApiCaseHeader.vue +++ b/api-test/frontend/src/business/definition/components/case/ApiCaseHeader.vue @@ -2,6 +2,11 @@
+ +
+ {{ api.num }} +
+
{ + if (res.data) { + this.getWorkspaceId(resource, res.data, isTurnSpace, workspaceId); + } + }); + }, + checkPermission(resource, workspaceId, isTurnSpace) { + getOwnerProjectIds().then((res) => { + const project = res.data.find((p) => p === resource.projectId); + if (!project) { + this.$warning(this.$t('commons.no_permission')); + } else { + this.gotoTurn(resource, workspaceId, isTurnSpace); + } + }); + }, + getWorkspaceId(resource, data, isTurnSpace, workspaceId) { + resource.projectId = data.projectId; + if (data.projectId !== getCurrentProjectID()) { + isTurnSpace = false; + getProject(data.projectId).then((response) => { + if (response.data) { + workspaceId = response.data.workspaceId; + isTurnSpace = true; + this.checkPermission(resource, workspaceId, isTurnSpace); + } + }); + } else { + this.checkPermission(resource, workspaceId, isTurnSpace); + } + }, + gotoTurn(resource, workspaceId, isTurnSpace) { + if (resource.protocol === 'dubbo://') { + resource.protocol = 'DUBBO'; + } + let definitionData = this.$router.resolve({ + name: 'ApiDefinitionWithQuery', + params: { + versionId: 'default', + redirectID: getUUID(), + dataType: 'api', + dataSelectRange: 'edit:' + resource.id, + projectId: resource.projectId, + type: resource.protocol, + workspaceId: workspaceId, + }, + }); + if (isTurnSpace) { + window.open(definitionData.href, '_blank'); + } + }, }, };