73 lines
2.1 KiB
JavaScript
73 lines
2.1 KiB
JavaScript
class Video {
|
||
constructor() {
|
||
this.videoMenu();
|
||
// this.Url = GetQueryString("url")\
|
||
this.page = 1
|
||
this.scrollLoadData()
|
||
}
|
||
async videoMenu() {
|
||
let res = await VideoService.Foodrecipes({
|
||
page:this.page
|
||
});
|
||
|
||
res.items.forEach((v, i) => {
|
||
$(".content").append(`
|
||
<li>
|
||
<a >
|
||
<div class="content_pic" style="background-image: url(${v.bd_photo});">
|
||
<div class="pic_yingyin">
|
||
<i class="iconfont icon-play"></i>
|
||
</div>
|
||
</div>
|
||
<p>${v.seo_title.substring(0,7)}</p>
|
||
<div class="pic_pinglun">
|
||
<div class="toux_left">
|
||
<img src="../img/ms.jpg" alt="">
|
||
<span>美食杰</span>
|
||
</div>
|
||
<div class="toux_right">
|
||
<i class="iconfont icon-faxian"></i>
|
||
<span>${v.click_num}</span>
|
||
</div>
|
||
</div>
|
||
</a>
|
||
</li>
|
||
`)
|
||
})
|
||
var videoarr = {};
|
||
|
||
$(function() {
|
||
$('.content').find('li').each(function() {
|
||
$(this).click(function() {
|
||
addData($(this).index());
|
||
})
|
||
})
|
||
|
||
})
|
||
function addData(index) {
|
||
videoarr.title= res.items[index].seo_title,
|
||
videoarr.practice= res.items[index].intro,
|
||
videoarr.video= res.items[index].xhz_video_url
|
||
|
||
console.log(videoarr);
|
||
localStorage.setItem("video", JSON.stringify(videoarr))
|
||
|
||
location.href = "./videoinfo.html"
|
||
}
|
||
}
|
||
scrollLoadData(){
|
||
var scroll = new auiScroll({
|
||
listen: true,
|
||
distance: 10 //判断到达底部的距离,isToBottom为true
|
||
}, (ret) => {
|
||
if(ret.isToBottom){
|
||
this.page += 1;
|
||
this.videoMenu()
|
||
}
|
||
});
|
||
}
|
||
|
||
|
||
}
|
||
|
||
new Video() |