fix(测试跟踪): 功能用例多次点击删除评论按钮报错

--bug=1013667 --user=李玉号 【测试跟踪】功能用例 删除评论 ,多次点击删除 按钮 页面会报错
https://www.tapd.cn/55049933/s/1169565
This commit is contained in:
shiziyuan9527 2022-05-31 11:40:07 +08:00 committed by 刘瑞斌
parent dfc0e5aa49
commit 0b2225c010
4 changed files with 21 additions and 2 deletions

View File

@ -86,6 +86,9 @@ public class TestCaseCommentService {
private void checkCommentOwner(String commentId) {
TestCaseComment comment = testCaseCommentMapper.selectByPrimaryKey(commentId);
if (comment == null) {
MSException.throwException("The requested resource does not exist.");
}
if (!StringUtils.equals(comment.getAuthor(), SessionUtils.getUser().getId())) {
MSException.throwException(Translator.get("check_owner_comment"));
}

View File

@ -20,7 +20,7 @@
</span>
<span class="comment-delete">
<el-link icon="el-icon-edit" style="font-size: 9px;margin-right: 6px;" @click="openEdit" :disabled="readOnly"/>
<el-link icon="el-icon-close" @click="deleteComment" :disabled="readOnly"/>
<el-link icon="el-icon-close" v-prevent-link-re-click @click="deleteComment" :disabled="readOnly"/>
</span>
<br/>

View File

@ -18,7 +18,7 @@ import '../common/css/menu-header.css';
import '../common/css/main.css';
import CKEditor from '@ckeditor/ckeditor5-vue';
import VueFab from 'vue-float-action-button'
import {left2RightDrag, bottom2TopDrag, right2LeftDrag} from "../common/js/directive";
import {left2RightDrag, bottom2TopDrag, right2LeftDrag, onceLinkClick} from "../common/js/directive";
import JsonSchemaEditor from './components/common/json-schema/schema/index';
import ComparedEditor from './components/history/api/json-view/schema/index';
import JSONPathPicker from 'vue-jsonpath-picker';
@ -81,6 +81,9 @@ Vue.directive('preventReClick', {
}
});
// 防止a标签重复点击
Vue.directive('preventLinkReClick', onceLinkClick);
// 添加全局事件总线
Vue.prototype.$EventBus = new Vue();

View File

@ -57,3 +57,16 @@ export const bottom2TopDrag = {
};
}
};
export const onceLinkClick = {
inserted (el, binding) {
el.addEventListener('click', () => {
if (el.style.pointerEvents === '') {
el.style.pointerEvents = 'none'; // 防止a标签
setTimeout(() => {
el.style.pointerEvents = '';
}, binding.value || 3000);
}
})
}
}