Authored by QC-L

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

@@ -2,7 +2,8 @@ @@ -2,7 +2,8 @@
2 2
3 .prize-item { 3 .prize-item {
4 border-bottom: 2rpx dashed #E0E0E0; 4 border-bottom: 2rpx dashed #E0E0E0;
5 - padding: 20rpx 30rpx; 5 + padding: 20rpx 0rpx;
  6 + margin-left: 30rpx;
6 position: relative; 7 position: relative;
7 z-index: 1; 8 z-index: 1;
8 overflow: hidden; 9 overflow: hidden;
@@ -489,7 +489,7 @@ Page(Object.assign({ @@ -489,7 +489,7 @@ Page(Object.assign({
489 }, 489 },
490 onShareAppMessage(res) { 490 onShareAppMessage(res) {
491 let params = { 491 let params = {
492 - TITLE: `点一下!和我一起开黑0元抢${this.data.product.name}`, 492 + TITLE: `0元抽奖】点一下,免费拿走${this.data.product.name}`,
493 DESC: '我在有货精选发现一个不错的商品赶快来看看吧!' 493 DESC: '我在有货精选发现一个不错的商品赶快来看看吧!'
494 }; 494 };
495 495
@@ -34,6 +34,14 @@ Page(Object.assign({ @@ -34,6 +34,14 @@ Page(Object.assign({
34 }], 34 }],
35 tabIndex: 0, 35 tabIndex: 0,
36 36
  37 + my_zero_list: [{
  38 + page: 1,
  39 + data: []
  40 + }, {
  41 + page: 1,
  42 + data: []
  43 + }],
  44 +
37 footText: '', 45 footText: '',
38 hasUnionID: false, 46 hasUnionID: false,
39 uid: 0, 47 uid: 0,
@@ -83,26 +91,30 @@ Page(Object.assign({ @@ -83,26 +91,30 @@ Page(Object.assign({
83 this.setData({ 91 this.setData({
84 footText: '内容加载中...' 92 footText: '内容加载中...'
85 }); 93 });
86 -  
87 let tabIndex = this.data.tabIndex; 94 let tabIndex = this.data.tabIndex;
88 - let page = this.data.list[tabIndex].page;  
89 - let pageKey = `list[${tabIndex}].page`;  
90 - let productsKey = `list[${tabIndex}].products`  
91 -  
92 - this._getPage(page).then((list) => {  
93 - let oldList = this.data.list[tabIndex].products;  
94 -  
95 - if (list.length > 0) { 95 + if (tabIndex !== 3) {
  96 + let page = this.data.list[tabIndex].page;
  97 + let pageKey = `list[${tabIndex}].page`;
  98 + let productsKey = `list[${tabIndex}].products`
  99 +
  100 + this._getPage(page).then((list) => {
  101 + let oldList = this.data.list[tabIndex].products;
  102 +
  103 + if (list.length > 0) {
  104 + this.setData({
  105 + [productsKey]: oldList.concat(list),
  106 + [pageKey]: page + 1,
  107 + })
  108 + }
  109 +
96 this.setData({ 110 this.setData({
97 - [productsKey]: oldList.concat(list),  
98 - [pageKey]: page + 1,  
99 - })  
100 - }  
101 -  
102 - this.setData({  
103 - footText: '暂无更多内容'  
104 - });  
105 - }) 111 + footText: '暂无更多内容'
  112 + });
  113 + })
  114 + } else {
  115 + console.log('++++++++++++++++++++');
  116 + this._getReleaseData();
  117 + }
106 }, 118 },
107 119
108 _getPage(page) { 120 _getPage(page) {
@@ -125,6 +137,9 @@ Page(Object.assign({ @@ -125,6 +137,9 @@ Page(Object.assign({
125 footText: '内容加载中...' 137 footText: '内容加载中...'
126 }) 138 })
127 139
  140 + this._getProceedingData();
  141 + this._getReleaseData();
  142 +
128 return this._getPage(page).then(list => { 143 return this._getPage(page).then(list => {
129 if (list.length === 0) { 144 if (list.length === 0) {
130 this.setData({ 145 this.setData({
@@ -197,6 +212,49 @@ Page(Object.assign({ @@ -197,6 +212,49 @@ Page(Object.assign({
197 }) 212 })
198 }, 213 },
199 214
  215 + _getProceedingData() {
  216 + let type = 0;
  217 + let page = 1;
  218 + let limit = 1000;
  219 + let key = `my_zero_list[${type}].data`
  220 + this.service.getMyList({type, page, limit}).then(res => {
  221 + let data = []
  222 + if (res && res.code === 200) {
  223 + data = res.data;
  224 + }
  225 + this.setData({
  226 + [key]: data
  227 + })
  228 + });
  229 + },
  230 +
  231 + _getReleaseData() {
  232 + let type = 1;
  233 + let my_zero_list = this.data.my_zero_list;
  234 + let page = my_zero_list[type].page;
  235 + let oldData = my_zero_list[type].data;
  236 + let key = `my_zero_list[${type}].data`;
  237 + let keyPage = `my_zero_list[${type}].page`;
  238 + this.service.getMyList({type, page}).then(res => {
  239 + let data = []
  240 + if (res && res.code === 200) {
  241 + data = res.data;
  242 + }
  243 + this.setData({
  244 + [key]: oldData.concat(data),
  245 + [keyPage]: ++page
  246 + })
  247 + this.setData({
  248 + footText: ''
  249 + })
  250 + if (data.length === 0) {
  251 + this.setData({
  252 + footText: '暂无更多内容'
  253 + })
  254 + }
  255 + });
  256 + },
  257 +
200 _jumpBanner() { 258 _jumpBanner() {
201 if (this.data.bannerUrl == null) { 259 if (this.data.bannerUrl == null) {
202 return; 260 return;
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 "quickNavigation": "/pages/quickNavigation/quickNavigation", 8 "quickNavigation": "/pages/quickNavigation/quickNavigation",
9 "tabs": "./components/tabs", 9 "tabs": "./components/tabs",
10 "tabs-pane": "./components/tabs-pane", 10 "tabs-pane": "./components/tabs-pane",
11 - "dialog": "../../component/dialog/dialog" 11 + "dialog": "../../component/dialog/dialog",
  12 + "prize-item": "./components/prize-item"
12 } 13 }
13 } 14 }
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <view class="list-top-blank"></view> 2 <view class="list-top-blank"></view>
3 3
4 <tabs-pane name="进行中"> 4 <tabs-pane name="进行中">
5 - <image class="topgif" src="./images/yoluck.gif"/> 5 + <image class="topgif" src="./images/yoluck.gif"/>
6 <view class="productList"> 6 <view class="productList">
7 <block wx:for="{{list[0].products}}" wx:key="{{item.id}}"> 7 <block wx:for="{{list[0].products}}" wx:key="{{item.id}}">
8 <product-item product="{{item}}" class="product"></product-item> 8 <product-item product="{{item}}" class="product"></product-item>
@@ -27,24 +27,44 @@ @@ -27,24 +27,44 @@
27 </tabs-pane> 27 </tabs-pane>
28 28
29 <tabs-pane name="已参加"> 29 <tabs-pane name="已参加">
30 - <view class="productList"> 30 + <block wx:if="{{isLogin}}">
  31 + <view class="title-view">
  32 + <view class="space-line"></view>
  33 + <text class="title">进行中</text>
  34 + </view>
  35 + <block wx:for="{{my_zero_list[0].data}}">
  36 + <prize-item item="{{item}}" bindshare="share"></prize-item>
  37 + </block>
  38 + <view class="title-view">
  39 + <view class="space-line"></view>
  40 + <text class="title">已公布</text>
  41 + </view>
  42 + <block wx:for="{{my_zero_list[1].data}}">
  43 + <prize-item item="{{item}}" bindshare="share"></prize-item>
  44 + </block>
  45 + </block>
  46 + <block wx:else>
  47 + <view>登录页面</view>
  48 + </block>
  49 + <!-- <view class="productList">
31 <block wx:for="{{list[2].products}}" wx:key="{{item.id}}"> 50 <block wx:for="{{list[2].products}}" wx:key="{{item.id}}">
32 <product-item product="{{item}}" class="product"></product-item> 51 <product-item product="{{item}}" class="product"></product-item>
33 </block> 52 </block>
34 - </view> 53 + </view> -->
35 </tabs-pane> 54 </tabs-pane>
36 55
37 <view class="list-foot-blank">{{footText}}</view> 56 <view class="list-foot-blank">{{footText}}</view>
38 </tabs> 57 </tabs>
39 -  
40 -<view class="bottom-banner" bindtap="_jumpBanner" wx:if="{{bannerSrc != null}}">  
41 -<image class="bottom-banner-img" src="{{bannerSrc}}"></image>  
42 -</view> 58 +<block wx:if="{{tabIndex !== 3}}">
  59 + <view class="bottom-banner" bindtap="_jumpBanner" wx:if="{{bannerSrc != null}}">
  60 + <image class="bottom-banner-img" src="{{bannerSrc}}"></image>
  61 + </view>
  62 +</block>
43 63
44 <!-- <view class="bottom-bar"> 64 <!-- <view class="bottom-bar">
45 <block wx:if="{{isLogin}}"> 65 <block wx:if="{{isLogin}}">
46 <view bindtap="goMyList">我的抽奖码</view> 66 <view bindtap="goMyList">我的抽奖码</view>
47 - </block> 67 + </block>
48 68
49 <block wx:else> 69 <block wx:else>
50 <button class="bottom-btn" plain="true" hover-class="none" open-type="{{!hasUnionID ? 'getUserInfo':'getPhoneNumber'}}" bindgetphonenumber="getPhoneNumber" bindgetuserinfo='getUserInfo'>我的抽奖码</button> 70 <button class="bottom-btn" plain="true" hover-class="none" open-type="{{!hasUnionID ? 'getUserInfo':'getPhoneNumber'}}" bindgetphonenumber="getPhoneNumber" bindgetuserinfo='getUserInfo'>我的抽奖码</button>
@@ -62,4 +62,25 @@ @@ -62,4 +62,25 @@
62 .topgif { 62 .topgif {
63 width: 100%; 63 width: 100%;
64 height: 200rpx; 64 height: 200rpx;
  65 +}
  66 +
  67 +.space-line {
  68 + background-color: #444444;
  69 + width: 8rpx;
  70 + height: 30rpx;
  71 + margin-right: 10rpx;
  72 +}
  73 +
  74 +.title-view {
  75 + border-bottom:2rpx dashed #E0E0E0;
  76 + margin-left: 32rpx;
  77 + margin-top: 20rpx;
  78 + padding-bottom: 20rpx;
  79 + font-size: 32rpx;
  80 + color: #444444;
  81 + letter-spacing: -0.14px;
  82 + display: flex;
  83 + flex-direction: row;
  84 + align-items: center;
  85 + font-family: PingFangSC-Medium;
65 } 86 }
@@ -231,7 +231,7 @@ Page(Object.assign({ @@ -231,7 +231,7 @@ Page(Object.assign({
231 }, 231 },
232 onShareAppMessage(res) { 232 onShareAppMessage(res) {
233 let params = { 233 let params = {
234 - TITLE: `点一下!和我一起开黑0元抢${this.data.shareProduct.name}`, 234 + TITLE: `0元抽奖】点一下,免费拿走${this.data.shareProduct.name}`,
235 DESC: '我在有货精选发现一个不错的商品赶快来看看吧!' 235 DESC: '我在有货精选发现一个不错的商品赶快来看看吧!'
236 }; 236 };
237 237