Authored by 梁志锋

Merge remote-tracking branch 'origin/develop' into beta

... ... @@ -5,9 +5,9 @@
}
.coin-num {
color: #d0021b;
font-size: pxToRem(66px);
font-size: pxToRem(80px);
font-weight: bold;
line-height: pxToRem(106px);
line-height: pxToRem(88px);
// letter-spacing: pxToRem(8px);
}
... ...
... ... @@ -11,7 +11,7 @@
</span>
<ul id="country-code-list" class="country-code-list">
{{# countryList}}
<li data-cc="+{{code}}">{{name}} +{{code}}</li>
<li data-cc="{{areaCode}}">{{name}} {{areaCode}}</li>
{{/ countryList}}
</ul>
</div>
... ... @@ -28,7 +28,7 @@
</li>
<li class="input-container-li clearfix">
<input id="captcha" class="input va captcha" type="text" name="captcha" placeholder="验证码" autocomplete="off" maxlength="4">
<img id="captcha-img" class="captcha-img" src="http://web.dev.yohobuy.com/passport/images" alt="">
<img id="captcha-img" class="captcha-img" src="{{captchaUrl}}" alt="">
<a id="change-captcha" class="link change-captcha">换一张</a>
<span id="captcha-err" class="err-tip captcha-err hide">
<i></i>
... ...
... ... @@ -9,7 +9,7 @@
<li class="po-re">
<label class="pn-label">手机号码</label>
<span class="country-code">+{{area}}</span>
<span class="phone-num">{{phoneNum}}</span>
<span class="phone-num">{{mobile}}</span>
</li>
<li class="po-re">
<input id="captcha" class="input va captcha" type="text" name="captcha">
... ... @@ -22,8 +22,8 @@
</li>
<li>
<input name="area" id="area" type="hidden" value="{{area}}">
<input name="mobile" id="mobile" type="hidden" value="{{phoneNum}}">
<input name="captchaPic" id="captchaPic" type="hidden" value="{{captcha}}">
<input name="mobile" id="mobile" type="hidden" value="{{mobile}}">
<input name="captchaPic" id="captchaPic" type="hidden" value="{{verifyCode}}">
<input name="refer" id="refer" type="hidden" value="">
<input id="next-step" class="btn next-step disable" type="submit" value="下一步" disabled="">
</li>
... ...
... ... @@ -102,16 +102,20 @@
</div>
</div>
<ul class="panel-body check-container clearfix">
{{# brandsShow}}
<li class="attr" data-index="{{index}}" data-key="{{key}}">
<a href="{{href}}">
<span class="iconfont checkbox" data-id="{{id}}">&#xe613;</span>
<span title="{{name}}">{{name}}</span>
</a>
</li>
{{/ brandsShow}}
</ul>
<div class="panel-body">
<div class="ul-scroll">
<ul class="check-container clearfix">
{{# brandsShow}}
<li class="attr" data-index="{{index}}" data-key="{{key}}">
<a href="{{href}}">
<span class="iconfont checkbox" data-id="{{id}}">&#xe613;</span>
<span title="{{name}}">{{name}}</span>
</a>
</li>
{{/ brandsShow}}
</ul>
</div>
</div>
<div class="btns">
<button id="brand-multi-ok" class="multi-select-ok dis">确定</button>
... ...
... ... @@ -1483,305 +1483,309 @@ require("js/product/sort-pager");
require("js/product/product");
});
define("js/product/filter", ["jquery"], function(require, exports, module){
/**
* 商品筛选逻辑
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/12/4
*/
var $ = require("jquery");
var checkUnicode = {
unchecked: '&#xe613;',
checked: '&#xe612;'
},
moreUnicode = {
up: '&#xe610;',
down: '&#xe600;'
};
//品牌相关变量
var $brandDefault = $('.brand .default'),
$brandPanel = $('.brand .brand-panel'),
$brandAttrs = $('.brand .attr'),
$brandMore = $('#brand-more'),
$brandMulti = $('#brand-multi');
var $brandMoreTxt, $brandMoreIcon;
//价格相关变量
var $udPrice = $('.ud-price-range'),
interReg = /^\d+$/,
$limit, $min, $max, $btn;
//分类相关变量
var $sortSub = $('.sort-sub-wrap');
//高级选项相关变量
var $seniorSubWrap = $('.senior-sub-wrap'),
$seniorAttrWrap = $('.senior-attr-wrap');
var seniorHoverTime, hoveredIndex;
//清除checkbox选中状态
function clearChecked($checkbox) {
$checkbox.removeClass('checked').html(checkUnicode.unchecked);
}
//显示更多品牌面板
function brandShowMore() {
$brandDefault.addClass('hide');
$brandPanel.removeClass('hide');
}
//隐藏更多品牌面板
function brandHideMore() {
$brandPanel.addClass('hide');
$brandDefault.removeClass('hide');
}
//url构造&跳转
function uriLoc(attr, val) {
var href = decodeURIComponent(window.location.search),
query = attr + '=' + val,
newHref;
if (href === '') {
newHref = '?' + query;
} else {
newHref = href + '&' + query;
}
window.location.href = newHref;
}
//隐藏高级选项面板
function hideSeniorPanel(index) {
$seniorSubWrap.children('.senior-sub:eq(' + hoveredIndex + ')').addClass('hide');
$seniorAttrWrap.children('.attr:eq(' + hoveredIndex + ')').removeClass('hover');
hoveredIndex = -1;
}
//屏蔽筛选项双击文字选中
$('.filter-box').on('selectstart', '.attr, .brands-index span', function() {
return false;
});
//【分类】
$('.sort-pre').on('click', 'li', function() {
var $this = $(this),
index = $this.index();
$this.siblings('.active').removeClass('active');
$this.addClass('active');
$sortSub.children(':not(.hide)').addClass('hide');
$sortSub.children(':eq(' + index + ')').removeClass('hide');
});
//【品牌】
if ($brandMore.length > 0) {
$brandMoreTxt = $brandMore.children('em');
$brandMoreIcon = $brandMore.children('.iconfont');
}
//【品牌】多选
$brandMulti.click(function() {
if ($brandPanel.css('display') === 'none') {
//显示品牌面板
brandShowMore();
}
$brandPanel.addClass('multi'); //显示出checkbox
$(this).addClass('hide');
});
//【品牌】更多
$brandMore.click(function() {
var $this = $(this);
if ($this.hasClass('more')) {
brandHideMore();
$brandMoreTxt.text('更多');
$brandMoreIcon.html(moreUnicode.down);
} else {
brandShowMore();
$brandMoreTxt.text('收起');
$brandMoreIcon.html(moreUnicode.up);
}
$(this).toggleClass('more');
});
//【品牌】索引
$('.brands-index').on('click', 'span', function() {
var $this = $(this),
index = $this.data('index');
if ($this.index() === 0) {
//全部
$brandAttrs.removeClass('hide');
} else {
$brandAttrs.addClass('hide').filter('[data-index=' + index + ']').removeClass('hide');
}
});
//【品牌】搜索
$('#brand-search-input').keyup(function() {
var val = $(this).val().toLowerCase();
if (val === '') {
$brandAttrs.removeClass('hide');
} else {
$brandAttrs.addClass('hide').filter('[data-key*=' + val + ']').removeClass('hide');
}
});
//【品牌】多选确定
$('#brand-multi-ok').click(function() {
var val = '';
if ($(this).hasClass('dis')) {
return;
}
$brandPanel.find('.checked').each(function() {
var id = $(this).data('id');
val += (val === '') ? id : (',' + id);
});
uriLoc('brand', val);
});
//【品牌/高级选项】多选取消
$('.multi-select-cancel').click(function() {
var $panel = $(this).closest('.multi');
if ($panel.hasClass('brand-panel')) {
brandHideMore();
$brandMulti.removeClass('hide'); //显示多选按钮
}
$panel.removeClass('multi');
clearChecked($panel.find('.checkbox.checked')); //清除选中状态
});
//【品牌/高级选项】checkbox
$('.check-container').on('click', '.attr', function() {
var $this = $(this),
$check = $this.find('.checkbox'),
$btnOk = $this.parent('.check-container').next('.btns').find('.multi-select-ok');
$check.toggleClass('checked');
if ($check.hasClass('checked')) {
$check.html(checkUnicode.checked);
} else {
$check.html(checkUnicode.unchecked);
}
//更新按钮状态
if ($check.hasClass('checked') ||
$this.siblings('.attr').find('.checked').length > 0) {
$btnOk.removeClass('dis');
} else {
$btnOk.addClass('dis');
}
});
//【品牌/高级选项】当多选时阻止链接默认跳转
$('.brand, .senior').on('click', '.attr > a', function(e) {
if ($(this).closest('.multi').length > 0) {
e.preventDefault();
}
});
//【价格】用户定义价格处理
if ($udPrice.length > 0) {
$limit = $udPrice.find('.limit');
$min = $limit.filter('.min');
$max = $limit.filter('.max');
$btn = $udPrice.find('.price-sure');
//【价格】输入
$limit.keyup(function() {
var min = $.trim($min.val()),
max = $.trim($max.val()),
isMinInt = interReg.test(min),
isMaxInt = interReg.test(max);
if (isMaxInt && (min === '' || isMinInt) ||
isMinInt && (max === '' || isMaxInt)
) {
$btn.removeClass('hide');
} else {
$btn.addClass('hide');
}
});
//【价格】多项查询
$btn.click(function() {
var min = $.trim($min.val()),
max = $.trim($max.val()),
tmp;
//对于min大于max的情况,交换位置
if (min !== '' && max !== '' && +min > +max) {
tmp = max;
max = min;
min = tmp;
}
uriLoc('price', min + ',' + max);
});
}
//【高级选项】鼠标移入显示子项
$seniorAttrWrap.on('mouseenter', '.attr', function() {
var index = $(this).addClass('hover').index();
$seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide');
}).on('mouseleave', '.attr', function() {
var $this = $(this),
index = $this.index();
hoveredIndex = index;
seniorHoverTime = setTimeout(function() {
hideSeniorPanel();
}, 100);
});
//【高级选项】多选
$('.senior-sub').on('click', '.multi-select', function() {
$(this).closest('.senior-sub').addClass('multi');
}).on('click', '.multi-select-ok', function() {
var $btn = $(this),
$sub = $btn.closest('.senior-sub'),
val = '';
if ($btn.hasClass('dis')) {
return;
}
$sub.find('.checked').each(function() {
var id = $(this).data('id');
val += (val === '') ? id : (',' + id);
});
uriLoc($sub.data('attr'), val);
}).on('mouseenter', function() {
clearTimeout(seniorHoverTime);
}).on('mouseleave', function() {
hideSeniorPanel();
/**
* 商品筛选逻辑
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/12/4
*/
var $ = require("jquery");
var checkUnicode = {
unchecked: '&#xe613;',
checked: '&#xe612;'
},
moreUnicode = {
up: '&#xe610;',
down: '&#xe600;'
};
//品牌相关变量
var $brandDefault = $('.brand .default'),
$brandPanel = $('.brand .brand-panel'),
$brandAttrs = $('.brand .attr'),
$brandMore = $('#brand-more'),
$brandMulti = $('#brand-multi');
var $brandMoreTxt, $brandMoreIcon;
//价格相关变量
var $udPrice = $('.ud-price-range'),
interReg = /^\d+$/,
$limit, $min, $max, $btn;
//分类相关变量
var $sortSub = $('.sort-sub-wrap');
//高级选项相关变量
var $seniorSubWrap = $('.senior-sub-wrap'),
$seniorAttrWrap = $('.senior-attr-wrap');
var seniorHoverTime, hoveredIndex;
//清除checkbox选中状态
function clearChecked($checkbox) {
$checkbox.removeClass('checked').html(checkUnicode.unchecked);
}
//显示更多品牌面板
function brandShowMore() {
$brandDefault.addClass('hide');
$brandPanel.removeClass('hide');
}
//隐藏更多品牌面板
function brandHideMore() {
$brandPanel.addClass('hide');
$brandDefault.removeClass('hide');
}
//url构造&跳转
function uriLoc(attr, val) {
var href = decodeURIComponent(window.location.search),
query = attr + '=' + val,
newHref;
if (href === '') {
newHref = '?' + query;
} else {
newHref = href + '&' + query;
}
window.location.href = newHref;
}
//隐藏高级选项面板
function hideSeniorPanel(index) {
$seniorSubWrap.children('.senior-sub:eq(' + hoveredIndex + ')').addClass('hide');
$seniorAttrWrap.children('.attr:eq(' + hoveredIndex + ')').removeClass('hover');
hoveredIndex = -1;
}
//屏蔽筛选项双击文字选中
$('.filter-box').on('selectstart', '.attr, .brands-index span', function() {
return false;
});
//【分类】
$('.sort-pre').on('click', 'li', function() {
var $this = $(this),
index = $this.index();
$this.siblings('.active').removeClass('active');
$this.addClass('active');
$sortSub.children(':not(.hide)').addClass('hide');
$sortSub.children(':eq(' + index + ')').removeClass('hide');
});
//【品牌】
if ($brandMore.length > 0) {
$brandMoreTxt = $brandMore.children('em');
$brandMoreIcon = $brandMore.children('.iconfont');
}
//【品牌】多选
$brandMulti.click(function() {
if ($brandPanel.css('display') === 'none') {
//显示品牌面板
brandShowMore();
}
$brandPanel.addClass('multi'); //显示出checkbox
$(this).addClass('hide');
});
//【品牌】更多
$brandMore.click(function() {
var $this = $(this);
if ($this.hasClass('more')) {
brandHideMore();
$brandMoreTxt.text('更多');
$brandMoreIcon.html(moreUnicode.down);
} else {
brandShowMore();
$brandMoreTxt.text('收起');
$brandMoreIcon.html(moreUnicode.up);
}
$(this).toggleClass('more');
});
//【品牌】索引
$('.brands-index').on('click', 'span', function() {
var $this = $(this),
index = $this.data('index');
if ($this.index() === 0) {
//全部
$brandAttrs.removeClass('hide');
} else {
$brandAttrs.addClass('hide').filter('[data-index=' + index + ']').removeClass('hide');
}
});
//【品牌】搜索
$('#brand-search-input').keyup(function() {
var val = $(this).val().toLowerCase();
if (val === '') {
$brandAttrs.removeClass('hide');
} else {
$brandAttrs.addClass('hide').filter('[data-key*=' + val + ']').removeClass('hide');
}
});
//【品牌】多选确定
$('#brand-multi-ok').click(function() {
var val = '';
if ($(this).hasClass('dis')) {
return;
}
$brandPanel.find('.checked').each(function() {
var id = $(this).data('id');
val += (val === '') ? id : (',' + id);
});
uriLoc('brand', val);
});
//【品牌/高级选项】多选取消
$('.multi-select-cancel').click(function() {
var $panel = $(this).closest('.multi');
if ($panel.hasClass('brand-panel')) {
brandHideMore();
$brandMulti.removeClass('hide'); //显示多选按钮
}
$panel.removeClass('multi');
clearChecked($panel.find('.checkbox.checked')); //清除选中状态
});
//【品牌/高级选项】checkbox
$('.check-container').on('click', '.attr', function() {
var $this = $(this),
$check = $this.find('.checkbox'),
$btnOk = $this.parent('.check-container').next('.btns').find('.multi-select-ok');
$check.toggleClass('checked');
if ($check.hasClass('checked')) {
$check.html(checkUnicode.checked);
} else {
$check.html(checkUnicode.unchecked);
}
//更新按钮状态
if ($check.hasClass('checked') ||
$this.siblings('.attr').find('.checked').length > 0) {
$btnOk.removeClass('dis');
} else {
$btnOk.addClass('dis');
}
});
//【品牌/高级选项】当多选时阻止链接默认跳转
$('.brand, .senior').on('click', '.attr > a', function(e) {
if ($(this).closest('.multi').length > 0) {
e.preventDefault();
}
});
//【价格】用户定义价格处理
if ($udPrice.length > 0) {
$limit = $udPrice.find('.limit');
$min = $limit.filter('.min');
$max = $limit.filter('.max');
$btn = $udPrice.find('.price-sure');
//【价格】输入
$limit.keyup(function() {
var min = $.trim($min.val()),
max = $.trim($max.val()),
isMinInt = interReg.test(min),
isMaxInt = interReg.test(max);
if (isMaxInt && (min === '' || isMinInt) ||
isMinInt && (max === '' || isMaxInt)
) {
$btn.removeClass('hide');
} else {
$btn.addClass('hide');
}
});
//【价格】多项查询
$btn.click(function() {
var min = $.trim($min.val()),
max = $.trim($max.val()),
tmp;
//对于min大于max的情况,交换位置
if (min !== '' && max !== '' && +min > +max) {
tmp = max;
max = min;
min = tmp;
}
uriLoc('price', min + ',' + max);
});
}
//【高级选项】鼠标移入显示子项
$seniorAttrWrap.on('mouseenter', '.attr', function() {
var $this = $(this);
var index = $this.index();
$this.addClass('hover').siblings().removeClass('hover');
$seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide');
}).on('mouseleave', '.attr', function() {
var $this = $(this),
index = $this.index();
hoveredIndex = index;
seniorHoverTime = setTimeout(function() {
hideSeniorPanel();
}, 100);
});
//【高级选项】多选
$('.senior-sub').on('click', '.multi-select', function() {
$(this).closest('.senior-sub').addClass('multi');
}).on('click', '.multi-select-ok', function() {
var $btn = $(this),
$sub = $btn.closest('.senior-sub'),
val = '';
if ($btn.hasClass('dis')) {
return;
}
$sub.find('.checked').each(function() {
var id = $(this).data('id');
val += (val === '') ? id : (',' + id);
});
uriLoc($sub.data('attr'), val);
}).on('mouseenter', function() {
clearTimeout(seniorHoverTime);
}).on('mouseleave', function() {
hideSeniorPanel();
});
});
define("js/product/sort-pager", ["jquery"], function(require, exports, module){
/**
... ... @@ -3962,7 +3966,7 @@ function picCaptchaAjaxFn(page, callback) {
type: 'POST',
url: url,
data: {
code: $ca.val()
verifyCode: $ca.val()
//mobile: $pn.val(),
//area: $region.text().split('+')[1]
... ... @@ -3995,7 +3999,7 @@ function msgCaptchaAjaxFn(page, callback) {
type: 'POST',
url: url,
data: {
code: $ca.val(),
verifyCode: $ca.val(),
mobile: $pn.val(),
area: $region.text().split('+')[1]
}
... ... @@ -4291,7 +4295,7 @@ exports.init = function(page) {
$regionSelect.change(function() {
$region.text('+' + $('#region').val());
$region.text($('#region').val());
validateRule(page, $pn, showErrTip); //验证
});
... ... @@ -4319,7 +4323,7 @@ exports.init = function(page) {
data: {
area: $region.text().split('+')[1],
mobile: $pn.val(),
code: $ca.val()
verifyCode: $ca.val()
}
}).then(function(data) {
if (data.code === 200) {
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -152,7 +152,7 @@ $('#brand-search-input').keyup(function() {
if (val === '') {
$brandAttrs.removeClass('hide');
} else {
$brandAttrs.addClass('hide').filter('[data-key*=' + val + ']').removeClass('hide');
$brandAttrs.addClass('hide').filter('[data-key*="' + val + '"]').removeClass('hide');
}
});
... ...
... ... @@ -14,16 +14,12 @@
.title {
float: left;
width: 90px;
width: 75px;
line-height: 30px;
}
.attr-content {
margin-left: 90px;
.default {
padding-right: 140px;
}
margin-left: 75px;
}
.multi-select {
... ... @@ -120,16 +116,17 @@
}
.brand-more {
margin-right: 20px;
margin-right: 10px;
cursor: pointer;
}
.brands-index {
float: left;
line-height: 30px;
margin-right: 5px;
span {
margin: 0 5px;
margin: 0 2px;
cursor: pointer;
-moz-user-select: none;
... ... @@ -145,7 +142,7 @@
line-height: 18px;
border: 1px solid #b0b0b0;
margin-top: 5px;
margin-left: 15px;
margin-left: 10px;
input {
float: left;
... ... @@ -159,7 +156,7 @@
display: inline-block;
width: 55px;
height: 18px;
background: #b0b0b0;
background: #3a3a3a;
color: #fff;
text-align: center;
cursor: default;
... ... @@ -168,10 +165,15 @@
.panel-body {
padding: 15px 20px;
margin-top: 5px;
background: #f4f7f6;
min-height: 30px;
border: 1px solid #000;
margin-top: 5px;
margin-left: 10px;
.ul-scroll {
overflow: auto;
min-height: 30px;
max-height: 150px;
}
}
}
... ... @@ -284,12 +286,12 @@
}
.senior-up-icon {
position: relative;
width: 100%;
height: 9px;
z-index: 1;
z-index: 3;
margin-left: -11px;
visibility: hidden;
background: image-url('product/senior-up.png') no-repeat;
background-position-x: 50%;
}
... ... @@ -301,4 +303,4 @@
.multi .checkbox {
display: inline;
}
}
}
\ No newline at end of file
... ...
@import "search", "list", "new-sale", "filter-box", "sort-pager", "good", "latest-walk", "left-content", "no-result", "hot-rank";
@import "search", "list", "new-sale", "filter-box", "sort-pager", "good", "latest-walk", "left-content", "no-result", "hot-rank", "shop-entry";
.product-page {
... ... @@ -44,6 +44,14 @@
height: 315px;
}
}
.panel-body .attr {
width: 25%;
}
.filter-box .brand .attr-content {
max-width: 730px;
}
}
/*990px*/
... ... @@ -74,5 +82,9 @@
height: 261px;
}
}
.filter-box .brand .attr-content {
max-width: 570px;
}
}
}
\ No newline at end of file
... ...
... ... @@ -148,6 +148,4 @@
color: #f00;
}
}
@import "shop-entry";
}
... ...
... ... @@ -5,7 +5,6 @@
*/
.product-search-page {
@import "shop-entry";
.goods-container {
height: auto;
padding: 25px 0 0 0;
... ... @@ -22,7 +21,6 @@
/*990px*/
@media (max-width: 1180px) {
.product-search-page {
.goods-container {
height: auto;
padding-top: 25px;
... ... @@ -42,5 +40,9 @@
height: 255px;
}
}
.filter-box .brand .attr-content {
max-width: 750px;
}
}
}
... ...
<?php
use Action\WebAction;
use LibModels\Web\Passport\RegData;
use Passport\PassportModel;
use Plugin\Helpers;
use LibModels\Wap\Passport\BackData;
use Plugin\AuthCode;
class BackController extends WebAction
{
/**
* 找回密码
*/
public function indexAction()
{
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array(
'simpleHeader' => PassportModel::getSimpleHeader(false),
'backPage' => true,
'back' => array(
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'countryCode' => '86',
'countryName' => '中国',
'countryList' => RegData::getAreasData(),
)
);
$this->_view->display('index', $data);
}
public function authcodeAction()
{
echo $this->echoJson(array('code'=> 200));
}
/**
*
*/
public function emailAction()
{
$phoneNum = $this->post('phoneNum','');
$area = $this->post('area','86');
$captcha = $this->post('captcha','');
if(Helpers::verifyEmail($phoneNum)){ //验证邮箱
$email = $phoneNum;
$data = BackData::sendCodeToEmail($email);
$this->setSession('phoneNum', $phoneNum);
if($data['code'] == 200) {
$this->redirect('sendemail');
}
else {
$this->redirect('index');
}
} else if(Helpers::verifyMobile($phoneNum)) {//验证手机号
$mobile = $phoneNum;
$data = BackData::sendCodeToMobile($mobile);
$this->setSession('phoneNum', $phoneNum);
$this->setSession('area', $area);
$this->setSession('captcha', $captcha);
if($data['code'] == 200) {
$this->redirect('verification');
}
else {
$this->redirect('index');
}
}
}
/**
* 发送邮件页面
*/
public function sendemailAction() {
$phoneNum = $this->getSession('phoneNum');
if(empty($phoneNum)) {
$this->redirect('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$simpleHeader = array(
'logo' => array(
'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
'url' => 'http://www.yohobuy.com'
),
'tool' => array(
'user' => '2586703@qq.com',
'userCenter' => '',
'loginHref' => '',
'logoutHref' => '',
'registerHref' => '',
'favoriteHref' => '',
'couponHref' => '',
'orderHref' => '',
'helpHref' => ''
)
);
$data = array(
'simpleHeader' => PassportModel::getSimpleHeader(false),
'sendEmail' => array(
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'countrys' => array(),
)
);
$this->_view->display('send-email', $data);
}
/**
* 重置密码页面
*/
public function backcodeAction() {
$code = $this->get('code');
$info = $this->checkCode($code);
if(empty($info)) {
$this->redirect('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array(
'simpleHeader' => PassportModel::getSimpleHeader(false),
'resetPage' => true,
'resetPwd' => array(
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'countrys' => array(),
'code' => $code,
)
);
$this->_view->display('reset-pwd', $data);
}
/**
* 更新密码接口
*
*/
public function updateAction()
{
$code = $this->post('code');
$password = $this->post('pwd');
$info = $this->checkCode($code);
if(Helpers::verifyPassword($password) && !empty($info)) {
//修改密码
if(isset($info['mobile'])) {//手机号修改密码
$mobile = $info['mobile'];
$token = $info['token'];
$area = $info['area'];
$data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
if($data['code']) {
$this->redirect('resetSuccess');
}
} else if(isset($info['uid'])) {//其他方式修改密码
$uid = $info['uid'];
$this->redirect('resetSuccess');
}
}
//跳转错误页面
$this->redirect('/error/index');
}
/**
* 重置密码成功
*/
public function resetSuccessAction() {
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array(
'simpleHeader' => PassportModel::getSimpleHeader(false),
'resetSuccess' => array(
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'countrys' => array()
)
);
$this->_view->display('reset-success', $data);
}
/**
* 手机验证页面
*/
public function verificationAction() {
$phoneNum = $this->getSession('phoneNum');
$area = $this->getSession('area');
$captcha = $this->getSession('captcha');
if(empty($phoneNum)) {
$this->redirect('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array(
'simpleHeader' => PassportModel::getSimpleHeader(false),
'vertificationPage' => true,
'verification' => array(
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'phoneNum' => $phoneNum,
'area' => $area,
'captcha'=> $captcha,
'countrys' => array()
)
);
$this->_view->display('verification', $data);
}
/**
* 手机找回密码验证
*/
public function backmobileAction()
{
$mobile = $this->post('mobile');//phoneNum
$area = $this->post('area');
//$captcha = $this->post('captcha');
$code = $this->post('captcha');//code
if($this->getSession('phoneNum') == $mobile && $this->getSession('area') == $area)
{
$result = BackData::validateMobileCode($mobile, $code, $area);
if($result['code'] == 200) {
$str = json_encode(array(
'mobile'=> $mobile,
'area' => $area,
'token'=> $result['data']['token'],
'create_time' => time()
));
$code = AuthCode::encode($str, PassportModel::BACK_FIND_SECRET_KEY);
$url = '/passport/back/backcode?code='.base64_encode($code);
$this->redirect(SITE_MAIN.$url);
}
}
}
/**
* 检查code
*
* @param string $code
* @return boolean
*/
private function checkCode($code)
{
$code = base64_decode($code);
$info = json_decode(AuthCode::decode($code, PassportModel::BACK_FIND_SECRET_KEY), true);
if ($info['create_time'] < 1 || (time() - $info['create_time']) > 86400) {
return array();
}
return $info;
}
<?php
use Action\WebAction;
use LibModels\Web\Passport\RegData;
use Passport\PassportModel;
use Plugin\Helpers;
use LibModels\Wap\Passport\BackData;
use Plugin\AuthCode;
class BackController extends WebAction
{
/**
* 找回密码
*/
public function indexAction()
{
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array(
'simpleHeader' => PassportModel::getSimpleHeader(false),
'backPage' => true,
'back' => array(
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'countryCode' => '86',
'countryName' => '中国',
'captchaUrl'=>'/passport/images?t=1449799445',
'countryList' => RegData::getAreasData(),
)
);
$this->_view->display('index', $data);
}
public function authcodeAction()
{
echo $this->echoJson(array('code'=> 200));
}
/**
*
*/
public function emailAction()
{
$phoneNum = $this->post('phoneNum','');
$area = $this->post('area','86');
$verifyCode = $this->post('verifyCode','');
if(Helpers::verifyEmail($phoneNum)){ //验证邮箱
$email = $phoneNum;
$data = BackData::sendCodeToEmail($email);
if($data['code'] == 200) {
$this->setSession('email', $email);
$this->redirect('sendemail');
}
else {
$this->redirect('index');
}
} else if(Helpers::verifyMobile($phoneNum)) {//验证手机号
$mobile = $phoneNum;
$data = BackData::sendCodeToMobile($mobile);
if($data['code'] == 200) {
$this->setSession('mobile', $mobile);
$this->setSession('area', $area);
$this->setSession('verifyCode', $verifyCode);
$this->redirect('verification');
}
else {
$this->redirect('index');
}
}
}
/**
* 发送邮件页面
*/
public function sendemailAction() {
$email = $this->getSession('email');
if(empty($email)) {
$this->redirect('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array(
'simpleHeader' => PassportModel::getSimpleHeader(false),
'sendEmail' => array(
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'countrys' => array(),
)
);
$this->_view->display('send-email', $data);
}
/**
* 重置密码页面
*/
public function backcodeAction() {
$code = $this->get('code');
$info = $this->checkCode($code);
if(empty($info)) {
$this->redirect('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array(
'simpleHeader' => PassportModel::getSimpleHeader(false),
'resetPage' => true,
'resetPwd' => array(
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'countrys' => array(),
'code' => $code,
)
);
$this->_view->display('reset-pwd', $data);
}
/**
* 更新密码接口
*
*/
public function updateAction()
{
$code = $this->post('code');
$password = $this->post('pwd');
$info = $this->checkCode($code);
if(Helpers::verifyPassword($password) && !empty($info)) {
//修改密码
if(isset($info['mobile'])) {//手机号修改密码
$mobile = $info['mobile'];
$token = $info['token'];
$area = $info['area'];
$data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
if($data['code']) {
$this->redirect('resetSuccess');
}
} else if(isset($info['uid'])) {//其他方式修改密码
$uid = $info['uid'];
$this->redirect('resetSuccess');
}
}
//跳转错误页面
$this->redirect('/error/index');
}
/**
* 重置密码成功
*/
public function resetSuccessAction() {
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array(
'simpleHeader' => PassportModel::getSimpleHeader(false),
'resetSuccess' => array(
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'countrys' => array()
)
);
$this->_view->display('reset-success', $data);
}
/**
* 手机验证页面
*/
public function verificationAction() {
$mobile = $this->getSession('mobile');
$area = $this->getSession('area');
$verifyCode = $this->getSession('verifyCode');
if(empty($mobile)) {
$this->redirect('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array(
'simpleHeader' => PassportModel::getSimpleHeader(false),
'vertificationPage' => true,
'verification' => array(
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'mobile' => $mobile,
'area' => $area,
'verifyCode'=> $verifyCode,
'countrys' => array()
)
);
$this->_view->display('verification', $data);
}
/**
* 手机找回密码验证
*/
public function backmobileAction()
{
$mobile = $this->post('mobile');
$area = $this->post('area');
$verifyCode = $this->post('verifyCode');
$code = $this->post('code');//code
if($this->getSession('mobile') == $mobile && $this->getSession('area') == $area)
{
$result = BackData::validateMobileCode($mobile, $code, $area);
if($result['code'] == 200) {
$str = json_encode(array(
'mobile'=> $mobile,
'area' => $area,
'token'=> $result['data']['token'],
'create_time' => time()
));
$code = AuthCode::encode($str, PassportModel::BACK_FIND_SECRET_KEY);
$url = '/passport/back/backcode?code='.base64_encode($code);
$this->redirect(SITE_MAIN.$url);
}
}
}
/**
* 检查code
*
* @param string $code
* @return boolean
*/
private function checkCode($code)
{
$code = base64_decode($code);
$info = json_decode(AuthCode::decode($code, PassportModel::BACK_FIND_SECRET_KEY), true);
if ($info['create_time'] < 1 || (time() - $info['create_time']) > 86400) {
return array();
}
return $info;
}
}
\ No newline at end of file
... ...
... ... @@ -22,12 +22,12 @@ class RegisterController extends WebAction
'region' => RegData::getAreasData(),
'location' => '+86',
'captchaUrl' => '/passport/images?t=1449799445',
'itemUrl' => '##',
'itemUrl' => 'http://www.yohobuy.com/help/?category_id=9',
'referUrl' => $refer,
'loginUrl' => '/signin.html?refer='.$refer,
'coverHref' => $cover['url'],
'coverImg' => $cover['img'],
'regBtnText' => '快速登录'
'regBtnText' => '立即注册'
)
);
$this->setCookie('refer', $refer);
... ...