class info { constructor () { this.getInfo(); } async getInfo() { let res = await indexServe.info({ url: query("url") }); $(".header img").src = res.backImg $(".info_main h2").innerText = res.title $(".info_main .posttime").innerText = res.posttime; res.Statistics.forEach(v => { $(".yyinfos").innerHTML += `
  • ${v.title}
  • ` }); res.stepInfo.arr.forEach(v => { $(".cpargsw").innerHTML += `
  • ${v.title}
  • ` }) $(".show_more .text").innerText = res.stepInfo.message; $(".more").onclick = () => { if ($(".more span").innerText == "展开") { $(".more span").innerText = "收起" $(".more img").style = `transform: rotate(180deg);` $(".show_more").style.height = "auto"; } else { $(".more span").innerText = "展开" $(".more img").style = `transform: rotate(0deg);` $(".show_more").style.height = "42px"; } } res.material.main.forEach(v => { $(".zhuliao ul").innerHTML+=`
  • ${v.title}
    ${v.nums}
  • ` }) res.material.accessories.forEach(v => { $(".fuliao ul").innerHTML+=`
  • ${v.title}
    ${v.nums}
  • ` }) res.DetailedSteps.forEach(v => { $(".info_list").innerHTML+=` ${ Array.isArray(v.step_img) ? `
  • 成品图
    ${ v.step_img.map((item,index) => { return `` }).toString().replaceAll(",", "") }
  • ` : v.step_img == null ? `
  • 烹饪技巧
    ${v.step_text}
  • ` : `
  • ${v.step_title}

    ${v.step_text}

  • ` }` }) _(".change_list img").forEach(v => { v.onclick = () => { _(".change_list img").forEach( item => item.style.opacity = 0.4) $(".cpimg img").src = v.src v.style.opacity = 1 } }) console.log(res) } } new info()