diff --git a/api-test/backend/src/main/java/io/metersphere/controller/plan/ShareTestPlanApiReportController.java b/api-test/backend/src/main/java/io/metersphere/controller/plan/ShareTestPlanApiReportController.java index 03119c4334..709c5ae531 100644 --- a/api-test/backend/src/main/java/io/metersphere/controller/plan/ShareTestPlanApiReportController.java +++ b/api-test/backend/src/main/java/io/metersphere/controller/plan/ShareTestPlanApiReportController.java @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @RestController -@RequestMapping("/share/test/plan/api/case") +@RequestMapping("/share") public class ShareTestPlanApiReportController { @Resource diff --git a/test-track/frontend/src/api/remote/api/api-definition.js b/test-track/frontend/src/api/remote/api/api-definition.js index bfc91b80d2..7ddc2992be 100644 --- a/test-track/frontend/src/api/remote/api/api-definition.js +++ b/test-track/frontend/src/api/remote/api/api-definition.js @@ -25,7 +25,7 @@ export function apiDefinitionReportGet(id) { } export function apiDefinitionReportGetDb(id) { - return get(BASE_URL + `getReport/${id}`); + return get(BASE_URL + `report/getReport/${id}`); } export function apiDefinitionRunDebug(file, files, params) { diff --git a/test-track/frontend/src/business/template/report/plan/planReportUse.js b/test-track/frontend/src/business/template/report/plan/planReportUse.js index 405746d3c8..2076687c71 100644 --- a/test-track/frontend/src/business/template/report/plan/planReportUse.js +++ b/test-track/frontend/src/business/template/report/plan/planReportUse.js @@ -11,8 +11,30 @@ import plugins from "metersphere-frontend/src/plugins"; import mavonEditor from "mavon-editor"; import {createPinia, PiniaVuePlugin} from 'pinia' import PersistedState from "pinia-plugin-persistedstate"; +import {TokenKey} from "metersphere-frontend/src/utils/constants"; +import axios from 'axios'; function planReportUse(id, template) { + // 获取gateway路由 + let user = JSON.parse(localStorage.getItem(TokenKey)); + axios({ + method: 'get', + url: '/services', + headers: { + 'CSRF-TOKEN': user.csrfToken, + 'X-AUTH-TOKEN': user.sessionId + }, + }).then((res)=>{ + let modules = {}, microPorts = {}; + res.data.data.forEach(svc => { + let name = svc.serviceId; + modules[name] = true; + microPorts[name] = svc.port; + }) + sessionStorage.setItem("micro_apps", JSON.stringify(modules)); + sessionStorage.setItem("micro_ports", JSON.stringify(microPorts)); + }) + const pinia = createPinia() pinia.use(PersistedState)//开启缓存,存储在localstorage