Authored by htoooth

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

@@ -57,7 +57,7 @@ Page({ @@ -57,7 +57,7 @@ Page({
57 referer: referer 57 referer: referer
58 }); 58 });
59 } 59 }
60 - if (options.login !== undefined) { 60 + if (options.login || options.login === 0) {
61 this.setData({ 61 this.setData({
62 needBind: (options.login === '0' || !options.login) ? 0 : true 62 needBind: (options.login === '0' || !options.login) ? 0 : true
63 }); 63 });
@@ -190,7 +190,7 @@ Page(Object.assign({ @@ -190,7 +190,7 @@ Page(Object.assign({
190 this.setData({ 190 this.setData({
191 'actionSheet.show': false 191 'actionSheet.show': false
192 }); 192 });
193 - 193 + console.log('ok');
194 let uid = this.data.originUid || this.data.uid; 194 let uid = this.data.originUid || this.data.uid;
195 195
196 if (index === 0) { 196 if (index === 0) {
@@ -4,7 +4,7 @@ import event from '../../common/event'; @@ -4,7 +4,7 @@ import event from '../../common/event';
4 import LimitModel from '../../models/limit/index'; 4 import LimitModel from '../../models/limit/index';
5 import helper from '../../utils/helper'; 5 import helper from '../../utils/helper';
6 import wx from '../../utils/wx'; 6 import wx from '../../utils/wx';
7 - 7 +import {Actionsheet} from '../../vendors/zanui/index';
8 8
9 let app = getApp(); 9 let app = getApp();
10 let router = global.router; 10 let router = global.router;
@@ -31,7 +31,7 @@ let router = global.router; @@ -31,7 +31,7 @@ let router = global.router;
31 * 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 31 * 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
32 */ 32 */
33 33
34 -Page({ 34 +Page(Object.assign({
35 35
36 /** 36 /**
37 * 页面的初始数据 37 * 页面的初始数据
@@ -39,6 +39,13 @@ Page({ @@ -39,6 +39,13 @@ Page({
39 data: { 39 data: {
40 userInfo: {}, // 用户信息 40 userInfo: {}, // 用户信息
41 activityInfo: {}, // 活动信息 41 activityInfo: {}, // 活动信息
  42 + shareInfo: {
  43 + default_image: '',
  44 + product_name: '',
  45 + product_qrCode: '',
  46 + product_skn: '',
  47 + limitProductCode: ''
  48 + },
42 test_uid: [349709, // 测试用 49 test_uid: [349709, // 测试用
43 500030924, 50 500030924,
44 500030922, 51 500030922,
@@ -95,7 +102,23 @@ Page({ @@ -95,7 +102,23 @@ Page({
95 tempScrollTop: 0, // 手动滚动页面时保存当前滚动的位置 102 tempScrollTop: 0, // 手动滚动页面时保存当前滚动的位置
96 showMsg: 0, // 0不显示提示框, 1显示提示框 103 showMsg: 0, // 0不显示提示框, 1显示提示框
97 hidePopup: 0, // 用于显示头像旁边的气泡 0:显示 1:不显示 104 hidePopup: 0, // 用于显示头像旁边的气泡 0:显示 1:不显示
98 - hideInviteButton: 0 // 用户显示邀请按钮 105 + hideInviteButton: 0, // 用户显示邀请按钮
  106 + actionSheet: {
  107 + componentId: 'shareActionSheet',
  108 + show: false,
  109 + closeOnClickOverlay: true,
  110 + cancelText: '取消',
  111 + actions: [{
  112 + name: '邀请好友助力',
  113 + className: 'action-class',
  114 + loading: false,
  115 + openType: 'share'
  116 + }, {
  117 + name: '生成图片分享到朋友圈',
  118 + className: 'action-class',
  119 + loading: false,
  120 + }]
  121 + },
99 }, 122 },
100 123
101 /** 124 /**
@@ -116,6 +139,14 @@ Page({ @@ -116,6 +139,14 @@ Page({
116 this.getUserActivityInfo(actId, uid); 139 this.getUserActivityInfo(actId, uid);
117 } 140 }
118 }); // 获取活动信息 141 }); // 获取活动信息
  142 +
  143 + for (let i in options) {
  144 + options[i] = decodeURIComponent(options[i]);
  145 + }
  146 +
  147 + this.setData({
  148 + shareInfo: Object.assign(this.data.shareInfo, options)
  149 + });
119 } 150 }
120 }, 151 },
121 152
@@ -129,7 +160,7 @@ Page({ @@ -129,7 +160,7 @@ Page({
129 /** 160 /**
130 * 生命周期函数--监听页面显示 161 * 生命周期函数--监听页面显示
131 */ 162 */
132 - onShow: function() { 163 + onShow: function(options) {
133 setTimeout(this.hidePopup, 4000); 164 setTimeout(this.hidePopup, 4000);
134 }, 165 },
135 166
@@ -183,17 +214,61 @@ Page({ @@ -183,17 +214,61 @@ Page({
183 * 用户点击右上角分享 214 * 用户点击右上角分享
184 */ 215 */
185 onShareAppMessage: function(res) { 216 onShareAppMessage: function(res) {
  217 + let params = {
  218 + FROM: res.from,
  219 + SHARE_RESUIL: 0,
  220 + TITLE: decodeURIComponent(this.data.shareInfo.product_name),
  221 + DESC: '我在有货限定频道发现一个不错的商品赶快来看看吧!',
  222 + PATH: `/pages/product/detail/detail?limitProductCode=
  223 + ${this.data.shareInfo.limitProductCode}&originUid=${app.getUid()}`,
  224 + IMG: decodeURIComponent(this.data.shareInfo.default_image)
  225 + };
  226 +
  227 + // 用户点击右上角分享
186 return { 228 return {
187 - title: this.data.activityInfo.activityName || '排队活动',  
188 - path: './?actId=' + this.data.activityInfo.activityId,  
189 - success: function(data) {  
190 - console.log(data); 229 + title: params.TITLE, // 分享标题
  230 + desc: params.DESC, // 分享描述
  231 + path: params.PATH, // 分享路径
  232 + imageUrl: params.IMG,
  233 + success: function() {
  234 + params.SHARE_RESUIL = 1;
191 }, 235 },
192 - fail: function(data) {  
193 - console.log(data); 236 + fail: function() {
  237 + params.SHARE_RESUIL = 2;
194 } 238 }
195 }; 239 };
196 }, 240 },
  241 + share: function() {
  242 + this.setData({
  243 + 'actionSheet.show': true
  244 + });
  245 + },
  246 + handleZanActionsheetCancel() {
  247 + this.setData({
  248 + 'actionSheet.show': false
  249 + });
  250 + },
  251 +
  252 + // 当行动按钮中有一个被点击时触发
  253 + // index 代表被点击按钮在传入参数 actions 中的位置
  254 + handleZanActionsheetClick({index}) {
  255 + this.setData({
  256 + 'actionSheet.show': false
  257 + });
  258 +
  259 + let uid = this.data.originUid || this.data.uid;
  260 +
  261 + if (index === 1) {
  262 + router.go('snapShare', this.data.shareInfo);
  263 + }
  264 + },
  265 +
  266 + /**
  267 + * 邀请好友助力排队按钮
  268 + */
  269 + inviteFriends: function(e) {
  270 + this.share();
  271 + },
197 272
198 /** 273 /**
199 * scroll-view滚动事件 274 * scroll-view滚动事件
@@ -211,7 +286,7 @@ Page({ @@ -211,7 +286,7 @@ Page({
211 * 跳转到我的排队列表 286 * 跳转到我的排队列表
212 */ 287 */
213 navigateToMyList: function(e) { 288 navigateToMyList: function(e) {
214 - router.go('myList', { actId: this.data.activityInfo.activityId}); 289 + router.go('myList', Object.assign({actId: this.data.activityInfo.activityId}, this.data.shareInfo));
215 }, 290 },
216 291
217 /** 292 /**
@@ -486,4 +561,4 @@ Page({ @@ -486,4 +561,4 @@ Page({
486 } 561 }
487 return new_time; 562 return new_time;
488 } 563 }
489 -}); 564 +}, Actionsheet));
1 <!--pages/limit/queue.wxml 限定商品用户排队页面--> 1 <!--pages/limit/queue.wxml 限定商品用户排队页面-->
  2 +<import src="../../vendors/zanui/actionsheet/index.wxml" />
2 <view class='container'> 3 <view class='container'>
3 <!--头部--> 4 <!--头部-->
4 <!-- <scroll-view scroll-y scroll-top='{{scrollTop}}' bindscroll='scroll' bindscrolltolower='onReachBottom' scroll-with-animation> --> 5 <!-- <scroll-view scroll-y scroll-top='{{scrollTop}}' bindscroll='scroll' bindscrolltolower='onReachBottom' scroll-with-animation> -->
@@ -139,6 +140,9 @@ @@ -139,6 +140,9 @@
139 <view class='button-close' bindtap='closeMsg'>关闭</view> 140 <view class='button-close' bindtap='closeMsg'>关闭</view>
140 </view> 141 </view>
141 </block> 142 </block>
142 - 143 + </view>
  144 + <view class='invite-button' hidden='{{hideInviteButton}}' bindtap='inviteFriends'>
  145 + 邀请好友助力排队
143 </view> 146 </view>
144 </view> 147 </view>
  148 +<template is="zan-actionsheet" data="{{...actionSheet}}" />
@@ -450,3 +450,17 @@ image { @@ -450,3 +450,17 @@ image {
450 border-color: rgba(255, 255, 255, 0); 450 border-color: rgba(255, 255, 255, 0);
451 color: #d0021b; 451 color: #d0021b;
452 } 452 }
  453 +
  454 +.invite-button {
  455 + position: fixed;
  456 + width: 280rpx;
  457 + height: 50rpx;
  458 + line-height: 50rpx;
  459 + color: white;
  460 + text-align: center;
  461 + font-size: 26rpx;
  462 + left: 66rpx;
  463 + bottom: 30rpx;
  464 + border-radius: 30rpx;
  465 + background-color: #d0021b;
  466 +}
@@ -4,7 +4,7 @@ import event from '../../common/event'; @@ -4,7 +4,7 @@ import event from '../../common/event';
4 import LimitModel from '../../models/limit/index'; 4 import LimitModel from '../../models/limit/index';
5 import helper from '../../utils/helper'; 5 import helper from '../../utils/helper';
6 import wx from '../../utils/wx'; 6 import wx from '../../utils/wx';
7 -import { Actionsheet } from '../../vendors/zanui/index'; 7 +import {Actionsheet} from '../../vendors/zanui/index';
8 8
9 9
10 let app = getApp(); 10 let app = getApp();
@@ -23,6 +23,13 @@ Page(Object.assign({ @@ -23,6 +23,13 @@ Page(Object.assign({
23 data: { 23 data: {
24 actId: 0, 24 actId: 0,
25 userInfo: {}, // 用户信息 25 userInfo: {}, // 用户信息
  26 + shareInfo: {
  27 + default_image: '',
  28 + product_name: '',
  29 + product_qrCode: '',
  30 + product_skn: '',
  31 + limitProductCode: ''
  32 + },
26 bgStyle: [ // 排队图片 33 bgStyle: [ // 排队图片
27 '../../static/images/limit/queue_bg_1.png', 34 '../../static/images/limit/queue_bg_1.png',
28 '../../static/images/limit/queue_bg_2.png', 35 '../../static/images/limit/queue_bg_2.png',
@@ -75,7 +82,14 @@ Page(Object.assign({ @@ -75,7 +82,14 @@ Page(Object.assign({
75 actId: actId 82 actId: actId
76 }); 83 });
77 this.getQueueList(actId); 84 this.getQueueList(actId);
  85 + for (let i in options) {
  86 + options[i] = decodeURIComponent(options[i]);
  87 + }
  88 + this.setData({
  89 + shareInfo: Object.assign(this.data.shareInfo, options)
  90 + });
78 } 91 }
  92 +
79 }, 93 },
80 94
81 /** 95 /**
@@ -88,7 +102,8 @@ Page(Object.assign({ @@ -88,7 +102,8 @@ Page(Object.assign({
88 /** 102 /**
89 * 生命周期函数--监听页面显示 103 * 生命周期函数--监听页面显示
90 */ 104 */
91 - onShow: function() { 105 + onShow: function(options) {
  106 + console.log(options);
92 if (app.getUid()) { 107 if (app.getUid()) {
93 this.setData({ 108 this.setData({
94 hideInviteButton: 0 109 hideInviteButton: 0
@@ -131,9 +146,11 @@ Page(Object.assign({ @@ -131,9 +146,11 @@ Page(Object.assign({
131 let params = { 146 let params = {
132 FROM: res.from, 147 FROM: res.from,
133 SHARE_RESUIL: 0, 148 SHARE_RESUIL: 0,
134 - TITLE: this.data.productName, 149 + TITLE: decodeURIComponent(this.data.shareInfo.product_name),
135 DESC: '我在有货限定频道发现一个不错的商品赶快来看看吧!', 150 DESC: '我在有货限定频道发现一个不错的商品赶快来看看吧!',
136 - PATH: `/pages/product/detail/detail?limitProductCode=${this.data.limitProductCode}&originUid=${app.getUid()}`, 151 + PATH: `/pages/product/detail/detail?limitProductCode=
  152 + ${this.data.limitProductCode}&originUid=${app.getUid()}`,
  153 + IMG: decodeURIComponent(this.data.shareInfo.default_image)
137 }; 154 };
138 155
139 // 用户点击右上角分享 156 // 用户点击右上角分享
@@ -141,6 +158,7 @@ Page(Object.assign({ @@ -141,6 +158,7 @@ Page(Object.assign({
141 title: params.TITLE, // 分享标题 158 title: params.TITLE, // 分享标题
142 desc: params.DESC, // 分享描述 159 desc: params.DESC, // 分享描述
143 path: params.PATH, // 分享路径 160 path: params.PATH, // 分享路径
  161 + imageUrl: params.IMG,
144 success: function() { 162 success: function() {
145 params.SHARE_RESUIL = 1; 163 params.SHARE_RESUIL = 1;
146 }, 164 },
@@ -169,13 +187,8 @@ Page(Object.assign({ @@ -169,13 +187,8 @@ Page(Object.assign({
169 187
170 let uid = this.data.originUid || this.data.uid; 188 let uid = this.data.originUid || this.data.uid;
171 189
172 - if (index === 0) {  
173 - // detailModel.addShareAction(uid, this.data.limitProductCode);  
174 - } else if (index === 1) {  
175 - // 生成页面给  
176 - // detailModel.addShareAction(uid, this.data.limitProductCode).then(() => {  
177 - // router.go('snapShare', this.data.snapData);  
178 - // }); 190 + if (index === 1) {
  191 + router.go('snapShare', this.data.shareInfo);
179 } 192 }
180 }, 193 },
181 194
@@ -217,9 +230,9 @@ Page(Object.assign({ @@ -217,9 +230,9 @@ Page(Object.assign({
217 this.setData({ 230 this.setData({
218 queueList: result 231 queueList: result
219 }); 232 });
220 - return Promise.resolve({ code: 200, data: this.data.queueList }); 233 + return Promise.resolve({code: 200, data: this.data.queueList});
221 } else { 234 } else {
222 - return Promise.reject({ code: 203, message: '获取失败' }); 235 + return Promise.reject({code: 203, message: '获取失败'});
223 } 236 }
224 }); 237 });
225 }, 238 },