From f0a3a34d7bb7015e4ca1a8ac61136134e9c0f4df Mon Sep 17 00:00:00 2001 From: Gitea Date: Wed, 7 Apr 2021 21:40:59 +0800 Subject: [PATCH] add divide pages --- templates/repo/modelarts/trainjob/show.tmpl | 104 +++++++++++--------- 1 file changed, 55 insertions(+), 49 deletions(-) diff --git a/templates/repo/modelarts/trainjob/show.tmpl b/templates/repo/modelarts/trainjob/show.tmpl index 94d93b019..44084611b 100755 --- a/templates/repo/modelarts/trainjob/show.tmpl +++ b/templates/repo/modelarts/trainjob/show.tmpl @@ -119,14 +119,13 @@ {{.log_file_name}} {{$.Link}}/{{.JobID}}/log - - +
-
{{.log.Content}}
-
- +
{{.log.Content}}
+ @@ -140,50 +139,57 @@ $('.menu .item').tab() $('.ui.style.accordion').accordion(); - $(".test").click(function(){ + $(".log").scroll(function () { + var scrollTop = $(this)[0].scrollTop; // 滚动条Y轴的滚动距离 + var scrollHeight = $(this)[0].scrollHeight; // 文档高度 + var divHeight = $(this).height(); // 可视区高度 var url = $('.fitted.address').text() var log_file_name = $('.fitted.file_name').text() - var EndLine = 1 - console.log(url) - $.ajax({ -         type: "GET", -         url: url, -         data:{ - // StartLine: StartLine, - EndLine: EndLine, - log_file_name: log_file_name, - order: asc - }, -         success:function(data){ - console.log(data) - //            if(data.success){ - //                $("searchResult").html(data.msg); - //            }else{ - //                $("#searchResult").html("出现错误:" + data.msg); - //            } -         }, -         error:function(jqXHR){ -            aler("发生错误:"+ jqXHR.status); -         } - }); - }); - - - // $(".log").scroll(function () { - // var scrollTop = $(this).scrollTop(); // 滚动条Y轴的滚动距离 - // var scrollHeight = $("pre").height(); // 内容可视区的高度,固定值 - // var windowHeight = $(this).height(); // 滚动条高度 - // console.log($(this)) - // console.log(scrollTop, scrollHeight, windowHeight) - // if (scrollTop + windowHeight == scrollHeight) { - // alert(1) - - //   //此处是滚动条到底部时候触发的事件,在这里写要加载的数据,或者是拉动滚动条的操作 - //    - //       //var page = Number($("#redgiftNextPage").attr('currentpage')) + 1; - //       //redgiftList(page); - //       //$("#redgiftNextPage").attr('currentpage', page + 1); - - // } - + console.log(scrollTop, scrollHeight, divHeight) + if(scrollTop + divHeight + 50 >= scrollHeight){ + alert("底部该加载数据了") + $.ajax({ +         type: "GET", +         url: url, +         data:{ + EndLine: EndLine, + log_file_name: log_file_name, + order: 'asc' + }, +         success:function(data){ + if (data==""){ + alert("日志到底了") + }else{ + pre.preappend(data) + } +         }, +         error:function(jqXHR){ +            alert("发生错误:"+ jqXHR.status); +         } + }); + } + if(scrollTop == 0){ + alert("顶部该加载数据了") + $.ajax({ +         type: "GET", +         url: url, +         data:{ + StartLine: StartLine, + log_file_name: log_file_name, + order: 'desc' + }, +         success:function(data){ + console.log(data) + if (data==""){ + alert("日志到顶了") + }else{ + pre.preappend(data) + } +         }, +         error:function(jqXHR){ +            alert("发生错误:"+ jqXHR.status); +         } + }); + } + }) \ No newline at end of file