Authored by biao

origin life

21.7 KB | W: | H:

21.3 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

21.6 KB | W: | H:

21.6 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
  1 +var $ = require('jquery'),
  2 + code = window.location.search;
  3 +
  4 +var arr = code.split('=');
  5 +
  6 +$('.coupon-input').val(arr[1]);
  1 +var $ = require('jquery'),
  2 + tel = $('.btn-input').val();
  3 +
  4 +
  5 +$('.down-app').click(function() {
  6 + $('.code').show();
  7 + $('.mark').show();
  8 +});
  9 +$('.close').click(function() {
  10 + $('.code').hide();
  11 + $('.mark').hide();
  12 +});
  13 +
  14 +function get(tel) {
  15 + $.ajax({
  16 + type: 'get',
  17 + url: '/index/life/sendCoupon',
  18 + dataType: 'json',
  19 + data: {
  20 + tel: tel
  21 + },
  22 + success: function(data) {
  23 + if (data.code === 200) {
  24 + location.href = '/life/coupon' + '?' + 'code' + '=' + data.data;
  25 + } else {
  26 + alert(data.message);
  27 + }
  28 + }
  29 + });
  30 +}
  31 +
  32 +$('.coupon-btn').click(function() {
  33 + get(tel);
  34 +});
  35 +
