Authored by biao

Merge branch 'hotfix/life'

Showing 48 changed files with 503 additions and 4 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'); @@ -10,5 +10,5 @@ require('./js/passport/entry');
10 require('./js/product/entry'); 10 require('./js/product/entry');
11 require('./js/me/entry'); 11 require('./js/me/entry');
12 require('./js/cart/entry'); 12 require('./js/cart/entry');
13 - 13 +require('./js/life/entry');
14 module.exports = yohobuy; 14 module.exports = yohobuy;
  1 +var $ = require('jquery');
  2 +
  3 +require('../common.js');
  4 +$('.coupon-input').val(window.cookie('lifeCoupon') || '');
  5 +require('../plugin/wx-share')();
  1 +/*
  2 + * To change this license header, choose License Headers in Project Properties.
  3 + * To change this template file, choose Tools | Templates
  4 + * and open the template in the editor.
  5 + */
  6 +
  7 +require('./login');
  8 +require('./coupon');
  9 +
  1 +var $ = require('jquery');
  2 +
  3 +require('../common.js');
  4 +require('../plugin/wx-share')();
  5 +$('.notice').click(function() {
  6 + $('.code').show();
  7 + $('.mark').show();
  8 +});
  9 +$('.close').click(function() {
  10 + $('.code').hide();
  11 + $('.mark').hide();
  12 +});
  13 +
  14 +function get() {
  15 + $.ajax({
  16 + type: 'get',
  17 + url: '/index/life/sendCoupon',
  18 + dataType: 'json',
  19 + success: function(data) {
  20 + $('.statu').html(data.message);
  21 + $('.statu-mark').show();
  22 + $('.statu-box').show();
  23 + if (data.code === 200) {
  24 + window.setCookie('lifeCoupon', data.data);
  25 + location.href = '/life/coupon';
  26 + } else if (data.code === 401) {
  27 + $('.successed').css('display', 'block');
  28 + $('.sure').click(function() {
  29 + location.href = '/life/coupon';
  30 + });
  31 + } else if (data.code === 403) {
  32 + $('.late').css('display', 'block');
  33 + } else {
  34 + $('.faill').css('display', 'block');
  35 + }
  36 + }
  37 + });
  38 +}
  39 +
  40 +$('.coupon-btn').click(function() {
  41 + get();
  42 + $('.mark').show();
  43 +});
  1 +/**
  2 + * 微信分享
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/10/30
  5 + */
  6 +
  7 +var $ = require('jquery');
  8 +
  9 +module.exports = function() {
  10 + var _weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage';
  11 +
  12 + $.getJSON(_weChatInterface + '?pageurl=' +
  13 + encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function(json) {
  14 + var _appId, _timestamp, _nonceStr, _signature;
  15 +
  16 + if (json !== undefined && json !== '') {
  17 + _appId = json.appId.toString();
  18 + _timestamp = json.timestamp;
  19 + _nonceStr = json.nonceStr.toString();
  20 + _signature = json.signature.toString();
  21 +
  22 + wx.config({
  23 + debug: false,
  24 + appId: _appId,
  25 + timestamp: _timestamp,
  26 + nonceStr: _nonceStr,
  27 + signature: _signature,
  28 + jsApiList: [
  29 + 'checkJsApi',
  30 + 'onMenuShareTimeline',
  31 + 'onMenuShareAppMessage',
  32 + 'onMenuShareQQ',
  33 + 'onMenuShareWeibo',
  34 + 'hideMenuItems',
  35 + 'showMenuItems',
  36 + 'hideAllNonBaseMenuItem',
  37 + 'showAllNonBaseMenuItem',
  38 + 'translateVoice',
  39 + 'startRecord',
  40 + 'stopRecord',
  41 + 'onRecordEnd',
  42 + 'playVoice',
  43 + 'pauseVoice',
  44 + 'stopVoice',
  45 + 'uploadVoice',
  46 + 'downloadVoice',
  47 + 'chooseImage',
  48 + 'previewImage',
  49 + 'uploadImage',
  50 + 'downloadImage',
  51 + 'getNetworkType',
  52 + 'openLocation',
  53 + 'getLocation',
  54 + 'hideOptionMenu',
  55 + 'showOptionMenu',
  56 + 'closeWindow',
  57 + 'scanQRCode',
  58 + 'chooseWXPay',
  59 + 'openProductSpecificView',
  60 + 'addCard',
  61 + 'chooseCard',
  62 + 'openCard'
  63 + ]
  64 + });
  65 + }
  66 + });
  67 +
  68 + wx.ready(function() {
  69 + var shareTitle = $('#title').val();
  70 + var shareImg = $('#img').val();
  71 + var shareDesc = $('#desc').val();
  72 + var shareLink = $('#link').val();
  73 + var shareData = {
  74 + title: shareTitle,
  75 + desc: shareDesc,
  76 + imgUrl: shareImg,
  77 + link: shareLink
  78 + };
  79 +
  80 + wx.onMenuShareAppMessage(shareData);
  81 + wx.onMenuShareTimeline(shareData);
  82 + wx.onMenuShareQQ(shareData);
  83 + wx.onMenuShareWeibo(shareData);
  84 + });
  85 +};
