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
var $ = require('jquery'),
code = window.location.search;
var arr = code.split('=');
$('.coupon-input').val(arr[1]);
\ No newline at end of file
... ...
var $ = require('jquery'),
tel = $('.btn-input').val();
$('.down-app').click(function() {
$('.code').show();
$('.mark').show();
});
$('.close').click(function() {
$('.code').hide();
$('.mark').hide();
});
function get(tel) {
$.ajax({
type: 'get',
url: '/index/life/sendCoupon',
dataType: 'json',
data: {
tel: tel
},
success: function(data) {
if (data.code === 200) {
location.href = '/life/coupon' + '?' + 'code' + '=' + data.data;
} else {
alert(data.message);
}
}
});
}
$('.coupon-btn').click(function() {
get(tel);
});
... ...
... ... @@ -186,3 +186,4 @@ a {
@import "me/index";
@import "product/index";
@import "cart/index";
@import "life/index";
... ...
html,body {
width: 100%;
height: 100%;
}
.coupon-page{
position: relative;
background-image: resolve('life/coupon/bg.jpg');
background-size: 100% 100%;
background-repeat: no-repeat;
height: 100%;
width: 100%;
.coupon-input{
width: 50%;
height: 0.75rem;
text-align: center;
border: none;
position: absolute;
top: 62%;
left: 30%;
font-size: 24px;
}
}
... ...
html,body {
width: 100%;
height: 100%;
}
.life-page{
position: relative;
background-image: resolve('life/index/bg.jpg');
background-size: 100% 100%;
background-repeat: no-repeat;
height: 100%;
width: 100%;
.life-page-link-content {
width: 100%;
height: 8.13%;
position: absolute;
top: 86%;
.life-page-link {
width: 60.625%;
height: 100%;
background-image: resolve('life/index/button.png');
background-size: 100% 100%;
background-repeat: no-repeat;
display: block;
position: relative;
margin: 0 auto;
}
}
}
@import "login";
\ No newline at end of file
... ...
html,body {
width: 100%;
height: 100%;
}
.lifelogin-page{
position: relative;
background-image:resolve('life/login/bg.jpg');
background-size: 100% 100%;
background-repeat: no-repeat;
height: 38.125rem;
width: 100%;
.btn-input{
position: absolute;
top: 15.2rem;
left: 4.2rem;
border:none;
width: 9.25rem;
height: 0.7rem;
line-height: 0.75rem;
text-align: center;
font-size: 24px;
}
.coupon-btn{
background-image:resolve('life/login/button_1.png');
background-size: 100% 100%;
background-repeat: no-repeat;
width: 60.625%;
height:8.13%;
position: absolute;
left: 20%;
top:17rem;
}
.down-app{
background-image:resolve('life/login/button_2.png');
background-size: 100% 100%;
background-repeat: no-repeat;
width: 80%;
height:8.13%;
left: 10%;
bottom: 4rem;
position: absolute;
}
.notice{
background-image:resolve('life/login/button_3.png');
background-size: 100% 100%;
background-repeat: no-repeat;
width: 80%;
height:8.13%;
position: absolute;
left: 10%;
bottom: 0.5rem;
}
.mark{
width: 100%;
height:38.125rem;
background:#69cffe;
position: fixed;
opacity: 0.5;
top:0 ;
z-index: 1;
display: none;
}
.code{
background-image:resolve('life/login/code.png');
background-size: 100% 100%;
background-repeat: no-repeat;
width: 100%;
position: fixed;
height:100%;
left:0;
top:15%;
display: none;
z-index: 2;
.close{
background-image:resolve('life/login/close.png');
background-size: 100% 100%;
background-repeat: no-repeat;
position:absolute;
width:40px;
height:40px;
left:1.4rem;
top:4rem;
}
}
}
@import "coupon";
\ No newline at end of file
... ...
{{> layout/header}}
<div class="coupon-page yoho-page">
<input type="text" placeholder="xxxxxx" class="coupon-input">
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="life-page yoho-page">
<div class="life-page-link-content">
<a class="life-page-link" href="/life/login"></a>
</div>
</div>
<script>
</script>
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="lifelogin-page yoho-page">
<input type="text" placeholder="输入手机号" class="btn-input"/>
<div class="coupon-btn"></div>
<div class="down-app"></div>
<div class="notice"></div>
<div class="mark"></div>
<div class="code">
<div class="close"></div>
</div>
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -384,3 +384,14 @@
seajs.use('js/index/coupon');
</script>
{{/if}}
{{!-- 本来生活 --}}
{{#if lifePage}}
<script>
seajs.use('js/life/login');
</script>
{{/if}}
{{#if couponPage}}
<script>
seajs.use('js/life/coupon');
</script>
{{/if}}
... ...
<?php
use Action\AbstractAction;
use Plugin\Helpers;
use LibModels\Wap\Coupon\CouponData;
class LifeController extends AbstractAction
{
const COUPON_ID = 13024;
public function indexAction()
{
$uid = $this->getUid();
if (!$uid) {
$this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/life/index'))));
}
$this->_view->display('index');
}
//点击领券按钮
public function sendCouponAction()
{
$result = array('code' => 400, 'message' => '领取失败', 'data' => '');
do {
if (!$this->isAjax()) {
break;
}
//获取领券参数
$couponId = self::COUPON_ID;
$uid = $this->getUid();
//领取优惠券
$result = CouponData::receiveCoupon($uid, $couponId);
if (!isset($result['code'])) {
break;
}
}
while (false);
$this->echoJson($result);
}
public function loginAction()
{
$this->_view->display('login',array(
'lifePage' => true));
}
public function couponAction()
{
//获取手机号,传优惠码
$this->_view->display('coupon',array(
'couponPage' => true));
}
}
... ...