feat(案例评审): 修复案例评审富文本框的相关问题
--bug=1005230 --user=宋天阳 【测试跟踪-测试用例】测试执行中评论添加连接图片无效 https://www.tapd.cn/55049933/s/1029246;--bug=1005224 --user=宋天阳 【测试跟踪-测试计划】测试用例执行中评论右上角按键无效 https://www.tapd.cn/55049933/s/1029252;--bug=1005223 --user=宋天阳 【测试跟踪-测试计划】测试计划中评论用例,上传图片后自动发布评论,且再次点击图片标志,上传图片的名称依然在 https://www.tapd.cn/55049933/s/1029254
This commit is contained in:
parent
0e46177fa1
commit
74f0fedc84
|
@ -2,10 +2,11 @@
|
|||
<div v-loading="result.loading">
|
||||
<div class="comment-list">
|
||||
<review-comment-item v-for="(comment) in comments" v-bind:key="comment.id"
|
||||
ref="reviewComments"
|
||||
:comment="comment"
|
||||
@refresh="refresh"
|
||||
:review-status="reviewStatus"/>
|
||||
<div v-if="comments.length === 0" style="text-align: center">
|
||||
<div v-if="comments.length === 0" style="text-align: center" >
|
||||
<i class="el-icon-chat-line-square" style="font-size: 15px;color: #8a8b8d;">
|
||||
<span style="font-size: 15px; color: #8a8b8d;">
|
||||
{{ $t('test_track.comment.no_comment') }}
|
||||
|
@ -68,7 +69,7 @@ export default {
|
|||
fullscreen: false, // 全屏编辑
|
||||
readmodel: false, // 沉浸式阅读
|
||||
htmlcode: false, // 展示html源码
|
||||
help: true, // 帮助
|
||||
help: false, // 帮助
|
||||
/* 1.3.5 */
|
||||
undo: false, // 上一步
|
||||
redo: false, // 下一步
|
||||
|
@ -107,7 +108,9 @@ export default {
|
|||
this.result = this.$post('/test/case/comment/save', comment, () => {
|
||||
this.$success(this.$t('test_track.comment.send_success'));
|
||||
this.refresh();
|
||||
this.$refs.md.toolbar_left_click('trash');
|
||||
if(this.$refs.md){
|
||||
this.$refs.md.toolbar_left_click('trash');
|
||||
}
|
||||
});
|
||||
},
|
||||
/* inputLight() {
|
||||
|
@ -145,13 +148,15 @@ export default {
|
|||
return isImg;
|
||||
},
|
||||
imgDel(file) {
|
||||
if (file && !this.clearImg) {
|
||||
this.$get('/resource/md/delete/' + file[1].prefix + "_" + file[1].name);
|
||||
}
|
||||
let fileUrl = file[1].prefix + "_" + file[1].name;
|
||||
let comments = this.$refs.reviewComments;
|
||||
comments.forEach(item => {
|
||||
let imgCheckResult = item.checkByUrls(fileUrl);
|
||||
if(imgCheckResult){
|
||||
item.deleteComment();
|
||||
}
|
||||
});
|
||||
},
|
||||
alertComment(){
|
||||
alert(JSON.stringify(this.comments))
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -101,15 +101,15 @@ export default {
|
|||
this.$warning(this.$t('test_track.comment.cannot_delete'));
|
||||
return;
|
||||
}
|
||||
this.$get("/test/case/comment/delete/" + this.comment.id, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.$emit("refresh");
|
||||
});
|
||||
if(this.imgNameList.length > 0){
|
||||
this.imgNameList.forEach(imgName => {
|
||||
this.$get('/resource/md/delete/' + imgName);
|
||||
});
|
||||
}
|
||||
this.$get("/test/case/comment/delete/" + this.comment.id, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.$emit("refresh");
|
||||
});
|
||||
},
|
||||
openEdit() {
|
||||
if (getCurrentUser().id !== this.comment.author) {
|
||||
|
@ -131,9 +131,9 @@ export default {
|
|||
let returnFlag = false;
|
||||
if(param){
|
||||
let message = param+"";
|
||||
let messageSplitArr = message.split("](/resource/md/get/");
|
||||
let matchIndex = message.indexOf("](/resource/md/get/");
|
||||
if(matchIndex > 0){
|
||||
let messageSplitArr = message.split("](/resource/md/get/");
|
||||
for(let itemIndex = 0;itemIndex < messageSplitArr.length; itemIndex ++){
|
||||
let itemStr = messageSplitArr[itemIndex];
|
||||
let picNameIndex = itemStr.indexOf("![");
|
||||
|
@ -148,7 +148,6 @@ export default {
|
|||
|
||||
let imgUrl = "/resource/md/get/"+itemStrArr;
|
||||
this.src = imgUrl;
|
||||
|
||||
if(this.srcList.indexOf(itemStrArr) < 0){
|
||||
this.srcList.push(imgUrl);
|
||||
}
|
||||
|
@ -162,6 +161,37 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
let imgUrlIndex = message.indexOf("](http");
|
||||
if(imgUrlIndex > 0){
|
||||
let imgUrlSplitArr = message.split("](http");
|
||||
for(let itemIndex = 0;itemIndex < imgUrlSplitArr.length; itemIndex ++){
|
||||
let itemStr = imgUrlSplitArr[itemIndex];
|
||||
let picNameIndex = itemStr.indexOf("![");
|
||||
if( picNameIndex < 0){
|
||||
let endUrlIndex = itemStr.indexOf(")");
|
||||
if( endUrlIndex > 0){
|
||||
let itemStrArr = itemStr.substr(0,endUrlIndex);
|
||||
//if(imgNameList.)
|
||||
if(this.imgNameList.indexOf(itemStrArr) < 0){
|
||||
this.imgNameList.push(itemStrArr);
|
||||
}
|
||||
let imgUrl = "http"+itemStrArr;
|
||||
this.src = imgUrl;
|
||||
if(this.srcList.indexOf(itemStrArr) < 0){
|
||||
this.srcList.push(imgUrl);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
let inputStr = itemStr.substr(0,picNameIndex);
|
||||
if(this.imgDescription === ""){
|
||||
this.imgDescription = inputStr;
|
||||
}else {
|
||||
this.imgDescription = "\n" + inputStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this.srcList.length > 0){
|
||||
returnFlag = true;
|
||||
|
@ -169,6 +199,17 @@ export default {
|
|||
}
|
||||
return returnFlag;
|
||||
},
|
||||
checkByUrls(url){
|
||||
let checkResultFlag = false;
|
||||
if(this.imgNameList.length > 0){
|
||||
this.imgNameList.forEach(imgName => {
|
||||
if(imgName === url){
|
||||
checkResultFlag = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
return checkResultFlag;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue