84 lines
2.3 KiB
HTML
84 lines
2.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Document</title>
|
|
<link rel="stylesheet" href="./css/clear.css">
|
|
<link rel="stylesheet" href="./css/public.css">
|
|
<link rel="stylesheet" href="./css/index.css">
|
|
|
|
</head>
|
|
<body>
|
|
<ul>
|
|
</ul>
|
|
</body>
|
|
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
|
|
|
|
<script src="./js/ajax.js"></script>
|
|
<script src="./js/utils.js"></script>
|
|
<script src="./js/index.js"></script>
|
|
<script>
|
|
var ul = document.querySelector("ul");
|
|
var page = '';
|
|
|
|
function getData() {
|
|
http({
|
|
url: 'http://127.0.0.1:3000/api/list',
|
|
method: 'GET',
|
|
data: {
|
|
page: page
|
|
},
|
|
success: function (res) {
|
|
page = res.data.pcursor
|
|
AppendUl(res.data)
|
|
}
|
|
})
|
|
}
|
|
|
|
function AppendUl(res) {
|
|
console.log(page)
|
|
res.list.forEach((val,index)=>{
|
|
ul.innerHTML+= `
|
|
<li>
|
|
<div class="toubu">
|
|
<div class="mohu" style="background: url(${val.thumbnailUrl});"></div>
|
|
<img src="${val.thumbnailUrl}" alt="">
|
|
</div>
|
|
<div class="bottom">
|
|
<div class="toux">
|
|
<a href="">
|
|
<img src="${val.user.avatar}" alt="">
|
|
<span>${val.user.name}</span>
|
|
</a>
|
|
</div>
|
|
<div class="dzsc">
|
|
<a class="down" href="">下载</a>
|
|
<a onclick="myFunction()" class="play" href="./play.html?uid=${val.user.id}&vid=${val.id}">播放</a>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
`
|
|
})
|
|
}
|
|
|
|
getData()
|
|
|
|
|
|
|
|
// $(".play").onclick(function () {
|
|
// $("video").get(0).play()
|
|
// });
|
|
$(window).scroll(function () {
|
|
var scrollTop = $(this).scrollTop();
|
|
var scrollHeight = $(document).height();
|
|
var windowHeight = $(this).height();
|
|
if (scrollTop + windowHeight == scrollHeight) {
|
|
getData()
|
|
console.log("到底了,发起请求")
|
|
}
|
|
});
|
|
|
|
|
|
</script>
|
|
</html> |