@@ -186,3 +186,4 @@ a { @@ -186,3 +186,4 @@ a {
186 @import "me/index"; 186 @import "me/index";
187 @import "product/index"; 187 @import "product/index";
188 @import "cart/index"; 188 @import "cart/index";
  189 +@import "life/index";
  1 +html,body {
  2 + width: 100%;
  3 + height: 100%;
  4 +}
  5 +.coupon-page{
  6 + position: relative;
  7 + background-image: resolve('life/coupon/bg.jpg');
  8 + background-size: 100% 100%;
  9 + background-repeat: no-repeat;
  10 + height: 100%;
  11 + width: 100%;
  12 + .coupon-input{
  13 + width: 50%;
  14 + height: 0.75rem;
  15 + text-align: center;
  16 + border: none;
  17 + position: absolute;
  18 + top: 62%;
  19 + left: 30%;
  20 + font-size: 24px;
  21 + }
  22 +}
  1 +html,body {
  2 + width: 100%;
  3 + height: 100%;
  4 +}
  5 +
  6 +.life-page{
  7 + position: relative;
  8 + background-image: resolve('life/index/bg.jpg');
  9 + background-size: 100% 100%;
  10 + background-repeat: no-repeat;
  11 + height: 100%;
  12 + width: 100%;
  13 + .life-page-link-content {
  14 + width: 100%;
  15 + height: 8.13%;
  16 + position: absolute;
  17 + top: 86%;
  18 + .life-page-link {
  19 + width: 60.625%;
  20 + height: 100%;
  21 + background-image: resolve('life/index/button.png');
  22 + background-size: 100% 100%;
  23 + background-repeat: no-repeat;
  24 + display: block;
  25 + position: relative;
  26 + margin: 0 auto;
  27 + }
  28 + }
  29 +
  30 +}
  31 +@import "login";
  1 +html,body {
  2 + width: 100%;
  3 + height: 100%;
  4 +}
  5 +
  6 +.lifelogin-page{
  7 + position: relative;
  8 + background-image:resolve('life/login/bg.jpg');
  9 + background-size: 100% 100%;
  10 + background-repeat: no-repeat;
  11 + height: 38.125rem;
  12 + width: 100%;
  13 + .btn-input{
  14 + position: absolute;
  15 + top: 15.2rem;
  16 + left: 4.2rem;
  17 + border:none;
  18 + width: 9.25rem;
  19 + height: 0.7rem;
  20 + line-height: 0.75rem;
  21 + text-align: center;
  22 + font-size: 24px;
  23 + }
  24 + .coupon-btn{
  25 + background-image:resolve('life/login/button_1.png');
  26 + background-size: 100% 100%;
  27 + background-repeat: no-repeat;
  28 + width: 60.625%;
  29 + height:8.13%;
  30 + position: absolute;
  31 + left: 20%;
  32 + top:17rem;
  33 + }
  34 + .down-app{
  35 + background-image:resolve('life/login/button_2.png');
  36 + background-size: 100% 100%;
  37 + background-repeat: no-repeat;
  38 + width: 80%;
  39 + height:8.13%;
  40 + left: 10%;
  41 + bottom: 4rem;
  42 + position: absolute;
  43 + }
  44 + .notice{
  45 + background-image:resolve('life/login/button_3.png');
  46 + background-size: 100% 100%;
  47 + background-repeat: no-repeat;
  48 + width: 80%;
  49 + height:8.13%;
  50 + position: absolute;
  51 + left: 10%;
  52 + bottom: 0.5rem;
  53 + }
  54 + .mark{
  55 + width: 100%;
  56 + height:38.125rem;
  57 + background:#69cffe;
  58 + position: fixed;
  59 + opacity: 0.5;
  60 + top:0 ;
  61 + z-index: 1;
  62 + display: none;
  63 + }
  64 + .code{
  65 + background-image:resolve('life/login/code.png');
  66 + background-size: 100% 100%;
  67 + background-repeat: no-repeat;
  68 + width: 100%;
  69 + position: fixed;
  70 + height:100%;
  71 + left:0;
  72 + top:15%;
  73 + display: none;
  74 + z-index: 2;
  75 + .close{
  76 + background-image:resolve('life/login/close.png');
  77 + background-size: 100% 100%;
  78 + background-repeat: no-repeat;
  79 + position:absolute;
  80 + width:40px;
  81 + height:40px;
  82 + left:1.4rem;
  83 + top:4rem;
  84 + }
  85 + }
  86 +}
  87 +@import "coupon";
  1 +{{> layout/header}}
  2 +<div class="coupon-page yoho-page">
  3 + <input type="text" placeholder="xxxxxx" class="coupon-input">
  4 +</div>
  5 +{{> layout/footer}}
  1 +{{> layout/header}}
  2 +<div class="life-page yoho-page">
  3 + <div class="life-page-link-content">
  4 + <a class="life-page-link" href="/life/login"></a>
  5 + </div>
  6 +</div>
  7 +<script>
  8 +
  9 +</script>
  10 +{{> layout/footer}}
  1 +{{> layout/header}}
  2 +<div class="lifelogin-page yoho-page">
  3 + <input type="text" placeholder="输入手机号" class="btn-input"/>
  4 + <div class="coupon-btn"></div>
  5 + <div class="down-app"></div>
  6 + <div class="notice"></div>
  7 + <div class="mark"></div>
  8 + <div class="code">
  9 + <div class="close"></div>
  10 + </div>
  11 +</div>
  12 +{{> layout/footer}}
@@ -384,3 +384,14 @@ @@ -384,3 +384,14 @@
384 seajs.use('js/index/coupon'); 384 seajs.use('js/index/coupon');
385 </script> 385 </script>
386 {{/if}} 386 {{/if}}
  387 +{{!-- 本来生活 --}}
  388 +{{#if lifePage}}
  389 +<script>
  390 + seajs.use('js/life/login');
  391 +</script>
  392 +{{/if}}
  393 +{{#if couponPage}}
  394 +<script>
  395 + seajs.use('js/life/coupon');
  396 +</script>
  397 +{{/if}}
  1 +<?php
  2 +
  3 +use Action\AbstractAction;
  4 +use Plugin\Helpers;
  5 +use LibModels\Wap\Coupon\CouponData;
  6 +
  7 +class LifeController extends AbstractAction
  8 +{
  9 +
  10 + const COUPON_ID = 13024;
  11 +
  12 + public function indexAction()
  13 + {
  14 + $uid = $this->getUid();
  15 + if (!$uid) {
  16 + $this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/life/index'))));
  17 + }
  18 + $this->_view->display('index');
  19 + }
  20 +
  21 + //点击领券按钮
  22 + public function sendCouponAction()
  23 + {
  24 + $result = array('code' => 400, 'message' => '领取失败', 'data' => '');
  25 + do {
  26 + if (!$this->isAjax()) {
  27 + break;
  28 + }
  29 + //获取领券参数
  30 + $couponId = self::COUPON_ID;
  31 + $uid = $this->getUid();
  32 + //领取优惠券
  33 + $result = CouponData::receiveCoupon($uid, $couponId);
  34 + if (!isset($result['code'])) {
  35 + break;
  36 + }
  37 + }
  38 + while (false);
  39 + $this->echoJson($result);
  40 + }
  41 +
  42 + public function loginAction()
  43 + {
  44 +
  45 + $this->_view->display('login',array(
  46 + 'lifePage' => true));
  47 + }
  48 +
  49 + public function couponAction()
  50 + {
  51 + //获取手机号,传优惠码
  52 + $this->_view->display('coupon',array(
  53 + 'couponPage' => true));
  54 + }
  55 +
  56 +}