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');