Authored by 邱骏

分享

@@ -172,7 +172,7 @@ Page(Object.assign({ @@ -172,7 +172,7 @@ Page(Object.assign({
172 this.setData({ 172 this.setData({
173 'actionSheet.show': false 173 'actionSheet.show': false
174 }); 174 });
175 - 175 + console.log('ok');
176 let uid = this.data.originUid || this.data.uid; 176 let uid = this.data.originUid || this.data.uid;
177 177
178 if (index === 0) { 178 if (index === 0) {
@@ -220,7 +220,8 @@ Page(Object.assign({ @@ -220,7 +220,8 @@ Page(Object.assign({
220 product_name: res.data.productName, 220 product_name: res.data.productName,
221 default_image, 221 default_image,
222 product_qrCode, 222 product_qrCode,
223 - product_skn: res.data.productSkn 223 + product_skn: res.data.productSkn,
  224 + limitProductCode: this.data.limitProductCode
224 }; 225 };
225 226
226 let productSourceType = PRODUCT_SOURCE_TYPE.ORIGIN; 227 let productSourceType = PRODUCT_SOURCE_TYPE.ORIGIN;
@@ -403,7 +404,7 @@ Page(Object.assign({ @@ -403,7 +404,7 @@ Page(Object.assign({
403 }); 404 });
404 }, 405 },
405 goQueueList() { 406 goQueueList() {
406 - router.go('myList', Object.assign({ 407 + router.go('queueIndex', Object.assign({
407 actId: this.data.activityId, 408 actId: this.data.activityId,
408 }, this.data.snapData)); 409 }, this.data.snapData));
409 }, 410 },
@@ -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 * 页面的初始数据
@@ -43,7 +43,8 @@ Page({ @@ -43,7 +43,8 @@ Page({
43 default_image: '', 43 default_image: '',
44 product_name: '', 44 product_name: '',
45 product_qrCode: '', 45 product_qrCode: '',
46 - product_skn: '' 46 + product_skn: '',
  47 + limitProductCode: ''
47 }, 48 },
48 test_uid: [349709, // 测试用 49 test_uid: [349709, // 测试用
49 500030924, 50 500030924,
@@ -101,7 +102,23 @@ Page({ @@ -101,7 +102,23 @@ Page({
101 tempScrollTop: 0, // 手动滚动页面时保存当前滚动的位置 102 tempScrollTop: 0, // 手动滚动页面时保存当前滚动的位置
102 showMsg: 0, // 0不显示提示框, 1显示提示框 103 showMsg: 0, // 0不显示提示框, 1显示提示框
103 hidePopup: 0, // 用于显示头像旁边的气泡 0:显示 1:不显示 104 hidePopup: 0, // 用于显示头像旁边的气泡 0:显示 1:不显示
104 - 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 + },
105 }, 122 },
106 123
107 /** 124 /**
@@ -122,6 +139,14 @@ Page({ @@ -122,6 +139,14 @@ Page({
122 this.getUserActivityInfo(actId, uid); 139 this.getUserActivityInfo(actId, uid);
123 } 140 }
124 }); // 获取活动信息 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 + });
125 } 150 }
126 }, 151 },
127 152
@@ -137,9 +162,6 @@ Page({ @@ -137,9 +162,6 @@ Page({
137 */ 162 */
138 onShow: function(options) { 163 onShow: function(options) {
139 setTimeout(this.hidePopup, 4000); 164 setTimeout(this.hidePopup, 4000);
140 - this.setData({  
141 - shareInfo: Object.assign(this.data.shareInfo, options)  
142 - });  
143 }, 165 },
144 166
145 /** 167 /**
@@ -192,17 +214,61 @@ Page({ @@ -192,17 +214,61 @@ Page({
192 * 用户点击右上角分享 214 * 用户点击右上角分享
193 */ 215 */
194 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 + // 用户点击右上角分享
195 return { 228 return {
196 - title: this.data.activityInfo.activityName || '排队活动',  
197 - path: './?actId=' + this.data.activityInfo.activityId,  
198 - success: function(data) {  
199 - 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;
200 }, 235 },
201 - fail: function(data) {  
202 - console.log(data); 236 + fail: function() {
  237 + params.SHARE_RESUIL = 2;
203 } 238 }
204 }; 239 };
205 }, 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 + },
206 272
207 /** 273 /**
208 * scroll-view滚动事件 274 * scroll-view滚动事件
@@ -220,7 +286,7 @@ Page({ @@ -220,7 +286,7 @@ Page({
220 * 跳转到我的排队列表 286 * 跳转到我的排队列表
221 */ 287 */
222 navigateToMyList: function(e) { 288 navigateToMyList: function(e) {
223 - router.go('myList', { actId: this.data.activityInfo.activityId}); 289 + router.go('myList', Object.assign({actId: this.data.activityInfo.activityId}, this.data.shareInfo));
224 }, 290 },
225 291
226 /** 292 /**
@@ -495,4 +561,4 @@ Page({ @@ -495,4 +561,4 @@ Page({
495 } 561 }
496 return new_time; 562 return new_time;
497 } 563 }
498 -}); 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();
@@ -27,7 +27,8 @@ Page(Object.assign({ @@ -27,7 +27,8 @@ Page(Object.assign({
27 default_image: '', 27 default_image: '',
28 product_name: '', 28 product_name: '',
29 product_qrCode: '', 29 product_qrCode: '',
30 - product_skn: '' 30 + product_skn: '',
  31 + limitProductCode: ''
31 }, 32 },
32 bgStyle: [ // 排队图片 33 bgStyle: [ // 排队图片
33 '../../static/images/limit/queue_bg_1.png', 34 '../../static/images/limit/queue_bg_1.png',
@@ -81,6 +82,9 @@ Page(Object.assign({ @@ -81,6 +82,9 @@ Page(Object.assign({
81 actId: actId 82 actId: actId
82 }); 83 });
83 this.getQueueList(actId); 84 this.getQueueList(actId);
  85 + for (let i in options) {
  86 + options[i] = decodeURIComponent(options[i]);
  87 + }
84 this.setData({ 88 this.setData({
85 shareInfo: Object.assign(this.data.shareInfo, options) 89 shareInfo: Object.assign(this.data.shareInfo, options)
86 }); 90 });
@@ -142,9 +146,11 @@ Page(Object.assign({ @@ -142,9 +146,11 @@ Page(Object.assign({
142 let params = { 146 let params = {
143 FROM: res.from, 147 FROM: res.from,
144 SHARE_RESUIL: 0, 148 SHARE_RESUIL: 0,
145 - TITLE: this.data.shareInfo.product_name, 149 + TITLE: decodeURIComponent(this.data.shareInfo.product_name),
146 DESC: '我在有货限定频道发现一个不错的商品赶快来看看吧!', 150 DESC: '我在有货限定频道发现一个不错的商品赶快来看看吧!',
147 - 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)
148 }; 154 };
149 155
150 // 用户点击右上角分享 156 // 用户点击右上角分享
@@ -152,6 +158,7 @@ Page(Object.assign({ @@ -152,6 +158,7 @@ Page(Object.assign({
152 title: params.TITLE, // 分享标题 158 title: params.TITLE, // 分享标题
153 desc: params.DESC, // 分享描述 159 desc: params.DESC, // 分享描述
154 path: params.PATH, // 分享路径 160 path: params.PATH, // 分享路径
  161 + imageUrl: params.IMG,
155 success: function() { 162 success: function() {
156 params.SHARE_RESUIL = 1; 163 params.SHARE_RESUIL = 1;
157 }, 164 },
@@ -180,13 +187,8 @@ Page(Object.assign({ @@ -180,13 +187,8 @@ Page(Object.assign({
180 187
181 let uid = this.data.originUid || this.data.uid; 188 let uid = this.data.originUid || this.data.uid;
182 189
183 - if (index === 0) {  
184 - // detailModel.addShareAction(uid, this.data.limitProductCode);  
185 - } else if (index === 1) {  
186 - // 生成页面给  
187 - // detailModel.addShareAction(uid, this.data.limitProductCode).then(() => {  
188 - // router.go('snapShare', this.data.snapData);  
189 - // }); 190 + if (index === 1) {
  191 + router.go('snapShare', this.data.shareInfo);
190 } 192 }
191 }, 193 },
192 194
@@ -228,9 +230,9 @@ Page(Object.assign({ @@ -228,9 +230,9 @@ Page(Object.assign({
228 this.setData({ 230 this.setData({
229 queueList: result 231 queueList: result
230 }); 232 });
231 - return Promise.resolve({ code: 200, data: this.data.queueList }); 233 + return Promise.resolve({code: 200, data: this.data.queueList});
232 } else { 234 } else {
233 - return Promise.reject({ code: 203, message: '获取失败' }); 235 + return Promise.reject({code: 203, message: '获取失败'});
234 } 236 }
235 }); 237 });
236 }, 238 },
@@ -6,5 +6,6 @@ export default { @@ -6,5 +6,6 @@ export default {
6 userCenter: {path: '/pages/home/index'}, 6 userCenter: {path: '/pages/home/index'},
7 snapShare: {path: '/pages/snapshootShare/snapshootShare'}, 7 snapShare: {path: '/pages/snapshootShare/snapshootShare'},
8 prizeUserList: {path: '/pages/queue/prizeUserList'}, 8 prizeUserList: {path: '/pages/queue/prizeUserList'},
9 - myList: {path: '/pages/queue/myList'} 9 + myList: {path: '/pages/queue/myList'},
  10 + queueIndex: {path: '/pages/queue/index'}
10 }; 11 };