79 lines
2.3 KiB
JavaScript
79 lines
2.3 KiB
JavaScript
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() |