Authored by 邱骏

修改yoluck接口及字段

@@ -42,6 +42,7 @@ function index(req, res, next) { @@ -42,6 +42,7 @@ function index(req, res, next) {
42 }).catch(e => next(_handelErrorMessage(e))); 42 }).catch(e => next(_handelErrorMessage(e)));
43 } 43 }
44 44
  45 +// 列表页分页
45 function nextPage(req, res, next) { 46 function nextPage(req, res, next) {
46 const page = req.query.page || 1; 47 const page = req.query.page || 1;
47 const type = Number(req.query.type || 0); 48 const type = Number(req.query.type || 0);
1 -const MODULE = '/activity/zerobuy'; 1 +// const MODULE = '/activity/zerobuy';
2 const serviceAPI = global.yoho.ServiceAPI; 2 const serviceAPI = global.yoho.ServiceAPI;
3 3
4 -const yoLuckApi = new global.yoho.ApiBase(global.yoho.config.domains.yoLuck, { 4 +/* 旧的api
  5 + const yoLuckApi = new global.yoho.ApiBase(global.yoho.config.domains.yoLuck, {
5 name: 'yoLuck', 6 name: 'yoLuck',
6 cache: global.yoho.cache, 7 cache: global.yoho.cache,
7 useCache: false 8 useCache: false
8 -}); 9 + });
  10 +*/
9 11
10 function productTime(p) { 12 function productTime(p) {
11 if (p.status === 1) { 13 if (p.status === 1) {
@@ -68,27 +70,31 @@ class YoLuckApi extends global.yoho.BaseModel { @@ -68,27 +70,31 @@ class YoLuckApi extends global.yoho.BaseModel {
68 * @returns {Promise} 70 * @returns {Promise}
69 */ 71 */
70 getList({page, type}) { 72 getList({page, type}) {
71 - return yoLuckApi.get(MODULE + '/list', {  
72 - page, 73 + // 已改成java接口,数据结构改变,字段名改变
  74 + return this.get({
  75 + data: {
  76 + method: 'app.yoluck.activityList',
73 type, 77 type,
74 - channel: 0 78 + page,
  79 + channel: 0,
  80 + size: 10
  81 + }
75 }).then(result => { 82 }).then(result => {
76 if (result.code === 200) { 83 if (result.code === 200) {
77 - const products = result.data; 84 + const products = result.data.list;
78 const newProducts = products.map((p) => { 85 const newProducts = products.map((p) => {
79 p = productTime(p); 86 p = productTime(p);
80 - p.countdown = formatCountDown(p.end_time); 87 + p.countdown = formatCountDown(p.endTime);
81 88
82 return p; 89 return p;
83 }); 90 });
84 91
85 - result.data = newProducts; 92 + result.data.list = newProducts;
86 return result; 93 return result;
87 } 94 }
88 95
89 return result; 96 return result;
90 }); 97 });
91 -  
92 } 98 }
93 99
94 /** 100 /**
@@ -97,13 +103,29 @@ class YoLuckApi extends global.yoho.BaseModel { @@ -97,13 +103,29 @@ class YoLuckApi extends global.yoho.BaseModel {
97 * @returns {Promise} 103 * @returns {Promise}
98 */ 104 */
99 getDetail({actPrizeId, uid}) { 105 getDetail({actPrizeId, uid}) {
100 - return yoLuckApi.get(MODULE + '/content', {actPrizeId, uid}).then(result => { 106 + /* return yoLuckApi.get(MODULE + '/content', {actPrizeId, uid}).then(result => {
101 if (result.code === 200) { 107 if (result.code === 200) {
102 productTime(result.data); 108 productTime(result.data);
103 result.data.countdown = formatCountDown(result.data.end_time); 109 result.data.countdown = formatCountDown(result.data.end_time);
104 } 110 }
105 111
106 return result; 112 return result;
  113 + });*/
  114 +
  115 + return this.get({
  116 + data: {
  117 + method: 'app.yoluck.getContent',
  118 + uid,
  119 + actPrizeId
  120 + }
  121 + }).then(result => {
  122 + // console.log('detail:', result);
  123 + if (result.code === 200) {
  124 + productTime(result.data);
  125 + result.data.countdown = formatCountDown(result.data.endTime);
  126 + }
  127 +
  128 + return result;
107 }); 129 });
108 } 130 }
109 131
@@ -113,7 +135,7 @@ class YoLuckApi extends global.yoho.BaseModel { @@ -113,7 +135,7 @@ class YoLuckApi extends global.yoho.BaseModel {
113 * @returns {Promise} 135 * @returns {Promise}
114 */ 136 */
115 getRecommend({actPrizeId}) { 137 getRecommend({actPrizeId}) {
116 - return yoLuckApi.get(MODULE + '/list/recommend', { 138 + /* return yoLuckApi.get(MODULE + '/list/recommend', {
117 actPrizeId, 139 actPrizeId,
118 channel: 0 140 channel: 0
119 }).then(result => { 141 }).then(result => {
@@ -131,6 +153,30 @@ class YoLuckApi extends global.yoho.BaseModel { @@ -131,6 +153,30 @@ class YoLuckApi extends global.yoho.BaseModel {
131 } 153 }
132 154
133 return result; 155 return result;
  156 + });*/
  157 +
  158 + return this.get({
  159 + data: {
  160 + method: 'app.yoluck.recommendList',
  161 + actPrizeId,
  162 + channel: 0
  163 + }
  164 + }).then(result => {
  165 + if (result.code === 200) {
  166 + console.log('recomment=', result);
  167 + const products = result.data;
  168 + const newProducts = products.map((p) => {
  169 + p = productTime(p);
  170 + p.countdown = formatCountDown(p.end_time);
  171 +
  172 + return p;
  173 + });
  174 +
  175 + result.data = newProducts;
  176 + return result;
  177 + }
  178 +
  179 + return result;
134 }); 180 });
135 } 181 }
136 182
@@ -140,7 +186,13 @@ class YoLuckApi extends global.yoho.BaseModel { @@ -140,7 +186,13 @@ class YoLuckApi extends global.yoho.BaseModel {
140 * @returns {Promise} 186 * @returns {Promise}
141 */ 187 */
142 getRecentAvatars({actPrizeId}) { 188 getRecentAvatars({actPrizeId}) {
143 - return yoLuckApi.get(MODULE + '/code/recent', {actPrizeId}); 189 + // return yoLuckApi.get(MODULE + '/code/recent', {actPrizeId});
  190 + return this.get({
  191 + data: {
  192 + method: 'app.yoluck.recent',
  193 + actPrizeId
  194 + }
  195 + });
144 } 196 }
145 197
146 /** 198 /**
@@ -150,7 +202,17 @@ class YoLuckApi extends global.yoho.BaseModel { @@ -150,7 +202,17 @@ class YoLuckApi extends global.yoho.BaseModel {
150 * @returns {Promise} 202 * @returns {Promise}
151 */ 203 */
152 getMyList({page, type, limit, uid}) { 204 getMyList({page, type, limit, uid}) {
153 - return yoLuckApi.get(MODULE + '/list/mine', {type, page, uid, limit, channel: 0}); 205 + // return yoLuckApi.get(MODULE + '/list/mine', {type, page, uid, limit, channel: 0});
  206 + return this.get({
  207 + data: {
  208 + method: 'app.yoluck.participationList',
  209 + type,
  210 + page,
  211 + uid,
  212 + size: limit,
  213 + channel: 0
  214 + }
  215 + });
154 } 216 }
155 217
156 /** 218 /**
@@ -160,7 +222,14 @@ class YoLuckApi extends global.yoho.BaseModel { @@ -160,7 +222,14 @@ class YoLuckApi extends global.yoho.BaseModel {
160 * @returns {Promise} 222 * @returns {Promise}
161 */ 223 */
162 getMyListWithActid(uid, actPrizeId) { 224 getMyListWithActid(uid, actPrizeId) {
163 - return yoLuckApi.get(MODULE + '/code/mine', {uid, actPrizeId}); 225 + // return yoLuckApi.get(MODULE + '/code/mine', {uid, actPrizeId});
  226 + return this.get({
  227 + data: {
  228 + method: 'app.yoluck.userCode',
  229 + uid,
  230 + actPrizeId
  231 + }
  232 + });
164 } 233 }
165 234
166 /** 235 /**
@@ -173,12 +242,23 @@ class YoLuckApi extends global.yoho.BaseModel { @@ -173,12 +242,23 @@ class YoLuckApi extends global.yoho.BaseModel {
173 * @returns {Promise} 242 * @returns {Promise}
174 */ 243 */
175 fetchCode({shareUid, uid, actPrizeId, userThumb, userName}) { 244 fetchCode({shareUid, uid, actPrizeId, userThumb, userName}) {
176 - return yoLuckApi.post(MODULE + '/code/gain', { 245 + /* return yoLuckApi.post(MODULE + '/code/gain', {
177 shareUid, 246 shareUid,
178 uid, 247 uid,
179 actPrizeId, 248 actPrizeId,
180 userThumb, 249 userThumb,
181 userName 250 userName
  251 + });*/
  252 +
  253 + return this.get({
  254 + data: {
  255 + method: 'app.yoluck.getCode',
  256 + actPrizeId,
  257 + uid,
  258 + shareUid,
  259 + userName,
  260 + userThumb
  261 + }
182 }); 262 });
183 } 263 }
184 264
@@ -138,7 +138,7 @@ class YoLuckService extends global.yoho.BaseModel { @@ -138,7 +138,7 @@ class YoLuckService extends global.yoho.BaseModel {
138 } 138 }
139 139
140 const [resRunning, resFinished] = await Promise.all([ 140 const [resRunning, resFinished] = await Promise.all([
141 - this.getMyListNext({page: 1, limit: 1000, type: YOLUCK_MYLIST_TYPE.running, uid}), 141 + await this.getMyListNext({page: 1, limit: 1000, type: YOLUCK_MYLIST_TYPE.running, uid}),
142 await this.getMyListNext({page: 1, limit: 1000, type: YOLUCK_MYLIST_TYPE.finished, uid}) 142 await this.getMyListNext({page: 1, limit: 1000, type: YOLUCK_MYLIST_TYPE.finished, uid})
143 ]); 143 ]);
144 144
@@ -155,7 +155,7 @@ class YoLuckService extends global.yoho.BaseModel { @@ -155,7 +155,7 @@ class YoLuckService extends global.yoho.BaseModel {
155 } else { 155 } else {
156 result.push(resFinished); 156 result.push(resFinished);
157 } 157 }
158 - 158 + console.log('已参加:', result);
159 return result; 159 return result;
160 } else { 160 } else {
161 result = await this.api.getList({page, type}); 161 result = await this.api.getList({page, type});
@@ -166,7 +166,6 @@ class YoLuckService extends global.yoho.BaseModel { @@ -166,7 +166,6 @@ class YoLuckService extends global.yoho.BaseModel {
166 error: '出错了' 166 error: '出错了'
167 }; 167 };
168 } 168 }
169 -  
170 return result.data; 169 return result.data;
171 } catch (e) { 170 } catch (e) {
172 return { 171 return {
@@ -176,6 +175,7 @@ class YoLuckService extends global.yoho.BaseModel { @@ -176,6 +175,7 @@ class YoLuckService extends global.yoho.BaseModel {
176 } 175 }
177 176
178 async _getDetail(actPrizeId, uid) { 177 async _getDetail(actPrizeId, uid) {
  178 + console.log('uid', uid);
179 try { 179 try {
180 const result = await this.api.getDetail({actPrizeId, uid}); 180 const result = await this.api.getDetail({actPrizeId, uid});
181 181
@@ -377,13 +377,15 @@ class YoLuckService extends global.yoho.BaseModel { @@ -377,13 +377,15 @@ class YoLuckService extends global.yoho.BaseModel {
377 try { 377 try {
378 const result = await this.api.getMyList({page, type, uid, limit}); 378 const result = await this.api.getMyList({page, type, uid, limit});
379 379
  380 + // console.log('已参加列表:', result.data.list);
  381 +
380 if (result.code !== 200) { 382 if (result.code !== 200) {
381 return { 383 return {
382 error: '出错了' 384 error: '出错了'
383 }; 385 };
384 } 386 }
385 387
386 - return result.data; 388 + return result;
387 } catch (e) { 389 } catch (e) {
388 return { 390 return {
389 error: e 391 error: e
@@ -479,6 +481,8 @@ class YoLuckService extends global.yoho.BaseModel { @@ -479,6 +481,8 @@ class YoLuckService extends global.yoho.BaseModel {
479 async getActivityCodeList(uid, actPrizeId) { 481 async getActivityCodeList(uid, actPrizeId) {
480 let result = await this.api.getMyListWithActid(uid, actPrizeId); 482 let result = await this.api.getMyListWithActid(uid, actPrizeId);
481 483
  484 + console.log('myresult:', result);
  485 +
482 let codeList = []; 486 let codeList = [];
483 let nearAvatar = '//img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100'; // eslint-disable-line 487 let nearAvatar = '//img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100'; // eslint-disable-line
484 488
@@ -499,7 +503,7 @@ class YoLuckService extends global.yoho.BaseModel { @@ -499,7 +503,7 @@ class YoLuckService extends global.yoho.BaseModel {
499 }); 503 });
500 } 504 }
501 }); 505 });
502 - 506 + console.log('mycode:', codeList);
503 return codeList; 507 return codeList;
504 } 508 }
505 } 509 }
@@ -20,8 +20,7 @@ @@ -20,8 +20,7 @@
20 {{#ifcond @index '===' 0}} 20 {{#ifcond @index '===' 0}}
21 {{#ifcond list.length '!==' 0}} 21 {{#ifcond list.length '!==' 0}}
22 <div class="js-panel-header"> 22 <div class="js-panel-header">
23 - <img  
24 - src="//img11.static.yhbimg.com/yhb-img01/2018/12/07/15/0188307712613ce043d4b68a94761ee1ff.gif" 23 + <img src="//img11.static.yhbimg.com/yhb-img01/2018/12/07/15/0188307712613ce043d4b68a94761ee1ff.gif"
25 alt=""> 24 alt="">
26 </div> 25 </div>
27 {{/ifcond}} 26 {{/ifcond}}
@@ -30,9 +29,10 @@ @@ -30,9 +29,10 @@
30 <!--数据部--> 29 <!--数据部-->
31 <div class="js-panel-body"> 30 <div class="js-panel-body">
32 {{#ifcond @index '===' 3}} 31 {{#ifcond @index '===' 3}}
  32 + {{log list}}
33 {{> yoluck/prize-list running=list.[0] finished=list.[1] }} 33 {{> yoluck/prize-list running=list.[0] finished=list.[1] }}
34 {{^}} 34 {{^}}
35 - {{#each list}} 35 + {{#each list.list}}
36 {{> yoluck/product-item .}} 36 {{> yoluck/product-item .}}
37 {{/each}} 37 {{/each}}
38 {{/ifcond}} 38 {{/ifcond}}
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 {{/isEqualOr}} 29 {{/isEqualOr}}
30 30
31 {{#isEqualOr status 5}} 31 {{#isEqualOr status 5}}
32 - <div class="counter-num" > 人数不足 活动结束 </div> 32 + <div class="counter-num" > 等待开奖 </div>
33 {{/isEqualOr}} 33 {{/isEqualOr}}
34 34
35 </div> 35 </div>
1 <div class="prize-item-comp"> 1 <div class="prize-item-comp">
2 - <div class="prize-item js-prizeitem" data-id="{{act_prize_id}}">  
3 - <img class="product-image" src="{{cover_img}}" alt=""> 2 + <div class="prize-item js-prizeitem" data-id="{{id}}">
  3 + <img class="product-image" src="{{coverImg}}" alt="">
4 4
5 <div class="content"> 5 <div class="content">
6 <div class="code">抽奖码 6 <div class="code">抽奖码
7 - <text style="color: black;">{{prize_code}}</text> 7 + <text style="color: black;">{{prizeCode}}</text>
8 </div> 8 </div>
9 <div class="product-name">{{name}}</div> 9 <div class="product-name">{{name}}</div>
10 10
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 {{/ifcond}} 17 {{/ifcond}}
18 18
19 {{#ifcond status '===' 4}} 19 {{#ifcond status '===' 4}}
20 - <div class="btn more js-fellow" data-id="{{act_prize_id}}" data-lottery="{{lottery_info}}">查看中奖信息</div> 20 + <div class="btn more js-fellow" data-id="{{id}}" data-lottery="{{lotteryInfo}}">查看中奖信息</div>
21 {{/ifcond}} 21 {{/ifcond}}
22 22
23 {{#ifcond status '===' 5}} 23 {{#ifcond status '===' 5}}
@@ -26,10 +26,10 @@ @@ -26,10 +26,10 @@
26 26
27 {{#isEqualOr status 1 2 6}} 27 {{#isEqualOr status 1 2 6}}
28 <div class="btn more js-share" 28 <div class="btn more js-share"
29 - data-img="{{cover_img}}" 29 + data-img="{{coverImg}}"
30 data-name="{{name}}" 30 data-name="{{name}}"
31 data-price="{{price}}" 31 data-price="{{price}}"
32 - data-id="{{act_prize_id}}" 32 + data-id="{{id}}"
33 > 33 >
34 获得更多抽奖码 34 获得更多抽奖码
35 </div> 35 </div>
@@ -4,9 +4,9 @@ @@ -4,9 +4,9 @@
4 <span class="title">进行中</span> 4 <span class="title">进行中</span>
5 </div> 5 </div>
6 </div> 6 </div>
7 -  
8 -{{#ifcond running.length '>' 0}}  
9 - {{#each running}} 7 +{{log .}}
  8 +{{#ifcond running.data.list.length '>' 0}}
  9 + {{#each running.data.list}}
10 {{> yoluck/prize-item .}} 10 {{> yoluck/prize-item .}}
11 {{/each}} 11 {{/each}}
12 {{^}} 12 {{^}}
@@ -20,8 +20,8 @@ @@ -20,8 +20,8 @@
20 </div> 20 </div>
21 </div> 21 </div>
22 22
23 -{{#ifcond finished.length '>' 0}}  
24 - {{#each finished}} 23 +{{#ifcond finished.data.list.length '>' 0}}
  24 + {{#each finished.data.list}}
25 {{> yoluck/prize-item .}} 25 {{> yoluck/prize-item .}}
26 {{/each}} 26 {{/each}}
27 {{^}} 27 {{^}}
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 <div class="desc"> 23 <div class="desc">
24 <div class="title {{#ifcond step '>=' 1}}active{{/ifcond}}">参加抽奖</div> 24 <div class="title {{#ifcond step '>=' 1}}active{{/ifcond}}">参加抽奖</div>
25 <div class="title {{#ifcond step '>=' 2}}active{{/ifcond}}">邀请好友</div> 25 <div class="title {{#ifcond step '>=' 2}}active{{/ifcond}}">邀请好友</div>
26 - <div class="title {{#ifcond step '>=' 3}}active{{/ifcond}}">{{#ifcond step '===' 4}}人数不足{{^}}人满开奖{{/ifcond}}</div> 26 + <div class="title {{#ifcond step '>=' 3}}active{{/ifcond}}">{{#ifcond step '===' 4}}等待开奖{{^}}等待开奖{{/ifcond}}</div>
27 </div> 27 </div>
28 </div> 28 </div>
29 </div> 29 </div>
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <text class="countdown_labeltext">倒计时</text> 4 <text class="countdown_labeltext">倒计时</text>
5 </div> 5 </div>
6 6
7 - <div class="product_countdown" data-endtime="{{product.end_time}}"> 7 + <div class="product_countdown" data-endtime="{{product.endTime}}">
8 {{> yoluck/time-countdown time=product.countdown}} 8 {{> yoluck/time-countdown time=product.countdown}}
9 </div> 9 </div>
10 {{/ifcond}} 10 {{/ifcond}}
@@ -18,13 +18,13 @@ @@ -18,13 +18,13 @@
18 {{/ifcond}} 18 {{/ifcond}}
19 {{/ifcond}} 19 {{/ifcond}}
20 20
21 - <img class="product_image" src="{{image2 product.cover_img q=60}}"/> 21 + <img class="product_image" src="{{image2 product.coverImg q=60}}"/>
22 </div> 22 </div>
23 23
24 <div class="product_name" 24 <div class="product_name"
25 data-id="{{product.id}}" 25 data-id="{{product.id}}"
26 data-name="{{product.name}}" 26 data-name="{{product.name}}"
27 - data-img="{{image2 product.cover_img q=60}}" 27 + data-img="{{image2 product.coverImg q=60}}"
28 data-price="{{product.price}}" 28 data-price="{{product.price}}"
29 > 29 >
30 {{product.name}} 30 {{product.name}}
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
39 </div> 39 </div>
40 40
41 {{#ifcond product.status '!==' 2}} 41 {{#ifcond product.status '!==' 2}}
42 - <div class="product_time">{{formatTime product.start_time product.end_time}}</div> 42 + <div class="product_time">{{formatTime product.startTime product.endTime}}</div>
43 {{/ifcond}} 43 {{/ifcond}}
44 44
45 <div class="product_margin"></div> 45 <div class="product_margin"></div>
1 {{#ifcond status '===' 2}} 1 {{#ifcond status '===' 2}}
2 - <div class="product_countdown" data-endtime="{{end_time}}"> 2 + <div class="product_countdown" data-endtime="{{endTime}}">
3 {{>yoluck/time-countdown time=countdown}} 3 {{>yoluck/time-countdown time=countdown}}
4 </div> 4 </div>
5 {{/ifcond}} 5 {{/ifcond}}
6 6
7 -<img class="product_image" src="{{image2 cover_img w=760 h=470 q=60}}" alt="" data-id="{{id}}"> 7 +<img class="product_image" src="{{image2 coverImg w=760 h=470 q=60}}" alt="" data-id="{{id}}">
8 <div class="product_name">{{name}}</div> 8 <div class="product_name">{{name}}</div>
9 9
10 <div class="product_lucky_bg"> 10 <div class="product_lucky_bg">
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 </div> 13 </div>
14 14
15 {{#ifcond status '!==' 2}} 15 {{#ifcond status '!==' 2}}
16 - <div class="product_time">{{formatTime start_time end_time}}</div> 16 + <div class="product_time">{{formatTime startTime endTime}}</div>
17 {{/ifcond}} 17 {{/ifcond}}
18 18
19 <div class="product_margin"></div> 19 <div class="product_margin"></div>
@@ -18,6 +18,6 @@ @@ -18,6 +18,6 @@
18 {{/isEqualOr}} 18 {{/isEqualOr}}
19 19
20 {{#isEqualOr status 5}} 20 {{#isEqualOr status 5}}
21 - <div class="btn cancel">人数不足 活动结束</div> 21 + <div class="btn cancel">待开奖</div>
22 {{/isEqualOr}} 22 {{/isEqualOr}}
23 </div> 23 </div>
@@ -31,7 +31,7 @@ const domains = { @@ -31,7 +31,7 @@ const domains = {
31 liveApi: 'http://testapi.live.yohops.com:9999/', 31 liveApi: 'http://testapi.live.yohops.com:9999/',
32 singleApi: 'http://api-test3.dev.yohocorp.com/', 32 singleApi: 'http://api-test3.dev.yohocorp.com/',
33 ufo: 'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/', 33 ufo: 'http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/',
34 - yoLuck: 'http://limit-yoho-activity-platform.test3.ingress.dev.yohocorp.com', 34 + yoLuck: 'http://yoho-activity-platform.test3.ingress.dev.yohocorp.com',
35 35
36 imSocket: 'wss://imsocket.yohobuy.com:443', 36 imSocket: 'wss://imsocket.yohobuy.com:443',
37 imCs: 'https://imhttp.yohobuy.com/api', 37 imCs: 'https://imhttp.yohobuy.com/api',
1 <div class="prize-item-comp"> 1 <div class="prize-item-comp">
2 - <div class="prize-item js-prizeitem" data-id="{{act_prize_id}}">  
3 - <img class="product-image" src="{{cover_img}}" alt=""> 2 + <div class="prize-item js-prizeitem" data-id="{{id}}">
  3 + <img class="product-image" src="{{coverImg}}" alt="">
4 4
5 <div class="content"> 5 <div class="content">
6 <div class="code">抽奖码 6 <div class="code">抽奖码
7 - <text style="color: black;">{{prize_code}}</text> 7 + <text style="color: black;">{{prizeCode}}</text>
8 </div> 8 </div>
9 <div class="product-name">{{name}}</div> 9 <div class="product-name">{{name}}</div>
10 10
@@ -17,19 +17,19 @@ @@ -17,19 +17,19 @@
17 {{/ifcond}} 17 {{/ifcond}}
18 18
19 {{#ifcond status '===' 4}} 19 {{#ifcond status '===' 4}}
20 - <div class="btn more js-fellow" data-id="{{act_prize_id}}">查看中奖信息</div> 20 + <div class="btn more js-fellow" data-id="{{id}}">查看中奖信息</div>
21 {{/ifcond}} 21 {{/ifcond}}
22 22
23 {{#ifcond status '===' 5}} 23 {{#ifcond status '===' 5}}
24 - <div class="btn">人数不足 活动结束</div> 24 + <div class="btn">等待开奖</div>
25 {{/ifcond}} 25 {{/ifcond}}
26 26
27 {{#is-equal-or status 1 2 6}} 27 {{#is-equal-or status 1 2 6}}
28 <div class="btn more js-share" 28 <div class="btn more js-share"
29 - data-img="{{cover_img}}" 29 + data-img="{{coverImg}}"
30 data-name="{{name}}" 30 data-name="{{name}}"
31 data-price="{{price}}" 31 data-price="{{price}}"
32 - data-id="{{act_prize_id}}" 32 + data-id="{{id}}"
33 > 33 >
34 获得更多抽奖码 34 获得更多抽奖码
35 </div> 35 </div>
@@ -5,9 +5,9 @@ @@ -5,9 +5,9 @@
5 </div> 5 </div>
6 </div> 6 </div>
7 7
8 -  
9 -{{#ifcond running.length '>' 0}}  
10 - {{#each running}} 8 +{{log .}}
  9 +{{#ifcond running.data.list.length '>' 0}}
  10 + {{#each running.data.list}}
11 {{> ./prize-item .}} 11 {{> ./prize-item .}}
12 {{/each}} 12 {{/each}}
13 {{^}} 13 {{^}}
@@ -21,8 +21,8 @@ @@ -21,8 +21,8 @@
21 </div> 21 </div>
22 </div> 22 </div>
23 23
24 -{{#ifcond finished.length '>' 0}}  
25 - {{#each finished}} 24 +{{#ifcond finished.data.list.length '>' 0}}
  25 + {{#each finished.data.list}}
26 {{> ./prize-item .}} 26 {{> ./prize-item .}}
27 {{/each}} 27 {{/each}}
28 {{^}} 28 {{^}}
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 </div> 6 </div>
7 {{/ifcond}} 7 {{/ifcond}}
8 8
9 -<img class="product_image" src="{{image2 cover_img w=760 h=470 q=60}}" alt="" data-id="{{id}}"> 9 +<img class="product_image" src="{{image2 coverImg w=760 h=470 q=60}}" alt="" data-id="{{id}}">
10 <div class="product_name">{{name}}</div> 10 <div class="product_name">{{name}}</div>
11 11
12 <div class="product_lucky_bg"> 12 <div class="product_lucky_bg">
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 </div> 15 </div>
16 16
17 {{#ifcond status '!==' 2}} 17 {{#ifcond status '!==' 2}}
18 -<div class="product_time">{{formatTime start_time end_time}}</div> 18 +<div class="product_time">{{formatTime startTime endTime}}</div>
19 {{/ifcond}} 19 {{/ifcond}}
20 20
21 <div class="product_margin"></div> 21 <div class="product_margin"></div>
@@ -18,6 +18,6 @@ @@ -18,6 +18,6 @@
18 {{/is-equal-or}} 18 {{/is-equal-or}}
19 19
20 {{#is-equal-or status 5}} 20 {{#is-equal-or status 5}}
21 - <div class="btn cancel">人数不足 活动结束</div> 21 + <div class="btn cancel">等待开奖</div>
22 {{/is-equal-or}} 22 {{/is-equal-or}}
23 </div> 23 </div>
@@ -131,7 +131,9 @@ function fetchPage(page, index) { @@ -131,7 +131,9 @@ function fetchPage(page, index) {
131 return; 131 return;
132 } 132 }
133 133
134 - if (result.data.length === 0) { 134 + // 当前page > 结果的最大page时不处理
  135 + if (page > result.data.page_total || result.data.length === 0) {
  136 + page--;
135 return; 137 return;
136 } 138 }
137 139
@@ -144,7 +146,7 @@ function fetchPage(page, index) { @@ -144,7 +146,7 @@ function fetchPage(page, index) {
144 $node.find('.js-panel-body').html($products); 146 $node.find('.js-panel-body').html($products);
145 } else { 147 } else {
146 let $node = tabpanelStore.nodes.eq(index); 148 let $node = tabpanelStore.nodes.eq(index);
147 - let $products = result.data.map(r => { 149 + let $products = result.data.list.map(r => {
148 const p = productTpl(r); 150 const p = productTpl(r);
149 151
150 store.countDown = store.countDown.add($(p).find('.product_countdown')); 152 store.countDown = store.countDown.add($(p).find('.product_countdown'));