From 1e10d0521c58f848c97d74d91a0081f21f023593 Mon Sep 17 00:00:00 2001 From: teukkk Date: Wed, 20 Nov 2024 15:49:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E5=AE=9A=E4=B9=89-CASE-=E4=BF=AE=E5=A4=8D=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E5=85=B3=E6=B3=A8=E7=94=A8=E4=BE=8B=E6=8E=A5=E5=8F=A3=E6=8E=89?= =?UTF-8?q?=E9=94=99=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1049149 --user=吕梦园 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001049149 --- frontend/src/api/modules/api-test/management.ts | 8 +++++++- frontend/src/api/requrls/api-test/management.ts | 3 ++- .../components/management/case/caseDetail.vue | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/frontend/src/api/modules/api-test/management.ts b/frontend/src/api/modules/api-test/management.ts index e8a892e46b..46dcb22534 100644 --- a/frontend/src/api/modules/api-test/management.ts +++ b/frontend/src/api/modules/api-test/management.ts @@ -93,6 +93,7 @@ import { SwitchDefinitionScheduleUrl, ToggleFollowCaseUrl, ToggleFollowDefinitionUrl, + ToggleUnFollowCaseUrl, TransferFileCaseUrl, TransferFileModuleOptionCaseUrl, TransferFileModuleOptionUrl, @@ -550,11 +551,16 @@ export function getCaseDetail(id: string) { return MSR.get({ url: GetCaseDetailUrl, params: id }); } -// 关注/取消关注接口用例 +// 关注接口用例 export function toggleFollowCase(id: string | number) { return MSR.get({ url: ToggleFollowCaseUrl, params: id }); } +// 取消关注接口用例 +export function toggleUnFollowCase(id: string | number) { + return MSR.get({ url: ToggleUnFollowCaseUrl, params: id }); +} + // 用例执行,传请求详情执行 export function runCase(data: ExecuteRequestParams) { return MSR.post({ url: RunCaseUrl, data }); diff --git a/frontend/src/api/requrls/api-test/management.ts b/frontend/src/api/requrls/api-test/management.ts index 34cfd0bb09..742b64f277 100644 --- a/frontend/src/api/requrls/api-test/management.ts +++ b/frontend/src/api/requrls/api-test/management.ts @@ -92,7 +92,8 @@ export const ExecuteCaseUrl = '/api/case/run'; // 单独执行接口用例 export const GetExecuteHistoryUrl = '/api/case/execute/page'; // 获取用的执行历史 export const GetDependencyUrl = '/api/case/get-reference'; // 获取用例的依赖关系 export const GetChangeHistoryUrl = '/api/case/operation-history/page'; // 获取用例的依赖关系 -export const ToggleFollowCaseUrl = '/api/case/follow'; // 接口定义-关注/取消关注 +export const ToggleFollowCaseUrl = '/api/case/follow'; // 接口用例-关注 +export const ToggleUnFollowCaseUrl = '/api/case/unfollow'; // 接口用例-取消关注 export const RunCaseUrl = '/api/case/run'; // 执行接口用例 export const GetCaseReportByIdUrl = '/api/report/case/get/'; // 接口用例报告获取 export const GetCaseReportDetailUrl = '/api/report/case/get/detail/'; // 接口用例报告获取 diff --git a/frontend/src/views/api-test/management/components/management/case/caseDetail.vue b/frontend/src/views/api-test/management/components/management/case/caseDetail.vue index 006e46050b..3b9ee720b8 100644 --- a/frontend/src/views/api-test/management/components/management/case/caseDetail.vue +++ b/frontend/src/views/api-test/management/components/management/case/caseDetail.vue @@ -139,7 +139,13 @@ import TabCaseExecuteHistory from '@/views/api-test/management/components/management/case/tabContent/tabCaseExecuteHistory.vue'; import { localExecuteApiDebug, stopLocalExecute } from '@/api/modules/api-test/common'; - import { debugCase, deleteCase, runCase, toggleFollowCase } from '@/api/modules/api-test/management'; + import { + debugCase, + deleteCase, + runCase, + toggleFollowCase, + toggleUnFollowCase, + } from '@/api/modules/api-test/management'; import { projectStopTask } from '@/api/modules/taskCenter/project'; import useModal from '@/hooks/useModal'; import useWebsocket from '@/hooks/useWebsocket'; @@ -200,7 +206,11 @@ async function follow() { try { followLoading.value = true; - await toggleFollowCase(caseDetail.value.id); + if (caseDetail.value.follow) { + await toggleUnFollowCase(caseDetail.value.id); + } else { + await toggleFollowCase(caseDetail.value.id); + } Message.success(caseDetail.value.follow ? t('common.unFollowSuccess') : t('common.followSuccess')); caseDetail.value.follow = !caseDetail.value.follow; emit('updateFollow');