44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
class Video {
|
|
constructor() {
|
|
footer()
|
|
this.getVideoList();
|
|
}
|
|
|
|
async getVideoList() {
|
|
let res = await indexServe.video({
|
|
page: 1
|
|
});
|
|
|
|
res.items.forEach(v => {
|
|
$(".content_title").innerHTML += `
|
|
<li class="food">
|
|
<div class="content_img">
|
|
<i class="content_img_play"></i>
|
|
</div>
|
|
<div class="content_font">
|
|
<p class="title">${v.title}</p>
|
|
<div class="content_font_below">
|
|
<div class="content_font_below_left">
|
|
<img src="../img/user.jpg" alt="">
|
|
<span>美食杰</span>
|
|
</div>
|
|
<div class="content_font_below_right">
|
|
<i class="view"></i>
|
|
<span class="content_font_below_right_span">103k</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
`
|
|
})
|
|
|
|
_(".content_title li").forEach((v,i) => {
|
|
v.onclick = function () {
|
|
localStorage.setItem("videoInfo", JSON.stringify(res.items[i]));
|
|
location.href = "./video_detailed.html"
|
|
}
|
|
})
|
|
console.log(res)
|
|
}
|
|
}
|
|
new Video(); |