Authored by Rock Zhang

Merge branch 'feature/wap323' into 'feature/wap323'

1.有货币页面改造 2.品牌一览页面增加顶部导航。 code review by Zhang Zhen

See merge request !90
... ... @@ -13,6 +13,7 @@ var swiper,
$fixTitleBar,
$brandList = $('.brand-list'),
$icon = $('.search-icon'),
$genderItem = $('.genderNav li'),
hotBrandsSwiper;
var searchH = $('.newbrand-search').outerHeight(),
... ... @@ -177,3 +178,11 @@ if ($('.brand-search-page').length) {
});
}
if ($genderItem.length > 0) {
$genderItem.on('touchstart', function() {
$('.genderNav ul .active').removeClass('active');
$(this).addClass('active');
window.location.search = 'channel=' + ($(this).data('id') + 1);
});
}
... ...
... ... @@ -193,4 +193,4 @@ exports.set = function(c) {
});
};
require('./maybe-like');
\ No newline at end of file
require('./maybe-like')();
... ...
... ... @@ -4,40 +4,45 @@
* @date: 2015/10/12
*/
var $ = require('jquery'),
module.exports = function(specificGender) {
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
tip = require('../plugin/tip'),
loading = require('../plugin/loading'),
lazyLoad = require('yoho.lazyload');
var navHammer,
var navHammer,
winH = $(window).height(),
$goodList = $('#goods-list'),
searching = false,
page = 0,
gender = null,
kidsType = $('.mobile-wrap').hasClass('kids-wrap') ? true : false,
lifestyleType = $('.mobile-wrap').hasClass('lifestyle-wrap') ? true : false,
num,
url;
var $curNav,
//The kidsType can be specified by the parameter. Add by @ZhaoBiao
var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false,
lifestyleType = specificGender === 'lifestyle' ||
$('.mobile-wrap').hasClass('lifestyle-wrap') ? true : false;
var $curNav,
index,
$navList = $('#maybe-like-nav');
//ajax url
if (kidsType) {
//ajax url
if (kidsType) {
url = '/product/recom/maylikekids';
} else if (lifestyleType) {
} else if (lifestyleType) {
url = '/product/recom/maylikelife';
} else {
gender = $('.mobile-wrap').hasClass('boys-wrap') ? '1,3' : '2,3',
} else {
gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ?
'1,3' : '2,3',
url = '/product/recom/maylike?gender=' + gender;
}
}
$curNav = $navList.children('.focus');
$curNav = $navList.children('.focus');
if (lifestyleType) {
if (lifestyleType) {
navHammer = new Hammer($navList[0]);
navHammer.on('tap', function(e) {
var $this = $(e.target).closest('li'),
... ... @@ -63,11 +68,11 @@ if (lifestyleType) {
$(document).trigger('scroll'); //Trigger lazyLoad
e.srcEvent.stopPropagation();
});
}
}
loading.init($('.maybe-like'));
loading.init($('.maybe-like'));
function search() {
function search() {
if (searching) {
return;
}
... ... @@ -131,19 +136,25 @@ function search() {
loading.hideLoadingMask();
}
});
}
}
$('.maybe-like p').on('touchstart', function(e) {
$('.maybe-like p').on('touchstart', function(e) {
search();
});
});
function scrollHandler() {
function scrollHandler() {
if ($(window).scrollTop() + winH >= $(document).height() - 200) {
search();
}
}
}
//srcoll to load more
$(window).scroll(function() {
// 优惠券页面直接加载你可能喜欢。add by @zhaobiao
if (specificGender) {
search();
}
//srcoll to load more
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
\ No newline at end of file
});
};
... ...
/**
* 新有货币界面
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2015/12/30
*/
function getGender() {
return window.cookie('_Channel');
}
require('../home/maybe-like')(getGender());
... ...
... ... @@ -19,3 +19,4 @@ require('./logistic');
require('./pay');
require('./personal-details');
require('./currency');
require('./currency-new');
... ...
.brand-page {
.re-pos-search {
top: 170rem / $pxConvertRem !important;
}
.genderNav {
display: block;
width: 100%;
height: 80rem / $pxConvertRem;
line-height: 80rem / $pxConvertRem;
overflow: hidden;
color: #aeaeae;
z-index: 3;
position: fixed;
top: 90rem / $pxConvertRem;
border-bottom: 1px solid #e1e1e1;
background-color: #fff;
ul{
width: 100%;
height: 90%;
overflow: hidden;
li{
width: 25%;
height: 100%;
overflow: hidden;
float: left;
text-align: center;
position: relative;
font-size: 28rem / $pxConvertRem;
i{
width: 100%;
height: 40%;
overflow: hidden;
display: block;
}
span:not(.split-border){
width: 100%;
height: auto;
overflow: hidden;
display: block;
//line-height: 40rem / $pxConvertRem;
}
.split-border {
display: inline-block;
width: 2px;
height: 1rem;
background-color: #e1e1e1;
position: absolute;
top: 30%;
right: 0;
}
}
li:last-child {
.split-border {
display: none;
}
}
li.active {
color: #444;
}
}
}
.newbrand-search {
width: 93.75%;
height: 60rem / $pxConvertRem;
... ...
... ... @@ -2,7 +2,18 @@
<div class="brand-page yoho-page">
{{# channel}}
<div class="newbrand-search">
<div class="genderNav">
<ul>
{{# channels}}
<li {{#if active}}class="active"{{/if}} data-id="{{@index}}">
<span>{{name}}</span>
<span class="split-border"></span>
</li>
{{/channels}}
</ul>
</div>
<div class="newbrand-search re-pos-search">
<div class="search-box clearfix">
<a href="{{searchUrl}}" >
<input type="text" class="search-input" placeholder="查找品牌" readonly="true">
... ...
{{> layout/header}}
<div class="yoho-coin-new-page yoho-page">
<div class="coin">
{{# yohoCoin}}
<p class="coin-num">
7876
{{coinNum}}
</p>
<p class="info">
<span class="dollar"></span>
YOHO
</p>
<a href="" class="more">查看明细</a>
<a href="/home/currencyDetail" class="more">查看明细</a>
<div class="coin-tip">
<span class="icon">!</span>
您有300个YOHO币即将于20171231日过期,请尽快使用
{{notice}}
</div>
{{/ yohoCoin}}
</div>
<div class="banner">
<a href="">
{{#banner}}
<a href="{{url}}">
{{!-- 演示图片 --}}
<img src="http://temp.im/640x200" alt="">
<img src="{{img}}" alt="img">
</a>
{{/banner}}
</div>
{{> home/maybe_like}}
... ...
... ... @@ -81,7 +81,7 @@
优惠券
<span class="iconfont num">{{coupon_num}} &#xe604;</span>
</a>
<a class="list-item" href="/home/currencyDetail">
<a class="list-item" href="/home/currency">
<span class="iconfont icon">&#xe635;</span>
YOHO
<span class="iconfont num">{{yoho_coin_num}} &#xe604;</span>
... ...
... ... @@ -334,3 +334,9 @@
seajs.use('js/me/currency');
</script>
{{/if}}
{{#if currencyPage}}
<script>
seajs.use('js/me/currency-new');
</script>
{{/if}}
... ...
... ... @@ -264,8 +264,9 @@ class HomeController extends AbstractAction
// banenr数据
$currency['banner'] = UserModel::getYohoCoinBanner();
$currency['pageFooter'] = true;
$currency['currencyPage'] = true;
$this->_view->display('currency', $currency);
$this->_view->display('currency-new', $currency);
}
/**
... ...
... ... @@ -40,20 +40,20 @@ class BrandModel
// 设置品牌一览顶部频道导航
$channels = array(
1 => array(
array(
'name' => 'Boy'
),
2 => array(
array(
'name' => 'Girl'
),
3 => array(
array(
'name' => 'Kid'
),
4 => array(
array(
'name' => 'Lifestyle'
)
);
$channels[$channel]['active'] = true;
$channels[$channel-1]['active'] = true;
$result['channels'] = $channels;
/* 根据频道调用接口 */
... ...