Authored by htoooth

Merge branch 'develop' of http://git.yoho.cn/fe/yoho-limited-sell-miniapp into develop

... ... @@ -57,7 +57,7 @@ Page({
referer: referer
});
}
if (options.login !== undefined) {
if (options.login || options.login === 0) {
this.setData({
needBind: (options.login === '0' || !options.login) ? 0 : true
});
... ...
... ... @@ -190,7 +190,7 @@ Page(Object.assign({
this.setData({
'actionSheet.show': false
});
console.log('ok');
let uid = this.data.originUid || this.data.uid;
if (index === 0) {
... ...
... ... @@ -4,7 +4,7 @@ import event from '../../common/event';
import LimitModel from '../../models/limit/index';
import helper from '../../utils/helper';
import wx from '../../utils/wx';
import {Actionsheet} from '../../vendors/zanui/index';
let app = getApp();
let router = global.router;
... ... @@ -31,7 +31,7 @@ let router = global.router;
* https://api.yoho.cn/?activityId=294&app_version=6.4.0&client_secret=e7ecfcd3410f5c8b0054c07b8366a700&client_type=iphone&fromPage=iFP_LimitPurchaseDetail&method=app.limitProduct.addUserShare&os_version=11.2.6&physical_channel=1&screen_size=375x667&session_key=d4c06294461b138058ce3aa2978cd602&udid=1a61c0b4db7b6e27999b1237977b5347eb503956&uid=349709&v=7 HTTP/1.1
*/
Page({
Page(Object.assign({
/**
* 页面的初始数据
... ... @@ -39,6 +39,13 @@ Page({
data: {
userInfo: {}, // 用户信息
activityInfo: {}, // 活动信息
shareInfo: {
default_image: '',
product_name: '',
product_qrCode: '',
product_skn: '',
limitProductCode: ''
},
test_uid: [349709, // 测试用
500030924,
500030922,
... ... @@ -95,7 +102,23 @@ Page({
tempScrollTop: 0, // 手动滚动页面时保存当前滚动的位置
showMsg: 0, // 0不显示提示框, 1显示提示框
hidePopup: 0, // 用于显示头像旁边的气泡 0:显示 1:不显示
hideInviteButton: 0 // 用户显示邀请按钮
hideInviteButton: 0, // 用户显示邀请按钮
actionSheet: {
componentId: 'shareActionSheet',
show: false,
closeOnClickOverlay: true,
cancelText: '取消',
actions: [{
name: '邀请好友助力',
className: 'action-class',
loading: false,
openType: 'share'
}, {
name: '生成图片分享到朋友圈',
className: 'action-class',
loading: false,
}]
},
},
/**
... ... @@ -116,6 +139,14 @@ Page({
this.getUserActivityInfo(actId, uid);
}
}); // 获取活动信息
for (let i in options) {
options[i] = decodeURIComponent(options[i]);
}
this.setData({
shareInfo: Object.assign(this.data.shareInfo, options)
});
}
},
... ... @@ -129,7 +160,7 @@ Page({
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow: function(options) {
setTimeout(this.hidePopup, 4000);
},
... ... @@ -183,17 +214,61 @@ Page({
* 用户点击右上角分享
*/
onShareAppMessage: function(res) {
let params = {
FROM: res.from,
SHARE_RESUIL: 0,
TITLE: decodeURIComponent(this.data.shareInfo.product_name),
DESC: '我在有货限定频道发现一个不错的商品赶快来看看吧!',
PATH: `/pages/product/detail/detail?limitProductCode=
${this.data.shareInfo.limitProductCode}&originUid=${app.getUid()}`,
IMG: decodeURIComponent(this.data.shareInfo.default_image)
};
// 用户点击右上角分享
return {
title: this.data.activityInfo.activityName || '排队活动',
path: './?actId=' + this.data.activityInfo.activityId,
success: function(data) {
console.log(data);
title: params.TITLE, // 分享标题
desc: params.DESC, // 分享描述
path: params.PATH, // 分享路径
imageUrl: params.IMG,
success: function() {
params.SHARE_RESUIL = 1;
},
fail: function(data) {
console.log(data);
fail: function() {
params.SHARE_RESUIL = 2;
}
};
},
share: function() {
this.setData({
'actionSheet.show': true
});
},
handleZanActionsheetCancel() {
this.setData({
'actionSheet.show': false
});
},
// 当行动按钮中有一个被点击时触发
// index 代表被点击按钮在传入参数 actions 中的位置
handleZanActionsheetClick({index}) {
this.setData({
'actionSheet.show': false
});
let uid = this.data.originUid || this.data.uid;
if (index === 1) {
router.go('snapShare', this.data.shareInfo);
}
},
/**
* 邀请好友助力排队按钮
*/
inviteFriends: function(e) {
this.share();
},
/**
* scroll-view滚动事件
... ... @@ -211,7 +286,7 @@ Page({
* 跳转到我的排队列表
*/
navigateToMyList: function(e) {
router.go('myList', { actId: this.data.activityInfo.activityId});
router.go('myList', Object.assign({actId: this.data.activityInfo.activityId}, this.data.shareInfo));
},
/**
... ... @@ -486,4 +561,4 @@ Page({
}
return new_time;
}
});
}, Actionsheet));
... ...
<!--pages/limit/queue.wxml 限定商品用户排队页面-->
<import src="../../vendors/zanui/actionsheet/index.wxml" />
<view class='container'>
<!--头部-->
<!-- <scroll-view scroll-y scroll-top='{{scrollTop}}' bindscroll='scroll' bindscrolltolower='onReachBottom' scroll-with-animation> -->
... ... @@ -139,6 +140,9 @@
<view class='button-close' bindtap='closeMsg'>关闭</view>
</view>
</block>
</view>
</view>
\ No newline at end of file
<view class='invite-button' hidden='{{hideInviteButton}}' bindtap='inviteFriends'>
邀请好友助力排队
</view>
</view>
<template is="zan-actionsheet" data="{{...actionSheet}}" />
\ No newline at end of file
... ...
... ... @@ -450,3 +450,17 @@ image {
border-color: rgba(255, 255, 255, 0);
color: #d0021b;
}
.invite-button {
position: fixed;
width: 280rpx;
height: 50rpx;
line-height: 50rpx;
color: white;
text-align: center;
font-size: 26rpx;
left: 66rpx;
bottom: 30rpx;
border-radius: 30rpx;
background-color: #d0021b;
}
... ...
... ... @@ -4,7 +4,7 @@ import event from '../../common/event';
import LimitModel from '../../models/limit/index';
import helper from '../../utils/helper';
import wx from '../../utils/wx';
import { Actionsheet } from '../../vendors/zanui/index';
import {Actionsheet} from '../../vendors/zanui/index';
let app = getApp();
... ... @@ -23,6 +23,13 @@ Page(Object.assign({
data: {
actId: 0,
userInfo: {}, // 用户信息
shareInfo: {
default_image: '',
product_name: '',
product_qrCode: '',
product_skn: '',
limitProductCode: ''
},
bgStyle: [ // 排队图片
'../../static/images/limit/queue_bg_1.png',
'../../static/images/limit/queue_bg_2.png',
... ... @@ -75,7 +82,14 @@ Page(Object.assign({
actId: actId
});
this.getQueueList(actId);
for (let i in options) {
options[i] = decodeURIComponent(options[i]);
}
this.setData({
shareInfo: Object.assign(this.data.shareInfo, options)
});
}
},
/**
... ... @@ -88,7 +102,8 @@ Page(Object.assign({
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
onShow: function(options) {
console.log(options);
if (app.getUid()) {
this.setData({
hideInviteButton: 0
... ... @@ -131,9 +146,11 @@ Page(Object.assign({
let params = {
FROM: res.from,
SHARE_RESUIL: 0,
TITLE: this.data.productName,
TITLE: decodeURIComponent(this.data.shareInfo.product_name),
DESC: '我在有货限定频道发现一个不错的商品赶快来看看吧!',
PATH: `/pages/product/detail/detail?limitProductCode=${this.data.limitProductCode}&originUid=${app.getUid()}`,
PATH: `/pages/product/detail/detail?limitProductCode=
${this.data.limitProductCode}&originUid=${app.getUid()}`,
IMG: decodeURIComponent(this.data.shareInfo.default_image)
};
// 用户点击右上角分享
... ... @@ -141,6 +158,7 @@ Page(Object.assign({
title: params.TITLE, // 分享标题
desc: params.DESC, // 分享描述
path: params.PATH, // 分享路径
imageUrl: params.IMG,
success: function() {
params.SHARE_RESUIL = 1;
},
... ... @@ -169,13 +187,8 @@ Page(Object.assign({
let uid = this.data.originUid || this.data.uid;
if (index === 0) {
// detailModel.addShareAction(uid, this.data.limitProductCode);
} else if (index === 1) {
// 生成页面给
// detailModel.addShareAction(uid, this.data.limitProductCode).then(() => {
// router.go('snapShare', this.data.snapData);
// });
if (index === 1) {
router.go('snapShare', this.data.shareInfo);
}
},
... ... @@ -217,9 +230,9 @@ Page(Object.assign({
this.setData({
queueList: result
});
return Promise.resolve({ code: 200, data: this.data.queueList });
return Promise.resolve({code: 200, data: this.data.queueList});
} else {
return Promise.reject({ code: 203, message: '获取失败' });
return Promise.reject({code: 203, message: '获取失败'});
}
});
},
... ...