Authored by 毕凯

Merge branch 'feature/raffle' into 'gray'

微信免单抽奖合mater,修改样式



See merge request !255
@@ -71,6 +71,21 @@ exports.getOrders = (req, res, next) => { @@ -71,6 +71,21 @@ exports.getOrders = (req, res, next) => {
71 }; 71 };
72 72
73 /** 73 /**
  74 + * 获取中奖记录
  75 + * @param req
  76 + * @param res
  77 + * @param next
  78 + */
  79 +exports.getRecord = (req, res, next) => {
  80 + raffleModel.getRecord({
  81 + pageCount: req.query.pageCount,
  82 + pageId: req.query.pageId,
  83 + }).then(result => {
  84 + res.json(result);
  85 + }).catch(next);
  86 +};
  87 +
  88 +/**
74 * 入口页 89 * 入口页
75 * @param req 90 * @param req
76 * @param res 91 * @param res
@@ -87,7 +87,7 @@ const activity = (params) => { @@ -87,7 +87,7 @@ const activity = (params) => {
87 resu.prizes = newPrizes; 87 resu.prizes = newPrizes;
88 } 88 }
89 89
90 - if (result[1] && result[1].data) { 90 + if (result[1] && result[1].data && result[1].data.mobile) {
91 mobile = result[1].data.mobile; 91 mobile = result[1].data.mobile;
92 Object.assign(resu, { 92 Object.assign(resu, {
93 mobile: mobile.substr(0,3) + '****' + mobile.substr(7) 93 mobile: mobile.substr(0,3) + '****' + mobile.substr(7)
@@ -470,12 +470,27 @@ const bind = (params) => { @@ -470,12 +470,27 @@ const bind = (params) => {
470 }, {code: 200}); 470 }, {code: 200});
471 }; 471 };
472 472
  473 +/**
  474 + * 获取中奖记录
  475 + * @returns {*}
  476 + * @private
  477 + * @param params
  478 + */
  479 +const getRecord = (params) => {
  480 + return service.get('/activity/lottery/getLotteryPrizeInfo', {
  481 + lotteryId: 20,
  482 + pageId: params.pageId,
  483 + pageCount: params.pageCount
  484 + }, {code: 200});
  485 +};
  486 +
473 487
474 module.exports = { 488 module.exports = {
475 order, 489 order,
476 getOrders, 490 getOrders,
477 activity, 491 activity,
478 lucky, 492 lucky,
479 - bind 493 + bind,
  494 + getRecord
480 }; 495 };
481 496
@@ -91,6 +91,7 @@ router.get('/market/v2', market.v2); // 市场推广活动å‡çº§ç‰ˆï¼Œè‡ªå®šä¹‰ä @@ -91,6 +91,7 @@ router.get('/market/v2', market.v2); // 市场推广活动å‡çº§ç‰ˆï¼Œè‡ªå®šä¹‰ä
91 router.get('/raffle/activity', raffle.activity); // 微信免单抽奖活动 91 router.get('/raffle/activity', raffle.activity); // 微信免单抽奖活动
92 router.get('/raffle/orders', auth, raffle.order); // 微信免单抽奖活动订单列表 92 router.get('/raffle/orders', auth, raffle.order); // 微信免单抽奖活动订单列表
93 router.get('/raffle/getOrders', raffle.getOrders); // 微信免单抽奖活动获取订单列表数据 93 router.get('/raffle/getOrders', raffle.getOrders); // 微信免单抽奖活动获取订单列表数据
  94 +router.get('/raffle/getRecord', raffle.getRecord); // 微信免单抽奖活动获取中奖记录
94 router.get('/raffle/enter', raffle.enter); // 微信免单抽奖活动入口页 95 router.get('/raffle/enter', raffle.enter); // 微信免单抽奖活动入口页
95 router.post('/raffle/lucky', raffle.lucky); // 微信免单抽奖按钮 96 router.post('/raffle/lucky', raffle.lucky); // 微信免单抽奖按钮
96 router.get('/raffle/bind', raffle.bind); // 送有货币 97 router.get('/raffle/bind', raffle.bind); // 送有货币
@@ -12,6 +12,12 @@ @@ -12,6 +12,12 @@
12 <li>{{name}}{{remark}}</li> 12 <li>{{name}}{{remark}}</li>
13 {{/ prizes}} 13 {{/ prizes}}
14 </ul> 14 </ul>
  15 + <div class="record">
  16 + <p>获奖名单:</p>
  17 + <div class="record-c">
  18 + <div class="record-list"></div>
  19 + </div>
  20 + </div>
