fix(测试跟踪): 禅道图片同步后不显示

--bug=1020301 --user=陈建星 【测试跟踪】github #20125, 同步禅道缺陷后,缺陷内容中的图片无法展示 https://www.tapd.cn/55049933/s/1312407
This commit is contained in:
chenjianxing 2022-12-05 15:14:45 +08:00 committed by jianxing
parent 4600ad8fde
commit 127a973af6
5 changed files with 47 additions and 22 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<mavon-editor :id="id" :editable="!disabled" @imgAdd="imgAdd" :default-open="defaultOpenValue" <mavon-editor v-loading="loading" :id="id" :editable="!disabled" @imgAdd="imgAdd" :default-open="defaultOpenValue"
:xss-options="xssOptions" :style="{'min-height': customMinHeight + 'px', 'min-width': '100px'}" :xss-options="xssOptions" :style="{'min-height': customMinHeight + 'px', 'min-width': '100px'}"
@change="change" :image-click="imageClick" @change="change" :image-click="imageClick"
:subfield="false" :toolbars="toolbars" :language="language" :toolbarsFlag="!disabled" :subfield="false" :toolbars="toolbars" :language="language" :toolbarsFlag="!disabled"
@ -80,7 +80,7 @@ export default {
}, },
data() { data() {
return { return {
result: {loading: false}, loading: false,
id: getUUID(), id: getUUID(),
xssOptions: { xssOptions: {
whiteList: { whiteList: {
@ -183,13 +183,13 @@ export default {
}, },
methods: { methods: {
imgAdd(pos, file) { imgAdd(pos, file) {
this.result.loading = true; this.loading = true;
uploadMarkDownImg(file) uploadMarkDownImg(file)
.then((r) => { .then((r) => {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
let url = '/resource/md/get?fileName=' + r.data; let url = '/resource/md/get?fileName=' + r.data;
this.$refs.md.$img2Url(pos, url); this.$refs.md.$img2Url(pos, url);
this.result.loading = false; this.loading = false;
}); });
this.$emit('imgAdd', file); this.$emit('imgAdd', file);
}, },

View File

@ -17,7 +17,7 @@ public class IssueProxyResourceController {
@GetMapping(value = "/md/get/url") @GetMapping(value = "/md/get/url")
public ResponseEntity<byte[]> getFileByUrl(@RequestParam ("url") String url, @RequestParam (value = "platform", required = false) String platform, public ResponseEntity<byte[]> getFileByUrl(@RequestParam ("url") String url, @RequestParam (value = "platform", required = false) String platform,
@RequestParam ("project_id") String projectId, @RequestParam ("workspace_id") String workspaceId) { @RequestParam (value = "workspace_id", required = false) String workspaceId) {
return issueProxyResourceService.getMdImageByUrl(url, platform, projectId, workspaceId); return issueProxyResourceService.getMdImageByUrl(url, platform, workspaceId);
} }
} }

View File

@ -29,7 +29,7 @@ public class IssueProxyResourceService {
* @param platform * @param platform
* @return * @return
*/ */
public ResponseEntity<byte[]> getMdImageByUrl(String url, String platform, String projectId, String workspaceId) { public ResponseEntity<byte[]> getMdImageByUrl(String url, String platform, String workspaceId) {
if (url.contains("md/get/url")) { if (url.contains("md/get/url")) {
MSException.throwException(Translator.get("invalid_parameter")); MSException.throwException(Translator.get("invalid_parameter"));
} }

View File

@ -80,6 +80,11 @@
</span> </span>
</span> </span>
<ms-review-table-item
v-else-if="item.id === 'description'"
:data="scope.row"
prop="description"/>
<span v-else-if="item.id === 'resourceName'"> <span v-else-if="item.id === 'resourceName'">
<el-link v-if="scope.row.resourceName" <el-link v-if="scope.row.resourceName"
@click="$router.push('/track/plan/view/' + scope.row.resourceId)"> @click="$router.push('/track/plan/view/' + scope.row.resourceId)">
@ -103,21 +108,12 @@
<!-- 自定义字段 --> <!-- 自定义字段 -->
<span v-else-if="item.isCustom"> <span v-else-if="item.isCustom">
<span v-if="item.type === 'richText' && scope.row.displayValueMap.get(item.id)"> <span v-if="item.type === 'richText' && scope.row.displayValueMap[item.id]">
<el-popover <ms-review-table-item
placement="right" :data="scope.row.displayValueMap" :prop="item.id"/>
width="500"
trigger="hover"
popper-class="issues-popover">
<ms-mark-down-text
prop="value"
:disabled="true"
:data="{value: scope.row.displayValueMap.get(item.id)}"/>
<el-button slot="reference" type="text">{{ $t('test_track.issue.preview') }}</el-button>
</el-popover>
</span> </span>
<span v-else> <span v-else>
{{ scope.row.displayValueMap.get(item.id) }} {{ scope.row.displayValueMap[item.id] }}
</span> </span>
</span> </span>
@ -185,10 +181,12 @@ import {
} from "metersphere-frontend/src/components/search/custom-component"; } from "metersphere-frontend/src/components/search/custom-component";
import MsMarkDownText from "metersphere-frontend/src/components/MsMarkDownText"; import MsMarkDownText from "metersphere-frontend/src/components/MsMarkDownText";
import {hasLicense} from "metersphere-frontend/src/utils/permission"; import {hasLicense} from "metersphere-frontend/src/utils/permission";
import MsReviewTableItem from "@/business/issue/MsReviewTableItem";
export default { export default {
name: "IssueList", name: "IssueList",
components: { components: {
MsReviewTableItem,
MsMarkDownText, MsMarkDownText,
MsMainContainer, MsMainContainer,
MsContainer, MsContainer,
@ -418,7 +416,7 @@ export default {
return; return;
} }
this.page.data.forEach(item => { this.page.data.forEach(item => {
let displayValueMap = new Map(); let displayValueMap = {};
let fieldIdSet = new Set(this.fields.map(i => i.id)); let fieldIdSet = new Set(this.fields.map(i => i.id));
this.issueTemplate.customFields.forEach(field => { this.issueTemplate.customFields.forEach(field => {
let displayValue; let displayValue;
@ -430,7 +428,7 @@ export default {
} else { } else {
displayValue = this.getCustomFieldValue(item, field); displayValue = this.getCustomFieldValue(item, field);
} }
displayValueMap.set(field.name, displayValue); displayValueMap[field.name] = displayValue;
}); });
item.displayValueMap = displayValueMap; item.displayValueMap = displayValueMap;
}); });

View File

@ -0,0 +1,27 @@
<template>
<el-popover
placement="right"
width="500"
trigger="hover"
popper-class="issues-popover">
<ms-mark-down-text :prop="prop" :data="data" :disabled="true"/>
<el-button slot="reference" type="text">{{ $t('test_track.issue.preview') }}</el-button>
</el-popover>
</template>
<script>
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
import MsMarkDownText from "metersphere-frontend/src/components/MsMarkDownText";
export default {
name: "MsReviewTableItem",
components: {MsMarkDownText, MsTableColumn},
props: {
data: Object,
prop: String,
}
}
</script>
<style scoped>
</style>