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,67 @@
class commodityinfo {
constructor() {
title("详情", `<i class="iconfont icon-fanhui"></i>`)
this.getcommodityinfo()
}
async getcommodityinfo() {
var res = await indexService.info({
thing_id: 7,
// thing_category:3
});
console.log(res);
var html = `
<div class="content">
<div class="head">
<img src="https://losta.oss-cn-shanghai.aliyuncs.com/7cpXrZK8JcenmECFRn6WD6P47PSf3kdR.jpg" alt="">
<div class="information">
<div class="name">bmy4</div>
<div class="address">电子信息职业技术学院3</div>
</div>
<div></div>
</div>
<div class="time">
<div class="test">
<p>测试标题2</p>
<span>2022-03-03 11:40:57</span>
</div>
<div class="certificate">证件</div>
</div>
<div class="bot">
<p>测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1测试介绍1
</p>
<img src="https://img13.360buyimg.com/n7/jfs/t1/220760/23/10339/352290/61d8e957E230aa7ce/9b38fef9ff0513e5.jpg"
alt="">
</div>
</div>
`
$("body").insertAdjacentHTML("beforeend", html);
res.forEach(v => {
var img = document.createElement("img")
img.src = v;
img.onload = () => {
// console.log(img.width);
$(".bot").innerHTML += `
<figure>
<a href="${v}" data-size="${img.width}x${img.height}">
<img src="${v}" alt="${v}" />
</a>
<figcaption itemprop="caption description"></figcaption>
</figure>
`
}
});
initPhotoSwipeFromDOM('.bot');
}
}
new commodityinfo()

View File

@@ -0,0 +1,41 @@
class guangchang {
constructor() {
this.getClick()
this.seek()
}
async seek(newKey) {
var res = await indexService.tab({
thing_category: -1,
page: 1,
thing_type:newKey == undefined ? 1 : newKey//这里用三元运算符判断获取参数为空 为1 不为空 为2
});
console.log(res);
// item($(".recommend"), res)
}
async getClick() {
//获取输入框值
$(".items").onclick = () => {
$(".content").style.display = "none"
$(".content1").style.display = "flex"
this.seek(2)
}
$(".itemf").onclick = () => {
$(".content1").style.display = "none"
$(".content").style.display = "flex"
this.seek(1)
}
}
}
function getClick(params) {
}
new guangchang()

View File

@@ -0,0 +1,55 @@
class Index {
constructor() {
this.getNotice()
this.initSwiper ()
// this.footer()
// this.title()
}
async getNotice() {
var res = await indexService.notice();
console.log(res);
//获取最新消息
res.forEach((v, i) => {
$(".mass .mass_list").innerHTML += `
<li>
<i></i>
<a class="ellipsis" href="">${v.notice_text}</a>
</li>
`
// console.log(v.notice_text);
});
//轮播图
_(".swiper swiper-wrapper").forEach((v,i) => {
if(i != 0 ){
v.onscroll = () => {
const {clientHeight,scrollHeight, scrollTop} = v;
var distance = scrollHeight - scrollTop - clientHeight;
if(distance <= 0.5){
this.principal[this.index].page += 1;
if(this.principal[this.index].page <= this.principal[this.index].total_page){
this.getClassList("loadMore")
}
}
}
}
})
}
initSwiper () {
var mySwiper = new Swiper ('.swiper', {
direction: 'horizontal', // 垂直切换选项
loop: true, // 循环模式选项
autoplay:true,//自动播放
// 如果需要分页器
pagination: {
el: '.swiper-pagination',
},
})
}
}
new Index()

View File

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

View File

@@ -0,0 +1,37 @@
class Search {
constructor() {
this.getSearch()
}
async seek(newKey) {
var res = await indexService.search({
keyword: newKey,
page: 1
});
if(res.length > 0){
$(".image_a").style.display = "none"
}else{
$(".image_a").style.display = "flex"
}
items($(".recommend"), res)
}
async getSearch() {
//获取输入框值
$(".search_box").oninput = () => {
if ($(".search_box").value.length > 0) {
this.seek($(".search_box").value)
}
}
//input获得焦点
$(".search_box").onfocus = () => {
this.seek($(".search_box").value)
}
}
}
new Search()

View File

@@ -0,0 +1,10 @@
class square {
constructor() {
footer()
}
}
new square()