Authored by huangyi

完成分享

... ... @@ -5,8 +5,8 @@ export const LOG_EVENT_HOST = 'https://analysis.yohobuy.com/yas_mobile';
// export const ACTIVITY_HOST = 'http://192.168.102.49:6006';
// export const ACTIVITY_HOST = 'http://172.16.10.53:6006'
//export const ACTIVITY_HOST = 'http://yoho-activity-platform.test3.ingress.dev.yohocorp.com';
export const ACTIVITY_HOST = 'https://action.yoho.cn';
export const ACTIVITY_HOST = 'http://yoho-activity-platform.test3.ingress.dev.yohocorp.com';
//export const ACTIVITY_HOST = 'https://action.yoho.cn';
// export const API_HOST = 'http://dev-api.yohops.com:9999';
// export const SERVICE_HOST = 'http://dev-api.yohops.com:9999/';
... ...
... ... @@ -125,6 +125,7 @@ Component({
fellow: false
});
console.log('隐藏');
this.triggerEvent('getcode');
},
submitFormId(e) {
... ...
... ... @@ -99,7 +99,7 @@ Page(Object.assign({
]
},
animation: null,
shareFlag:false
shareFlag: false
},
/**
... ... @@ -196,6 +196,7 @@ Page(Object.assign({
this._init().then(() => {
wx.stopPullDownRefresh();
})
this._getMineCode()
},
/**
... ... @@ -227,13 +228,6 @@ Page(Object.assign({
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
goLogin() {
const event = global.event;
event.emit('user-is-login', {logged: this.logged, loginSuccess: this.loginSuccess});
... ... @@ -249,7 +243,8 @@ Page(Object.assign({
_getMineCode() {
if (this.data.uid) {
this.service.fetchMyPrizeList({uid: this.data.uid, actPrizeId: this.data.actPrizeId}).then(res => {
let len = res.data.length;
let len = res.data.length > 3 ? 3 : res.data.length;
if (len) {
let animation = wx.createAnimation({
duration: 400 * len,
})
... ... @@ -261,6 +256,7 @@ Page(Object.assign({
let query = wx.createSelectorQuery();
query.select('.code-list-item-container').boundingClientRect();
query.exec((res) => {
console.log(res[0].height)
animation.height(res[0].height - 63).step();
this.setData({
animation: animation.export()
... ... @@ -268,7 +264,7 @@ Page(Object.assign({
})
}.bind(this), 400);
}
})
}
},
... ... @@ -337,10 +333,6 @@ Page(Object.assign({
let participantCount = r1.code === 200 ? r1.data.joinNum : 0;
// if (product.status >= ACTIVITY.END) {
// participantCount = product.limit;
// }
this.setData({
product: product,
recommends: r2.code === 200 ? r2.data : [],
... ... @@ -365,12 +357,6 @@ Page(Object.assign({
}).catch((e) => {
console.error(e);
wx.hideLoading();
// wx.showModal({
// title: "出错了",
// content: '请重新加载!',
// showCancel: false
// })
});
},
... ... @@ -457,6 +443,7 @@ Page(Object.assign({
mask: true
});
this._init();
this._getMineCode();
},
share(event) {
... ... @@ -465,11 +452,6 @@ Page(Object.assign({
})
},
requireAuth() {
// this.setData({
// showAuth: true
// })
},
_jumpBanner() {
if (this.data.bannerUrl == null) {
return;
... ... @@ -530,45 +512,27 @@ Page(Object.assign({
onShareAppMessage(res) {
let params = {
TITLE: `【0元抽奖】点一下,免费拿走${this.data.product.name}`,
DESC: '我在YO!LUCK发现一个不错的商品赶快来看看吧!'
DESC: '我在YO!LUCK发现一个不错的商品赶快来看看1吧!'
};
this.setData({
shareFlag: true
})
setTimeout(function () {
this.setData({shareFlag: false});
}.bind(this), 600);
if (res.from === 'menu') {
// 用户点击右上角分享
return {
title: params.TITLE, // 分享标题
desc: params.DESC, // 分享描述
path: `/pages/zeroSell/detail?actPrizeId=${this.data.product.id}`,
success: ()=> {
this.setData({
shareFlag: false
})
},
fail: ()=> {
this.setData({
shareFlag: false
})
}
path: `/pages/zeroSell/detail?actPrizeId=${this.data.product.id}`
};
} else if (res.from === 'button') {
// 用户点击分享按钮
return {
title: params.TITLE, // 分享标题
desc: params.DESC, // 分享描述
path: `/pages/zeroSell/detail?actPrizeId=${this.data.product.id}&shareUid=${app.getUid()}`,
success: ()=> {
this.setData({
shareFlag: false
})
},
fail: ()=> {
this.setData({
shareFlag: false
})
}
};
}
},
... ...
... ... @@ -4,17 +4,16 @@
<view class="header {{shareFlag || 'mt-header'}}" >
<product-header product="{{product}}" shareFlag="{{shareFlag}}" avatars="{{avatars}}"></product-header>
<view style="height: 20rpx;"></view>
</view>
<block wx:if="{{false}}">
<counter count="{{participantCount}}" num="{{product.limit}}" status="{{product.status}}"></counter>
<prize-progress step="{{step}}"></prize-progress>
</block>
<view class="machine">
<view class="machine {{shareFlag ? 'machine-t-m' : 'machine-t-l'}}">
<view class="code-list" animation="{{animation}}">
<view class="code-list-item-container">
<view class="code-list-item"><view class="content"></view></view>
<view class="code-list-item" wx:for="{{codeList}}">
<view class="code-list-item" wx:for="{{codeList}}" wx:if="{{index < 3}}">
<view class="content">
<image class="thumb" mode="widthFix" src="{{item.user_thumb}}"></image>
<view class="text">
... ... @@ -23,7 +22,9 @@
</view>
<view class="my-code">{{item.prize_code}}</view>
</view>
<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>
</view>
<image src="./images/down.png" mode="widthFix" class="down" wx:if="{{codeList.length>3}}"></image>
</view>
</view>
</view>
... ...
... ... @@ -118,6 +118,13 @@
width: 598rpx;
overflow: hidden;
}
.machine-t-l{
margin-top: 20rpx;
}
.machine-t-m{
margin-top: 40rpx;
}
.machine .code-list {
position: relative;
... ... @@ -132,6 +139,7 @@
width: 410rpx;
height: 164rpx;
overflow: hidden;
position: relative;
}
.code-list .code-list-item-container {
... ... @@ -157,6 +165,7 @@
background-size: contain;
background-repeat: no-repeat;
overflow: hidden;
z-index:4;
}
.code-list .code-list-item .content .thumb{
... ... @@ -179,3 +188,14 @@
height:172rpx;
vertical-align:middle;
}
.code-list .code-list-item .shadow {
width: 410rpx;
position: absolute;
top: 6rpx
}
.code-list .down {
width: 20rpx;
height: 20rpx;
margin-left: 50%
}
\ No newline at end of file
... ...