Authored by QC-L

修改首页Tab逻辑 review by 黄敬囿

... ... @@ -2,7 +2,8 @@
.prize-item {
border-bottom: 2rpx dashed #E0E0E0;
padding: 20rpx 30rpx;
padding: 20rpx 0rpx;
margin-left: 30rpx;
position: relative;
z-index: 1;
overflow: hidden;
... ...
... ... @@ -489,7 +489,7 @@ Page(Object.assign({
},
onShareAppMessage(res) {
let params = {
TITLE: `点一下!和我一起开黑0元抢${this.data.product.name}`,
TITLE: `0元抽奖】点一下,免费拿走${this.data.product.name}`,
DESC: '我在有货精选发现一个不错的商品赶快来看看吧!'
};
... ...
... ... @@ -34,6 +34,14 @@ Page(Object.assign({
}],
tabIndex: 0,
my_zero_list: [{
page: 1,
data: []
}, {
page: 1,
data: []
}],
footText: '',
hasUnionID: false,
uid: 0,
... ... @@ -83,26 +91,30 @@ Page(Object.assign({
this.setData({
footText: '内容加载中...'
});
let tabIndex = this.data.tabIndex;
let page = this.data.list[tabIndex].page;
let pageKey = `list[${tabIndex}].page`;
let productsKey = `list[${tabIndex}].products`
this._getPage(page).then((list) => {
let oldList = this.data.list[tabIndex].products;
if (list.length > 0) {
if (tabIndex !== 3) {
let page = this.data.list[tabIndex].page;
let pageKey = `list[${tabIndex}].page`;
let productsKey = `list[${tabIndex}].products`
this._getPage(page).then((list) => {
let oldList = this.data.list[tabIndex].products;
if (list.length > 0) {
this.setData({
[productsKey]: oldList.concat(list),
[pageKey]: page + 1,
})
}
this.setData({
[productsKey]: oldList.concat(list),
[pageKey]: page + 1,
})
}
this.setData({
footText: '暂无更多内容'
});
})
footText: '暂无更多内容'
});
})
} else {
console.log('++++++++++++++++++++');
this._getReleaseData();
}
},
_getPage(page) {
... ... @@ -125,6 +137,9 @@ Page(Object.assign({
footText: '内容加载中...'
})
this._getProceedingData();
this._getReleaseData();
return this._getPage(page).then(list => {
if (list.length === 0) {
this.setData({
... ... @@ -197,6 +212,49 @@ Page(Object.assign({
})
},
_getProceedingData() {
let type = 0;
let page = 1;
let limit = 1000;
let key = `my_zero_list[${type}].data`
this.service.getMyList({type, page, limit}).then(res => {
let data = []
if (res && res.code === 200) {
data = res.data;
}
this.setData({
[key]: data
})
});
},
_getReleaseData() {
let type = 1;
let my_zero_list = this.data.my_zero_list;
let page = my_zero_list[type].page;
let oldData = my_zero_list[type].data;
let key = `my_zero_list[${type}].data`;
let keyPage = `my_zero_list[${type}].page`;
this.service.getMyList({type, page}).then(res => {
let data = []
if (res && res.code === 200) {
data = res.data;
}
this.setData({
[key]: oldData.concat(data),
[keyPage]: ++page
})
this.setData({
footText: ''
})
if (data.length === 0) {
this.setData({
footText: '暂无更多内容'
})
}
});
},
_jumpBanner() {
if (this.data.bannerUrl == null) {
return;
... ...
... ... @@ -8,6 +8,7 @@
"quickNavigation": "/pages/quickNavigation/quickNavigation",
"tabs": "./components/tabs",
"tabs-pane": "./components/tabs-pane",
"dialog": "../../component/dialog/dialog"
"dialog": "../../component/dialog/dialog",
"prize-item": "./components/prize-item"
}
}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,7 @@
<view class="list-top-blank"></view>
<tabs-pane name="进行中">
<image class="topgif" src="./images/yoluck.gif"/>
<image class="topgif" src="./images/yoluck.gif"/>
<view class="productList">
<block wx:for="{{list[0].products}}" wx:key="{{item.id}}">
<product-item product="{{item}}" class="product"></product-item>
... ... @@ -27,24 +27,44 @@
</tabs-pane>
<tabs-pane name="已参加">
<view class="productList">
<block wx:if="{{isLogin}}">
<view class="title-view">
<view class="space-line"></view>
<text class="title">进行中</text>
</view>
<block wx:for="{{my_zero_list[0].data}}">
<prize-item item="{{item}}" bindshare="share"></prize-item>
</block>
<view class="title-view">
<view class="space-line"></view>
<text class="title">已公布</text>
</view>
<block wx:for="{{my_zero_list[1].data}}">
<prize-item item="{{item}}" bindshare="share"></prize-item>
</block>
</block>
<block wx:else>
<view>登录页面</view>
</block>
<!-- <view class="productList">
<block wx:for="{{list[2].products}}" wx:key="{{item.id}}">
<product-item product="{{item}}" class="product"></product-item>
</block>
</view>
</view> -->
</tabs-pane>
<view class="list-foot-blank">{{footText}}</view>
</tabs>
<view class="bottom-banner" bindtap="_jumpBanner" wx:if="{{bannerSrc != null}}">
<image class="bottom-banner-img" src="{{bannerSrc}}"></image>
</view>
<block wx:if="{{tabIndex !== 3}}">
<view class="bottom-banner" bindtap="_jumpBanner" wx:if="{{bannerSrc != null}}">
<image class="bottom-banner-img" src="{{bannerSrc}}"></image>
</view>
</block>
<!-- <view class="bottom-bar">
<block wx:if="{{isLogin}}">
<view bindtap="goMyList">我的抽奖码</view>
</block>
</block>
<block wx:else>
<button class="bottom-btn" plain="true" hover-class="none" open-type="{{!hasUnionID ? 'getUserInfo':'getPhoneNumber'}}" bindgetphonenumber="getPhoneNumber" bindgetuserinfo='getUserInfo'>我的抽奖码</button>
... ...
... ... @@ -62,4 +62,25 @@
.topgif {
width: 100%;
height: 200rpx;
}
.space-line {
background-color: #444444;
width: 8rpx;
height: 30rpx;
margin-right: 10rpx;
}
.title-view {
border-bottom:2rpx dashed #E0E0E0;
margin-left: 32rpx;
margin-top: 20rpx;
padding-bottom: 20rpx;
font-size: 32rpx;
color: #444444;
letter-spacing: -0.14px;
display: flex;
flex-direction: row;
align-items: center;
font-family: PingFangSC-Medium;
}
\ No newline at end of file
... ...
... ... @@ -231,7 +231,7 @@ Page(Object.assign({
},
onShareAppMessage(res) {
let params = {
TITLE: `点一下!和我一起开黑0元抢${this.data.shareProduct.name}`,
TITLE: `0元抽奖】点一下,免费拿走${this.data.shareProduct.name}`,
DESC: '我在有货精选发现一个不错的商品赶快来看看吧!'
};
... ...