Skip to content

Commit

Permalink
fix: 脚本执行中任务日志更新时日志任务跳动 #3248
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 21014
  • Loading branch information
hLinx committed Oct 17, 2024
1 parent 5fa4fbd commit 61d2741
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/frontend/src/components/jb-ai/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
transition: all .1s ease-in-out;
&.active{
transform: translateX(29px);
transform: translateX(39px);
}
&:hover{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,14 @@
},
mounted() {
this.initEditor();
const handleHideAiExtendTool = () => {
this.aiExtendToolStyle = {};
};
document.body.addEventListener('mousedown', handleHideAiExtendTool);
this.$once('hook:beforeDestroy', () => {
document.body.removeEventListener('mousedown', handleHideAiExtendTool);
});
this.initAiHelper();
},
methods: {
/**
* @desc 获取脚本日志
*/
fetchLogContent() {
console.log('taskExecuteDetail = ', this.taskExecuteDetail);
if (!this.taskExecuteDetail.executeObject) {
this.isLoading = false;
if (this.editor) {
Expand Down Expand Up @@ -277,22 +272,23 @@
} = editor.renderer.layerConfig;
this.isWillAutoScroll = height + scrollTop + 30 >= maxHeight;
});
editorSession.on('changeScrollTop', () => {
console.log('editorSession = scroll');
});
console.log('editor = init', editor);
this.editor = editor;
setTimeout(() => {
document.body.querySelector('.ace_content').appendChild(this.$refs.aiExtendTool);
}, 1000);
this.$once('hook:beforeDestroy', () => {
editor.destroy();
editor.container.remove();
});
},
initAiHelper() {
const handleHideAiExtendTool = () => {
this.aiExtendToolStyle = {};
};
document.body.addEventListener('mousedown', handleHideAiExtendTool);
this.$once('hook:beforeDestroy', () => {
document.body.removeEventListener('mousedown', handleHideAiExtendTool);
});
},
/**
* @desc 外部调用
*/
Expand Down Expand Up @@ -326,6 +322,7 @@
autoScrollTimeout() {
if (this.isWillAutoScroll && !this.isLoading) {
this.handleScrollBottom();
return;
}
setTimeout(() => {
this.autoScrollTimer = this.autoScrollTimeout();
Expand All @@ -345,7 +342,6 @@
this.editor.scrollToLine(Infinity);
},
handleMouseUp(event) {
console.log('handleMouseUphandleMouseUphandleMouseUp', this.isAiEnable);
if (!this.isAiEnable) {
return;
}
Expand All @@ -354,18 +350,15 @@
this.aiExtendToolStyle = {};
return;
}
console.log('handleMouseUphandleMouseUphandleMouseUp');
const containerEle = document.body.querySelector('.ace_content');
const {
left: contentBoxLeft,
top: contentBoxTop,
} = getOffset(containerEle);
} = getOffset(this.$refs.contentBox);
const [transformY] = containerEle.style.transform.match(/([\d]+)[^\d]+$/);
const { pageX, pageY } = event;
this.aiExtendToolStyle = {
display: 'flex',
top: `${Math.max(pageY - 40 - contentBoxTop + parseInt(transformY, 10), 8)}px`,
top: `${Math.max(pageY - 40 - contentBoxTop, 8)}px`,
left: `${Math.max(pageX + 4 - contentBoxLeft, 8)}px`,
};
});
Expand Down Expand Up @@ -523,7 +516,7 @@
}
.ai-extend-tool{
position: fixed;
position: absolute;
z-index: 1000;
display: none;
width: 32px;
Expand Down

0 comments on commit 61d2741

Please sign in to comment.