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,6 @@
class Agreement{
constructor() {
pHeader("用户协议")
}
}
new Agreement()

View File

@@ -0,0 +1,69 @@
class Edit {
constructor() {
pHeader("分类编辑")
// 已选
this.principal = get_storage("principal")
// 待选
this.additional = get_storage("additional")
this.yx();
}
yx () {
$(".yx").empty()
this.principal.forEach(v => {
$(".yx").append(`
<li>${v.title}</li>
`)
});
var self = this
$(".yx li").click(function () {
self.additional.push(self.principal[$(this).index()])
self.principal = self.principal.filter((v,i) => {
if (i != $(this).index()) {
return v
}
});
set_storage("principal", self.principal)
set_storage("additional", self.additional)
self.yx()
})
$(".dx").empty()
this.additional.forEach(v => {
$(".dx").append(`
<li>${v.title}</li>
`)
})
var self = this
$(".dx li").click(function () {
self.principal.push(self.additional[$(this).index()])
self.additional = self.additional.filter((v,i) => {
if (i != $(this).index()) {
return v
}
});
set_storage("principal", self.principal)
set_storage("additional", self.additional)
self.yx()
})
}
}
new Edit()

View File

@@ -0,0 +1,143 @@
class Index {
constructor() {
this.currentIndex = 0;
this.classData = []
this.geIndex();
this.GetType();
footer()
$(".search").click(function (){
window.location.replace("search.html");
})
lui.scrollToBottom('.swiper-slide-active',function(){
})
}
async GetType() {
var principal = [], additional = []
if (localStorage.getItem("principal") == null) {
let res = await indexServe.type();
principal = res.principal
additional = res.additional
localStorage.setItem("principal", JSON.stringify(principal))
localStorage.setItem("additional", JSON.stringify(additional))
} else {
principal = get_storage("principal")
additional = get_storage("additional")
}
var self = this;
principal.unshift({
title: '首页',
id: -1,
page: 0,
content: []
})
this.classData = principal
principal.forEach((v,i) => {
$(".header_menu ul").append(`
<li class="${i == 0 ? 'active': ''}">${v.title}</li>
`)
if (i > 0) {
$(".page-wrapper").append(`
<div class="swiper-slide eee list_fa padding_16 top"></div>
`)
}
});
var page = new Swiper ('.page-container', {
direction: 'horizontal',
on:{
slideChange: function (){
self.currentIndex = this.activeIndex;
$(".header_menu ul li").eq(this.activeIndex).addClass("active").siblings().removeClass("active")
self.getClassList();
},
},
})
$(".header_menu ul li").click(function () {
self.currentIndex = $(this).index()
$(this).addClass("active").siblings().removeClass("active")
page.slideTo($(this).index())
})
}
async getClassList() {
if (this.classData[this.currentIndex].id != -1) {
if (this.classData[this.currentIndex].content.length == 0) {
let res = await indexServe.classList({
page: this.classData[this.currentIndex].page,
id: this.classData[this.currentIndex].id
});
this.classData[this.currentIndex].total_page = res.total_page
this.classData[this.currentIndex].content = [
...this.classData[this.currentIndex].content,
...res.data
]
item($(".page-wrapper .eee").eq(this.currentIndex -1),
this.classData[this.currentIndex].content)
}
}
}
async geIndex() {
let data = await indexServe.index()
console.log(data)
var modelArr = [ { content: [] }, { content: [] } ]
data.model.res.forEach((v,i) => {
if (i<4) {
modelArr[0].content.push(v)
} else {
modelArr[1].content.push(v)
}
})
modelArr.forEach(v=> {
$(".model-wrapper").append(`
<ul class="swiper-slide">
${
v.content.map(item => {
return ` <li>
<a href="./model_info.html?id=${item.id}&t=${item.title}">
<div class="top">
<img src="${item.preview}" alt="">
<span>${item.total}</span>
</div>
<p>${item.title}</p>
</a>
</li>`
}).toString().replaceAll(",","")
}
</ul>
`)
})
item(".news", data.newest.data)
item(".remm", data.recommended.data)
new Swiper ('.model-container', {
direction: 'horizontal',
})
}
}
new Index()

View File

