|
@@ -4,8 +4,9 @@ import event from '../../common/event'; |
|
@@ -4,8 +4,9 @@ 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';
|
|
|
8
|
-import { stringify } from '../../vendors/query-stringify';
|
7
|
+import {Actionsheet} from '../../vendors/zanui/index';
|
|
|
8
|
+import {stringify} from '../../vendors/query-stringify';
|
|
|
9
|
+import commonModel from '../../models/common';
|
9
|
|
10
|
|
10
|
let app = getApp();
|
11
|
let app = getApp();
|
11
|
let router = global.router;
|
12
|
let router = global.router;
|
|
@@ -17,558 +18,579 @@ let router = global.router; |
|
@@ -17,558 +18,579 @@ let router = global.router; |
17
|
*/
|
18
|
*/
|
18
|
/**
|
19
|
/**
|
19
|
* 接口:获取用户排队信息
|
20
|
* 接口:获取用户排队信息
|
20
|
- * https://api.yoho.cn/?activityId=179&app_version=6.4.0&client_secret=ee1114702f3db67327afe9eeeac92b5a&client_type=iphone&fromPage=iFP_Queue&method=app.drawline.getUserActivityInfo&os_version=11.2.5&physical_channel=1&screen_size=375x667&session_key=3c9a644c3d95d9a7453c61f3009b2884&udid=1a61c0b4db7b6e27999b1237977b5347eb503956&uid=349709&v=7
|
21
|
+ * method=app.drawline.getUserActivityInfo
|
|
|
22
|
+ * activityId=179
|
21
|
*
|
23
|
*
|
22
|
- * 接口:获取排队用户信息
|
|
|
23
|
- * https://api.yoho.cn/?activityId=179&app_version=6.4.0&client_secret=e8f42148d30976fb44dfff1d89ea7a60&client_type=iphone&fromPage=iFP_Queue&limit=50&method=app.drawline.getQueueList&os_version=11.2.5&physical_channel=1&screen_size=375x667&session_key=3c9a644c3d95d9a7453c61f3009b2884&sort=0&udid=1a61c0b4db7b6e27999b1237977b5347eb503956&uid=349709&v=7
|
|
|
24
|
*
|
24
|
*
|
25
|
- * 接口:排队活动
|
|
|
26
|
- * https://api.yoho.cn/?activityId=179&app_version=6.4.0&client_secret=52db394bdb79e2dcf0e2a2782496ee78&client_type=iphone&fromPage=iFP_Queue&method=app.drawline.getActivityInfo&os_version=11.2.5&physical_channel=1&screen_size=375x667&session_key=3c9a644c3d95d9a7453c61f3009b2884&udid=1a61c0b4db7b6e27999b1237977b5347eb503956&uid=349709&v=7
|
25
|
+ * 接口:获取排队用户信息(列表)
|
|
|
26
|
+ * method=app.drawline.getQueueList
|
|
|
27
|
+ * activityId=179
|
|
|
28
|
+ * limit=50
|
|
|
29
|
+ * sort=0
|
|
|
30
|
+ *
|
|
|
31
|
+ *
|
|
|
32
|
+ * 接口:排队活动信息
|
|
|
33
|
+ * method=app.drawline.getActivityInfo
|
|
|
34
|
+ * activityId=179
|
|
|
35
|
+ *
|
27
|
*
|
36
|
*
|
28
|
* 接口:中奖列表
|
37
|
* 接口:中奖列表
|
29
|
- * https://api.yoho.cn/?activityId=179&app_version=6.4.0&client_secret=936b01c80de696e81c59fee6ea64fd50&client_type=iphone&fromPage=iFP_QueueResult&limit=20&method=app.drawline.getLuckyUserList&os_version=11.2.6&page=1&physical_channel=1&screen_size=375x667&session_key=3c9a644c3d95d9a7453c61f3009b2884&udid=1a61c0b4db7b6e27999b1237977b5347eb503956&uid=349709&v=7
|
38
|
+ * method=app.drawline.getLuckyUserList
|
|
|
39
|
+ * activityId=179
|
|
|
40
|
+ * limit=20
|
|
|
41
|
+ * page=1
|
30
|
*
|
42
|
*
|
31
|
- * 接口:添加用户分享记录
|
|
|
32
|
- * 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
|
|
|
33
|
*/
|
43
|
*/
|
34
|
|
44
|
|
35
|
Page(Object.assign({
|
45
|
Page(Object.assign({
|
36
|
|
46
|
|
37
|
- /**
|
47
|
+ /**
|
38
|
* 页面的初始数据
|
48
|
* 页面的初始数据
|
39
|
*/
|
49
|
*/
|
40
|
- data: {
|
|
|
41
|
- userInfo: {}, // 用户信息
|
|
|
42
|
- activityInfo: {}, // 活动信息
|
|
|
43
|
- shareInfo: {
|
|
|
44
|
- default_image: '',
|
|
|
45
|
- product_name: '',
|
|
|
46
|
- product_qrCode: '',
|
|
|
47
|
- product_skn: '',
|
|
|
48
|
- limitProductCode: ''
|
50
|
+ data: {
|
|
|
51
|
+ userInfo: {}, // 用户信息
|
|
|
52
|
+ activityInfo: {}, // 活动信息
|
|
|
53
|
+ shareInfo: {
|
|
|
54
|
+ default_image: '',
|
|
|
55
|
+ product_name: '',
|
|
|
56
|
+ product_qrCode: '',
|
|
|
57
|
+ product_skn: '',
|
|
|
58
|
+ limitProductCode: ''
|
|
|
59
|
+ },
|
|
|
60
|
+ test_uid: [349709, // 测试用
|
|
|
61
|
+ 500030924,
|
|
|
62
|
+ 500030922,
|
|
|
63
|
+ 500030918,
|
|
|
64
|
+ 500030916,
|
|
|
65
|
+ 500030914,
|
|
|
66
|
+ 500030912,
|
|
|
67
|
+ 500030910,
|
|
|
68
|
+ 500030908,
|
|
|
69
|
+ 500030906,
|
|
|
70
|
+ 500030904,
|
|
|
71
|
+ 500030890,
|
|
|
72
|
+ 500030888,
|
|
|
73
|
+ 500030886,
|
|
|
74
|
+ 500030884,
|
|
|
75
|
+ 500030876,
|
|
|
76
|
+ 500030830,
|
|
|
77
|
+ 500030694,
|
|
|
78
|
+ 500030690,
|
|
|
79
|
+ 500030688
|
|
|
80
|
+ ],
|
|
|
81
|
+ now_test_uid_index: 15,
|
|
|
82
|
+ h5PageUrl: [
|
|
|
83
|
+ {
|
|
|
84
|
+ title: '排队活动说明',
|
|
|
85
|
+ url: 'https://activity.yoho.cn/feature/249.html?nodownload=1'
|
|
|
86
|
+ }
|
|
|
87
|
+ ],
|
|
|
88
|
+ bgStyle: [ // 排队图片
|
|
|
89
|
+ '../../static/images/limit/queue_bg_1.png',
|
|
|
90
|
+ '../../static/images/limit/queue_bg_2.png',
|
|
|
91
|
+ '../../static/images/limit/queue_bg_3.png',
|
|
|
92
|
+ '../../static/images/limit/queue_bg_4.png',
|
|
|
93
|
+ '../../static/images/limit/queue_bg_5.png',
|
|
|
94
|
+ '../../static/images/limit/queue_bg_6.png',
|
|
|
95
|
+ '../../static/images/limit/queue_bg_7.png',
|
|
|
96
|
+ '../../static/images/limit/queue_bg_8.png'
|
|
|
97
|
+ ],
|
|
|
98
|
+ vipImage: [ // 3种用户vip等级小图标
|
|
|
99
|
+ '',
|
|
|
100
|
+ '../../static/images/limit/level-1.png',
|
|
|
101
|
+ '../../static/images/limit/level-2.png',
|
|
|
102
|
+ '../../static/images/limit/level-3.png'
|
|
|
103
|
+ ],
|
|
|
104
|
+ defaultAvatar: '../../static/images/icons/default-avatar.png',
|
|
|
105
|
+ resultHead: [
|
|
|
106
|
+ '../../static/images/limit/fail-head.png',
|
|
|
107
|
+ '../../static/images/limit/success-head.png'
|
|
|
108
|
+ ],
|
|
|
109
|
+ api_status: 0, // 用于防止连续点击参加活动 0:没调用接口 1:正在调用接口
|
|
|
110
|
+ giftImage: '../../static/images/limit/gift.png',
|
|
|
111
|
+ queueList: [], // 排队列表
|
|
|
112
|
+ scrollTop: 0, // 控制scroll-view滚动的实际位置
|
|
|
113
|
+ tempScrollTop: 0, // 手动滚动页面时保存当前滚动的位置
|
|
|
114
|
+ showMsg: 0, // 0不显示提示框, 1显示提示框
|
|
|
115
|
+ hidePopup: 0, // 用于显示头像旁边的气泡 0:显示 1:不显示
|
|
|
116
|
+ hideInviteButton: 1, // 用户显示邀请按钮
|
|
|
117
|
+ actionSheet: {
|
|
|
118
|
+ componentId: 'shareActionSheet',
|
|
|
119
|
+ show: false,
|
|
|
120
|
+ closeOnClickOverlay: true,
|
|
|
121
|
+ cancelText: '取消',
|
|
|
122
|
+ actions: [{
|
|
|
123
|
+ name: '邀请好友助力',
|
|
|
124
|
+ className: 'action-class',
|
|
|
125
|
+ loading: false,
|
|
|
126
|
+ openType: 'share'
|
|
|
127
|
+ }, {
|
|
|
128
|
+ name: '生成图片分享到朋友圈',
|
|
|
129
|
+ className: 'action-class',
|
|
|
130
|
+ loading: false,
|
|
|
131
|
+ }]
|
|
|
132
|
+ },
|
49
|
},
|
133
|
},
|
50
|
- test_uid: [349709, // 测试用
|
|
|
51
|
- 500030924,
|
|
|
52
|
- 500030922,
|
|
|
53
|
- 500030918,
|
|
|
54
|
- 500030916,
|
|
|
55
|
- 500030914,
|
|
|
56
|
- 500030912,
|
|
|
57
|
- 500030910,
|
|
|
58
|
- 500030908,
|
|
|
59
|
- 500030906,
|
|
|
60
|
- 500030904,
|
|
|
61
|
- 500030890,
|
|
|
62
|
- 500030888,
|
|
|
63
|
- 500030886,
|
|
|
64
|
- 500030884,
|
|
|
65
|
- 500030876,
|
|
|
66
|
- 500030830,
|
|
|
67
|
- 500030694,
|
|
|
68
|
- 500030690,
|
|
|
69
|
- 500030688
|
|
|
70
|
- ],
|
|
|
71
|
- now_test_uid_index: 15,
|
|
|
72
|
- h5PageUrl: [
|
|
|
73
|
- {
|
|
|
74
|
- title: '排队活动说明',
|
|
|
75
|
- url: 'https://activity.yoho.cn/feature/249.html?nodownload=1'
|
|
|
76
|
- }
|
|
|
77
|
- ],
|
|
|
78
|
- bgStyle: [ // 排队图片
|
|
|
79
|
- '../../static/images/limit/queue_bg_1.png',
|
|
|
80
|
- '../../static/images/limit/queue_bg_2.png',
|
|
|
81
|
- '../../static/images/limit/queue_bg_3.png',
|
|
|
82
|
- '../../static/images/limit/queue_bg_4.png',
|
|
|
83
|
- '../../static/images/limit/queue_bg_5.png',
|
|
|
84
|
- '../../static/images/limit/queue_bg_6.png',
|
|
|
85
|
- '../../static/images/limit/queue_bg_7.png',
|
|
|
86
|
- '../../static/images/limit/queue_bg_8.png'
|
|
|
87
|
- ],
|
|
|
88
|
- vipImage: [ // 3种用户vip等级小图标
|
|
|
89
|
- '',
|
|
|
90
|
- '../../static/images/limit/level-1.png',
|
|
|
91
|
- '../../static/images/limit/level-2.png',
|
|
|
92
|
- '../../static/images/limit/level-3.png'
|
|
|
93
|
- ],
|
|
|
94
|
- defaultAvatar: '../../static/images/icons/default-avatar.png',
|
|
|
95
|
- resultHead: [
|
|
|
96
|
- '../../static/images/limit/fail-head.png',
|
|
|
97
|
- '../../static/images/limit/success-head.png'
|
|
|
98
|
- ],
|
|
|
99
|
- api_status: 0, // 用于防止连续点击参加活动 0:没调用接口 1:正在调用接口
|
|
|
100
|
- giftImage: '../../static/images/limit/gift.png',
|
|
|
101
|
- queueList: [], // 排队列表
|
|
|
102
|
- scrollTop: 0, // 控制scroll-view滚动的实际位置
|
|
|
103
|
- tempScrollTop: 0, // 手动滚动页面时保存当前滚动的位置
|
|
|
104
|
- showMsg: 0, // 0不显示提示框, 1显示提示框
|
|
|
105
|
- hidePopup: 0, // 用于显示头像旁边的气泡 0:显示 1:不显示
|
|
|
106
|
- hideInviteButton: 1, // 用户显示邀请按钮
|
|
|
107
|
- actionSheet: {
|
|
|
108
|
- componentId: 'shareActionSheet',
|
|
|
109
|
- show: false,
|
|
|
110
|
- closeOnClickOverlay: true,
|
|
|
111
|
- cancelText: '取消',
|
|
|
112
|
- actions: [{
|
|
|
113
|
- name: '邀请好友助力',
|
|
|
114
|
- className: 'action-class',
|
|
|
115
|
- loading: false,
|
|
|
116
|
- openType: 'share'
|
|
|
117
|
- }, {
|
|
|
118
|
- name: '生成图片分享到朋友圈',
|
|
|
119
|
- className: 'action-class',
|
|
|
120
|
- loading: false,
|
|
|
121
|
- }]
|
|
|
122
|
- },
|
|
|
123
|
- },
|
|
|
124
|
|
134
|
|
125
|
- /**
|
135
|
+ /**
|
126
|
* 生命周期函数--监听页面加载
|
136
|
* 生命周期函数--监听页面加载
|
127
|
*/
|
137
|
*/
|
128
|
- onLoad: function(options) {
|
|
|
129
|
- console.log(options);
|
|
|
130
|
- let actId = options.actId;
|
|
|
131
|
- let uid = app.getUid();
|
|
|
132
|
-
|
|
|
133
|
- if (actId) {
|
|
|
134
|
- this.getActivityInfo(actId).then(res => {
|
|
|
135
|
- console.log('res', res);
|
|
|
136
|
- if (res.code === 200) {
|
|
|
137
|
- this.getQueueList(actId, 0);
|
|
|
138
|
- }
|
|
|
139
|
- if (uid) {
|
|
|
140
|
- this.getUserActivityInfo(actId, uid);
|
138
|
+ onLoad: function (options) {
|
|
|
139
|
+ console.log(options);
|
|
|
140
|
+ let actId = options.actId;
|
|
|
141
|
+ let uid = app.getUid();
|
|
|
142
|
+
|
|
|
143
|
+ if (actId) {
|
|
|
144
|
+ this.getActivityInfo(actId).then(res => {
|
|
|
145
|
+ console.log('res', res);
|
|
|
146
|
+ if (res.code === 200) {
|
|
|
147
|
+ this.getQueueList(actId, 0);
|
|
|
148
|
+ }
|
|
|
149
|
+ if (uid) {
|
|
|
150
|
+ this.getUserActivityInfo(actId, uid);
|
|
|
151
|
+ }
|
|
|
152
|
+ }); // 获取活动信息
|
|
|
153
|
+
|
|
|
154
|
+ for (let i in options) {
|
|
|
155
|
+ options[i] = decodeURIComponent(options[i]);
|
|
|
156
|
+ }
|
|
|
157
|
+
|
|
|
158
|
+ this.setData({
|
|
|
159
|
+ shareInfo: Object.assign(this.data.shareInfo, options)
|
|
|
160
|
+ });
|
141
|
}
|
161
|
}
|
142
|
- }); // 获取活动信息
|
|
|
143
|
-
|
|
|
144
|
- for (let i in options) {
|
|
|
145
|
- options[i] = decodeURIComponent(options[i]);
|
|
|
146
|
- }
|
|
|
147
|
-
|
|
|
148
|
- this.setData({
|
|
|
149
|
- shareInfo: Object.assign(this.data.shareInfo, options)
|
|
|
150
|
- });
|
|
|
151
|
- }
|
|
|
152
|
- },
|
162
|
+ },
|
153
|
|
163
|
|
154
|
- /**
|
164
|
+ /**
|
155
|
* 生命周期函数--监听页面初次渲染完成
|
165
|
* 生命周期函数--监听页面初次渲染完成
|
156
|
*/
|
166
|
*/
|
157
|
- onReady: function() {
|
167
|
+ onReady: function () {
|
158
|
|
168
|
|
159
|
- },
|
169
|
+ },
|
160
|
|
170
|
|
161
|
- /**
|
171
|
+ /**
|
162
|
* 生命周期函数--监听页面显示
|
172
|
* 生命周期函数--监听页面显示
|
163
|
*/
|
173
|
*/
|
164
|
- onShow: function(options) {
|
|
|
165
|
- setTimeout(this.hidePopup, 4000);
|
|
|
166
|
- if (app.getUid()) {
|
|
|
167
|
- this.setData({
|
|
|
168
|
- hideInviteButton: 0
|
|
|
169
|
- });
|
|
|
170
|
- }
|
|
|
171
|
- },
|
174
|
+ onShow: function (options) {
|
|
|
175
|
+ setTimeout(this.hidePopup, 4000);
|
|
|
176
|
+ if (app.getUid()) {
|
|
|
177
|
+ this.setData({
|
|
|
178
|
+ hideInviteButton: 0
|
|
|
179
|
+ });
|
|
|
180
|
+ }
|
|
|
181
|
+ },
|
172
|
|
182
|
|
173
|
- /**
|
183
|
+ /**
|
174
|
* 生命周期函数--监听页面隐藏
|
184
|
* 生命周期函数--监听页面隐藏
|
175
|
*/
|
185
|
*/
|
176
|
- onHide: function() {
|
|
|
177
|
- },
|
186
|
+ onHide: function () {
|
|
|
187
|
+ },
|
178
|
|
188
|
|
179
|
- /**
|
189
|
+ /**
|
180
|
* 生命周期函数--监听页面卸载
|
190
|
* 生命周期函数--监听页面卸载
|
181
|
*/
|
191
|
*/
|
182
|
- onUnload: function() {
|
|
|
183
|
- },
|
192
|
+ onUnload: function () {
|
|
|
193
|
+ },
|
184
|
|
194
|
|
185
|
- /**
|
195
|
+ /**
|
186
|
* 页面相关事件处理函数--监听用户下拉动作
|
196
|
* 页面相关事件处理函数--监听用户下拉动作
|
187
|
*/
|
197
|
*/
|
188
|
- onPullDownRefresh: function() {
|
|
|
189
|
- let actId = this.data.activityInfo.activityId;
|
|
|
190
|
-
|
|
|
191
|
- if (actId) {
|
|
|
192
|
- this.getActivityInfo(actId).then(res => {
|
|
|
193
|
- console.log('res', res);
|
|
|
194
|
- if (res.code === 200) {
|
|
|
195
|
- this.getQueueList(actId, 0);
|
|
|
196
|
- wx.stopPullDownRefresh();
|
198
|
+ onPullDownRefresh: function () {
|
|
|
199
|
+ let actId = this.data.activityInfo.activityId;
|
|
|
200
|
+
|
|
|
201
|
+ if (actId) {
|
|
|
202
|
+ this.getActivityInfo(actId).then(res => {
|
|
|
203
|
+ console.log('res', res);
|
|
|
204
|
+ if (res.code === 200) {
|
|
|
205
|
+ this.getQueueList(actId, 0);
|
|
|
206
|
+ wx.stopPullDownRefresh();
|
|
|
207
|
+ }
|
|
|
208
|
+ }); // 获取活动信息
|
197
|
}
|
209
|
}
|
198
|
- }); // 获取活动信息
|
|
|
199
|
- }
|
|
|
200
|
- },
|
210
|
+ },
|
201
|
|
211
|
|
202
|
- /**
|
212
|
+ /**
|
203
|
* 页面上拉触底事件的处理函数
|
213
|
* 页面上拉触底事件的处理函数
|
204
|
*/
|
214
|
*/
|
205
|
- onReachBottom: function() {
|
|
|
206
|
- console.log('到底部啦');
|
|
|
207
|
- let actId = this.data.activityInfo.activityId;
|
|
|
208
|
- let sort = this.data.queueList[this.data.queueList.length - 1].sort;
|
|
|
209
|
- let limit = 50;
|
|
|
210
|
-
|
|
|
211
|
- if (sort > 1) {
|
|
|
212
|
- if (sort - 1 < limit) {
|
|
|
213
|
- limit = sort - 1;
|
|
|
214
|
- }
|
|
|
215
|
- this.getQueueList(actId, sort - 1, limit, true);
|
|
|
216
|
- }
|
|
|
217
|
- },
|
215
|
+ onReachBottom: function () {
|
|
|
216
|
+ console.log('到底部啦');
|
|
|
217
|
+ let actId = this.data.activityInfo.activityId;
|
|
|
218
|
+ let sort = this.data.queueList[this.data.queueList.length - 1].sort;
|
|
|
219
|
+ let limit = 50;
|
|
|
220
|
+
|
|
|
221
|
+ if (sort > 1) {
|
|
|
222
|
+ if (sort - 1 < limit) {
|
|
|
223
|
+ limit = sort - 1;
|
|
|
224
|
+ }
|
|
|
225
|
+ this.getQueueList(actId, sort - 1, limit, true);
|
|
|
226
|
+ }
|
|
|
227
|
+ },
|
218
|
|
228
|
|
219
|
- /**
|
229
|
+ /**
|
220
|
* 用户点击右上角分享
|
230
|
* 用户点击右上角分享
|
221
|
*/
|
231
|
*/
|
222
|
- onShareAppMessage: function(res) {
|
|
|
223
|
- let params = {
|
|
|
224
|
- FROM: res.from,
|
|
|
225
|
- SHARE_RESUIL: 0,
|
|
|
226
|
- TITLE: decodeURIComponent(this.data.shareInfo.product_name),
|
|
|
227
|
- DESC: '我在有货限定频道发现一个不错的商品赶快来看看吧!',
|
|
|
228
|
- PATH: `/pages/product/detail/detail?limitProductCode=
|
232
|
+ onShareAppMessage: function (res) {
|
|
|
233
|
+ let params = {
|
|
|
234
|
+ FROM: res.from,
|
|
|
235
|
+ SHARE_RESUIL: 0,
|
|
|
236
|
+ TITLE: decodeURIComponent(this.data.shareInfo.product_name),
|
|
|
237
|
+ DESC: '我在有货限定频道发现一个不错的商品赶快来看看吧!',
|
|
|
238
|
+ PATH: `/pages/product/detail/detail?limitProductCode=
|
229
|
${this.data.shareInfo.limitProductCode}&originUid=${app.getUid()}`,
|
239
|
${this.data.shareInfo.limitProductCode}&originUid=${app.getUid()}`,
|
230
|
- IMG: decodeURIComponent(this.data.shareInfo.default_image)
|
|
|
231
|
- };
|
|
|
232
|
-
|
|
|
233
|
- // 用户点击右上角分享
|
|
|
234
|
- return {
|
|
|
235
|
- title: params.TITLE, // 分享标题
|
|
|
236
|
- desc: params.DESC, // 分享描述
|
|
|
237
|
- path: params.PATH, // 分享路径
|
|
|
238
|
- imageUrl: params.IMG,
|
|
|
239
|
- success: function() {
|
|
|
240
|
- params.SHARE_RESUIL = 1;
|
|
|
241
|
- },
|
|
|
242
|
- fail: function() {
|
|
|
243
|
- params.SHARE_RESUIL = 2;
|
|
|
244
|
- }
|
|
|
245
|
- };
|
|
|
246
|
- },
|
|
|
247
|
- share: function() {
|
|
|
248
|
- this.setData({
|
|
|
249
|
- 'actionSheet.show': true
|
|
|
250
|
- });
|
|
|
251
|
- },
|
|
|
252
|
- handleZanActionsheetCancel() {
|
|
|
253
|
- this.setData({
|
|
|
254
|
- 'actionSheet.show': false
|
|
|
255
|
- });
|
|
|
256
|
- },
|
|
|
257
|
-
|
|
|
258
|
- // 当行动按钮中有一个被点击时触发
|
|
|
259
|
- // index 代表被点击按钮在传入参数 actions 中的位置
|
|
|
260
|
- handleZanActionsheetClick({index}) {
|
|
|
261
|
- this.setData({
|
|
|
262
|
- 'actionSheet.show': false
|
|
|
263
|
- });
|
|
|
264
|
-
|
|
|
265
|
- let uid = this.data.originUid || this.data.uid;
|
|
|
266
|
-
|
|
|
267
|
- if (index === 1) {
|
|
|
268
|
- router.go('snapShare', this.data.shareInfo);
|
|
|
269
|
- }
|
|
|
270
|
- },
|
240
|
+ IMG: decodeURIComponent(this.data.shareInfo.default_image)
|
|
|
241
|
+ };
|
|
|
242
|
+
|
|
|
243
|
+ // 用户点击右上角分享
|
|
|
244
|
+ return {
|
|
|
245
|
+ title: params.TITLE, // 分享标题
|
|
|
246
|
+ desc: params.DESC, // 分享描述
|
|
|
247
|
+ path: params.PATH, // 分享路径
|
|
|
248
|
+ imageUrl: params.IMG,
|
|
|
249
|
+ success: function () {
|
|
|
250
|
+ params.SHARE_RESUIL = 1;
|
|
|
251
|
+ },
|
|
|
252
|
+ fail: function () {
|
|
|
253
|
+ params.SHARE_RESUIL = 2;
|
|
|
254
|
+ }
|
|
|
255
|
+ };
|
|
|
256
|
+ },
|
|
|
257
|
+ share: function () {
|
|
|
258
|
+ this.setData({
|
|
|
259
|
+ 'actionSheet.show': true
|
|
|
260
|
+ });
|
|
|
261
|
+ },
|
|
|
262
|
+ handleZanActionsheetCancel() {
|
|
|
263
|
+ this.setData({
|
|
|
264
|
+ 'actionSheet.show': false
|
|
|
265
|
+ });
|
|
|
266
|
+ },
|
|
|
267
|
+
|
|
|
268
|
+ // 当行动按钮中有一个被点击时触发
|
|
|
269
|
+ // index 代表被点击按钮在传入参数 actions 中的位置
|
|
|
270
|
+ handleZanActionsheetClick({index}) {
|
|
|
271
|
+ this.setData({
|
|
|
272
|
+ 'actionSheet.show': false
|
|
|
273
|
+ });
|
271
|
|
274
|
|
272
|
- /**
|
275
|
+ let uid = this.data.originUid || this.data.uid;
|
|
|
276
|
+
|
|
|
277
|
+ if (index === 1) {
|
|
|
278
|
+ router.go('snapShare', this.data.shareInfo);
|
|
|
279
|
+ }
|
|
|
280
|
+ },
|
|
|
281
|
+
|
|
|
282
|
+ /**
|
273
|
* 邀请好友助力排队按钮
|
283
|
* 邀请好友助力排队按钮
|
274
|
*/
|
284
|
*/
|
275
|
- inviteFriends: function(e) {
|
|
|
276
|
- this.share();
|
|
|
277
|
- },
|
285
|
+ inviteFriends: function (e) {
|
|
|
286
|
+ this.share();
|
|
|
287
|
+ },
|
278
|
|
288
|
|
279
|
- /**
|
289
|
+ /**
|
280
|
* scroll-view滚动事件
|
290
|
* scroll-view滚动事件
|
281
|
*/
|
291
|
*/
|
282
|
- scroll: function(e) {
|
|
|
283
|
- console.log(e);
|
|
|
284
|
- let scrollTop = e.detail.scrollTop;
|
292
|
+ scroll: function (e) {
|
|
|
293
|
+ console.log(e);
|
|
|
294
|
+ let scrollTop = e.detail.scrollTop;
|
285
|
|
295
|
|
286
|
- this.setData({
|
|
|
287
|
- tempScrollTop: scrollTop
|
|
|
288
|
- });
|
|
|
289
|
- },
|
296
|
+ this.setData({
|
|
|
297
|
+ tempScrollTop: scrollTop
|
|
|
298
|
+ });
|
|
|
299
|
+ },
|
290
|
|
300
|
|
291
|
- /**
|
301
|
+ /**
|
292
|
* 跳转到我的排队列表
|
302
|
* 跳转到我的排队列表
|
293
|
*/
|
303
|
*/
|
294
|
- navigateToMyList: function(e) {
|
|
|
295
|
- router.go('myList', Object.assign({actId: this.data.activityInfo.activityId}, this.data.shareInfo));
|
|
|
296
|
- },
|
304
|
+ navigateToMyList: function (e) {
|
|
|
305
|
+ router.go('myList', Object.assign({actId: this.data.activityInfo.activityId}, this.data.shareInfo));
|
|
|
306
|
+ },
|
297
|
|
307
|
|
298
|
- /**
|
308
|
+ /**
|
299
|
* 点击用户头像,跳转到用户对应位置<已取消该功能>
|
309
|
* 点击用户头像,跳转到用户对应位置<已取消该功能>
|
300
|
*/
|
310
|
*/
|
301
|
- userTap: function(e) {
|
|
|
302
|
- console.log(this.data.userInfo);
|
|
|
303
|
- let uid = this.data.userInfo.uid;
|
|
|
304
|
- let sort = this.data.userInfo.sort || 0;
|
|
|
305
|
- let limit = sort >= 50 ? 50 : sort;
|
|
|
306
|
- let actId = this.data.activityInfo.activityId;
|
|
|
307
|
- let list_length = this.data.queueList.length > 200 ? 200 : this.data.queueList.length;
|
|
|
308
|
-
|
|
|
309
|
- for (let i = 0; i < list_length; i++) {
|
|
|
310
|
- let item = this.data.queueList[i];
|
|
|
311
|
-
|
|
|
312
|
- if (item.uid === uid) {
|
|
|
313
|
- this.scrollPage('item_' + item.uid);
|
|
|
314
|
- console.log(item.uid);
|
|
|
315
|
- break;
|
|
|
316
|
- } else if (i === list_length - 1) {
|
|
|
317
|
- console.log(i);
|
|
|
318
|
- this.getQueueList(actId, sort, limit).then(res => {
|
|
|
319
|
- console.log('111', res);
|
|
|
320
|
- if (res.code === 200) {
|
|
|
321
|
- let item_id = 'item_' + uid;
|
|
|
322
|
-
|
|
|
323
|
- this.scrollPage(item_id);
|
|
|
324
|
- }
|
|
|
325
|
- });
|
|
|
326
|
- }
|
|
|
327
|
- }
|
|
|
328
|
- },
|
311
|
+ userTap: function (e) {
|
|
|
312
|
+ console.log(this.data.userInfo);
|
|
|
313
|
+ let uid = this.data.userInfo.uid;
|
|
|
314
|
+ let sort = this.data.userInfo.sort || 0;
|
|
|
315
|
+ let limit = sort >= 50 ? 50 : sort;
|
|
|
316
|
+ let actId = this.data.activityInfo.activityId;
|
|
|
317
|
+ let list_length = this.data.queueList.length > 200 ? 200 : this.data.queueList.length;
|
|
|
318
|
+
|
|
|
319
|
+ for (let i = 0; i < list_length; i++) {
|
|
|
320
|
+ let item = this.data.queueList[i];
|
|
|
321
|
+
|
|
|
322
|
+ if (item.uid === uid) {
|
|
|
323
|
+ this.scrollPage('item_' + item.uid);
|
|
|
324
|
+ console.log(item.uid);
|
|
|
325
|
+ break;
|
|
|
326
|
+ } else if (i === list_length - 1) {
|
|
|
327
|
+ console.log(i);
|
|
|
328
|
+ this.getQueueList(actId, sort, limit).then(res => {
|
|
|
329
|
+ console.log('111', res);
|
|
|
330
|
+ if (res.code === 200) {
|
|
|
331
|
+ let item_id = 'item_' + uid;
|
|
|
332
|
+
|
|
|
333
|
+ this.scrollPage(item_id);
|
|
|
334
|
+ }
|
|
|
335
|
+ });
|
|
|
336
|
+ }
|
|
|
337
|
+ }
|
|
|
338
|
+ },
|
329
|
|
339
|
|
330
|
- /**
|
340
|
+ /**
|
331
|
* 关闭提示框
|
341
|
* 关闭提示框
|
332
|
*/
|
342
|
*/
|
333
|
- closeMsg: function(e) {
|
|
|
334
|
- this.setData({
|
|
|
335
|
- showMsg: 0
|
|
|
336
|
- });
|
|
|
337
|
- },
|
343
|
+ closeMsg: function (e) {
|
|
|
344
|
+ this.setData({
|
|
|
345
|
+ showMsg: 0
|
|
|
346
|
+ });
|
|
|
347
|
+ },
|
338
|
|
348
|
|
339
|
- /**
|
349
|
+ /**
|
340
|
* 隐藏气泡
|
350
|
* 隐藏气泡
|
341
|
*/
|
351
|
*/
|
342
|
- hidePopup: function(e) {
|
|
|
343
|
- this.setData({
|
|
|
344
|
- hidePopup: 1
|
|
|
345
|
- });
|
|
|
346
|
- },
|
352
|
+ hidePopup: function (e) {
|
|
|
353
|
+ this.setData({
|
|
|
354
|
+ hidePopup: 1
|
|
|
355
|
+ });
|
|
|
356
|
+ },
|
347
|
|
357
|
|
348
|
- /**
|
358
|
+ /**
|
349
|
* 点击参加活动按钮
|
359
|
* 点击参加活动按钮
|
350
|
*/
|
360
|
*/
|
351
|
- joinInQueue: function(e) {
|
|
|
352
|
- let uid = app.getUid();
|
|
|
353
|
- let activityId = this.data.activityInfo.activityId;
|
|
|
354
|
- let isEnd = this.data.activityInfo.isEnd === 0 ? 0 : 1;
|
|
|
355
|
-
|
|
|
356
|
- if (activityId && uid && !isEnd) {
|
|
|
357
|
- this.addQueue(this.data.activityInfo.activityId, uid);
|
|
|
358
|
- } else if (isEnd) {
|
|
|
359
|
- this.setData({
|
|
|
360
|
- showMsg: 1
|
|
|
361
|
- });
|
|
|
362
|
- } else if (!uid) {
|
|
|
363
|
- let pages = getCurrentPages();
|
|
|
364
|
- let referer = pages[pages.length - 1].route + '?' + stringify(this.data.shareInfo);
|
|
|
365
|
-
|
|
|
366
|
- router.go('userCenter', { referer });
|
|
|
367
|
- }
|
|
|
368
|
- },
|
361
|
+ joinInQueue: function (e) {
|
|
|
362
|
+ let uid = app.getUid();
|
|
|
363
|
+ let activityId = this.data.activityInfo.activityId;
|
|
|
364
|
+ let isEnd = this.data.activityInfo.isEnd === 0 ? 0 : 1;
|
|
|
365
|
+
|
|
|
366
|
+ if (activityId && uid && !isEnd) {
|
|
|
367
|
+ this.addQueue(this.data.activityInfo.activityId, uid);
|
|
|
368
|
+ } else if (isEnd) {
|
|
|
369
|
+ this.setData({
|
|
|
370
|
+ showMsg: 1
|
|
|
371
|
+ });
|
|
|
372
|
+ } else if (!uid) {
|
|
|
373
|
+ let pages = getCurrentPages();
|
|
|
374
|
+ let referer = pages[pages.length - 1].route + '?' + stringify(this.data.shareInfo);
|
|
|
375
|
+
|
|
|
376
|
+ router.go('userCenter', {referer});
|
|
|
377
|
+ }
|
|
|
378
|
+ },
|
369
|
|
379
|
|
370
|
- /**
|
380
|
+ /**
|
371
|
* 获取活动信息
|
381
|
* 获取活动信息
|
372
|
*/
|
382
|
*/
|
373
|
- getActivityInfo: function(actId) {
|
|
|
374
|
- return LimitModel.getActivityInfo(actId).then(res => { // 获取活动信息
|
|
|
375
|
- console.log(res);
|
|
|
376
|
- if (res.code === 200) {
|
|
|
377
|
- let topBanner = helper.image(res.data.topBanner, 750, 352, 1);
|
|
|
378
|
- let isBegin = res.data.isBegin;
|
|
|
379
|
- let isDrawEnd = res.data.isDrawEnd;
|
|
|
380
|
- let isEnd = res.data.isEnd;
|
|
|
381
|
- let prizeType = res.data.prizeType;
|
|
|
382
|
- let activityName = res.data.activityName;
|
|
|
383
|
- let activityId = res.data.activityId;
|
|
|
384
|
- let bgStyle = res.data.bgStyle && res.data.bgStyle.length > 0 ? res.data.bgStyle : this.data.bgStyle;
|
|
|
385
|
-
|
|
|
386
|
- this.setData({
|
|
|
387
|
- activityInfo: {
|
|
|
388
|
- topBanner: topBanner,
|
|
|
389
|
- isBegin: isBegin, // 是否已开始 0-未开始 1-进行中 2-已结束
|
|
|
390
|
- isDrawEnd: isDrawEnd, // 是否已开奖 1-开奖 0-未开奖
|
|
|
391
|
- isEnd: isEnd, // 是否已结束 1-结束 0-未结束
|
|
|
392
|
- prizeType: prizeType, // 奖品类型1-有货币 2-优惠券 3-限购码
|
|
|
393
|
- activityId: activityId,
|
|
|
394
|
- activityName: activityName
|
|
|
395
|
- },
|
|
|
396
|
- bgStyle: bgStyle
|
383
|
+ getActivityInfo: function (actId) {
|
|
|
384
|
+ return LimitModel.getActivityInfo(actId).then(res => { // 获取活动信息
|
|
|
385
|
+ console.log(res);
|
|
|
386
|
+ if (res.code === 200) {
|
|
|
387
|
+ let topBanner = helper.image(res.data.topBanner, 750, 352, 1);
|
|
|
388
|
+ let isBegin = res.data.isBegin;
|
|
|
389
|
+ let isDrawEnd = res.data.isDrawEnd;
|
|
|
390
|
+ let isEnd = res.data.isEnd;
|
|
|
391
|
+ let prizeType = res.data.prizeType;
|
|
|
392
|
+ let activityName = res.data.activityName;
|
|
|
393
|
+ let activityId = res.data.activityId;
|
|
|
394
|
+ let bgStyle = res.data.bgStyle && res.data.bgStyle.length > 0 ? res.data.bgStyle : this.data.bgStyle;
|
|
|
395
|
+
|
|
|
396
|
+ this.setData({
|
|
|
397
|
+ activityInfo: {
|
|
|
398
|
+ topBanner: topBanner,
|
|
|
399
|
+ isBegin: isBegin, // 是否已开始 0-未开始 1-进行中 2-已结束
|
|
|
400
|
+ isDrawEnd: isDrawEnd, // 是否已开奖 1-开奖 0-未开奖
|
|
|
401
|
+ isEnd: isEnd, // 是否已结束 1-结束 0-未结束
|
|
|
402
|
+ prizeType: prizeType, // 奖品类型1-有货币 2-优惠券 3-限购码
|
|
|
403
|
+ activityId: activityId,
|
|
|
404
|
+ activityName: activityName
|
|
|
405
|
+ },
|
|
|
406
|
+ bgStyle: bgStyle
|
|
|
407
|
+ });
|
|
|
408
|
+ return Promise.resolve({code: res.code});
|
|
|
409
|
+ } else {
|
|
|
410
|
+ return Promise.reject({code: res.code});
|
|
|
411
|
+ }
|
397
|
});
|
412
|
});
|
398
|
- return Promise.resolve({code: res.code});
|
|
|
399
|
- } else {
|
|
|
400
|
- return Promise.reject({code: res.code});
|
|
|
401
|
- }
|
|
|
402
|
- });
|
|
|
403
|
- },
|
|
|
404
|
-
|
|
|
405
|
- /**
|
413
|
+ },
|
|
|
414
|
+
|
|
|
415
|
+ /**
|
406
|
* 加入排队
|
416
|
* 加入排队
|
407
|
*/
|
417
|
*/
|
408
|
- addQueue: function(actId, uid) {
|
|
|
409
|
- if (!this.data.api_status) {
|
|
|
410
|
- this.setData({
|
|
|
411
|
- api_status: 1
|
|
|
412
|
- });
|
|
|
413
|
- LimitModel.addQueue(actId).then((res) => {
|
|
|
414
|
- console.log('加入排队', res);
|
|
|
415
|
- if (res.code === 200 && res.data) {
|
|
|
416
|
- let sort = res.data.sort;
|
|
|
417
|
-
|
|
|
418
|
- this.setData({
|
|
|
419
|
- userInfo: Object.assign(this.data.userInfo, {sort: sort, isDrawline: 1}),
|
|
|
420
|
- showMsg: 1,
|
|
|
421
|
- api_status: 0
|
|
|
422
|
- });
|
|
|
423
|
- setTimeout(this.getQueueList, 1000);
|
|
|
424
|
-
|
|
|
425
|
- // this.getQueueList(this.data.activityInfo.activityId, 0);
|
418
|
+ addQueue: function (actId, uid) {
|
|
|
419
|
+ if (!this.data.api_status) {
|
|
|
420
|
+ this.setData({
|
|
|
421
|
+ api_status: 1
|
|
|
422
|
+ });
|
|
|
423
|
+ LimitModel.addQueue(actId).then((res) => {
|
|
|
424
|
+ console.log('加入排队', res);
|
|
|
425
|
+ if (res.code === 200 && res.data) {
|
|
|
426
|
+ let sort = res.data.sort;
|
|
|
427
|
+
|
|
|
428
|
+ this.setData({
|
|
|
429
|
+ userInfo: Object.assign(this.data.userInfo, {sort: sort, isDrawline: 1}),
|
|
|
430
|
+ showMsg: 1,
|
|
|
431
|
+ api_status: 0
|
|
|
432
|
+ });
|
|
|
433
|
+ setTimeout(this.getQueueList, 1000);
|
|
|
434
|
+
|
|
|
435
|
+ // this.getQueueList(this.data.activityInfo.activityId, 0);
|
|
|
436
|
+ }
|
|
|
437
|
+ }).catch(() => {
|
|
|
438
|
+ console.log('错误');
|
|
|
439
|
+ this.setData({
|
|
|
440
|
+ api_status: 0
|
|
|
441
|
+ });
|
|
|
442
|
+ });
|
426
|
}
|
443
|
}
|
427
|
- }).catch(() => {
|
|
|
428
|
- console.log('错误');
|
|
|
429
|
- this.setData({
|
|
|
430
|
- api_status: 0
|
|
|
431
|
- });
|
|
|
432
|
- });
|
|
|
433
|
- }
|
|
|
434
|
- },
|
444
|
+ },
|
435
|
|
445
|
|
436
|
- /**
|
446
|
+ /**
|
437
|
* 获取用户参与排队的信息
|
447
|
* 获取用户参与排队的信息
|
438
|
*/
|
448
|
*/
|
439
|
- getUserActivityInfo: function(actId) {
|
|
|
440
|
- LimitModel.getUserActivityInfo(actId).then(res => {
|
|
|
441
|
- console.log('getUserActivityInfo:', res);
|
|
|
442
|
- this.setData({
|
|
|
443
|
- userInfo: {
|
|
|
444
|
- uid: res.data.uid,
|
|
|
445
|
- headIco: helper.image(res.data.headIco, 128, 128, 1) || this.data.defaultAvatar,
|
|
|
446
|
- isDrawline: res.data.isDrawline,
|
|
|
447
|
- isLucky: res.data.isLucky,
|
|
|
448
|
- sort: res.data.sort
|
|
|
449
|
- }
|
|
|
450
|
- });
|
|
|
451
|
-
|
|
|
452
|
- if (this.data.activityInfo.isDrawEnd) {
|
|
|
453
|
- this.setData({
|
|
|
454
|
- showMsg: 1
|
449
|
+ getUserActivityInfo: function (actId) {
|
|
|
450
|
+ LimitModel.getUserActivityInfo(actId).then(res => {
|
|
|
451
|
+ console.log('getUserActivityInfo:', res);
|
|
|
452
|
+ this.setData({
|
|
|
453
|
+ userInfo: {
|
|
|
454
|
+ uid: res.data.uid,
|
|
|
455
|
+ headIco: helper.image(res.data.headIco, 128, 128, 1) || this.data.defaultAvatar,
|
|
|
456
|
+ isDrawline: res.data.isDrawline,
|
|
|
457
|
+ isLucky: res.data.isLucky,
|
|
|
458
|
+ sort: res.data.sort
|
|
|
459
|
+ }
|
|
|
460
|
+ });
|
|
|
461
|
+
|
|
|
462
|
+ if (this.data.activityInfo.isDrawEnd) {
|
|
|
463
|
+ this.setData({
|
|
|
464
|
+ showMsg: 1
|
|
|
465
|
+ });
|
|
|
466
|
+ }
|
455
|
});
|
467
|
});
|
456
|
- }
|
|
|
457
|
- });
|
|
|
458
|
- },
|
468
|
+ },
|
459
|
|
469
|
|
460
|
- /**
|
470
|
+ /**
|
461
|
* 获取排队列表
|
471
|
* 获取排队列表
|
462
|
*/
|
472
|
*/
|
463
|
- getQueueList: function(actId, start = 0, limit = 50, isAdd = false) {
|
|
|
464
|
- let that = this;
|
|
|
465
|
-
|
|
|
466
|
- actId = actId || this.data.activityInfo.activityId;
|
|
|
467
|
-
|
|
|
468
|
- return LimitModel.getQueueList(actId, start, limit).then(res => {
|
|
|
469
|
- console.log(res);
|
|
|
470
|
- if (res.data && res.data.length > 0) {
|
|
|
471
|
- let result = [];
|
|
|
472
|
-
|
|
|
473
|
- res.data.forEach((item, index) => {
|
|
|
474
|
- if (!item.headIco) {
|
|
|
475
|
- item.headIco = that.data.defaultAvatar;
|
|
|
476
|
- } else {
|
|
|
477
|
- item.headIco = helper.image(item.headIco, 100, 100, 1);
|
|
|
478
|
- }
|
|
|
479
|
- item.nickName = item.nickName || '用户' + item.uid;
|
|
|
480
|
- item.nickName = item.nickName.length > 12 ? item.nickName.substring(0, 12) + '...' : item.nickName;
|
|
|
481
|
- item.queueTime = this.formatTimeText(item.queueTime);
|
|
|
482
|
- item.vipLevel = item.vipLevel || 0;
|
|
|
483
|
- item.vipImage = this.data.vipImage[item.vipLevel];
|
|
|
484
|
- let bgStyle = this.data.bgStyle;
|
|
|
485
|
- let bgIndex = index % bgStyle.length;
|
|
|
486
|
-
|
|
|
487
|
- item.background = helper.imgView(bgStyle[bgIndex], 340, 162, 1);
|
|
|
488
|
- result.push(item);
|
473
|
+ getQueueList: function (actId, start = 0, limit = 50, isAdd = false) {
|
|
|
474
|
+ let that = this;
|
|
|
475
|
+
|
|
|
476
|
+ actId = actId || this.data.activityInfo.activityId;
|
|
|
477
|
+
|
|
|
478
|
+ return LimitModel.getQueueList(actId, start, limit).then(res => {
|
|
|
479
|
+ console.log(res);
|
|
|
480
|
+ if (res.data && res.data.length > 0) {
|
|
|
481
|
+ let result = [];
|
|
|
482
|
+
|
|
|
483
|
+ res.data.forEach((item, index) => {
|
|
|
484
|
+ if (!item.headIco) {
|
|
|
485
|
+ item.headIco = that.data.defaultAvatar;
|
|
|
486
|
+ } else {
|
|
|
487
|
+ item.headIco = helper.image(item.headIco, 100, 100, 1);
|
|
|
488
|
+ }
|
|
|
489
|
+ item.nickName = item.nickName || '用户' + item.uid;
|
|
|
490
|
+ item.nickName = item.nickName.length > 12 ? item.nickName.substring(0, 12) + '...' : item.nickName;
|
|
|
491
|
+ item.queueTime = this.formatTimeText(item.queueTime);
|
|
|
492
|
+ item.vipLevel = item.vipLevel || 0;
|
|
|
493
|
+ item.vipImage = this.data.vipImage[item.vipLevel];
|
|
|
494
|
+ let bgStyle = this.data.bgStyle;
|
|
|
495
|
+ let bgIndex = index % bgStyle.length;
|
|
|
496
|
+
|
|
|
497
|
+ item.background = helper.imgView(bgStyle[bgIndex], 340, 162, 1);
|
|
|
498
|
+ result.push(item);
|
|
|
499
|
+ });
|
|
|
500
|
+ if (isAdd) { // 如果是下拉则添加数据
|
|
|
501
|
+ this.setData({
|
|
|
502
|
+ queueList: this.data.queueList.concat(result)
|
|
|
503
|
+ });
|
|
|
504
|
+ } else { // 普通情况下覆盖
|
|
|
505
|
+ this.setData({
|
|
|
506
|
+ queueList: result
|
|
|
507
|
+ });
|
|
|
508
|
+ }
|
|
|
509
|
+ return Promise.resolve({code: 200, data: this.data.queueList});
|
|
|
510
|
+ } else {
|
|
|
511
|
+ return Promise.reject({code: 203, message: '获取失败'});
|
|
|
512
|
+ }
|
489
|
});
|
513
|
});
|
490
|
- if (isAdd) { // 如果是下拉则添加数据
|
|
|
491
|
- this.setData({
|
|
|
492
|
- queueList: this.data.queueList.concat(result)
|
|
|
493
|
- });
|
|
|
494
|
- } else { // 普通情况下覆盖
|
|
|
495
|
- this.setData({
|
|
|
496
|
- queueList: result
|
|
|
497
|
- });
|
|
|
498
|
- }
|
|
|
499
|
- return Promise.resolve({code: 200, data: this.data.queueList});
|
|
|
500
|
- } else {
|
|
|
501
|
- return Promise.reject({code: 203, message: '获取失败'});
|
|
|
502
|
- }
|
|
|
503
|
- });
|
|
|
504
|
- },
|
|
|
505
|
- scrollPage: function(id) { // 滚动页面到对应位置
|
|
|
506
|
- if (id) {
|
|
|
507
|
- let item_query = wx.createSelectorQuery();
|
|
|
508
|
-
|
|
|
509
|
- item_query.select('#' + id).boundingClientRect();
|
|
|
510
|
- item_query.selectViewport().scrollOffset();
|
|
|
511
|
- item_query.exec(res => {
|
|
|
512
|
- console.log('scroll:', res);
|
|
|
513
|
- if (res.length > 0 && this.data.queueList.length > 6 && res[0].top !== 0) {
|
|
|
514
|
- wx.pageScrollTo({
|
|
|
515
|
- scrollTop: res[0].top + res[1].scrollTop,
|
|
|
516
|
- duration: 500
|
|
|
517
|
- });
|
|
|
518
|
-
|
|
|
519
|
- // this.setData({
|
|
|
520
|
- // scrollTop: res[0].top + this.data.tempScrollTop
|
|
|
521
|
- // })
|
514
|
+ },
|
|
|
515
|
+ scrollPage: function (id) { // 滚动页面到对应位置
|
|
|
516
|
+ if (id) {
|
|
|
517
|
+ let item_query = wx.createSelectorQuery();
|
|
|
518
|
+
|
|
|
519
|
+ item_query.select('#' + id).boundingClientRect();
|
|
|
520
|
+ item_query.selectViewport().scrollOffset();
|
|
|
521
|
+ item_query.exec(res => {
|
|
|
522
|
+ console.log('scroll:', res);
|
|
|
523
|
+ if (res.length > 0 && this.data.queueList.length > 6 && res[0].top !== 0) {
|
|
|
524
|
+ wx.pageScrollTo({
|
|
|
525
|
+ scrollTop: res[0].top + res[1].scrollTop,
|
|
|
526
|
+ duration: 500
|
|
|
527
|
+ });
|
|
|
528
|
+
|
|
|
529
|
+ // this.setData({
|
|
|
530
|
+ // scrollTop: res[0].top + this.data.tempScrollTop
|
|
|
531
|
+ // })
|
|
|
532
|
+ }
|
|
|
533
|
+ });
|
522
|
}
|
534
|
}
|
523
|
- });
|
|
|
524
|
- }
|
|
|
525
|
|
535
|
|
526
|
- },
|
536
|
+ },
|
527
|
|
537
|
|
528
|
- /**
|
538
|
+ /**
|
529
|
* 跳转到活动说明的H5页面
|
539
|
* 跳转到活动说明的H5页面
|
530
|
*/
|
540
|
*/
|
531
|
- navigateToDescPage: function() {
|
|
|
532
|
- router.goUrl(this.data.h5PageUrl[0].url + '&title=' + this.data.h5PageUrl[0].title);
|
|
|
533
|
- },
|
541
|
+ navigateToDescPage: function () {
|
|
|
542
|
+ router.goUrl(this.data.h5PageUrl[0].url + '&title=' + this.data.h5PageUrl[0].title);
|
|
|
543
|
+ },
|
534
|
|
544
|
|
535
|
- /**
|
545
|
+ /**
|
536
|
*跳转到中奖名单页面
|
546
|
*跳转到中奖名单页面
|
537
|
*/
|
547
|
*/
|
538
|
- navigateToPrizeUserList: function() {
|
|
|
539
|
- if (this.data.activityInfo.isDrawEnd) {
|
|
|
540
|
- router.go('prizeUserList', {actId: this.data.activityInfo.activityId});
|
|
|
541
|
- }
|
|
|
542
|
- },
|
548
|
+ navigateToPrizeUserList: function () {
|
|
|
549
|
+ if (this.data.activityInfo.isDrawEnd) {
|
|
|
550
|
+ router.go('prizeUserList', {actId: this.data.activityInfo.activityId});
|
|
|
551
|
+ }
|
|
|
552
|
+ },
|
543
|
|
553
|
|
544
|
- /**
|
554
|
+ /**
|
545
|
* 跳转到个人中心限购码页面
|
555
|
* 跳转到个人中心限购码页面
|
546
|
*/
|
556
|
*/
|
547
|
- navigateToUserCodePage: function() {
|
|
|
548
|
- if (this.data.userInfo.isLucky) {
|
|
|
549
|
- router.go('userCenter');
|
|
|
550
|
- }
|
|
|
551
|
- },
|
557
|
+ navigateToUserCodePage: function () {
|
|
|
558
|
+ if (this.data.userInfo.isLucky) {
|
|
|
559
|
+ router.go('userCenter');
|
|
|
560
|
+ }
|
|
|
561
|
+ },
|
|
|
562
|
+ /**
|
|
|
563
|
+ * 提交formId消息模板
|
|
|
564
|
+ */
|
|
|
565
|
+ submitFormId: function (e) {
|
|
|
566
|
+ console.log(e);
|
|
|
567
|
+ commonModel.addWechatFormId({
|
|
|
568
|
+ formId: e.detail.formId,
|
|
|
569
|
+ uid: app.getUid() || 0,
|
|
|
570
|
+ openId: app.getUnionID() || app.getOpenID() || '',
|
|
|
571
|
+ miniappType: app.getMiniappType()
|
|
|
572
|
+ });
|
|
|
573
|
+ },
|
552
|
|
574
|
|
553
|
- /**
|
575
|
+ /**
|
554
|
* 处理接口返回的图片url
|
576
|
* 处理接口返回的图片url
|
555
|
*/
|
577
|
*/
|
556
|
- formatImgUrl: function(url, mode, width, height) {
|
|
|
557
|
- return url.replace(/{mode}/g, mode).replace(/{width}/g, width).replace(/{height}/g, height);
|
|
|
558
|
- },
|
|
|
559
|
-
|
|
|
560
|
- formatTimeText: function(time) {
|
|
|
561
|
- let new_time;
|
|
|
562
|
-
|
|
|
563
|
- if (time < 60) {
|
|
|
564
|
- new_time = time + 'sec';
|
|
|
565
|
- } else if (time >= 60 && time < 60 * 60) {
|
|
|
566
|
- new_time = parseInt(time / 60, 10) + 'min';
|
|
|
567
|
- } else if (time >= 60 * 60 && time < 60 * 60 * 24) {
|
|
|
568
|
- new_time = parseInt(time / (60 * 60), 10) + 'hour';
|
|
|
569
|
- } else if (time >= 60 * 60 * 24) {
|
|
|
570
|
- new_time = parseInt(time / (60 * 60 * 24), 10) + 'day';
|
578
|
+ formatImgUrl: function (url, mode, width, height) {
|
|
|
579
|
+ return url.replace(/{mode}/g, mode).replace(/{width}/g, width).replace(/{height}/g, height);
|
|
|
580
|
+ },
|
|
|
581
|
+
|
|
|
582
|
+ formatTimeText: function (time) {
|
|
|
583
|
+ let new_time;
|
|
|
584
|
+
|
|
|
585
|
+ if (time < 60) {
|
|
|
586
|
+ new_time = time + 'sec';
|
|
|
587
|
+ } else if (time >= 60 && time < 60 * 60) {
|
|
|
588
|
+ new_time = parseInt(time / 60, 10) + 'min';
|
|
|
589
|
+ } else if (time >= 60 * 60 && time < 60 * 60 * 24) {
|
|
|
590
|
+ new_time = parseInt(time / (60 * 60), 10) + 'hour';
|
|
|
591
|
+ } else if (time >= 60 * 60 * 24) {
|
|
|
592
|
+ new_time = parseInt(time / (60 * 60 * 24), 10) + 'day';
|
|
|
593
|
+ }
|
|
|
594
|
+ return new_time;
|
571
|
}
|
595
|
}
|
572
|
- return new_time;
|
|
|
573
|
- }
|
|
|
574
|
}, Actionsheet)); |
596
|
}, Actionsheet)); |