Authored by 周少峰

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into feature/web-list

... ... @@ -513,6 +513,11 @@
{
attr: 'style', //查找的键值
name: '风格',
//若无子项,传url
url: '',
//若有子项,传sub
showMulti: true, //是否显示多选按钮
sub: [
{
... ...
... ... @@ -196,17 +196,22 @@
<div class="attr-content">
<ul class="clearfix senior-attr-wrap">
{{#each seniorChose}}
<li class="attr">
<li class="attr{{#unless sub}} no-sub{{/unless}}">
{{#if sub}}
{{name}}
<span class="iconfont">&#xe600;</span>
<div class="senior-up-icon"></div>
{{^}}
<a href="{{url}}">{{name}}</a>
{{/if}}
</li>
{{/each}}
</ul>
<div class="senior-sub-wrap">
{{#each seniorChose}}
{{#if sub}}
<div class="senior-sub hide" data-attr="{{attr}}">
<div class="senior-content">
{{#if showMulti}}
... ... @@ -228,6 +233,7 @@
</div>
</div>
</div>
{{/if}}
{{/each}}
</div>
</div>
... ...
{{#if latestWalk}}
<input id="latest-walk-count" type="hidden" value="{{latestWalk}}">
<div class="latest-walk">
<h2>最近浏览的商品</h2>
<div class="goods clearfix">
{{# latestWalk}}
<div id="latest-walk-goods" class="goods clearfix"></div>
</div>
<script id="latest-walk-tpl" type="text/html">
\{{# latestWalk}}
<div class="good">
<a href="{{href}}">
<img class="lazy" data-original="{{img}}">
<a href="\{{href}}">
<img class="lazy" data-original="\{{img}}">
</a>
<a class="name" href="{{href}}">{{name}}</a>
<a class="name" href="\{{href}}">\{{name}}</a>
<p class="price">
{{#if salePrice}}
<span class="market-price">¥{{marketPrice}}</span>
{{/if}}
<span class="sale-price">¥{{salePrice}}</span>
<span class="market-price">\{{marketPrice}}</span>
<span class="sale-price">\{{salePrice}}</span>
</p>
</div>
{{/ latestWalk}}
</div>
</div>
\{{/ latestWalk}}
</script>
{{/if}}
\ No newline at end of file
... ...
... ... @@ -17,7 +17,7 @@ $sc.click(function() {
$.post('/passport/back/sendbackmobile', {
mobile: $('#mobile').val(),
area: $('#area').val(),
verifyCode: $('#captchaPic').val(),
verifyCode: $('#captchaPic').val()
}, function(jsonData) {
if (jsonData.code === 200) {
$errTip.hide();
... ... @@ -71,17 +71,33 @@ itime = setInterval(function() {
$('#captcha').keyup(function() {
var v = $.trim($(this).val());
if (v !== '') {
var v = $.trim($(this).val()),
that = this;
if (v.length === 4) {
$.ajax({
type: 'POST',
url: '/passport/back/backmobile',
dataType: 'json',
data: {
verifyCode: $('#captcha').val(),
area: $('#area').val(),
mobile: $('#mobile').val()
},
success: function(res) {
if (res.code === 200) {
//添加验证码正确验证
//$next.removeClass('disable').prop('disabled', false);
$next.removeClass('disable').removeAttr('disabled');
$errTip.addClass('hide');
$(that).removeClass('error');
} else {
//$next.addClass('disable').prop('disabled', true);
$next.addClass('disable').attr('disabled', true);
$errTip.removeClass('hide').find('em').text('验证码输入错误');
$(that).addClass('error');
}
}
});
}
}).blur(function() {
var v = $.trim($(this).val());
... ... @@ -90,10 +106,7 @@ $('#captcha').keyup(function() {
//添加验证码正确验证
$(this).addClass('error');
$errTip.removeClass('hide');
} else {
$(this).removeClass('error');
$errTip.addClass('hide');
$errTip.removeClass('hide').text('请输入验证码');
}
}).focus(function() {
$(this).removeClass('error');
... ...
... ... @@ -309,6 +309,9 @@ $seniorAttrWrap.on('mouseenter', '.attr', function() {
var $this = $(this);
var index = $this.index();
if ($this.hasClass('no-sub')) {
return;
}
$this.addClass('hover').siblings().removeClass('hover');
$seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide');
... ... @@ -316,6 +319,10 @@ $seniorAttrWrap.on('mouseenter', '.attr', function() {
var $this = $(this),
index = $this.index();
if ($this.hasClass('no-sub')) {
return;
}
hoveredIndex = index;
seniorHoverTime = setTimeout(function() {
... ...
/**
* 最近浏览取接口渲染模板
* @author: xuqi<qi.xu@yoho.cn>
8 @date: 2016/1/20
*/
var $ = require('yoho.jquery');
var Handlebars = require('yoho.handlebars');
var lazyLoad = require('yoho.lazyload');
var $latestWalkCount = $('#latest-walk-count');
(function() {
var tpl;
if ($latestWalkCount.lenght < 0) {
return;
}
tpl = Handlebars.compile($('#latest-walk-tpl').html());
$.ajax({
url: 'http://itemapi.yohobuy.com/item/item/recentreview',
dataType: 'jsonp',
data: {
limit: $latestWalkCount.val()
},
success: function(data) {
var latestWalk = [],
res, i, cur;
if (data.code === 200) {
res = data.data;
for (i = 0; i < res.length; i++) {
cur = res[i];
latestWalk.push({
href: cur.url,
img: cur.pic_url,
name: cur.product_name,
salePrice: cur.price,
marketPrice: cur.market_price
});
}
if (latestWalk.length > 0) {
$('#latest-walk-goods').html(tpl({
latestWalk: latestWalk
}));
lazyLoad($('#latest-walk-goods .lazy'));
}
}
}
});
}());
\ No newline at end of file
... ...
... ... @@ -8,4 +8,6 @@ require('./filter');
require('./sort-pager');
require('./latest-walk');
require('./product');
\ No newline at end of file
... ...
... ... @@ -386,6 +386,10 @@
}
}
.promise .left {
margin-right: 45px;
}
.subscribe {
width: 200px;
... ...
... ... @@ -248,19 +248,7 @@ class Index1Controller extends AbstractAction
array(
'attr' => 'weather',
'name' => '适用季节',
'sub' => array(
array(
'id' => '1',
'href' => '',
'name' => '春天',
'checked' => true
),
array(
'id' => '2',
'href' => '',
'name' => '夏天'
)
)
'url' => ''
)
)
),
... ... @@ -970,44 +958,7 @@ class Index1Controller extends AbstractAction
),
'totalCount' => '2259',
'pager' => '<a href="" class="cur"><span>1</span></a><a href=""><span>2</span></a><a href="" title="下一页">下一页<span class="iconfont">&gt;</span></a>',
'latestWalk' => array(
array(
'img' => 'http://img11.static.yhbimg.com/goodsimg/2015/08/24/11/018fd5cbe604b37ea35336257fcbff8114.jpg?imageMogr2/thumbnail/195x260/extent/195x260/background/d2hpdGU=/position/center/quality/90',
'name' => 'Life·After Life 牛角扣夹棉连帽大衣(M51款)【吴亦凡亲身试着】',
'marketPrice' => '939',
'salePrice' => '679'
),
array(
'img' => 'http://img10.static.yhbimg.com/goodsimg/2014/11/05/08/0110a09053658b079265a553ee20a5779d.jpg?imageMogr2/thumbnail/195x260/extent/195x260/background/d2hpdGU=/position/center/quality/90',
'name' => 'th:字母撞色毛衣',
'marketPrice' => '698',
'salePrice' => '209'
),
array(
'img' => 'http://img10.static.yhbimg.com/goodsimg/2014/11/05/08/0110a09053658b079265a553ee20a5779d.jpg?imageMogr2/thumbnail/195x260/extent/195x260/background/d2hpdGU=/position/center/quality/90',
'name' => 'th:字母撞色毛衣',
'marketPrice' => '698',
'salePrice' => '209'
),
array(
'img' => 'http://img10.static.yhbimg.com/goodsimg/2014/11/05/08/0110a09053658b079265a553ee20a5779d.jpg?imageMogr2/thumbnail/195x260/extent/195x260/background/d2hpdGU=/position/center/quality/90',
'name' => 'th:字母撞色毛衣',
'marketPrice' => '698',
'salePrice' => '209'
),
array(
'img' => 'http://img10.static.yhbimg.com/goodsimg/2014/11/05/08/0110a09053658b079265a553ee20a5779d.jpg?imageMogr2/thumbnail/195x260/extent/195x260/background/d2hpdGU=/position/center/quality/90',
'name' => 'th:字母撞色毛衣',
'marketPrice' => '698',
'salePrice' => '209'
),
array(
'img' => 'http://img10.static.yhbimg.com/goodsimg/2014/11/05/08/0110a09053658b079265a553ee20a5779d.jpg?imageMogr2/thumbnail/195x260/extent/195x260/background/d2hpdGU=/position/center/quality/90',
'name' => 'th:字母撞色毛衣',
'marketPrice' => '698',
'salePrice' => '209'
)
)
'latestWalk' => 6
)
);
$this->_view->display('list', $data);
... ...