Authored by huangyi

完成分享

@@ -5,8 +5,8 @@ export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile'; @@ -5,8 +5,8 @@ export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile';
5 5
6 // export const ACTIVITY_HOST = 'http://192.168.102.49:6006'; 6 // export const ACTIVITY_HOST = 'http://192.168.102.49:6006';
7 // export const ACTIVITY_HOST = 'http://172.16.10.53:6006' 7 // export const ACTIVITY_HOST = 'http://172.16.10.53:6006'
8 -//export const ACTIVITY_HOST = 'http://yoho-activity-platform.test3.ingress.dev.yohocorp.com';  
9 -export const ACTIVITY_HOST = 'https://action.yoho.cn'; 8 +export const ACTIVITY_HOST = 'http://yoho-activity-platform.test3.ingress.dev.yohocorp.com';
  9 +//export const ACTIVITY_HOST = 'https://action.yoho.cn';
10 10
11 // export const API_HOST = 'http://dev-api.yohops.com:9999'; 11 // export const API_HOST = 'http://dev-api.yohops.com:9999';
12 // export const SERVICE_HOST = 'http://dev-api.yohops.com:9999/'; 12 // export const SERVICE_HOST = 'http://dev-api.yohops.com:9999/';
@@ -125,6 +125,7 @@ Component({ @@ -125,6 +125,7 @@ Component({
125 fellow: false 125 fellow: false
126 }); 126 });
127 console.log('隐藏'); 127 console.log('隐藏');
  128 + this.triggerEvent('getcode');
