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>
<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'}"
@change="change" :image-click="imageClick"
:subfield="false" :toolbars="toolbars" :language="language" :toolbarsFlag="!disabled"
@ -80,7 +80,7 @@ export default {
},
data() {
return {
result: {loading: false},
loading: false,
id: getUUID(),
xssOptions: {
whiteList: {
@ -183,13 +183,13 @@ export default {
},
methods: {
imgAdd(pos, file) {
this.result.loading = true;
this.loading = true;
uploadMarkDownImg(file)
.then((r) => {
this.$success(this.$t('commons.save_success'));
let url = '/resource/md/get?fileName=' + r.data;
this.$refs.md.$img2Url(pos, url);
this.result.loading = false;
this.loading = false;
});
this.$emit('imgAdd', file);
},

View File

@ -17,7 +17,7 @@ public class IssueProxyResourceController {
@GetMapping(value = "/md/get/url")
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) {
return issueProxyResourceService.getMdImageByUrl(url, platform, projectId, workspaceId);
@RequestParam (value = "workspace_id", required = false) String workspaceId) {
return issueProxyResourceService.getMdImageByUrl(url, platform, workspaceId);
}
}

View File

@ -29,7 +29,7 @@ public class IssueProxyResourceService {
* @param platform
* @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")) {
MSException.throwException(Translator.get("invalid_parameter"));
}

View File

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