82 lines
1.9 KiB
JavaScript
82 lines
1.9 KiB
JavaScript
(function(){
|
|
|
|
|
|
SetDirviceData()
|
|
|
|
|
|
var infoID = (JSON.parse(localStorage.getItem("info"))).id;
|
|
var ListArr = JSON.parse(localStorage.getItem(list));
|
|
|
|
ListArr.forEach(function(val,index) {
|
|
if(val.id == infoID) {
|
|
$(".like").removeClass("icon-star-outline").addClass("icon-star")
|
|
}
|
|
})
|
|
|
|
|
|
|
|
var infoData = JSON.parse(localStorage.getItem("info"))
|
|
$(".info-top").css({
|
|
background: `url("${infoData.albums[0]}") center /cover no-repeat`
|
|
})
|
|
|
|
document.title = infoData.title
|
|
$(".social-share").attr({
|
|
'data-description': infoData.imtro
|
|
})
|
|
|
|
$(".info-title h2").text(`${infoData.title}`)
|
|
$(".info-title p").text(`${infoData.imtro}`)
|
|
$(".zhu p").text(`${infoData.ingredients}`)
|
|
$(".fu p").text(`${infoData.burden}`)
|
|
|
|
infoData.steps.forEach(function(val,index) {
|
|
$(".info-step").append(`<div class="step-item">
|
|
<h2>${infoData.title} 步骤 ${index+1}</h2>
|
|
<img src="${val.img}" alt="">
|
|
<p>${val.step}</p>
|
|
</div>`)
|
|
});
|
|
|
|
var $config = {
|
|
url: location.href,
|
|
title: infoData.title,
|
|
description: infoData.imtro,
|
|
image: infoData.albums[0],
|
|
sites: ['qzone', 'qq', 'weibo','wechat', 'douban'],
|
|
wechatQrcodeTitle : "微信扫一扫:分享",
|
|
wechatQrcodeHelper : '<p>微信里点“发现”,扫一下</p><p>二维码便可将本文分享至朋友圈。</p>',
|
|
};
|
|
|
|
|
|
$(".icon-share2").click(function(){
|
|
$(".share").animate({
|
|
bottom: "0"
|
|
}, 200 );
|
|
});
|
|
|
|
$(".g-view").click(function(){
|
|
$(".share").animate({
|
|
bottom: "-60px"
|
|
}, 200 );
|
|
});
|
|
|
|
|
|
|
|
|
|
$('.icon-star-outline').on("click",function() {
|
|
var data = JSON.parse(localStorage.getItem(list));
|
|
data.push(JSON.parse(localStorage.getItem("info")))
|
|
localStorage.setItem(list,JSON.stringify(data))
|
|
YDUI.dialog.toast('已收藏成功', 'success', 1000);
|
|
|
|
$(".like").removeClass("icon-star-outline").addClass("icon-star")
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})() |