fix(测试计划): 测试计划功能用例编辑实际结果富文本框时上传图片,一段时间后图片无法查看

This commit is contained in:
AgAngle 2024-04-10 18:33:43 +08:00 committed by Craftsman
parent 4e109fa045
commit d1758335f7
2 changed files with 10 additions and 5 deletions

View File

@ -4,6 +4,9 @@
* @returns {*[]} * @returns {*[]}
*/ */
export function parseMdImage(text) { export function parseMdImage(text) {
if (!text) {
return [];
}
let regex = /\!\[.*?\]\(\/resource\/md\/get\?fileName=(.*?)\)/g; let regex = /\!\[.*?\]\(\/resource\/md\/get\?fileName=(.*?)\)/g;
let fileNames = []; let fileNames = [];
let match = regex.exec(text); let match = regex.exec(text);

View File

@ -339,16 +339,17 @@ export default {
} }
param.results = JSON.stringify(param.results); param.results = JSON.stringify(param.results);
param.actualResult = this.testCase.actualResult; param.actualResult = this.testCase.actualResult;
testPlanTestCaseEdit(param).then((response) => { testPlanTestCaseEdit(param).then(() => {
this.$success(this.$t("commons.save_success")); this.$success(this.$t("commons.save_success"));
this.updateTestCases(param); this.updateTestCases(param);
this.setPlanStatus(this.testCase.planId); this.setPlanStatus(this.testCase.planId);
this.handleMdImages({
id: param.id,
actualResult: param.actualResult,
description: this.testCase.comment,
});
if (this.testCase.comment) { if (this.testCase.comment) {
this.handleMdImages({
id: response.data.id,
description: this.testCase.comment,
});
this.$refs.comment.getComments(); this.$refs.comment.getComments();
this.testCase.comment = ""; this.testCase.comment = "";
} }
@ -362,6 +363,7 @@ export default {
// //
let mdImages = []; let mdImages = [];
mdImages.push(...parseMdImage(param.description)); mdImages.push(...parseMdImage(param.description));
mdImages.push(...parseMdImage(param.actualResult));
// //
saveMarkDownImg({ saveMarkDownImg({
projectId: getCurrentProjectID(), projectId: getCurrentProjectID(),