15 <a class="btn" href="./orders"></a> 21 <a class="btn" href="./orders"></a>
16 <div class="account">{{# mobile}}您已绑定账号:{{.}}{{/ mobile}}</div> 22 <div class="account">{{# mobile}}您已绑定账号:{{.}}{{/ mobile}}</div>
17 <div class="rule-c"> 23 <div class="rule-c">

3.13 KB | W: | H:

3.73 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
@@ -35,7 +35,8 @@ var orderHammer, @@ -35,7 +35,8 @@ var orderHammer,
35 reasonSwiper; 35 reasonSwiper;
36 36
37 var userId = '', 37 var userId = '',
38 - orderCode = ''; 38 + orderCode = '',
  39 + pageId = 0;
39 40
40 var orderContent = require('activity/raffle/order-content.hbs'); 41 var orderContent = require('activity/raffle/order-content.hbs');
41 42
@@ -401,6 +402,72 @@ $(function() { @@ -401,6 +402,72 @@ $(function() {
401 $(slides[activeIndex]).css('transform', ''); 402 $(slides[activeIndex]).css('transform', '');
402 } 403 }
403 }); 404 });
  405 +
  406 + // 中奖记录
  407 + if ($('.record').length > 0) {
  408 + var pageCount = 6;
  409 + recordInit();
  410 + goScroll();
  411 + }
  412 +
  413 + // 初始化
  414 + function recordInit() {
  415 + var recordResult = getRecord();
  416 + var $recordList = '';
  417 + if (recordResult && recordResult.code === 200) {
  418 + $recordList = recordResult.data.lotteryPrize;
  419 + }
  420 + var $recordSpan = '';
  421 + for (var i = 0; i < $recordList.length; i++) {
  422 + $recordSpan = $recordSpan + '<span>' + $recordList[i].userName + '中了' + $recordList[i].prizeName + ':' + $recordList[i].prizeRemark + ';&nbsp</span>';
  423 + }
  424 + $('.record-list').append($recordSpan);
  425 + }
  426 +
  427 + // 获取中奖记录
  428 + function getRecord() {
  429 + pageId ++;
  430 + var recordResult = '';
  431 + $.ajax({
  432 + type: 'GET',
  433 + url: '/activity/raffle/getRecord',
  434 + data: {
  435 + pageId: pageId,
  436 + pageCount: pageCount
  437 + },
  438 + async: false,
  439 + success: function(res) {
  440 + if (res.code === 200) {
  441 + if (res.data.lotteryPrize.length < pageCount) {
  442 + pageId = 0;
  443 + }
  444 + recordResult = res;
  445 + } else {
  446 + tip.show('网络断开了~~');
  447 + }
  448 + },
  449 + error: function(res) {
  450 + tip.show('网络断开了~~');
  451 + }
  452 + });
  453 + return recordResult;
  454 + }
  455 +
  456 + // 滚动
  457 + function goScroll() {
  458 + var $firstSpan = $('.record-list span:first');
  459 + var $recordList = $('.record-list');
  460 + $recordList.animate({marginLeft: '-' + $firstSpan.width() + 'px'}, 10000, 'linear',
  461 + function() {
  462 + $firstSpan.remove();
  463 + $recordList.css('margin-left', '0');
  464 + if ($recordList.find('span').length < 5) {
  465 + recordInit();
  466 + }
  467 + goScroll();
  468 + }
  469 + );
  470 + }
404 }); 471 });
405 472
406 $reaMask.find('.box-cmp').on('touchend', function(e) { 473 $reaMask.find('.box-cmp').on('touchend', function(e) {
@@ -7,6 +7,28 @@ @@ -7,6 +7,28 @@
7 background-size: 100% auto; 7 background-size: 100% auto;
8 background-repeat: no-repeat; 8 background-repeat: no-repeat;
9 9
  10 + .record {
  11 + color: #fff;
  12 + font-size: 25px;
  13 + margin-top: 30px;
  14 +
  15 + p {
  16 + text-align: center;
  17 + }
  18 +
  19 + .record-c {
  20 + width: 480px;
  21 + margin: 0 auto;
  22 + overflow: hidden;
  23 + height: 40px;
  24 + line-height: 40px;
  25 + }
  26 +
  27 + .record-list {
  28 + width: 2000px;
  29 + }
  30 + }
  31 +
10 .logo { 32 .logo {
11 width: 263px; 33 width: 263px;
12 height: 53px; 34 height: 53px;
@@ -43,7 +65,7 @@ @@ -43,7 +65,7 @@
43 } 65 }
44 66
45 .kind-list { 67 .kind-list {
46 - padding-top: 15px; 68 + padding-top: 40px;
47 69
48 li { 70 li {
49 font-size: 22px; 71 font-size: 22px;