first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
(function(){
var InfoData = JSON.parse(localStorage.getItem("info"));
var LikeData = localStorage.getItem("like") == null
? []
: JSON.parse(localStorage.getItem("like"));
var status = true;
$(".info-header").css({
'background': `url(${InfoData.albums[0]}) no-repeat center center`,
'background-size': 'cover'
})
$('.info-title h3').text(InfoData.title)
$('.info-title p').text(InfoData.tags)
$('.item1 p').text(InfoData.ingredients)
$('.item2 p').text(InfoData.burden)
InfoData.steps.forEach((val,index) => {
$('.list-item ul').append(`<li>
<h2>${index == 0 ? InfoData.title+'步骤'+(index+1) : '步骤'+(index+1)}</h2>
<img src="${val.img}" alt="">
<p class="padding20">${val.step}</p>
</li>`)
});
$("#likefood").on('click', function () {
changeStatus()
if(status) {
LikeData.push(JSON.parse(localStorage.getItem("info")))
localStorage.setItem("like", JSON.stringify(LikeData))
$("#likefood").removeClass("icon-star-outline").addClass("icon-star")
} else {
YDUI.dialog.toast('您已经收藏过了', 'error', 1000);
}
});
function checkIsLike() {
changeStatus()
if(!status) {
$("#likefood").removeClass("icon-star-outline").addClass("icon-star")
}
}
function changeStatus () {
LikeData.forEach( val => val.id == InfoData.id ? status = false : status = true);
}
checkIsLike()
})()