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(`
${v.seo_title.substring(0,7)}
美食杰
${v.click_num}
`)
})
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()