Commit b4c8bf43 by 高淑倩

add: 首页分类

parent 2fd0a794
...@@ -10,44 +10,19 @@ Component({ ...@@ -10,44 +10,19 @@ Component({
* 组件的属性列表 * 组件的属性列表
*/ */
properties: { properties: {
categorys:{
type: Array,
value: []
}
}, },
attached() { attached() {
}, },
/** /**
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
currentTab: 0, currentTab: 0
navData: [{
label: '分类1'
},
{
label: '分类2'
},
{
label: '分类3'
},
{
label: '分类4'
},
{
label: '分类5'
},
{
label: '分类6'
},
{
label: '分类7'
},
{
label: '分类8'
},
{
label: '分类9'
}
]
}, },
/** /**
* 组件的方法列表 * 组件的方法列表
...@@ -57,6 +32,8 @@ Component({ ...@@ -57,6 +32,8 @@ Component({
switchNav(event) { switchNav(event) {
const ev = event.currentTarget.dataset; const ev = event.currentTarget.dataset;
let cur = ev.current let cur = ev.current
let redirectid = ev.redirectid
console.log('redirectid', redirectid)
if (this.data.currentTab == cur) { if (this.data.currentTab == cur) {
return false return false
} else { } else {
......
<!--component/tabSort/tabSort.wxml--> <!--component/tabSort/tabSort.wxml-->
<view class="tab-sort" wx:if="{{navData}}"> <view class="tab-sort" wx:if="{{categorys}}">
<scroll-view scroll-x class="scroll-view_H" scroll-with-animation="{{true}}"> <scroll-view scroll-x class="scroll-view_H" scroll-with-animation="{{true}}">
<block <block
wx:for="{{navData}}" wx:for="{{categorys}}"
wx:for-index="idx" wx:for-index="idx"
wx:for-item="navItem" wx:for-item="navItem"
wx:key="idx" wx:key="idx"
...@@ -11,13 +11,10 @@ ...@@ -11,13 +11,10 @@
class="scroll-view-item {{currentTab == idx ?'active':''}}" class="scroll-view-item {{currentTab == idx ?'active':''}}"
style="width:{{navItemWidth}}%" style="width:{{navItemWidth}}%"
data-current="{{idx}}" data-current="{{idx}}"
data-startTimeStr="{{navItem.startTimeStr}}" data-redirectId ="{{navItem.redirectId}}"
data-endTimeStr="{{navItem.endTimeStr}}"
data-btnText="{{navItem.buttonText}}"
data-id="{{navItem.id}}"
bindtap="switchNav" bindtap="switchNav"
> >
<view>{{navItem.label}}</view> <view>{{navItem.title}}</view>
</view> </view>
</block> </block>
</scroll-view> </scroll-view>
...@@ -34,7 +31,7 @@ ...@@ -34,7 +31,7 @@
bindchange="switchTab" bindchange="switchTab"
> >
<swiper-item <swiper-item
wx:for="{{navData}}" wx:for="{{categorys}}"
wx:for-item="navItem" wx:for-item="navItem"
wx:for-index="idx" wx:for-index="idx"
wx:key="idx" wx:key="idx"
......
...@@ -27,7 +27,7 @@ wxService.page({ ...@@ -27,7 +27,7 @@ wxService.page({
baseUserInfo: null, baseUserInfo: null,
// cardMember: null, // cardMember: null,
pageBackgroundColor: 0, pageBackgroundColor: 0,
guidePageModalShow:true guidePageModalShow: false
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
......
<!--pages/userCenter.wxml--> <!--pages/userCenter.wxml-->
<view class='user-center' style="background: {{pageBackgroundColor == 1? '#eee': '#fff'}};min-height: {{outoHeigth}}px"> <view class='user-center' style="background: {{pageBackgroundColor == 1? '#eee': '#fff'}};min-height: {{outoHeigth}}px">
<!-- 1 轮播 2 个人中心 3 图片导航 4 底部--> <!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)-->
<!-- 分类Tab --> <block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem">
<tab-sort/>
<view class="page-bgc"> {{pItem.type}}
<!-- 轮播 --> <view wx:if="{{pItem.type == 1}}">
<image-swiper/>
</view>
<view class="" wx:if="{{pItem.type == 2}}">
<person-center/>
</view>
<view class="" wx:if="{{pItem.type == 3}}">
<pic-nav/>
</view>
<view class="" wx:if="{{pItem.type == 4}}">
<bottom />
</view>
<view class="" wx:if="{{pItem.type == 5}}">
<bottom-tabs/>
</view>
<view class="" wx:if="{{pItem.type == 6}}">
<announcement/>
</view>
<view class="" wx:if="{{pItem.type == 7}}">
<tab-sort categorys="{{pItem.categoryType.categorys}}"/>
</view>
<view class="" wx:if="{{pItem.type == 8}}">
<attention/>
</view>
<view class="" wx:if="{{pItem.type == 9}}">
<attention/>
</view>
</block>
<!--
<tab-sort/>
<view class="page-bgc">
<image-swiper/> <image-swiper/>
<!--公告-->
<announcement/> <announcement/>
<!-- 导航图标 -->
<icon-swiper/> <icon-swiper/>
<!-- 图片导航 -->
<pic-nav/> <pic-nav/>
</view> </view>
<view class="person-hot border_box"> <view class="person-hot border_box">
...@@ -18,14 +53,14 @@ ...@@ -18,14 +53,14 @@
<span class="hot border_box">HOT -</span> <span class="hot border_box">HOT -</span>
</view> </view>
<!-- 商品活动 人气hot -->
<hot-item/> <hot-item/>
<!-- 关注 -->
<attention/> <attention/>
<!-- 图片广告 -->
<bannerAd/> <bannerAd/>-->
<!-- <block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem"> <!-- <block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem">
<view class="pd1530" wx:if="{{pItem.type == 1}}"> <view class="pd1530" wx:if="{{pItem.type == 1}}">
...@@ -52,4 +87,4 @@ ...@@ -52,4 +87,4 @@
<!--<authorization-modal isAuthorization='{{isAuthorization}}' />--> <!--<authorization-modal isAuthorization='{{isAuthorization}}' />-->
<guide-page-modal show="{{guidePageModalShow}}" /> <guide-page-modal show="{{guidePageModalShow}}" />
<bottom-tabs />
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment