Authored by 梁志锋

update

framework @ 119c247f
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
... ...
... ... @@ -22,6 +22,37 @@ function cookie(name) {
return cookieVal;
}
function setCookie(name, value, options) {
var expires = '',
path,
domain,
secure,
date;
if (typeof value !== 'undefined') {
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
if (options.expires &&
(typeof options.expires === 'number' || options.expires.toUTCString)) {
if (typeof options.expires === 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString();
}
path = options.path ? '; path=' + options.path : '';
domain = options.domain ? '; domain=' + options.domain : '';
secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
}
}
function getUser() {
var c = cookie('_UID'),
user;
... ... @@ -60,7 +91,7 @@ function getShoppingKey() {
}
//页面通用底部位置及status设置
(function() {
(function () {
var $footer = $('#yoho-footer'),
$op = $footer.children('.op-row');
... ... @@ -94,8 +125,10 @@ function getShoppingKey() {
//暴露公共接口
window.cookie = cookie;
window.setCookie = setCookie;
window.getUser = getUser;
window.getUid = getUid;
window.getShoppingKey = getShoppingKey;
\ No newline at end of file
window.getShoppingKey = getShoppingKey;
... ...
... ... @@ -28,7 +28,7 @@ lazyLoad($('img.lazy'));
//$('img:in-viewport').trigger('appear');
//点击首页汉堡menu图标,滑出侧栏导航
$('.nav-btn').on('click', function (event) {
$('.nav-btn').on('tap', function (event) {
if (!$(this).hasClass('menu-open')) {
$('.mobile-wrap').addClass('menu-open');
$('.overlay').addClass('show');
... ... @@ -45,7 +45,7 @@ $('.nav-btn').on('click', function (event) {
});
//点击页面主体,收起侧栏导航及二级导航
$('.mobile-wrap').on('click', function () {
$('.mobile-wrap').on('tap', function () {
if ($(this).hasClass('menu-open')) {
$('.mobile-wrap').removeClass('menu-open');
$('.overlay').removeClass('show');
... ... @@ -59,7 +59,7 @@ $('.mobile-wrap').on('click', function () {
});
//点击一级导航,弹出二级导航
$('.side-nav').on('click', 'li', function () {
$('.side-nav').on('tap', 'li', function () {
if ($(this).find('.sub-nav').size() > 0) {
$('.sub-nav').removeClass('show');
$(this).find('.sub-nav').addClass('show');
... ... @@ -68,7 +68,7 @@ $('.side-nav').on('click', 'li', function () {
//返回一级导航,收起二级导航
$('.sub-nav').each(function () {
$(this).find('li').eq(0).on('click', function (e) {
$(this).find('li').eq(0).on('tap', function (e) {
$('.sub-nav').removeClass('show');
e.stopPropagation();
});
... ... @@ -84,6 +84,7 @@ $('.sub-nav').on('mouseenter', 'li', function () {
//头部banner轮播
if ($('.banner-swiper').find('li').size() > 1) {
bannerSwiper = new Swiper('.banner-swiper', {
lazyLoading: true,
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: false,
... ... @@ -137,15 +138,8 @@ $('.category-swiper').each(function (i, index) {
}
});
//回到顶部
// $('.back-to-top').bind('touchstart', function (e) {
// e.preventDefault();
// $(window).scrollTop(0);
// });
//关闭头部下载浮层
$('.header-download').on('click', '.close-btn', function () {
$('.header-download').on('tap', '.close-btn', function () {
$(this).parent().remove();
});
... ...
... ... @@ -34,7 +34,7 @@ if (kidsType) {
$curNav = $navList.children('.focus');
$('#maybe-like-nav').delegate('li', 'touchstart', function() {
$('#maybe-like-nav').delegate('li', 'tap', function() {
var $this = $(this),
$goods = $('.goods-list'),
$content;
... ...
/**
* 底部JS
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
* @date: 2015/10/26
*/
var $ = require('yoho.zepto');
function downLoadApp() {
var appUrl = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445';
var clickedAt = new Date();
setTimeout(function () {
if ((new Date()) - clickedAt < 2000) {
window.location = appUrl;
}
}, 500);
}
$('#float-layer-close').bind('tap', function () {
$('#float-layer-app').hide();
window.setCookie('_float-layer-app', 'id490655927',
{
domain: '.yohobuy.com'
});
window.setCookie('_float-layer-app-close', 1,
{
domain: '.yohobuy.com',
expires: 1
});
});
$('#float-layer-btn').tap(function () {
downLoadApp('bottom');
});
if (!window.cookie('_float-layer-app')) {
$('#float-layer-app').show();
} else {
$('#float-layer-app').hide();
}
... ...
... ... @@ -5,4 +5,5 @@
*/
require('./search');
require('./channel');
\ No newline at end of file
require('./channel');
require('./footer');
\ No newline at end of file
... ...
... ... @@ -26,7 +26,7 @@ $pwd.bind('input', function() {
}
});
$btnOk.on('touchstart', function() {
$btnOk.on('tap', function() {
var pwd = trim($pwd.val()),
mobileBack = true,
setting,
... ...
... ... @@ -59,6 +59,10 @@ var $listNav = $('#list-nav'),
if ($('.swiper-container .swiper-slide').length > 1) {
swiper = new Swiper('.swiper-container', {
lazyLoading: true,
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: false,
paginationClickable: true,
pagination: '.swiper-pagination'
});
}
... ... @@ -216,7 +220,7 @@ filter.registerCbFn(search);
//3.筛选无active时点击展开筛选面板
//4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
//5.当前active为筛选并且点击其他项时,隐藏筛选面板
$listNav.delegate('li', 'touchstart', function() {
$listNav.delegate('li', 'tap', function() {
var $this = $(this),
nav,
navType,
... ...
... ... @@ -33,6 +33,10 @@ var defaultOpt = {
p_d: $('#p_d').val()
};
var now = new Date(),
month = now.getMonth() + 1,
date = now.getDate();
var $listNav = $('#list-nav'),
//导航数据信息
... ... @@ -59,9 +63,15 @@ var $listNav = $('#list-nav'),
$pgc.addClass('hide');
$dgc.addClass('hide');
$('#today a').text(month + '月' + date + '号');
if ($('.swiper-container .swiper-slide').length > 1) {
swiper = new Swiper('.swiper-container', {
lazyLoading: true,
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: false,
paginationClickable: true,
pagination: '.swiper-pagination'
});
}
... ... @@ -237,7 +247,7 @@ filter.registerCbFn(search);
//3.筛选无active时点击展开筛选面板
//4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态
//5.当前active为筛选并且点击其他项时,隐藏筛选面板
$listNav.delegate('li', 'touchstart', function() {
$listNav.delegate('li', 'tap', function() {
var $this = $(this),
nav,
navType,
... ... @@ -273,7 +283,7 @@ $listNav.delegate('li', 'touchstart', function() {
nav = navInfo[navType];
if (!($this.hasClass('active'))) {
$active = $this.siblings('.active');
$pre = $this; //$pre为除筛选导航的其他导航项,若当前active的为筛选,则把$pre置为当前点击项
... ...
.float-layer {
height: 44px;
background: rgba(68, 68, 68, 0.95);
position: fixed;
width: 100%;
bottom: 0;
left: 0;
z-index: 9999;
padding: 10px 0;
.float-layer-left {
padding-left: 22px;
overflow: hidden;
float: left;
img {
height: 44px;
float: left;
margin-right: 10px;
}
p {
float: left;
font-size: 16px;
height: 44px;
line-height: 44px;
color: white;
}
}
}
#float-layer-close {
position: absolute;
left: 0;
top: 0;
width: 50px;
height: 50px;
}
#float-layer-btn {
position: absolute;
top: 50%;
right: 15px;
font-size: 16px;
padding: 0 10px;
height: 27px;
line-height: 27px;
background: white;
border-radius: 5px;
margin-top: -13px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0.5);
}
\ No newline at end of file
... ...
... ... @@ -39,5 +39,5 @@
}
@import "search";
@import "search","footer";
... ...
... ... @@ -38,4 +38,5 @@
width: 100%;
bottom: 0;
}
}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="mobile-wrap boys-wrap yoho-page">
{{# headerDownload}}
{{> home/header_download}}
{{/ headerDownload}}
{{! 首页header}}
{{# homeHeader}}
{{> home/home_header}}
... ... @@ -20,4 +15,5 @@
<div class="overlay"></div>
</div>
{{> home/side_nav}}
{{> layout/footer}}
\ No newline at end of file
{{> layout/footer}}
{{> layout/download_app}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="mobile-wrap girls-wrap yoho-page">
{{# headerDownload}}
{{> home/header_download}}
{{/ headerDownload}}
{{! 首页header}}
{{! 首页header}}
{{# homeHeader}}
{{> home/home_header}}
{{/ homeHeader}}
... ... @@ -14,5 +9,6 @@
<div class="overlay"></div>
</div>
{{> home/side_nav}}
{{> layout/footer}}
\ No newline at end of file
{{> home/side_nav}}
{{> layout/footer}}
{{> layout/download_app}}
\ No newline at end of file
... ...
... ... @@ -16,4 +16,5 @@
</div>
</div>
{{>layout/footer}}
\ No newline at end of file
{{>layout/footer}}
{{> layout/download_app}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="mobile-wrap kids-wrap yoho-page">
{{! app下载}}
{{# headerDownload}}
{{> home/header_download}}
{{/ headerDownload}}
{{! 首页header}}
{{# homeHeader}}
{{> home/home_header}}
... ... @@ -26,4 +21,5 @@
<div class="overlay"></div>
</div>
{{> home/side_nav}}
{{> layout/footer}}
\ No newline at end of file
{{> layout/footer}}
{{> layout/download_app}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="mobile-wrap lifestyle-wrap yoho-page">
{{! app下载}}
{{# headerDownload}}
{{> home/header_download}}
{{/ headerDownload}}
{{! 首页header}}
{{# homeHeader}}
{{> home/home_header}}
... ... @@ -24,4 +19,5 @@
<div class="overlay"></div>
</div>
{{> home/side_nav}}
{{> layout/footer}}
\ No newline at end of file
{{> layout/footer}}
{{> layout/download_app}}
\ No newline at end of file
... ...
... ... @@ -5,9 +5,8 @@
{{/ headerBanner}}
<ul id="list-nav" class="list-nav clearfix">
<li class="today active">
<a href="javascript:void(0);">
1026
<li id="today" class="today active">
<a href="javascript:void(0);">
</a>
</li>
<li class="week">
... ...
{{#showDownloadApp}}
<div class="float-layer hide" id="float-layer-app">
<div class="float-layer-left">
<img src="http://static.yohobuy.com/m/v1/img/yohobuy_new.png" alt="">
<p>新用户首单减10元</p>
</div>
<a href="javascript:void(0);" id="float-layer-close" >
<img src="http://static.yohobuy.com/m/v1/img/close_new.png" width="22">
</a>
<a href="http://m.yohobuy.com/download/hyapp" id="float-layer-btn">
立即下载
</a>
</div>
{{/showDownloadApp}}
\ No newline at end of file
... ...
... ... @@ -10,4 +10,6 @@
CopyRight©2007-2016 南京新与力文化传播有限公司
</address>
</footer>
{{/pageFooter}}
\ No newline at end of file
{{/pageFooter}}
\ No newline at end of file
... ...
... ... @@ -85,25 +85,36 @@
</script>
{{/if}}
{{!-- 频道选择页 --}}
{{#if channelPage}}
<script>
seajs.use('js/index/footer');
</script>
{{/if}}
{{!-- 首页 --}}
{{#if grilsHomePage}}
<script>
seajs.use('js/home/home');
seajs.use('js/index/footer');
</script>
{{/if}}
{{#if boysHomePage}}
<script>
seajs.use('js/home/home');
seajs.use('js/index/footer');
</script>
{{/if}}
{{#if kidsHomePage}}
<script>
seajs.use('js/home/home');
seajs.use('js/index/footer');
</script>
{{/if}}
{{#if lifestyleHomePage}}
<script>
seajs.use('js/home/home');
seajs.use('js/index/footer');
</script>
{{/if}}
... ...