fix(系统设置): 平台插件图片无法显示

--bug=1019990 --user=陈建星 【系统设置】服务集成-jira平台-显示有问题 https://www.tapd.cn/55049933/s/1299926
This commit is contained in:
chenjianxing 2022-11-21 18:20:04 +08:00 committed by jianxing
parent 399cf72869
commit 02bcc512f6
5 changed files with 29 additions and 8 deletions

View File

@ -1,4 +1,4 @@
import {post, get} from "metersphere-frontend/src/plugins/request"; import {post, get, generateModuleUrl} from "metersphere-frontend/src/plugins/request";
const BASE_URL = "/platform/plugin/"; const BASE_URL = "/platform/plugin/";
export function getPlatformProjectInfo(key) { export function getPlatformProjectInfo(key) {
@ -20,3 +20,7 @@ export function getPlatformOption() {
export function getThirdPartTemplateSupportPlatform() { export function getThirdPartTemplateSupportPlatform() {
return get(BASE_URL + 'template/support/list'); return get(BASE_URL + 'template/support/list');
} }
export function generatePlatformResourceUrl(configId, fileName) {
return generateModuleUrl(BASE_URL + `resource/${configId}?fileName=${fileName}`);
}

View File

@ -22,7 +22,7 @@
<ms-instructions-icon v-if="item.instructionsIcon" effect="light"> <ms-instructions-icon v-if="item.instructionsIcon" effect="light">
<template> <template>
<img class="jira-image" <img class="jira-image"
:src="'/platform/plugin/resource/' + config.id + '?fileName=' + item.instructionsIcon"/> :src="getPlatformImageUrl(config, item)"/>
</template> </template>
</ms-instructions-icon> </ms-instructions-icon>
</el-form-item> </el-form-item>
@ -34,6 +34,7 @@
import MsInstructionsIcon from "metersphere-frontend/src/components/MsInstructionsIcon"; import MsInstructionsIcon from "metersphere-frontend/src/components/MsInstructionsIcon";
import {getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token"; import {getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token";
import { import {
generatePlatformResourceUrl,
getPlatformProjectInfo, getPlatformProjectInfo,
getPlatformProjectOption, getPlatformProjectOption,
validateProjectConfig, validateProjectConfig,
@ -141,6 +142,9 @@ export default {
callback(); callback();
} }
}); });
},
getPlatformImageUrl(config, item) {
return generatePlatformResourceUrl(config.id, item.instructionsIcon);
} }
} }
} }

View File

@ -1,4 +1,5 @@
import {post, get} from "metersphere-frontend/src/plugins/request"; import {post, get, generateModuleUrl} from "metersphere-frontend/src/plugins/request";
const BASE_URL = "/platform/plugin/"; const BASE_URL = "/platform/plugin/";
export function getIntegrationInfo() { export function getIntegrationInfo() {
@ -27,3 +28,7 @@ export function getPlatformOption() {
export function getThirdPartTemplateSupportPlatform() { export function getThirdPartTemplateSupportPlatform() {
return get(BASE_URL + 'template/support/list'); return get(BASE_URL + 'template/support/list');
} }
export function generatePlatformResourceUrl(configId, fileName) {
return generateModuleUrl(BASE_URL + `resource/${configId}?fileName=${fileName}`);
}

View File

@ -5,7 +5,7 @@
<el-radio-group v-model="platform" style="margin-top: 10px"> <el-radio-group v-model="platform" style="margin-top: 10px">
<span v-for="config in platformConfigs" :key="config.key"> <span v-for="config in platformConfigs" :key="config.key">
<el-radio :label="config.label"> <el-radio :label="config.label">
<img class="platform" :src="'/platform/plugin/resource/' + config.id + '?fileName=' + config.image" <img class="platform" :src="getPlatformImageUrl(config)"
alt="Jira"/> alt="Jira"/>
</el-radio> </el-radio>
</span> </span>
@ -41,7 +41,7 @@ import ZentaoSetting from '@/business/workspace/integration/ZentaoSetting';
import AzuredevopsSetting from '@/business/workspace/integration/AzureDevopsSetting'; import AzuredevopsSetting from '@/business/workspace/integration/AzureDevopsSetting';
import {AZURE_DEVOPS, TAPD, ZEN_TAO} from "metersphere-frontend/src/utils/constants"; import {AZURE_DEVOPS, TAPD, ZEN_TAO} from "metersphere-frontend/src/utils/constants";
import PlatformConfig from "@/business/workspace/integration/PlatformConfig"; import PlatformConfig from "@/business/workspace/integration/PlatformConfig";
import {getIntegrationInfo} from "@/api/platform-plugin"; import {generatePlatformResourceUrl, getIntegrationInfo} from "@/api/platform-plugin";
export default { export default {
name: "BugManagement", name: "BugManagement",
@ -72,9 +72,13 @@ export default {
}, },
azuredevopsEnable() { azuredevopsEnable() {
return this.platform === AZURE_DEVOPS; return this.platform === AZURE_DEVOPS;
}
}, },
}, methods: {
methods: {} getPlatformImageUrl(config) {
return generatePlatformResourceUrl(config.id, config.image);
}
}
} }
</script> </script>

View File

@ -22,7 +22,7 @@
<ms-instructions-icon v-if="item.instructionsIcon" effect="light"> <ms-instructions-icon v-if="item.instructionsIcon" effect="light">
<template> <template>
<img class="jira-image" <img class="jira-image"
:src="'/platform/plugin/resource/' + config.id + '?fileName=' + item.instructionsIcon"/> :src="getPlatformImageUrl(config, item)"/>
</template> </template>
</ms-instructions-icon> </ms-instructions-icon>
</el-form-item> </el-form-item>
@ -34,6 +34,7 @@
import MsInstructionsIcon from "metersphere-frontend/src/components/MsInstructionsIcon"; import MsInstructionsIcon from "metersphere-frontend/src/components/MsInstructionsIcon";
import {getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token"; import {getCurrentWorkspaceId} from "metersphere-frontend/src/utils/token";
import { import {
generatePlatformResourceUrl,
getPlatformProjectInfo, getPlatformProjectInfo,
getPlatformProjectOption, getPlatformProjectOption,
validateProjectConfig, validateProjectConfig,
@ -140,6 +141,9 @@ export default {
callback(); callback();
} }
}); });
},
getPlatformImageUrl(config, item) {
return generatePlatformResourceUrl(config.id, item.instructionsIcon);
} }
} }
} }