绚火健康
This commit is contained in:
53
pages/classify/index.js
Normal file
53
pages/classify/index.js
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
parentId : '',
|
||||
categorieArr : [],
|
||||
categorieindex : 0
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 获取商品分类
|
||||
this.categorieInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 商品分类信息
|
||||
*/
|
||||
categorieInfo() {
|
||||
wx.$api.mall.Categorie({
|
||||
parent_id: this.data.parentId
|
||||
}).then(res => {
|
||||
this.setData({
|
||||
categorieArr: res.data
|
||||
})
|
||||
}).catch(err =>{
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
// 一级分类
|
||||
categorieTap(e) {
|
||||
this.setData({
|
||||
categorieindex: e.currentTarget.dataset.index
|
||||
})
|
||||
}
|
||||
})
|
||||
4
pages/classify/index.json
Normal file
4
pages/classify/index.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "全部分类"
|
||||
}
|
||||
23
pages/classify/index.wxml
Normal file
23
pages/classify/index.wxml
Normal file
@@ -0,0 +1,23 @@
|
||||
<!-- search -->
|
||||
<view class="search">
|
||||
<navigator class="mall-search" url="/pages/search/search" hover-class="none">
|
||||
<image class="mall-search-icon" src="/static/icons/search.png" mode="widthFix"></image>搜索商品
|
||||
</navigator>
|
||||
</view>
|
||||
|
||||
<!-- 内容 -->
|
||||
<scroll-view class="stair-nav" scroll-y>
|
||||
<view class="stair-nav-li {{ item.category_id == categorieArr[categorieindex].category_id ? 'active' : ''}}" wx:for="{{categorieArr}}" wx:key="categorieArr" bindtap="categorieTap" data-index="{{index}}">{{item.name}}</view>
|
||||
</scroll-view>
|
||||
<scroll-view class="level-content" scroll-y>
|
||||
<view class="levelList-title">{{categorieArr[categorieindex].name}}</view>
|
||||
<view class="level-nav" wx:if="{{categorieArr[categorieindex].children.length > 0}}">
|
||||
<navigator hover-class="none" url="/pages/mall/goods/goods?id={{categorieArr[categorieindex].category_id}}" class="level-nav-li" wx:for="{{categorieArr[categorieindex].children}}" wx:key="children" wx:for-item="items">
|
||||
<view class="level-nav-cover"><image src="{{items.cover}}" mode="aspectFill"></image></view>
|
||||
<view class="level-nav-title">{{items.name}}</view>
|
||||
</navigator>
|
||||
</view>
|
||||
<view class="level-tips" wx:else>
|
||||
暂无产品
|
||||
</view>
|
||||
</scroll-view>
|
||||
138
pages/classify/index.wxss
Normal file
138
pages/classify/index.wxss
Normal file
@@ -0,0 +1,138 @@
|
||||
/* 搜索 */
|
||||
.search {
|
||||
height: 110rpx;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 999;
|
||||
padding: 10rpx 30rpx 0;
|
||||
box-sizing: border-box;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.mall-search {
|
||||
background: #f7f7f7;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
border-radius: 80rpx;
|
||||
color: #b8b7bc;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.mall-search-icon {
|
||||
width: 38rpx;
|
||||
height: 38rpx;
|
||||
margin: 26rpx 20rpx 0 0;
|
||||
}
|
||||
|
||||
/* 一级分类 */
|
||||
|
||||
.stair-nav {
|
||||
position: fixed;
|
||||
top: 110rpx;
|
||||
left: 0;
|
||||
background: #fcfafb;
|
||||
height: calc(100vh - 100rpx);
|
||||
width: 160rpx;
|
||||
text-align: center;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 0;
|
||||
height: 0;
|
||||
color: transparent;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.stair-nav-li {
|
||||
line-height: 110rpx;
|
||||
border-top: solid 1rpx #ffffff;
|
||||
}
|
||||
|
||||
.stair-nav-li.active {
|
||||
background: white;
|
||||
color: #e92344;
|
||||
font-weight: bold;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.stair-nav-li.active::before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
left: 0;
|
||||
top: 30rpx;
|
||||
height: 40rpx;
|
||||
background: #e92344;
|
||||
width: 6rpx;
|
||||
}
|
||||
|
||||
/* 二级分类 */
|
||||
|
||||
.level-content{
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
padding: 110rpx 0 0 170rpx;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.levelList-title {
|
||||
font-size: 26rpx;
|
||||
color: #2c2c2c;
|
||||
font-weight: 600;
|
||||
line-height: 110rpx;
|
||||
padding: 0 25rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.level-nav{
|
||||
display: flex;
|
||||
flex-wrap:wrap;
|
||||
}
|
||||
|
||||
.level-nav-li{
|
||||
width: 33.333%;
|
||||
text-align: center;
|
||||
padding: 0 20rpx;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.level-nav-cover{
|
||||
width: 100%;
|
||||
padding-top: 100%;
|
||||
position: relative;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
background-color: #fcfafb;
|
||||
}
|
||||
|
||||
.level-nav-cover image {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.level-nav-title{
|
||||
font-size: 26rpx;
|
||||
margin-top: 15rpx;
|
||||
color: #464854;
|
||||
}
|
||||
|
||||
|
||||
.level-tips {
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
padding: 80rpx 0;
|
||||
color: #a3a3a3;
|
||||
}
|
||||
Reference in New Issue
Block a user