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,110 @@
class infoget {
constructor() {
this.likeList
= localStorage.getItem("list") == null
? []
: JSON.parse(localStorage.getItem("list"));
this.currentifo = {},
this.infoSevice()
}
async infoSevice () {
var res = await infoSevice.infoSevice({
page:1,
id:GetUrlParam("id"),
t:GetUrlParam("name"),
});
this.currentifo = res
$(".action").append(`
<a onclick=window.history.go(-1)> <i class="iconfont icon-back1"></i></a>
<span>写真集详情</span>
`)
res.data.forEach((v) =>{
$(".info").append(`
<figure>
<a href="" data-size="1800x2700">
<img src="${v.src}"
alt="${v.title}">
</a>
</figure>
`)
})
this.like();
}
like() {
var isHave = this.likeList.filter((items,index) => {
// console.log(items)
if (item.data != this.currentifo.data) {
// console.log(this.currentifo.data[0].title)
return items
}
});
isHave.forEach((v,i)=>{
console.log(v.title)
console.log(this.currentifo.data[i].title)
if (v.title = this.currentifo.data[i].title) {
$(".likeicon").removeClass("icon-xin").addClass("icon-aixin");
}
})
// 切换收藏 与 取消收藏
$('.likeicon').on('click', () =>{
// console.log(this.currentifo)
if ($(".likeicon").hasClass("icon-xin")) {
$(".likeicon").removeClass("icon-xin ").addClass("icon-aixin");
this.likeList.push(this.currentifo)
// console.log(this.likeList)
localStorage.setItem("list", JSON.stringify(this.likeList))
} else {
$(".likeicon").removeClass("icon-aixin ").addClass("icon-xin");
this.likeList = this.likeList.filter((item,index) => {
// console.log("item.data",item.data)
// console.log("this.currentifo.data",this.currentifo.data)
if (item.data !== this.currentifo.data) {
return item
}
// console.log(item)
});
localStorage.setItem("list", JSON.stringify(this.likeList))
}
})
}
}
function GetUrlParam(paraName) {
var url = document.location.toString();
var arrObj = url.split("?");
if (arrObj.length > 1) {
var arrPara = arrObj[1].split("&");
var arr;
for (var i = 0; i < arrPara.length; i++) {
arr = arrPara[i].split("=");
if (arr != null && arr[0] == paraName) {
return arr[1];
}
}
return "";
}
else {
return "";
}
}
new infoget();