@@ -8,11 +8,14 @@ var $ = require('jquery'); @@ -8,11 +8,14 @@ var $ = require('jquery');
8 8
9 module.exports = function() { 9 module.exports = function() {
10 var _weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage'; 10 var _weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage';
11 -  
12 $.getJSON(_weChatInterface + '?pageurl=' + 11 $.getJSON(_weChatInterface + '?pageurl=' +
13 encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function (json) { 12 encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function (json) {
14 var _appId, _timestamp, _nonceStr, _signature; 13 var _appId, _timestamp, _nonceStr, _signature;
15 14
  15 + if (!wx) {
  16 + return;
  17 + }
  18 +
16 if (json !== undefined && json !== '') { 19 if (json !== undefined && json !== '') {
17 _appId = json.appId.toString(); 20 _appId = json.appId.toString();
18 _timestamp = json.timestamp; 21 _timestamp = json.timestamp;
@@ -191,3 +191,4 @@ iframe[height="0"] { @@ -191,3 +191,4 @@ iframe[height="0"] {
191 @import "me/index"; 191 @import "me/index";
192 @import "product/index"; 192 @import "product/index";
193 @import "cart/index"; 193 @import "cart/index";
  194 +@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 + margin-bottom: -32px;
  13 + .coupon-input{
  14 + width: 48%;
  15 + height: 30px;
  16 + text-align: center;
  17 + border: none;
  18 + position: absolute;
  19 + top: 62%;
  20 + left: 30%;
  21 + font-size: 24px;
  22 + background-color: #FFFFFF;
  23 + }
  24 + .share{
  25 + color: #FFFFFF;
  26 + font-size:40px;
  27 + text-align: center;
  28 + display: block;
  29 + position: absolute;
  30 + top:80%;
  31 + width: 100%;
  32 + }
  33 +}
  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 + margin-bottom: -32px;
  14 + .life-page-link-content {
  15 + width: 100%;
  16 + height: 8.13%;
  17 + position: absolute;
  18 + top: 86%;
  19 + .life-page-link {
  20 + width: 60.625%;
  21 + height: 100%;
  22 + background-image: resolve('life/index/button.png');
  23 + background-size: contain;
  24 + background-repeat: no-repeat;
  25 + display: block;
  26 + position: relative;
  27 + margin: 0 auto;
  28 + }
  29 + }
  30 +
  31 +}
  32 +@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: contain;
  10 + background-repeat: no-repeat;
  11 + height: 1525px;
  12 + width: 100%;
  13 + margin-bottom: -32px;
  14 + .btn-input{
  15 + position: absolute;
  16 + top: 608px;
  17 + left: 168px;
  18 + border:none;
  19 + width: 370px;
  20 + height:40px;
  21 + line-height: 30px;
  22 + text-align: center;
  23 + font-size: 24px;
  24 + }
  25 + .coupon-btn{
  26 + background-image:resolve('life/login/button_1.png');
  27 + background-size: contain;
  28 + background-repeat: no-repeat;
  29 + width: 388px;
  30 + height:82px;
  31 + position: absolute;
  32 + left: 20%;
  33 + top:680px;
  34 + }
  35 + .down-app{
  36 + background-image:resolve('life/login/button_2.png');
  37 + background-size: contain;
  38 + background-repeat: no-repeat;
  39 + width: 80%;
  40 + height:8.13%;
  41 + left: 10%;
  42 + bottom: 160px;
  43 + position: absolute;
  44 + }
  45 + .notice{
  46 + background-image:resolve('life/login/button_3.png');
  47 + background-size: contain;
  48 + background-repeat: no-repeat;
  49 + width: 80%;
  50 + height:7%;
  51 + position: absolute;
  52 + left: 10%;
  53 + bottom: 20px;
  54 + }
  55 + .mark{
  56 + width: 100%;
  57 + height:1525px;
  58 + background:#69cffe;
  59 + position: fixed;
  60 + opacity: 0.5;
  61 + top:0 ;
  62 + z-index: 1;
  63 + display: none;
  64 + }
  65 + .code{
  66 + background-image:resolve('life/login/codebox.jpg');
  67 + background-size: contain;
  68 + background-repeat: no-repeat;
  69 + width: 80%;
  70 + position:fixed;
  71 + height:60%;
  72 + left:10%;
  73 + top:20%;
  74 + display: none;
  75 + z-index: 2;
  76 + .close{
  77 + background-image:resolve('life/login/close.png');
  78 + background-size: 100% 100%;
  79 + background-repeat: no-repeat;
  80 + position:absolute;
  81 + width:40px;
  82 + height:40px;
  83 + left:10px;
  84 + top:10px;
  85 + }
  86 + img{
  87 + height: 40%;
  88 + width: 50%;
  89 + position: absolute;
  90 + left: 25%;
  91 + top:40%;
  92 + }
  93 + }
  94 + .successed{
  95 + background-image:resolve('life/login/get.png');
  96 + background-size: 100% 100%;
  97 + position: absolute;
  98 + width: 80%;
  99 + height:20%;
  100 + left: 10%;
  101 + top:33%;
  102 + display: none;
  103 + z-index: 2;
  104 + }
  105 + .faill{
  106 + background-image:resolve('life/login/faill.png');
  107 + background-size: 100% 100%;
  108 + position: absolute;
  109 + width: 80%;
  110 + height:20%;
  111 + left:10%;
  112 + top:33%;
  113 + display: none;
  114 + z-index: 2;
  115 + }
  116 + .late{
  117 + background-image:resolve('life/login/late.png');
  118 + background-size: 100% 100%;
  119 + position: absolute;
  120 + width: 80%;
  121 + height:20%;
  122 + left: 10%;
  123 + top:33%;
  124 + display: none;
  125 + z-index: 2;
  126 + }
  127 + .sure{
  128 + position: absolute;
  129 + display: block;
  130 + width: 42%;
  131 + height: 23%;
  132 + left: 29%;
  133 + bottom: 3%;
  134 + color: #FFFFFF;
  135 + sborder: solid 2px #FFFFFF;
  136 + }
  137 +}
  138 +@import "coupon";
  1 +{{> layout/header}}
  2 +<div class="coupon-page yoho-page">
  3 + <input type="text" class="coupon-input" disabled="true">
  4 + {{#wxshare}}
  5 + <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
  6 + <input id="shareLink" type="hidden" value="{{shareLink}}">
  7 + <input id="shareImg" type="hidden" value="{{shareImg}}">
  8 + <input id="shareTitle" type="hidden" value="{{shareTitle}}">
  9 + <input id="shareDesc" type="hidden" value="{{shareDesc}}">
  10 + {{/wxshare}}
  11 +</div>
  12 +{{> 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 + {{#wxshare}}
  7 + <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
  8 + <input id="shareLink" type="hidden" value="{{shareLink}}">
  9 + <input id="shareImg" type="hidden" value="{{shareImg}}">
  10 + <input id="shareTitle" type="hidden" value="{{shareTitle}}">
  11 + <input id="shareDesc" type="hidden" value="{{shareDesc}}">
  12 + {{/wxshare}}
  13 +</div>
  14 +{{> layout/footer}}
  15 +
  16 +<script type="text/javascript">
  17 + seajs.use('js/plugin/wx-share', function(share) {
  18 + share();
  19 + });
  20 +</script>
  1 +{{> layout/header}}
  2 +<div class="lifelogin-page yoho-page">
  3 + <div class="coupon-btn"></div>
  4 + <a class="down-app" href="http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho"></a>
  5 + <div class="notice"></div>
  6 + <div class="mark"></div>
  7 + <div class="code">
  8 + <div class="close"></div>
  9 + <img src="http://img01.yohoboys.com/staticimg/2016/05/26/17/010eeb57a3999e58da7ce7c6f4f6e8e252.jpg"/>
  10 + </div>
  11 + <div class="successed">
  12 + <span class="sure"></span>
  13 + </div>
  14 + <div class="faill">
  15 + <a href="/life/index" class="sure"></a>
  16 + </div>
  17 + <div class="late">
  18 + <a href="/life/index" class="sure"></a>
  19 + </div>
  20 + <img src="{{shareImg}}" style="display: none;">
  21 + {{#wxshare}}
  22 + <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
  23 + <input id="shareLink" type="hidden" value="{{shareLink}}">
  24 + <input id="shareImg" type="hidden" value="{{shareImg}}">
  25 + <input id="shareTitle" type="hidden" value="{{shareTitle}}">
  26 + <input id="shareDesc" type="hidden" value="{{shareDesc}}">
  27 + {{/wxshare}}
  28 +</div>
  29 +{{> layout/footer}}
@@ -377,13 +377,11 @@ @@ -377,13 +377,11 @@
377 seajs.use('js/me/message-detail'); 377 seajs.use('js/me/message-detail');
378 </script> 378 </script>
379 {{/if}} 379 {{/if}}
380 -  
381 {{#if floorPage}} 380 {{#if floorPage}}
382 <script> 381 <script>
383 seajs.use('js/index/coupon'); 382 seajs.use('js/index/coupon');
384 </script> 383 </script>
385 {{/if}} 384 {{/if}}
386 -  
387 {{#if jitDetailPage}} 385 {{#if jitDetailPage}}
388 <script> 386 <script>
389 seajs.use('js/cart/jit-detail'); 387 seajs.use('js/cart/jit-detail');
@@ -403,3 +401,15 @@ @@ -403,3 +401,15 @@
403 seajs.use('js/product/shop'); 401 seajs.use('js/product/shop');
404 </script> 402 </script>
405 {{/if}} 403 {{/if}}
  404 +
  405 +{{!-- 本来生活 --}}
  406 +{{#if lifePage}}
  407 +<script>
  408 + seajs.use('js/life/login');
  409 +</script>
  410 +{{/if}}
  411 +{{#if couponPage}}
  412 +<script>
  413 + seajs.use('js/life/coupon');
  414 +</script>
  415 +{{/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 = 23360;
  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', array(
  19 + 'wxshare' => array(
  20 + 'shareLink' => 'http://m.yohobuy.com/life/index',
  21 + 'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/05/26/17/0208d70abf2b3fc94412f0e4d84f6728df.png',
  22 + 'shareTitle' => 'YOHO!BUY有货清凉夏日福利券限时派送中 ',
  23 + 'shareDesc' => '我已成功领取36元清凉夏日福利券,你也快来吧!',
  24 + ),
  25 + ));
  26 + }
  27 +
  28 + //点击领券按钮
  29 + public function sendCouponAction()
  30 + {
  31 + $result = array('code' => 400, 'message' => '领取失败', 'data' => '');
  32 + do {
  33 + if (!$this->isAjax()) {
  34 + break;
  35 + }
  36 + //获取领券参数
  37 + $couponId = self::COUPON_ID;
  38 + $uid = $this->getUid();
  39 + //领取优惠券
  40 + $result = CouponData::receiveCoupon($uid, $couponId);
  41 + if (!isset($result['code'])) {
  42 + break;
  43 + }
  44 + }
  45 + while (false);
  46 + $this->echoJson($result);
  47 + }
  48 +
  49 + public function loginAction()
  50 + {
  51 + $uid = $this->getUid();
  52 + if (!$uid) {
  53 + $this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/life/index'))));
  54 + }
  55 +
  56 + $this->_view->display('login', array(
  57 + 'wxshare' => array(
  58 + 'shareLink' => 'http://m.yohobuy.com/life/index',
  59 + 'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/05/26/17/0208d70abf2b3fc94412f0e4d84f6728df.png',
  60 + 'shareTitle' => 'YOHO!BUY有货清凉夏日福利券限时派送中 ',
  61 + 'shareDesc' => '我已成功领取36元清凉夏日福利券,你也快来吧!',
  62 + ),
  63 + 'lifePage' => true));
  64 + }
  65 +
  66 + public function couponAction()
  67 + {
  68 + //获取手机号,传优惠码
  69 + $this->_view->display('coupon', array(
  70 + 'wxshare' => array(
  71 + 'shareLink' => 'http://m.yohobuy.com/life/index',
  72 + 'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/05/26/17/0208d70abf2b3fc94412f0e4d84f6728df.png',
  73 + 'shareTitle' => 'YOHO!BUY有货清凉夏日福利券限时派送中 ',
  74 + 'shareDesc' => '我已成功领取36元清凉夏日福利券,你也快来吧!',
  75 + ),
  76 + 'couponPage' => true));
  77 + }
  78 +
  79 +}