<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta content="telephone=no" name="format-detection"> <meta name="wap-font-scale" content="no"> <title>平臺輔助記錄</title> <link rel="stylesheet" href="css/reset.css"> <link rel="stylesheet" href="css/index.css"> <script type="text/javascript" src="js/fsize.js"></script> </head> <body> <div class="assistRecord"> <div class="title"> <div class="left"> <img class="icon" src="img/date.png" alt=""> <span class="txt">發放日期</span> </div> <div class="right"> <img class="icon" src="img/fire.png" alt=""> <span class="txt">輔助金豆數</span> </div> </div> <div class="list-box"> <ul class="list"> <!--<li class="item">--> <!--<span class="left">2018年6月6日 11:21</span>--> <!--<div class="right">--> <!--<img class="icon" src="img/filefly.png" alt="">--> <!--<span class="score">20000</span>--> <!--</div>--> <!--</li>--> </ul> </div> </div> </body> <script type="text/javascript" src="js/jquery-3.2.1.min.js"></script> <script type="text/javascript"> $ip = "https://webserver.yabolive.net"; var page = 1; var isMore = true; var addFlag = true; getData(page); function getData (page) { $.ajax({ url: $ip + '/user/getsubsidy.html', type: 'POST', dataType: 'json', data: { uid: sessionStorage.bbb, token: sessionStorage.kkk, lang: '1', cid: 'h5_gw', os: 'h5', page: page, pageSize: 15, type: 1 }, success: function (res) { console.log(res); var html = ''; if (res.list.length != 0) { for (var i = 0; i < res.list.length; i++) { html += '<li class="item">'; html += '<span class="left">'+gettime(res.list[0].time)+'</span>'; //2018年6月6日 11:21 html += '<div class="right">'; html += '<img class="icon" src="img/filefly.png" alt="">'; html += '<span class="score">'+res.list[0].fireflynum+'</span>'; html += '</div>'; html += '</li>'; } }else { html += '<div class="no-data">'; html += '<img class="no-record" src="img/no-record.png" alt="">'; html += '<p class="txt">暫時沒有平臺輔助記錄</p>'; html += '</div>'; } $(".list").append(html); addFlag = true; if (res.list[14] == undefined) { isMore = false; } }, error: function () { } }); } function gettime(date){ var date = new Date(date);//如果date为10位不需要乘1000 var Y = date.getFullYear() + '-'; var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'; var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' '; var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'; var m = (date.getMinutes() <10 ? '0' + date.getMinutes() : date.getMinutes()); var s = (date.getSeconds() <10 ? '0' + date.getSeconds() : date.getSeconds()); return Y+M+D+h+m; } var end = 1; next = true; // $(window).bind("scroll", function () { // if ($(document).scrollTop() + $(window).height() > $(document).height() - 1 && end != 0 && next)// 接近底部100px // { // alert(); // if (more == true) { // // money(Mpage) // } // } // }); $(".list-box").bind("scroll", function () { console.log($('.list-box').height() + $(".list-box").scrollTop()); console.log($(".list").height()); if ($('.list-box').height() + $(".list-box").scrollTop() >= $(".list").height() - 100) { console.log(addFlag + '---' + addFlag); if (addFlag) { if (isMore) { page++; getData(page); } addFlag = false; } } }); </script> </html>