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,58 @@
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
ShopList: [],
value: '',
height: 0,
SwiperList: ['../../static/banner.jpg', '../../static/banner.jpg','../../static/banner.jpg'],
typeList: [
{ id: 1, text: '限时白嫖', href: '/list', icon: '../../static/type_1.png' },
{ id: 2, text: '新品推荐', href: '/list', icon: '../../static/type_2.png' },
{ id: 3, text: '低价高配', href: '/list', icon: '../../static/type_3.png' },
{ id: 4, text: '超值特卖', href: '/list', icon: '../../static/type_4.png' }
]
},
onLoad: function () {
this.getHomeList()
this.setData({
height: app.globalData.statusBarHeight
})
},
onClickLeft() {
wx.showToast({ title: '点击返回', icon: 'none' });
},
onClickRight() {
wx.showToast({ title: '点击按钮', icon: 'none' });
},
async getHomeList() {
var data = await global.$api.post({
url: "/home/index",
data: {}
});
console.log("index:",data)
data.result.forEach((val) => {
val.wares_info = val.wares_info.substring(0,10) + '..';
val.wares_masterimg = JSON.parse(val.wares_masterimg)[0]
})
this.setData({
ShopList: data.result
})
console.log(data.result);
},
enterInfo(item) {
console.log("item: ", item.currentTarget.dataset.list.wares_id)
wx.navigateTo({
url: `/pages/info/info?id=${item.currentTarget.dataset.list.wares_id}`
})
},
enterlist(e) {
var a = e.currentTarget.dataset.id+1
console.log(a)
wx.navigateTo({
url: `/pages/list/list?id=${a}`
})
},
})

View File

@@ -0,0 +1,13 @@
{
"navigationBarTitleText": "首页",
"navigationStyle": "custom",
"usingComponents": {
"van-nav-bar": "@vant/weapp/nav-bar/index",
"van-search": "@vant/weapp/search/index",
"lb-swiper": "/components/swiper/swiper",
"van-grid": "@vant/weapp/grid/index",
"van-grid-item": "@vant/weapp/grid-item/index",
"van-row": "@vant/weapp/row/index",
"van-col": "@vant/weapp/col/index"
}
}

View File

@@ -0,0 +1,66 @@
<view class="container">
<navigator url='../search/search'>
<view class="header" style="margin-top: {{height}}px;">
<image src="../../static/logoing.png"></image>
<van-search
shape="round"
class="search-input"
value="{{ value }}"
placeholder="请输入搜索关键词" />
</view>
</navigator>
<lb-swiper list="{{SwiperList}}"/>
<van-grid border="{{false}}">
<van-grid-item use-slot data-id="{{index}}" wx:for="{{ typeList }}" bindtap="enterlist" wx:key="index">
<image src="{{item.icon}}"></image>
<text>{{item.text}}</text>
</van-grid-item>
</van-grid>
<van-row>
<van-col span="12">
<image
src="../../static/banner4.jpg"
alt="">
</image>
</van-col>
<van-col span="12">
<van-row>
<van-col span="24">
<image style="height: 118px"
src="../../static/banner2.jpg"
alt="">
</image>
<image style="height: 118px"
src="../../static/banner3.jpg"
alt="">
</image>
</van-col>
</van-row>
</van-col>
</van-row>
<van-row>
<van-col span="24">
<image style="height: 160px" src="../../static/banner1.jpg"
alt="">
</image>
</van-col>
</van-row>
<van-row>
<van-col class="shop_item"
wx:for="{{ShopList}}"
span="12"
data-list="{{item}}"
bindtap="enterInfo"
wx:key="index">
<image src="{{item.wares_masterimg}}"></image>
<text class="title">{{item.wares_title}}</text>
<text class="info">{{ item.wares_info}}...</text>
<text class="price">¥{{item.wares_nowprice}}</text>
</van-col>
</van-row>
</view>

View File

@@ -0,0 +1,55 @@
.header {
height: 46px;
width: 100%;
position: fixed;
display: flex;
justify-content: flex-start;
padding: 0 10px;
box-sizing: border-box;
align-items: center;
z-index:99999;
}
.header image{
width: 25px;
height: 20px;
}
.search-input {
width: 69%;
}
.van-grid image {
width: 40px;
height: 40px;
margin-bottom: 5px;
}
.van-grid text {
font-size: 13px;
}
.van-col--12 {
text-align: center
}
.shop_item {
margin-bottom: 10px;
}
.shop_item image{
width: 150px;
height: 145px;
}
.shop_item text {
display: block
}
.shop_item .title{
font-size: 14px;
color: rgba(0,0,0,.87);
}
.shop_item .info{
font-size: 12px;
color: rgba(0,0,0,.54);
margin-top: 4px;
}
.shop_item .price{
font-size: 14px;
color: #ea625b;
margin-top: 4px;
line-height: 21px;
}