first commit
This commit is contained in:
60
h5/js/page/mechanism_info.js
Normal file
60
h5/js/page/mechanism_info.js
Normal file
@@ -0,0 +1,60 @@
|
||||
class MechanismInfo {
|
||||
|
||||
constructor () {
|
||||
// 设置标题栏文字
|
||||
utils.SetHeaderTitle(utils.GetQueryString("t"))
|
||||
this.GetMechanismInfo()
|
||||
}
|
||||
|
||||
async GetMechanismInfo() {
|
||||
var res = []
|
||||
if (utils.GetQueryString("type") == "tags") {
|
||||
res = await homeService.classList({
|
||||
page: 0,
|
||||
id: utils.GetQueryString("id")
|
||||
})
|
||||
} else {
|
||||
res = await homeService.mechanismList({
|
||||
page: 0,
|
||||
id: utils.GetQueryString("id")
|
||||
})
|
||||
}
|
||||
|
||||
console.log(res);
|
||||
|
||||
res.data.forEach(v => {
|
||||
document.querySelector(".jglist ul").innerHTML+=
|
||||
`
|
||||
<li>
|
||||
<div class="newest_img">
|
||||
<a href="./info.html?id=${v.id}">
|
||||
<img src="${v.preview}" alt="${v.title}">
|
||||
</a>
|
||||
<span>${v.total}P</span>
|
||||
</div>
|
||||
<div class="newest_text">
|
||||
<a href="./info.html?id=${v.id}">
|
||||
<p class="t">${v.title}</p>
|
||||
<p class="source">${v.user}</p>
|
||||
${
|
||||
v.hasOwnProperty("source")
|
||||
? `<p class="source">${v.source}</p>`
|
||||
: ''
|
||||
}
|
||||
</a>
|
||||
<div class="tags">
|
||||
${
|
||||
(v.tags.map((t) => {
|
||||
return `<div class="tags_item"><a href="./mechanism_info.html?id=${t.id}&type=tags&t=${t.title}">${t.title}</a></div>`
|
||||
})).toString().replace(/,/ig, " ")
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
`
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new MechanismInfo()
|
||||
Reference in New Issue
Block a user