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,79 @@
class Institutiondetails {
constructor() {
header(query("title"))
this.details()
this.errr()
}
max = 0
page = 1;
//获取数据
async details() {
$(".swiper-slide1").onscroll = (v) => {
const { clientHeight, scrollHeight, scrollTop } = $(".swiper-slide1");
let distance = scrollHeight - scrollTop - clientHeight;
console.log(distance)
if (distance <=1) {
if (this.page < this.max - 1) {
this.page += 1;
this.errr()
console.log(this.page)
} else {
}
} else {
}
}
}
async errr(){
let id = query("id");
let data = {
id: id,
page: this.page
}
console.log( this.page)
let details = await indexserve.mechanismList(data);
this.max = details.result.total_page;
console.log(details)
item($(".swiper-slide1"), details.result.data,2)
}
// boot = true;
// //机构移动
// Mechanismmovement() {
// $("body").ontouchmove = (e) => {
// // console.log(e.touches[0].pageY)
// //e.touches[0].pageY 获取当前手指在页面中的位置
// //document.body.offsetHeight 获取当前页面中的高度
// //手指在页面中的位置>= 获取当前页面中的高度-浏览器的高度
// if (e.touches[0].pageY >= document.body.offsetHeight - window.innerHeight - 300) {
// if (this.boot == false) {
// if (this.page >= this.max) {
// this.page = this.max;
// alert("到底了")
// } else {
// this.page += 1;
// console.log(this.page)
// console.log(this.max)
// this.details();
// }
// this.boot = true;
// }
// // alert("到底了")
// } else {
// this.boot = false;
// }
// }
// }
}
new Institutiondetails()

View File

@@ -0,0 +1,154 @@
class Index {
constructor() {
footer()
this.classifyindex()
this.initSwiper()
this.Home()
this.index = 0
this.principal = []
this.onbeforeunload()
}
onbeforeunload() {
window.onbeforeunload = ()=> {
let ee= getItem("principalIII")
setItem("principal",ee)
}
}
//首页分类
async classifyindex() {
console.log("首页")
if (!getItem("principal")) {
let principalh = await indexserve.type()
let { additional, principal } = principalh.result
this.principal = principal;
//已选
setItem("principal", principal)
//刷新
setItem("principalIII", principal)
//未选
setItem("additional", additional)
//收藏
setItem("like",[])
//历史记录
setItem("History",[])
} else {
this.principal = getItem("principal")
console.log()
}
this.principal.forEach((v, i) => {
//添加分类Li
$(".header_menu ul").html(`
<li class="${i == 0 ? "active" : ""}">${v.title} </li>
`)
$(".swiper-wrapper").html(`
<div class="swiper-slide">
<ul class="qwe${i}"></ul>
</div>
`)
});
_(".header_menu ul li").tap(({ v, i }) => {
this.swiper.slideTo(i)
})
_(".swiper-wrapper .swiper-slide").forEach(v => {
v.onscroll = () => {
const { clientHeight, scrollHeight, scrollTop } = v;
let distance = scrollHeight - scrollTop - clientHeight;
if (distance <= 1) {
if (this.index != 0) {
this.principal[this.index].page += 1;
setItem("principal", this.principal)
if (this.principal[this.index].page <= this.principal[this.index].total_page) {
this.classifications('ko')
}
}
} else {
}
}
})
}
initSwiper() {
let self = this
this.swiper = new Swiper('.swiper', {
direction: 'horizontal',
on: {
slideChangeTransitionStart: function () {
self.index = this.activeIndex
_(".header_menu ul li")[this.activeIndex].appClass("active")
.siblings().removeClass("active");
console.log("中")
self.classifications()
},
},
})
}
//首页
ddf
async Home() {
let xq = await indexserve.index();
console.log( xq.result.list)
this.ddf=()=>{
item(_(".swiper-wrapper .swiper-slide ul")[0], xq.result.list)
}
this.ddf();
clicka(".swiper-wrapper .swiper-slide ul li", xq.result.list, "detail.html")
}
async classifications(type = "click") {
console.log("未")
console.log(this.principal)
this.principal = getItem("principal")
let loadData = async () => {
let red = await indexserve.mechanismList({
id: this.principal[this.index].id,
page: this.principal[this.index].page
})
console.log(red)
//将值赋给分类中的变量
// console.log(red)
red.result.data.forEach(v=>{
this.principal[this.index].content.push(v);
})
this.principal[this.index].total_page = red.result.total_page;
console.log(this.principal[this.index].content)
setItem("principal", this.principal)
// console.log(this.principal.result.principal[this.index].content)
item(
_(".swiper-wrapper .swiper-slide ul")[this.index],
this.principal[this.index].content
)
console.log(this.principal[this.index].content)
let fff = `.swiper-wrapper .swiper-slide .qwe${this.index} li`
clicka(fff, this.principal[this.index].content, "detail.html")
this.ddf();
}
if (type == "click") {
if (this.principal[this.index].content.length == 0) {
this.principal[this.index].page += 1
loadData()
}
} else {
loadData()
}
}
}
new Index()

View File

@@ -0,0 +1,25 @@
class mechanism {
constructor() {
footer()
this.institutions();
}
async institutions() {
let insti = await indexserve.mechanism()
console.log(insti.result)
insti.result.forEach((v) => {
console.log(v)
$(".content").html(`
<li>
<a href="./Institutiondetails.html?id=${v.id}&page=${v.page}&title=${v.title}">
<p>${v.title}</p>
<p>${v.id}套</p>
</a>
</li>
`);
})
}
}
new mechanism()