Authored by 邱骏

助力排队

@@ -41,15 +41,15 @@ Page({ @@ -41,15 +41,15 @@ Page({
41 clock: '../../static/images/limit/clock_left.png' 41 clock: '../../static/images/limit/clock_left.png'
42 } 42 }
43 }, 43 },
44 - onLoad: function() { 44 + onLoad: function () {
45 yas = new Yas(app); 45 yas = new Yas(app);
46 46
47 this.getList(0, 1, 20, false); 47 this.getList(0, 1, 20, false);
48 }, 48 },
49 - onShow: function() { 49 + onShow: function () {
50 yas.pageOpenReport(); 50 yas.pageOpenReport();
51 }, 51 },
52 - onPullDownRefresh: function() { 52 + onPullDownRefresh: function () {
53 this.setData({ 53 this.setData({
54 refreshText: '加载中...' 54 refreshText: '加载中...'
55 }); 55 });
@@ -62,7 +62,7 @@ Page({ @@ -62,7 +62,7 @@ Page({
62 }); 62 });
63 63
64 }, 64 },
65 - onReachBottom: function() { 65 + onReachBottom: function () {
66 let page = this.data.listData[this.data.tabSelected].page; 66 let page = this.data.listData[this.data.tabSelected].page;
67 let page_total = this.data.listData[this.data.tabSelected].page_total; 67 let page_total = this.data.listData[this.data.tabSelected].page_total;
68 68
@@ -71,7 +71,7 @@ Page({ @@ -71,7 +71,7 @@ Page({
71 this.getList(this.data.tabSelected, page, 20, true); 71 this.getList(this.data.tabSelected, page, 20, true);
72 } 72 }
73 }, 73 },
74 - getUserInfo: function(e) { 74 + getUserInfo: function (e) {
75 console.log(e); 75 console.log(e);
76 if (e.detail.errMsg === 'getUserInfo:ok') { 76 if (e.detail.errMsg === 'getUserInfo:ok') {
77 // AccountModel.decodeUserInfo(); 77 // AccountModel.decodeUserInfo();
@@ -82,7 +82,7 @@ Page({ @@ -82,7 +82,7 @@ Page({
82 hasUserInfo: true 82 hasUserInfo: true
83 }); 83 });
84 }, 84 },
85 - tabChange: function(e) { // 切换TAB 85 + tabChange: function (e) { // 切换TAB
86 let index = e.currentTarget.dataset.index; 86 let index = e.currentTarget.dataset.index;
87 87
88 if (index !== this.data.tabSelected) { 88 if (index !== this.data.tabSelected) {
@@ -104,7 +104,7 @@ Page({ @@ -104,7 +104,7 @@ Page({
104 * limit: 每页数量, 104 * limit: 每页数量,
105 * isBottom:是否是到达底部后触发 105 * isBottom:是否是到达底部后触发
106 */ 106 */
107 - getList: function(index, page, limit, isBottom) { 107 + getList: function (index, page, limit, isBottom) {
108 let method = this.data.tabBarArr[index].method; 108 let method = this.data.tabBarArr[index].method;
109 let that = this; 109 let that = this;
110 110
@@ -136,20 +136,21 @@ Page({ @@ -136,20 +136,21 @@ Page({
136 } 136 }
137 }); 137 });
138 }, 138 },
139 - navigateToDetail: function(e) { // 跳转到详情页 139 + navigateToDetail: function (e) { // 跳转到详情页
140 console.log(e); 140 console.log(e);
141 let id = e.currentTarget.dataset.id; 141 let id = e.currentTarget.dataset.id;
142 let limitProductCode = e.currentTarget.dataset.code; 142 let limitProductCode = e.currentTarget.dataset.code;
143 143
144 if (app.getUid() && app.getUserInfo().wechat) { 144 if (app.getUid() && app.getUserInfo().wechat) {
145 - router.go('productDetail', { limitProductCode }); 145 + router.go('productDetail', {limitProductCode});
146 } else { 146 } else {
147 - let referer = getCurrentPages()[0].route; 147 + let pages = getCurrentPages();
  148 + let referer = pages[pages.length - 1].route;
148 149
149 - router.go('userCenter', { referer }); 150 + router.go('userCenter', {referer});
150 } 151 }
151 }, 152 },
152 - navigateToHome: function(e) { // 跳转到我的限购码 153 + navigateToHome: function (e) { // 跳转到我的限购码
153 router.go('userCenter'); 154 router.go('userCenter');
154 } 155 }
155 }); 156 });
@@ -160,6 +160,7 @@ Page(Object.assign({ @@ -160,6 +160,7 @@ Page(Object.assign({
160 }; 160 };
161 } else if (res.from === 'button') { 161 } else if (res.from === 'button') {
162 // 用户点击分享按钮 162 // 用户点击分享按钮
  163 + console.log(`/pages/product/detail/detail?limitProductCode=${this.data.limitProductCode}&originUid=${app.getUid()}&originUnionID=${app.getUnionID()}`)
163 return { 164 return {
164 title: params.TITLE, // 分享标题 165 title: params.TITLE, // 分享标题
165 desc: params.DESC, // 分享描述 166 desc: params.DESC, // 分享描述
@@ -4,7 +4,8 @@ import event from '../../common/event'; @@ -4,7 +4,8 @@ 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 +import { stringify } from '../../vendors/query-stringify';
8 9
9 let app = getApp(); 10 let app = getApp();
10 let router = global.router; 11 let router = global.router;
@@ -102,7 +103,7 @@ Page(Object.assign({ @@ -102,7 +103,7 @@ Page(Object.assign({
102 tempScrollTop: 0, // 手动滚动页面时保存当前滚动的位置 103 tempScrollTop: 0, // 手动滚动页面时保存当前滚动的位置
103 showMsg: 0, // 0不显示提示框, 1显示提示框 104 showMsg: 0, // 0不显示提示框, 1显示提示框
104 hidePopup: 0, // 用于显示头像旁边的气泡 0:显示 1:不显示 105 hidePopup: 0, // 用于显示头像旁边的气泡 0:显示 1:不显示
105 - hideInviteButton: 0, // 用户显示邀请按钮 106 + hideInviteButton: 1, // 用户显示邀请按钮
106 actionSheet: { 107 actionSheet: {
107 componentId: 'shareActionSheet', 108 componentId: 'shareActionSheet',
108 show: false, 109 show: false,
@@ -162,6 +163,11 @@ Page(Object.assign({ @@ -162,6 +163,11 @@ Page(Object.assign({
162 */ 163 */
163 onShow: function(options) { 164 onShow: function(options) {
164 setTimeout(this.hidePopup, 4000); 165 setTimeout(this.hidePopup, 4000);
  166 + if (app.getUid()) {
  167 + this.setData({
  168 + hideInviteButton: 0
  169 + });
  170 + }
165 }, 171 },
166 172
167 /** 173 /**
@@ -343,17 +349,20 @@ Page(Object.assign({ @@ -343,17 +349,20 @@ Page(Object.assign({
343 * 点击参加活动按钮 349 * 点击参加活动按钮
344 */ 350 */
345 joinInQueue: function(e) { 351 joinInQueue: function(e) {
346 - let uid = app.getUid() || this.data.test_uid[this.data.now_test_uid_index]; 352 + let uid = app.getUid();
347 let activityId = this.data.activityInfo.activityId; 353 let activityId = this.data.activityInfo.activityId;
348 let isEnd = this.data.activityInfo.isEnd === 0 ? 0 : 1; 354 let isEnd = this.data.activityInfo.isEnd === 0 ? 0 : 1;
349 355
350 if (activityId && uid && !isEnd) { 356 if (activityId && uid && !isEnd) {
351 this.addQueue(this.data.activityInfo.activityId, uid); 357 this.addQueue(this.data.activityInfo.activityId, uid);
352 } else if (isEnd) { 358 } else if (isEnd) {
353 -  
354 this.setData({ 359 this.setData({
355 showMsg: 1 360 showMsg: 1
356 }); 361 });
  362 + } else if(!uid) {
  363 + let pages = getCurrentPages();
  364 + let referer = pages[pages.length - 1].route + '?' + stringify(this.data.shareInfo);
  365 + router.go('userCenter', { referer });
357 } 366 }
358 }, 367 },
359 368