@@ -0,0 +1,118 @@
class Info {
constructor() {
this.res = {}
this.like = {}
this.likeArr =
localStorage.getItem("like") == null
? []
: JSON.parse(localStorage.getItem("like"))
this.page = 1;
this.total_page = 0;
this.pswpElement = $(".pswp")[0]
this.getInfo()
.then(() => this.renderInfo())
}
async getInfo() {
this.res = await indexServe.info({
page: this.page,
id: query("id")
});
this.total_page = this.res.total_page
// 详情页
this.res.data.forEach(v => {
var image = new Image();
image.src = v.src
image.onload = () => {
if (image.width < image.height) {
this.like.preview = v.src
}
$(".info_img").append(`
<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<a href="${v.src}" itemprop="contentUrl" data-size="${image.width}x${image.height}">
<img src="${v.src}" itemprop="thumbnail" alt="${v.title}" />
</a>
<figcaption itemprop="caption description">${v.title}</figcaption>
</figure>
`)
}
})
initPhotoSwipeFromDOM(".info_img")
$(".tuijian").empty()
$(".xianguan").empty()
item(".tuijian", this.res.recommend)
item(".xianguan", this.res.relevant)
}
renderInfo() {
console.log(this.res)
pHeader(this.res.title, `
<i class="iconfont like icon-xin"></i>
<i class="iconfont icon-home"></i>
`);
this.like = {
id: query("id"),
title: this.res.title,
total: this.res.total,
preview: query("img")
}
console.log(this.like,'aaaaaaa')
var isHave = this.likeArr.filter((v,i) => {
if (v.id == query("id")) {
return v
}
})
// 本地收藏过了
if (isHave.length != 0) {
$(".like").removeClass("icon-xin")
$(".like").addClass("icon-aixin")
} else {
$(".like").removeClass("icon-aixin")
$(".like").addClass("icon-xin")
}
$(".like").click(() => {
// 空心,表示未收藏,改成实心 收藏
if ($(".like").hasClass("icon-xin")) {
$(".like").removeClass("icon-xin")
$(".like").addClass("icon-aixin")
this.likeArr.push(this.like)
localStorage.setItem("like",JSON.stringify(this.likeArr))
} else {
$(".like").removeClass("icon-aixin")
$(".like").addClass("icon-xin")
this.likeArr = this.likeArr.filter((v,i) => {
if (v.id != query("id")) {
return v
}
})
localStorage.setItem("like",JSON.stringify(this.likeArr))
}
})
$(".icon-xiangxia").click(() => {
this.page+=1
if (this.page == this.total_page) {
$(".icon-xiangxia").hide()
}
this.getInfo()
})
}
}
new Info();

View File

@@ -0,0 +1,34 @@
class Like {
constructor() {
pHeader("我的收藏", `<i class="like iconfont icon-home" style="display: flex;"></i>`)
var like_list = JSON.parse(localStorage.getItem("like"))
console.log(like_list)
if (like_list.length != 0){
$(".nodata").remove()
like_list.forEach(v => {
$(".like_li").append(`
<li>
<div class="newest_img">
<a href="./info.html?id=${v.id}">
<img src="${v.preview}" alt="">
</a>
<span>${v.total}</span>
</div>
<div class="newest_text">
<a href="./info.html?id=42881">
<p class="t">${v.title}</p>
</a>
</div>
</li>
`)
})
}
}
}
new Like()

View File

@@ -0,0 +1,7 @@
class me{
constructor() {
footer()
}
}
new me()

View File

@@ -0,0 +1,24 @@
class mechanism{
constructor() {
footer()
pHeader("机构")
this.getmechanism()
}
async getmechanism() {
let res = await indexServe.mechanism()
console.log(res)
res.forEach((v)=>{
$(".mechanism_list").append(`
<li>
<a href="./mechanism_info.html?id=${v.id}&t=${v.title}&type=mechanism">
<p>${v.title}</p>
<span>${v.quantity}</span>
</a>
</li>
`)
})
}
}
new mechanism()

View File

@@ -0,0 +1,37 @@
class Mechanism_info{
constructor() {
query("type")=="mechanism"
? this.getmechanismList()
: this.getclassList()
pHeader(query("t"))
console.log()
}
async getmechanismList() {
let res = await indexServe.mechanismList({
page: 0,
id: query("id")
});
console.log(res)
item(".list_a", res.data)
}
async getclassList() {
let res = await indexServe.classList({
page: 0,
id: query("id")
});
console.log(res)
item(".list_a", res.data)
}
}
new Mechanism_info()

View File

@@ -0,0 +1,15 @@
class model{
constructor() {
footer()
pHeader("模特")
this.getAllModel()
}
async getAllModel() {
let data = await indexServe.allModel()
console.log(data)
modellist(".hot_models",data.hot_models)
modellist(".newest",data.newest)
}
}
new model()

View File

@@ -0,0 +1,27 @@
class Model_info{
constructor() {
this.getModel_info()
pHeader(query("t"))
}
async getModel_info(){
let res =await indexServe.modelList({
page:0,
id:query("id")
})
console.log(query("id"))
$('.content').prepend(`
<div class="model_info_header">
<img src="${res.model_info.portrait}" alt="">
<div class="right_text">
<p>${res.model_info.name}</p>
<span>${res.model_info.explain}</span>
</div>
</div> `)
item(".modo___aaa",res.data)
modellist(".models_list_a",res.similar)
}
}
new Model_info()

View File

@@ -0,0 +1,37 @@
class search {
constructor() {
this.getsearch()
}
getsearch() {
$(".ccc").click(
async () => {
let data = await indexServe.search({
keyword: $('.search_aaa').val(),
}
)
console.log(data)
data.forEach(v => {
$(".recmm").append(`
<li>
<div class="newest_img">
<a href="./info.html?id=${v.id}">
<img src="${v.preview}" alt="">
</a>
</div>
<div class="newest_text">
<div class="t">${v.title}</div>
`)
})
})
$(".icon-back1").click(function (){
window.location.replace("index.html")
})
}
}
new search