128 }, 129 },
129 130
130 submitFormId(e) { 131 submitFormId(e) {
@@ -99,7 +99,7 @@ Page(Object.assign({ @@ -99,7 +99,7 @@ Page(Object.assign({
99 ] 99 ]
100 }, 100 },
101 animation: null, 101 animation: null,
102 - shareFlag:false 102 + shareFlag: false
103 }, 103 },
104 104
105 /** 105 /**
@@ -196,6 +196,7 @@ Page(Object.assign({ @@ -196,6 +196,7 @@ Page(Object.assign({
196 this._init().then(() => { 196 this._init().then(() => {
197 wx.stopPullDownRefresh(); 197 wx.stopPullDownRefresh();
198 }) 198 })
  199 + this._getMineCode()
199 }, 200 },
200 201
201 /** 202 /**
@@ -227,13 +228,6 @@ Page(Object.assign({ @@ -227,13 +228,6 @@ Page(Object.assign({
227 }) 228 })
228 }, 229 },
229 230
230 - /**  
231 - * 用户点击右上角分享  
232 - */  
233 - onShareAppMessage: function () {  
234 -  
235 - },  
236 -  
237 goLogin() { 231 goLogin() {
238 const event = global.event; 232 const event = global.event;
239 event.emit('user-is-login', {logged: this.logged, loginSuccess: this.loginSuccess}); 233 event.emit('user-is-login', {logged: this.logged, loginSuccess: this.loginSuccess});
@@ -249,26 +243,28 @@ Page(Object.assign({ @@ -249,26 +243,28 @@ Page(Object.assign({
249 _getMineCode() { 243 _getMineCode() {
250 if (this.data.uid) { 244 if (this.data.uid) {
251 this.service.fetchMyPrizeList({uid: this.data.uid, actPrizeId: this.data.actPrizeId}).then(res => { 245 this.service.fetchMyPrizeList({uid: this.data.uid, actPrizeId: this.data.actPrizeId}).then(res => {
252 - let len = res.data.length;  
253 - let animation = wx.createAnimation({  
254 - duration: 400 * len,  
255 - })  
256 - this.setData({  
257 - codeList: res.data,  
258 - })  
259 - this.animation = animation  
260 - setTimeout(function () {  
261 - let query = wx.createSelectorQuery();  
262 - query.select('.code-list-item-container').boundingClientRect();  
263 - query.exec((res) => {  
264 - animation.height(res[0].height - 63).step();  
265 - this.setData({  
266 - animation: animation.export()  
267 - }) 246 + let len = res.data.length > 3 ? 3 : res.data.length;
  247 + if (len) {
  248 + let animation = wx.createAnimation({
  249 + duration: 400 * len,
268 }) 250 })
  251 + this.setData({
  252 + codeList: res.data,
  253 + })
  254 + this.animation = animation
  255 + setTimeout(function () {
  256 + let query = wx.createSelectorQuery();
  257 + query.select('.code-list-item-container').boundingClientRect();
  258 + query.exec((res) => {
  259 + console.log(res[0].height)
  260 + animation.height(res[0].height - 63).step();
  261 + this.setData({
  262 + animation: animation.export()
  263 + })
  264 + })
269 265
270 - }.bind(this), 400);  
271 - 266 + }.bind(this), 400);
  267 + }
272 }) 268 })
273 } 269 }
274 }, 270 },
@@ -337,10 +333,6 @@ Page(Object.assign({ @@ -337,10 +333,6 @@ Page(Object.assign({
337 333
338 let participantCount = r1.code === 200 ? r1.data.joinNum : 0; 334 let participantCount = r1.code === 200 ? r1.data.joinNum : 0;
339 335
340 - // if (product.status >= ACTIVITY.END) {  
341 - // participantCount = product.limit;  
342 - // }  
343 -  
344 this.setData({ 336 this.setData({
345 product: product, 337 product: product,
346 recommends: r2.code === 200 ? r2.data : [], 338 recommends: r2.code === 200 ? r2.data : [],
@@ -365,12 +357,6 @@ Page(Object.assign({ @@ -365,12 +357,6 @@ Page(Object.assign({
365 }).catch((e) => { 357 }).catch((e) => {
366 console.error(e); 358 console.error(e);
367 wx.hideLoading(); 359 wx.hideLoading();
368 -  
369 - // wx.showModal({  
370 - // title: "出错了",  
371 - // content: '请重新加载!',  
372 - // showCancel: false  
373 - // })  
374 }); 360 });
375 }, 361 },
376 362
@@ -457,6 +443,7 @@ Page(Object.assign({ @@ -457,6 +443,7 @@ Page(Object.assign({
457 mask: true 443 mask: true
458 }); 444 });
459 this._init(); 445 this._init();
  446 + this._getMineCode();
460 }, 447 },
461 448
462 share(event) { 449 share(event) {
@@ -465,11 +452,6 @@ Page(Object.assign({ @@ -465,11 +452,6 @@ Page(Object.assign({
465 }) 452 })
466 }, 453 },
467 454
468 - requireAuth() {  
469 - // this.setData({  
470 - // showAuth: true  
471 - // })  
472 - },  
473 _jumpBanner() { 455 _jumpBanner() {
474 if (this.data.bannerUrl == null) { 456 if (this.data.bannerUrl == null) {
475 return; 457 return;
@@ -530,45 +512,27 @@ Page(Object.assign({ @@ -530,45 +512,27 @@ Page(Object.assign({
530 onShareAppMessage(res) { 512 onShareAppMessage(res) {
531 let params = { 513 let params = {
532 TITLE: `【0元抽奖】点一下,免费拿走${this.data.product.name}`, 514 TITLE: `【0元抽奖】点一下,免费拿走${this.data.product.name}`,
533 - DESC: '我在YO!LUCK发现一个不错的商品赶快来看看吧!' 515 + DESC: '我在YO!LUCK发现一个不错的商品赶快来看看1吧!'
534 }; 516 };
535 this.setData({ 517 this.setData({
536 shareFlag: true 518 shareFlag: true
537 }) 519 })
  520 + setTimeout(function () {
  521 + this.setData({shareFlag: false});
  522 + }.bind(this), 600);
538 if (res.from === 'menu') { 523 if (res.from === 'menu') {
539 // 用户点击右上角分享 524 // 用户点击右上角分享
540 return { 525 return {
541 title: params.TITLE, // 分享标题 526 title: params.TITLE, // 分享标题
542 desc: params.DESC, // 分享描述 527 desc: params.DESC, // 分享描述
543 - path: `/pages/zeroSell/detail?actPrizeId=${this.data.product.id}`,  
544 - success: ()=> {  
545 - this.setData({  
546 - shareFlag: false  
547 - })  
548 - },  
549 - fail: ()=> {  
550 - this.setData({  
551 - shareFlag: false  
552 - })  
553 - } 528 + path: `/pages/zeroSell/detail?actPrizeId=${this.data.product.id}`
554 }; 529 };
555 } else if (res.from === 'button') { 530 } else if (res.from === 'button') {
556 // 用户点击分享按钮 531 // 用户点击分享按钮
557 -  
558 return { 532 return {
559 title: params.TITLE, // 分享标题 533 title: params.TITLE, // 分享标题
560 desc: params.DESC, // 分享描述 534 desc: params.DESC, // 分享描述
561 path: `/pages/zeroSell/detail?actPrizeId=${this.data.product.id}&shareUid=${app.getUid()}`, 535 path: `/pages/zeroSell/detail?actPrizeId=${this.data.product.id}&shareUid=${app.getUid()}`,
562 - success: ()=> {  
563 - this.setData({  
564 - shareFlag: false  
565 - })  
566 - },  
567 - fail: ()=> {  
568 - this.setData({  
569 - shareFlag: false  
570 - })  
571 - }  
572 }; 536 };
573 } 537 }
574 }, 538 },
@@ -4,17 +4,16 @@ @@ -4,17 +4,16 @@
4 <view class="header {{shareFlag || 'mt-header'}}" > 4 <view class="header {{shareFlag || 'mt-header'}}" >
5 5
6 <product-header product="{{product}}" shareFlag="{{shareFlag}}" avatars="{{avatars}}"></product-header> 6 <product-header product="{{product}}" shareFlag="{{shareFlag}}" avatars="{{avatars}}"></product-header>
7 - <view style="height: 20rpx;"></view>  
8 </view> 7 </view>
9 <block wx:if="{{false}}"> 8 <block wx:if="{{false}}">
10 <counter count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter> 9 <counter count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter>
11 <prize-progress step="{{step}}"></prize-progress> 10 <prize-progress step="{{step}}"></prize-progress>
12 </block> 11 </block>
13 - <view class="machine"> 12 + <view class="machine {{shareFlag ? 'machine-t-m' : 'machine-t-l'}}">
14 <view class="code-list" animation="{{animation}}"> 13 <view class="code-list" animation="{{animation}}">
15 <view class="code-list-item-container"> 14 <view class="code-list-item-container">
16 <view class="code-list-item"><view class="content"></view></view> 15 <view class="code-list-item"><view class="content"></view></view>
17 - <view class="code-list-item" wx:for="{{codeList}}"> 16 + <view class="code-list-item" wx:for="{{codeList}}" wx:if="{{index < 3}}">
18 <view class="content"> 17 <view class="content">
19 <image class="thumb" mode="widthFix" src="{{item.user_thumb}}"></image> 18 <image class="thumb" mode="widthFix" src="{{item.user_thumb}}"></image>
20 <view class="text"> 19 <view class="text">
@@ -23,7 +22,9 @@ @@ -23,7 +22,9 @@
23 </view> 22 </view>
24 <view class="my-code">{{item.prize_code}}</view> 23 <view class="my-code">{{item.prize_code}}</view>
25 </view> 24 </view>
  25 + <image class="shadow" src="https://img11.static.yhbimg.com/yhb-img01/2018/12/27/19/0140fa3243af949068d2aabeedb0ea0666.png" mode="widthFix" wx:if="{{index == 2 && codeList.length>3 }}"></image>
26 </view> 26 </view>
  27 + <image src="./images/down.png" mode="widthFix" class="down" wx:if="{{codeList.length>3}}"></image>
27 </view> 28 </view>
28 </view> 29 </view>
29 </view> 30 </view>
@@ -118,6 +118,13 @@ @@ -118,6 +118,13 @@
118 width: 598rpx; 118 width: 598rpx;
119 overflow: hidden; 119 overflow: hidden;
120 } 120 }
  121 +.machine-t-l{
  122 + margin-top: 20rpx;
  123 +}
  124 +
  125 +.machine-t-m{
  126 + margin-top: 40rpx;
  127 +}
121 128
122 .machine .code-list { 129 .machine .code-list {
123 position: relative; 130 position: relative;
@@ -132,6 +139,7 @@ @@ -132,6 +139,7 @@
132 width: 410rpx; 139 width: 410rpx;
133 height: 164rpx; 140 height: 164rpx;
134 overflow: hidden; 141 overflow: hidden;
  142 + position: relative;
135 } 143 }
136 144
137 .code-list .code-list-item-container { 145 .code-list .code-list-item-container {
@@ -157,6 +165,7 @@ @@ -157,6 +165,7 @@
157 background-size: contain; 165 background-size: contain;
158 background-repeat: no-repeat; 166 background-repeat: no-repeat;
159 overflow: hidden; 167 overflow: hidden;
  168 + z-index:4;
160 } 169 }
161 170
162 .code-list .code-list-item .content .thumb{ 171 .code-list .code-list-item .content .thumb{
@@ -179,3 +188,14 @@ @@ -179,3 +188,14 @@
179 height:172rpx; 188 height:172rpx;
180 vertical-align:middle; 189 vertical-align:middle;
181 } 190 }
  191 +.code-list .code-list-item .shadow {
  192 + width: 410rpx;
  193 + position: absolute;
  194 + top: 6rpx
  195 +}
  196 +
  197 +.code-list .down {
  198 + width: 20rpx;
  199 + height: 20rpx;
  200 + margin-left: 50%
  201 +}