| @@ -422,10 +422,10 @@ td, th { | |||||
| <div class="ui tab" data-tab="second{{$k}}"> | <div class="ui tab" data-tab="second{{$k}}"> | ||||
| <div style="position: relative;"> | <div style="position: relative;"> | ||||
| <span> | <span> | ||||
| <a title="滚动到顶部" style="position: absolute; right: -32px;cursor: pointer;"><i class="icon-to-top"></i></a> | |||||
| <a title="滚动到顶部" style="position: absolute; right: -32px;cursor: pointer;" id="log_top"><i class="icon-to-top"></i></a> | |||||
| </span> | </span> | ||||
| <span> | <span> | ||||
| <a title="滚动到底部" style="position: absolute; bottom: 10px;right: -32px;cursor: pointer;"><i class="icon-to-bottom"></i></a> | |||||
| <a title="滚动到底部" style="position: absolute; bottom: 10px;right: -32px;cursor: pointer;" id="log_bottom"><i class="icon-to-bottom"></i></a> | |||||
| </span> | </span> | ||||
| <div class="ui message message{{.VersionName}}" style="display: none;"> | <div class="ui message message{{.VersionName}}" style="display: none;"> | ||||
| <div id="header"></div> | <div id="header"></div> | ||||
| @@ -888,27 +888,54 @@ td, th { | |||||
| function scrollAnimation(dom, currentY, targetY, currentX) { | function scrollAnimation(dom, currentY, targetY, currentX) { | ||||
| let needScrollTop = targetY - currentY; | let needScrollTop = targetY - currentY; | ||||
| let _currentY = currentY; | let _currentY = currentY; | ||||
| let context = this; | |||||
| setTimeout(() => { | setTimeout(() => { | ||||
| // 一次调用滑动帧数,每次调用会不一样 | // 一次调用滑动帧数,每次调用会不一样 | ||||
| //取总距离的十分之一 | //取总距离的十分之一 | ||||
| const dist = Math.ceil(needScrollTop / 10); | const dist = Math.ceil(needScrollTop / 10); | ||||
| _currentY += dist; | _currentY += dist; | ||||
| //移动一个十分之一 | //移动一个十分之一 | ||||
| console.log(_currentY, targetY) | |||||
| dom.scrollTo(currentX || 0, _currentY); | dom.scrollTo(currentX || 0, _currentY); | ||||
| // 如果移动幅度小于十个像素,直接移动,否则递归调用,实现动画效果 | // 如果移动幅度小于十个像素,直接移动,否则递归调用,实现动画效果 | ||||
| if (needScrollTop > 10 || needScrollTop < -10) { | if (needScrollTop > 10 || needScrollTop < -10) { | ||||
| context.scrollAnimation(dom, _currentY, targetY) | |||||
| scrollAnimation(dom, _currentY, targetY) | |||||
| } else { | } else { | ||||
| dom.scrollTo(_currentY, targetY) | |||||
| dom.scrollTo(0, targetY) | |||||
| } | } | ||||
| }, 1) | }, 1) | ||||
| } | } | ||||
| function scrollTop(){ | |||||
| let logContentDom = document.querySelector('.log'), context = this; | |||||
| $('#log_top').click(function(){ | |||||
| let logContentDom = document.querySelector('.log') | |||||
| if(!logContentDom) | if(!logContentDom) | ||||
| return | return | ||||
| scrollAnimation(logContentDom, logContentDom.scrollTop, 0); | scrollAnimation(logContentDom, logContentDom.scrollTop, 0); | ||||
| } | |||||
| }) | |||||
| $('#log_bottom').click(function(){ | |||||
| let logContentDom = document.querySelector('.log') | |||||
| if(!logContentDom) | |||||
| return | |||||
| //如果内容撑大到可以滚动,则触发滚动 | |||||
| // if(!['10','11','12'].includes(context.taskInfo.statusCode)){ | |||||
| // context.getLogContent(0, context.lines, 'goDown') | |||||
| // } | |||||
| if(logContentDom.scrollHeight > logContentDom.clientHeight){ | |||||
| console.log("1111") | |||||
| scrollAnimation(logContentDom, logContentDom.scrollTop, logContentDom.scrollHeight - logContentDom.clientHeight); | |||||
| } | |||||
| else{ | |||||
| logScroll(version_name) | |||||
| logContentDom.scrollTo(0,logContentDom.scrollTop-1); | |||||
| } | |||||
| // if(this.checkCurrentCanScrollBottom()){ | |||||
| // // this.goDown(); | |||||
| // this.scrollAnimation(logContentDom, logContentDom.scrollTop, logContentDom.scrollHeight - logContentDom.clientHeight); | |||||
| // }else{ | |||||
| // //如果内容不足,则往后追加内容 | |||||
| // this.goDown(); | |||||
| // logContentDom.scrollTo(0,logContentDom.scrollTop-1); | |||||
| // } | |||||
| }) | |||||
| </script> | </script> | ||||