From 4b0ee0687669c5162980dd4a75441cc10510fc20 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Mon, 17 Oct 2022 17:34:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=88=86=E4=BA=AB=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E6=97=A0=E6=B3=95=E8=B7=B3=E8=BD=AC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ShareTestPlanApiReportController.java | 2 +- .../src/api/remote/api/api-definition.js | 2 +- .../template/report/plan/planReportUse.js | 22 +++++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) 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