Authored by 邱骏

form

@@ -274,5 +274,8 @@ App({ @@ -274,5 +274,8 @@ App({
274 }, 274 },
275 getSystemInfo() { 275 getSystemInfo() {
276 return this.globalData.systemInfo; 276 return this.globalData.systemInfo;
  277 + },
  278 + getMiniappType() {
  279 + return config.mini_app_type;
277 } 280 }
278 }); 281 });
@@ -24,7 +24,8 @@ const config = { @@ -24,7 +24,8 @@ const config = {
24 unionType: '', // 渠道号 24 unionType: '', // 渠道号
25 MINI_APP_DOMAIN: 'miniapp.yohobuy.com', 25 MINI_APP_DOMAIN: 'miniapp.yohobuy.com',
26 appid: 'wx39f299b6485cf97a', // 业务中使用、与package.config.json内appid保持一致wx39f299b6485cf97a 26 appid: 'wx39f299b6485cf97a', // 业务中使用、与package.config.json内appid保持一致wx39f299b6485cf97a
27 - business_line: 'miniappOffshop' // 业务线 27 + business_line: 'miniappOffshop', // 业务线
  28 + mini_app_type: 4
28 }; 29 };
29 30
30 export default config; 31 export default config;
@@ -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,19 +18,28 @@ let router = global.router; @@ -17,19 +18,28 @@ 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({
@@ -125,7 +135,7 @@ Page(Object.assign({ @@ -125,7 +135,7 @@ Page(Object.assign({
125 /** 135 /**
126 * 生命周期函数--监听页面加载 136 * 生命周期函数--监听页面加载
127 */ 137 */
128 - onLoad: function(options) { 138 + onLoad: function (options) {
129 console.log(options); 139 console.log(options);
130 let actId = options.actId; 140 let actId = options.actId;
131 let uid = app.getUid(); 141 let uid = app.getUid();
@@ -154,14 +164,14 @@ Page(Object.assign({ @@ -154,14 +164,14 @@ Page(Object.assign({
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) { 174 + onShow: function (options) {
165 setTimeout(this.hidePopup, 4000); 175 setTimeout(this.hidePopup, 4000);
166 if (app.getUid()) { 176 if (app.getUid()) {
167 this.setData({ 177 this.setData({
@@ -173,19 +183,19 @@ Page(Object.assign({ @@ -173,19 +183,19 @@ Page(Object.assign({
173 /** 183 /**
174 * 生命周期函数--监听页面隐藏 184 * 生命周期函数--监听页面隐藏
175 */ 185 */
176 - onHide: function() { 186 + onHide: function () {
177 }, 187 },
178 188
179 /** 189 /**
180 * 生命周期函数--监听页面卸载 190 * 生命周期函数--监听页面卸载
181 */ 191 */
182 - onUnload: function() { 192 + onUnload: function () {
183 }, 193 },
184 194
185 /** 195 /**
186 * 页面相关事件处理函数--监听用户下拉动作 196 * 页面相关事件处理函数--监听用户下拉动作
187 */ 197 */
188 - onPullDownRefresh: function() { 198 + onPullDownRefresh: function () {
189 let actId = this.data.activityInfo.activityId; 199 let actId = this.data.activityInfo.activityId;
190 200
191 if (actId) { 201 if (actId) {
@@ -202,7 +212,7 @@ Page(Object.assign({ @@ -202,7 +212,7 @@ Page(Object.assign({
202 /** 212 /**
203 * 页面上拉触底事件的处理函数 213 * 页面上拉触底事件的处理函数
204 */ 214 */
205 - onReachBottom: function() { 215 + onReachBottom: function () {
206 console.log('到底部啦'); 216 console.log('到底部啦');
207 let actId = this.data.activityInfo.activityId; 217 let actId = this.data.activityInfo.activityId;
208 let sort = this.data.queueList[this.data.queueList.length - 1].sort; 218 let sort = this.data.queueList[this.data.queueList.length - 1].sort;
@@ -219,7 +229,7 @@ Page(Object.assign({ @@ -219,7 +229,7 @@ Page(Object.assign({
219 /** 229 /**
220 * 用户点击右上角分享 230 * 用户点击右上角分享
221 */ 231 */
222 - onShareAppMessage: function(res) { 232 + onShareAppMessage: function (res) {
223 let params = { 233 let params = {
224 FROM: res.from, 234 FROM: res.from,
225 SHARE_RESUIL: 0, 235 SHARE_RESUIL: 0,
@@ -236,15 +246,15 @@ Page(Object.assign({ @@ -236,15 +246,15 @@ Page(Object.assign({
236 desc: params.DESC, // 分享描述 246 desc: params.DESC, // 分享描述
237 path: params.PATH, // 分享路径 247 path: params.PATH, // 分享路径
238 imageUrl: params.IMG, 248 imageUrl: params.IMG,
239 - success: function() { 249 + success: function () {
240 params.SHARE_RESUIL = 1; 250 params.SHARE_RESUIL = 1;
241 }, 251 },
242 - fail: function() { 252 + fail: function () {
243 params.SHARE_RESUIL = 2; 253 params.SHARE_RESUIL = 2;
244 } 254 }
245 }; 255 };
246 }, 256 },
247 - share: function() { 257 + share: function () {
248 this.setData({ 258 this.setData({
249 'actionSheet.show': true 259 'actionSheet.show': true
250 }); 260 });
@@ -272,14 +282,14 @@ Page(Object.assign({ @@ -272,14 +282,14 @@ Page(Object.assign({
272 /** 282 /**
273 * 邀请好友助力排队按钮 283 * 邀请好友助力排队按钮
274 */ 284 */
275 - inviteFriends: function(e) { 285 + inviteFriends: function (e) {
276 this.share(); 286 this.share();
277 }, 287 },
278 288
279 /** 289 /**
280 * scroll-view滚动事件 290 * scroll-view滚动事件
281 */ 291 */
282 - scroll: function(e) { 292 + scroll: function (e) {
283 console.log(e); 293 console.log(e);
284 let scrollTop = e.detail.scrollTop; 294 let scrollTop = e.detail.scrollTop;
285 295
@@ -291,14 +301,14 @@ Page(Object.assign({ @@ -291,14 +301,14 @@ Page(Object.assign({
291 /** 301 /**
292 * 跳转到我的排队列表 302 * 跳转到我的排队列表
293 */ 303 */
294 - navigateToMyList: function(e) { 304 + navigateToMyList: function (e) {
295 router.go('myList', Object.assign({actId: this.data.activityInfo.activityId}, this.data.shareInfo)); 305 router.go('myList', Object.assign({actId: this.data.activityInfo.activityId}, this.data.shareInfo));
296 }, 306 },
297 307
298 /** 308 /**
299 * 点击用户头像,跳转到用户对应位置<已取消该功能> 309 * 点击用户头像,跳转到用户对应位置<已取消该功能>
300 */ 310 */
301 - userTap: function(e) { 311 + userTap: function (e) {
302 console.log(this.data.userInfo); 312 console.log(this.data.userInfo);
303 let uid = this.data.userInfo.uid; 313 let uid = this.data.userInfo.uid;
304 let sort = this.data.userInfo.sort || 0; 314 let sort = this.data.userInfo.sort || 0;
@@ -330,7 +340,7 @@ Page(Object.assign({ @@ -330,7 +340,7 @@ Page(Object.assign({
330 /** 340 /**
331 * 关闭提示框 341 * 关闭提示框
332 */ 342 */
333 - closeMsg: function(e) { 343 + closeMsg: function (e) {
334 this.setData({ 344 this.setData({
335 showMsg: 0 345 showMsg: 0
336 }); 346 });
@@ -339,7 +349,7 @@ Page(Object.assign({ @@ -339,7 +349,7 @@ Page(Object.assign({
339 /** 349 /**
340 * 隐藏气泡 350 * 隐藏气泡
341 */ 351 */
342 - hidePopup: function(e) { 352 + hidePopup: function (e) {
343 this.setData({ 353 this.setData({
344 hidePopup: 1 354 hidePopup: 1
345 }); 355 });
@@ -348,7 +358,7 @@ Page(Object.assign({ @@ -348,7 +358,7 @@ Page(Object.assign({
348 /** 358 /**
349 * 点击参加活动按钮 359 * 点击参加活动按钮
350 */ 360 */
351 - joinInQueue: function(e) { 361 + joinInQueue: function (e) {
352 let uid = app.getUid(); 362 let uid = app.getUid();
353 let activityId = this.data.activityInfo.activityId; 363 let activityId = this.data.activityInfo.activityId;
354 let isEnd = this.data.activityInfo.isEnd === 0 ? 0 : 1; 364 let isEnd = this.data.activityInfo.isEnd === 0 ? 0 : 1;
@@ -363,14 +373,14 @@ Page(Object.assign({ @@ -363,14 +373,14 @@ Page(Object.assign({
363 let pages = getCurrentPages(); 373 let pages = getCurrentPages();
364 let referer = pages[pages.length - 1].route + '?' + stringify(this.data.shareInfo); 374 let referer = pages[pages.length - 1].route + '?' + stringify(this.data.shareInfo);
365 375
366 - router.go('userCenter', { referer }); 376 + router.go('userCenter', {referer});
367 } 377 }
368 }, 378 },
369 379
370 /** 380 /**
371 * 获取活动信息 381 * 获取活动信息
372 */ 382 */
373 - getActivityInfo: function(actId) { 383 + getActivityInfo: function (actId) {
374 return LimitModel.getActivityInfo(actId).then(res => { // 获取活动信息 384 return LimitModel.getActivityInfo(actId).then(res => { // 获取活动信息
375 console.log(res); 385 console.log(res);
376 if (res.code === 200) { 386 if (res.code === 200) {
@@ -405,7 +415,7 @@ Page(Object.assign({ @@ -405,7 +415,7 @@ Page(Object.assign({
405 /** 415 /**
406 * 加入排队 416 * 加入排队
407 */ 417 */
408 - addQueue: function(actId, uid) { 418 + addQueue: function (actId, uid) {
409 if (!this.data.api_status) { 419 if (!this.data.api_status) {
410 this.setData({ 420 this.setData({
411 api_status: 1 421 api_status: 1
@@ -436,7 +446,7 @@ Page(Object.assign({ @@ -436,7 +446,7 @@ Page(Object.assign({
436 /** 446 /**
437 * 获取用户参与排队的信息 447 * 获取用户参与排队的信息
438 */ 448 */
439 - getUserActivityInfo: function(actId) { 449 + getUserActivityInfo: function (actId) {
440 LimitModel.getUserActivityInfo(actId).then(res => { 450 LimitModel.getUserActivityInfo(actId).then(res => {
441 console.log('getUserActivityInfo:', res); 451 console.log('getUserActivityInfo:', res);
442 this.setData({ 452 this.setData({
@@ -460,7 +470,7 @@ Page(Object.assign({ @@ -460,7 +470,7 @@ Page(Object.assign({
460 /** 470 /**
461 * 获取排队列表 471 * 获取排队列表
462 */ 472 */
463 - getQueueList: function(actId, start = 0, limit = 50, isAdd = false) { 473 + getQueueList: function (actId, start = 0, limit = 50, isAdd = false) {
464 let that = this; 474 let that = this;
465 475
466 actId = actId || this.data.activityInfo.activityId; 476 actId = actId || this.data.activityInfo.activityId;
@@ -502,7 +512,7 @@ Page(Object.assign({ @@ -502,7 +512,7 @@ Page(Object.assign({
502 } 512 }
503 }); 513 });
504 }, 514 },
505 - scrollPage: function(id) { // 滚动页面到对应位置 515 + scrollPage: function (id) { // 滚动页面到对应位置
506 if (id) { 516 if (id) {
507 let item_query = wx.createSelectorQuery(); 517 let item_query = wx.createSelectorQuery();
508 518
@@ -528,14 +538,14 @@ Page(Object.assign({ @@ -528,14 +538,14 @@ Page(Object.assign({
528 /** 538 /**
529 * 跳转到活动说明的H5页面 539 * 跳转到活动说明的H5页面
530 */ 540 */
531 - navigateToDescPage: function() { 541 + navigateToDescPage: function () {
532 router.goUrl(this.data.h5PageUrl[0].url + '&title=' + this.data.h5PageUrl[0].title); 542 router.goUrl(this.data.h5PageUrl[0].url + '&title=' + this.data.h5PageUrl[0].title);
533 }, 543 },
534 544
535 /** 545 /**
536 *跳转到中奖名单页面 546 *跳转到中奖名单页面
537 */ 547 */
538 - navigateToPrizeUserList: function() { 548 + navigateToPrizeUserList: function () {
539 if (this.data.activityInfo.isDrawEnd) { 549 if (this.data.activityInfo.isDrawEnd) {
540 router.go('prizeUserList', {actId: this.data.activityInfo.activityId}); 550 router.go('prizeUserList', {actId: this.data.activityInfo.activityId});
541 } 551 }
@@ -544,20 +554,32 @@ Page(Object.assign({ @@ -544,20 +554,32 @@ Page(Object.assign({
544 /** 554 /**
545 * 跳转到个人中心限购码页面 555 * 跳转到个人中心限购码页面
546 */ 556 */
547 - navigateToUserCodePage: function() { 557 + navigateToUserCodePage: function () {
548 if (this.data.userInfo.isLucky) { 558 if (this.data.userInfo.isLucky) {
549 router.go('userCenter'); 559 router.go('userCenter');
550 } 560 }
551 }, 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) { 578 + formatImgUrl: function (url, mode, width, height) {
557 return url.replace(/{mode}/g, mode).replace(/{width}/g, width).replace(/{height}/g, height); 579 return url.replace(/{mode}/g, mode).replace(/{width}/g, width).replace(/{height}/g, height);
558 }, 580 },
559 581
560 - formatTimeText: function(time) { 582 + formatTimeText: function (time) {
561 let new_time; 583 let new_time;
562 584
563 if (time < 60) { 585 if (time < 60) {
@@ -141,8 +141,10 @@ @@ -141,8 +141,10 @@
141 </view> 141 </view>
142 </block> 142 </block>
143 </view> 143 </view>
144 - <view class='invite-button' hidden='{{hideInviteButton}}' bindtap='inviteFriends'> 144 + <form bindsubmit='submitFormId' report-submit='true'>
  145 + <button class='invite-button' hidden='{{hideInviteButton}}' form-type='submit' bindtap='inviteFriends'>
145 邀请好友助力排队 146 邀请好友助力排队
146 - </view> 147 + </button>
  148 + </form>
147 </view> 149 </view>
148 <template is="zan-actionsheet" data="{{...actionSheet}}" /> 150 <template is="zan-actionsheet" data="{{...actionSheet}}" />
@@ -200,6 +200,18 @@ Page(Object.assign({ @@ -200,6 +200,18 @@ Page(Object.assign({
200 }, 200 },
201 201
202 /** 202 /**
  203 + * 提交formId消息模板
  204 + */
  205 + submitFormId: function (e) {
  206 + commonModel.addWechatFormId({
  207 + formId: e.detail.formId,
  208 + uid: app.getUid() || 0,
  209 + openId: app.getUnionID() || app.getOpenID() || '',
  210 + miniappType: app.getMiniappType()
  211 + });
  212 + },
  213 +
  214 + /**
203 * 获取排队列表 215 * 获取排队列表
204 */ 216 */
205 getQueueList: function(actId, limit = 10) { 217 getQueueList: function(actId, limit = 10) {
@@ -30,8 +30,10 @@ @@ -30,8 +30,10 @@
30 </view> 30 </view>
31 </view> 31 </view>
32 </block> 32 </block>
33 - <view class='invite-button' hidden='{{hideInviteButton}}' bindtap='inviteFriends'> 33 + <form bindsubmit='submitFormId' report-submit='true'>
  34 + <button class='invite-button' hidden='{{hideInviteButton}}' form-type='submit' bindtap='inviteFriends'>
34 邀请好友助力排队 35 邀请好友助力排队
35 - </view> 36 + </button>
  37 + </form>
36 </view> 38 </view>
37 <template is="zan-actionsheet" data="{{...actionSheet}}" /> 39 <template is="zan-actionsheet" data="{{...actionSheet}}" />
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 "list": [] 33 "list": []
34 }, 34 },
35 "miniprogram": { 35 "miniprogram": {
36 - "current": 8, 36 + "current": 4,
37 "list": [ 37 "list": [
38 { 38 {
39 "id": 0, 39 "id": 0,