hahah
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-12-03 11:18:07 +08:00
parent 9e7485dfa2
commit 4991b3686c
16 changed files with 589 additions and 402 deletions

View File

@@ -1,6 +1,30 @@
class Domestic {
constructor() {
util.header(
`<div class="header_title">分类</div>`,
"",
""
)
util.footer()
this.getTagListData()
}
async getTagListData() {
let res = await tagServe.tagList()
$(".type_list").innerHTML = res.maps(v => {
return `
<li>
<a href="./tagListInfo.html?url=${v.url}&title=${v.title}">
<div class="text">${v.title}</div>
<p class="nums">${v.count}套</p>
</a>
</li>
`
})
}
}

View File

@@ -17,7 +17,7 @@ class Index {
this.getTagRecommend()
this.getHomeHotData()
this.getHomeListData()
this.initSwiper()
this.event()
}
@@ -39,8 +39,8 @@ class Index {
$(".recommend-tag").innerHTML = res.maps(v => {
return `
<li>
<div class="icon">${v.title.substr(0,1)}</div>
<div class="title">${v.title}</div>
<a class="icon" href="./tagListInfo.html?url=${v.url}&title=${v.title}">${v.title.substr(0,1)}</a>
<a class="title" href="./tagListInfo.html?url=${v.url}&title=${v.title}">${v.title}</a>
</li>
`
})
@@ -56,14 +56,14 @@ class Index {
</div>
`
})
this.initSwiper()
}
initSwiper() {
var mySwiper = new Swiper('.banner', {
loop: true, // 循环模式选项
// 如果需要分页器
loop: true,
pagination: {
el: '.swiper-pagination',
},

View File

@@ -13,7 +13,7 @@ class Info {
.then(() => {
util.header(
`<div class="title flex1 ellipsis">${this.title}</div>`,
`<div class="header_title flex1 ellipsis">${this.title}</div>`,
`
<div class="ilist">
<i class="iconfont icon-wujiaoxing"></i>
@@ -53,11 +53,15 @@ class Info {
// TODO 找一个合适分享
$(".icon-fenxiang").onclick = async () => {
await navShare({
title: this.title,
text: `我这有个好看的,快来看看 ${this.title}`,
url: location.href
})
await navigator.clipboard.writeText(`
我这有个好看的,快来看看 ${this.title}
${location.href}
`)
// await navShare({
// title: this.title,
// text: `我这有个好看的,快来看看 ${this.title}`,
// url: location.href
// })
}
let sc = $(".icon-wujiaoxing")

View File

@@ -43,6 +43,7 @@ class Search {
let input = $(".header input")
$(".header .button").onclick = async () => {
this.page = 1
if (input.value.length != 0) {
this.keyword = input.value
this.totalArr = []
@@ -51,7 +52,13 @@ class Search {
util.hidden(".no-search")
item(".have-search ul", this.totalArr)
util.show(".have-search")
this.onscroll()
onscroll(async () => {
this.page += 1
if (this.page <= this.totalPage) {
await this.getSearchKeyData()
item(".have-search ul", this.totalArr)
}
})
}
}
@@ -75,23 +82,6 @@ class Search {
this.totalPage = totalPage
list.forEach(v => this.totalArr.push(v));
}
// 滚动到底部实现自动加载下一页数据
onscroll() {
window.onscroll = async () => {
var scrollHeight = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
var clientHeight = window.innerHeight || Math.min(document.documentElement.clientHeight, document.body.clientHeight);
if (clientHeight + Math.ceil(scrollTop) >= scrollHeight) {
this.page += 1
if (this.page <= this.totalPage) {
await this.getSearchKeyData()
item(".have-search ul", this.totalArr)
}
}
}
}
}
new Search

37
js/page/tagListInfo.js Normal file
View File

@@ -0,0 +1,37 @@
class TagListInfo {
page = 1;
totalPage = 0;
totalArr = []
constructor() {
util.header(
`<div class="header_title">${query("title")}</div>`,
"",
)
this.getTagInfoData()
}
async getTagInfoData() {
let { totalPage, list } = await tagServe.tagInfo({
url: query("url"),
page: this.page
});
this.totalPage = totalPage
// list.forEach(v => {
// this.totalArr.push(v)
// });
this.totalArr = [ ...this.totalArr, ...list ]
item(".default-model ul", this.totalArr)
onscroll(async () => {
this.page += 1
if (this.page <= this.totalPage) {
await this.getTagInfoData()
// item(".default-model ul", list)
}
})
}
}
new TagListInfo