Authored by biao

Merge branch 'hotfix/life'

Showing 48 changed files with 504 additions and 5 deletions
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.

21.7 KB | W: | H:

21.3 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -10,5 +10,5 @@ require('./js/passport/entry');
require('./js/product/entry');
require('./js/me/entry');
require('./js/cart/entry');
require('./js/life/entry');
module.exports = yohobuy;
... ...
var $ = require('jquery');
require('../common.js');
$('.coupon-input').val(window.cookie('lifeCoupon') || '');
require('../plugin/wx-share')();
... ...
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
require('./login');
require('./coupon');
... ...
var $ = require('jquery');
require('../common.js');
require('../plugin/wx-share')();
$('.notice').click(function() {
$('.code').show();
$('.mark').show();
});
$('.close').click(function() {
$('.code').hide();
$('.mark').hide();
});
function get() {
$.ajax({
type: 'get',
url: '/index/life/sendCoupon',
dataType: 'json',
success: function(data) {
$('.statu').html(data.message);
$('.statu-mark').show();
$('.statu-box').show();
if (data.code === 200) {
window.setCookie('lifeCoupon', data.data);
location.href = '/life/coupon';
} else if (data.code === 401) {
$('.successed').css('display', 'block');
$('.sure').click(function() {
location.href = '/life/coupon';
});
} else if (data.code === 403) {
$('.late').css('display', 'block');
} else {
$('.faill').css('display', 'block');
}
}
});
}
$('.coupon-btn').click(function() {
get();
$('.mark').show();
});
... ...
/**
* 微信分享
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/30
*/
var $ = require('jquery');
module.exports = function() {
var _weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage';
$.getJSON(_weChatInterface + '?pageurl=' +
encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function(json) {
var _appId, _timestamp, _nonceStr, _signature;
if (json !== undefined && json !== '') {
_appId = json.appId.toString();
_timestamp = json.timestamp;
_nonceStr = json.nonceStr.toString();
_signature = json.signature.toString();
wx.config({
debug: false,
appId: _appId,
timestamp: _timestamp,
nonceStr: _nonceStr,
signature: _signature,
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'hideMenuItems',
'showMenuItems',
'hideAllNonBaseMenuItem',
'showAllNonBaseMenuItem',
'translateVoice',
'startRecord',
'stopRecord',
'onRecordEnd',
'playVoice',
'pauseVoice',
'stopVoice',
'uploadVoice',
'downloadVoice',
'chooseImage',
'previewImage',
'uploadImage',
'downloadImage',
'getNetworkType',
'openLocation',
'getLocation',
'hideOptionMenu',
'showOptionMenu',
'closeWindow',
'scanQRCode',
'chooseWXPay',
'openProductSpecificView',
'addCard',
'chooseCard',
'openCard'
]
});
}
});
wx.ready(function() {
var shareTitle = $('#title').val();
var shareImg = $('#img').val();
var shareDesc = $('#desc').val();
var shareLink = $('#link').val();
var shareData = {
title: shareTitle,
desc: shareDesc,
imgUrl: shareImg,
link: shareLink
};
wx.onMenuShareAppMessage(shareData);
wx.onMenuShareTimeline(shareData);
wx.onMenuShareQQ(shareData);
wx.onMenuShareWeibo(shareData);
});
};
\ No newline at end of file
... ...
... ... @@ -8,11 +8,14 @@ var $ = require('jquery');
module.exports = function() {
var _weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage';
$.getJSON(_weChatInterface + '?pageurl=' +
encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function (json) {
var _appId, _timestamp, _nonceStr, _signature;
if (!wx) {
return;
}
if (json !== undefined && json !== '') {
_appId = json.appId.toString();
_timestamp = json.timestamp;
... ... @@ -82,4 +85,4 @@ module.exports = function() {
wx.onMenuShareQQ(shareData);
wx.onMenuShareWeibo(shareData);
});
};
\ No newline at end of file
};
... ...
... ... @@ -191,3 +191,4 @@ iframe[height="0"] {
@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%;
margin-bottom: -32px;
.coupon-input{
width: 48%;
height: 30px;
text-align: center;
border: none;
position: absolute;
top: 62%;
left: 30%;
font-size: 24px;
background-color: #FFFFFF;
}
.share{
color: #FFFFFF;
font-size:40px;
text-align: center;
display: block;
position: absolute;
top:80%;
width: 100%;
}
}
... ...
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%;
margin-bottom: -32px;
.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: contain;
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: contain;
background-repeat: no-repeat;
height: 1525px;
width: 100%;
margin-bottom: -32px;
.btn-input{
position: absolute;
top: 608px;
left: 168px;
border:none;
width: 370px;
height:40px;
line-height: 30px;
text-align: center;
font-size: 24px;
}
.coupon-btn{
background-image:resolve('life/login/button_1.png');
background-size: contain;
background-repeat: no-repeat;
width: 388px;
height:82px;
position: absolute;
left: 20%;
top:680px;
}
.down-app{
background-image:resolve('life/login/button_2.png');
background-size: contain;
background-repeat: no-repeat;
width: 80%;
height:8.13%;
left: 10%;
bottom: 160px;
position: absolute;
}
.notice{
background-image:resolve('life/login/button_3.png');
background-size: contain;
background-repeat: no-repeat;
width: 80%;
height:7%;
position: absolute;
left: 10%;
bottom: 20px;
}
.mark{
width: 100%;
height:1525px;
background:#69cffe;
position: fixed;
opacity: 0.5;
top:0 ;
z-index: 1;
display: none;
}
.code{
background-image:resolve('life/login/codebox.jpg');
background-size: contain;
background-repeat: no-repeat;
width: 80%;
position:fixed;
height:60%;
left:10%;
top:20%;
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:10px;
top:10px;
}
img{
height: 40%;
width: 50%;
position: absolute;
left: 25%;
top:40%;
}
}
.successed{
background-image:resolve('life/login/get.png');
background-size: 100% 100%;
position: absolute;
width: 80%;
height:20%;
left: 10%;
top:33%;
display: none;
z-index: 2;
}
.faill{
background-image:resolve('life/login/faill.png');
background-size: 100% 100%;
position: absolute;
width: 80%;
height:20%;
left:10%;
top:33%;
display: none;
z-index: 2;
}
.late{
background-image:resolve('life/login/late.png');
background-size: 100% 100%;
position: absolute;
width: 80%;
height:20%;
left: 10%;
top:33%;
display: none;
z-index: 2;
}
.sure{
position: absolute;
display: block;
width: 42%;
height: 23%;
left: 29%;
bottom: 3%;
color: #FFFFFF;
sborder: solid 2px #FFFFFF;
}
}
@import "coupon";
\ No newline at end of file
... ...
{{> layout/header}}
<div class="coupon-page yoho-page">
<input type="text" class="coupon-input" disabled="true">
{{#wxshare}}
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<input id="shareLink" type="hidden" value="{{shareLink}}">
<input id="shareImg" type="hidden" value="{{shareImg}}">
<input id="shareTitle" type="hidden" value="{{shareTitle}}">
<input id="shareDesc" type="hidden" value="{{shareDesc}}">
{{/wxshare}}
</div>
{{> layout/footer}}
... ...
{{> layout/header}}
<div class="life-page yoho-page">
<div class="life-page-link-content">
<a class="life-page-link" href="/life/login"></a>
</div>
{{#wxshare}}
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<input id="shareLink" type="hidden" value="{{shareLink}}">
<input id="shareImg" type="hidden" value="{{shareImg}}">
<input id="shareTitle" type="hidden" value="{{shareTitle}}">
<input id="shareDesc" type="hidden" value="{{shareDesc}}">
{{/wxshare}}
</div>
{{> layout/footer}}
<script type="text/javascript">
seajs.use('js/plugin/wx-share', function(share) {
share();
});
</script>
... ...
{{> layout/header}}
<div class="lifelogin-page yoho-page">
<div class="coupon-btn"></div>
<a class="down-app" href="http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho"></a>
<div class="notice"></div>
<div class="mark"></div>
<div class="code">
<div class="close"></div>
<img src="http://img01.yohoboys.com/staticimg/2016/05/26/17/010eeb57a3999e58da7ce7c6f4f6e8e252.jpg"/>
</div>
<div class="successed">
<span class="sure"></span>
</div>
<div class="faill">
<a href="/life/index" class="sure"></a>
</div>
<div class="late">
<a href="/life/index" class="sure"></a>
</div>
<img src="{{shareImg}}" style="display: none;">
{{#wxshare}}
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<input id="shareLink" type="hidden" value="{{shareLink}}">
<input id="shareImg" type="hidden" value="{{shareImg}}">
<input id="shareTitle" type="hidden" value="{{shareTitle}}">
<input id="shareDesc" type="hidden" value="{{shareDesc}}">
{{/wxshare}}
</div>
{{> layout/footer}}
... ...
... ... @@ -377,13 +377,11 @@
seajs.use('js/me/message-detail');
</script>
{{/if}}
{{#if floorPage}}
<script>
seajs.use('js/index/coupon');
</script>
{{/if}}
{{#if jitDetailPage}}
<script>
seajs.use('js/cart/jit-detail');
... ... @@ -403,3 +401,15 @@
seajs.use('js/product/shop');
</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 = 23360;
public function indexAction()
{
$uid = $this->getUid();
if (!$uid) {
$this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/life/index'))));
}
$this->_view->display('index', array(
'wxshare' => array(
'shareLink' => 'http://m.yohobuy.com/life/index',
'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/05/26/17/0208d70abf2b3fc94412f0e4d84f6728df.png',
'shareTitle' => 'YOHO!BUY有货清凉夏日福利券限时派送中 ',
'shareDesc' => '我已成功领取36元清凉夏日福利券,你也快来吧!',
),
));
}
//点击领券按钮
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()
{
$uid = $this->getUid();
if (!$uid) {
$this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/life/index'))));
}
$this->_view->display('login', array(
'wxshare' => array(
'shareLink' => 'http://m.yohobuy.com/life/index',
'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/05/26/17/0208d70abf2b3fc94412f0e4d84f6728df.png',
'shareTitle' => 'YOHO!BUY有货清凉夏日福利券限时派送中 ',
'shareDesc' => '我已成功领取36元清凉夏日福利券,你也快来吧!',
),
'lifePage' => true));
}
public function couponAction()
{
//获取手机号,传优惠码
$this->_view->display('coupon', array(
'wxshare' => array(
'shareLink' => 'http://m.yohobuy.com/life/index',
'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/05/26/17/0208d70abf2b3fc94412f0e4d84f6728df.png',
'shareTitle' => 'YOHO!BUY有货清凉夏日福利券限时派送中 ',
'shareDesc' => '我已成功领取36元清凉夏日福利券,你也快来吧!',
),
'couponPage' => true));
}
}
... ...