Authored by whb

index css, js

... ... @@ -1080,6 +1080,73 @@ function actionTipPic() {
});
}
function closeCover(){
var $cover = $('#cover');
$cover.remove();
}
/**
* 首次进入有弹窗
* @return {[type]} [description]
*/
function actionCover() {
var gender = cookieMap._Gender;
setCookie('_Channel','boys',{path : '/',domain : '.yohobuy.com',expires : 7});
if(typeof gender == 'undefined' || gender == '' || gender == null){
$.get('http://www.yohobuy.com/index/guide', function(data){
var newMask = document.createElement("div");
newMask.id = 'cover';
newMask.innerHTML=data;
document.body.appendChild(newMask);
var window_height = $(window).height();
var self_height = $('.guide-box').height();
var container_top = window_height / 2 - self_height / 2;
var length=$('.guide-box .clear').find("li").length;
$('.guide-box').css({
width: (200 * length) + 'px',
top: container_top + 'px'
});
$('#cover').bind('click', function(event){
setCookie('_Gender','1,3',{path : '/',domain : '.yohobuy.com',expires : 90});
setCookie('_Channel','boys',{path : '/',domain : '.yohobuy.com',expires : 7});
closeCover();
});
$('#cover .guide-box .close').bind('click', function(event){
getSource('弹窗','CLOSE','homepage_man');
setCookie('_Gender','1,3',{path : '/',domain : '.yohobuy.com',expires : 90});
setCookie('_Channel','boys',{path : '/',domain : '.yohobuy.com',expires : 7});
analy('guide_close');
closeCover();
});
$('.boys img , .boys .go').bind('click', function(event){
getSource('弹窗','BOYS','homepage_man');
setCookie('_Gender','1,3',{path : '/',domain : '.yohobuy.com',expires : 90});
setCookie('_Channel','boys',{path : '/',domain : '.yohobuy.com',expires : 7});
analy( 'guide_boys');
closeCover();
});
$('.girls img, .girls .go').bind('click', function(event){
getSource('弹窗','GIRLS','homepage_woman');
setCookie('_Gender','2,3',{path : '/',domain : '.yohobuy.com',expires : 90});
setCookie('_Channel','girls',{path : '/',domain : '.yohobuy.com',expires : 7});
analy( 'guide_girls');
});
$('.lifestyle img, .lifestyle .go').bind('click', function(event){
setCookie('_Channel','lifestyle',{path : '/',domain : '.yohobuy.com',expires : 7});
getSource('弹窗','LIEFSTYLE','homepage_lifestyle');
analy( 'guide_lifestyle');
});
//防止冒泡事件
$('#cover .guide-box').bind('click', function(event){
event.stopPropagation();
});
});
}
}
/**
* 查询跳转后保留关键字
* @return {[type]} [description]
... ... @@ -1530,7 +1597,7 @@ function actionExeTemplate() {
* @return {[type]} [description]
*/
function actionSearch() {
var searchDomain = 'http://search.yohobuy.com/product/search/suggest';
var searchDomain = 'http://search.yohobuy.com/api/suggest';
$('#query_key').search(searchDomain);
}
... ... @@ -1704,11 +1771,13 @@ function init() {
actionListenDelCarGoods(); //监听购物车删除
actionListenCartMore(); //
actionLoginInfo(); //获取登录信息
actionCover(); //初次登录弹框
}
init();
init();
});
define("js/product/entry", ["jquery","lazyload","handlebars","source-map"], function(require, exports, module){
define("js/product/entry", ["jquery","handlebars","source-map","lazyload"], function(require, exports, module){
/**
* 商品页面打包入口文件
* @auhtor: xuqi<qi.xu@yoho.cn>
... ... @@ -1719,7 +1788,7 @@ require("js/product/list");
require("js/product/hotrank");
});
define("js/product/list", ["jquery","lazyload"], function(require, exports, module){
define("js/product/list", ["jquery","handlebars","source-map","lazyload"], function(require, exports, module){
/**
* 商品列表页
* @author: xuqi<qi.xu@yoho.cn>
... ... @@ -1732,14 +1801,15 @@ require("js/product/sort-pager");
require("js/product/product");
});
define("js/product/filter", ["jquery"], function(require, exports, module){
define("js/product/filter", ["jquery","handlebars","source-map"], function(require, exports, module){
/**
* 商品筛选逻辑
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/12/4
*/
var $ = require("jquery");
var $ = require("jquery"),
Handlebars = require("handlebars");
var checkUnicode = {
unchecked: '&#xe613;',
... ... @@ -1773,6 +1843,13 @@ var $seniorSubWrap = $('.senior-sub-wrap'),
var seniorHoverTime, hoveredIndex;
// 尺寸 handlebars 模板
var sizeTmpl = '{{# size}}<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">{{name}}</a>{{/ size}}',
sizeCache = {}, // 缓存一下尺寸信息
$sizeWrap = $('.filter-box .size');
sizeTmpl = Handlebars.compile(sizeTmpl);
//清除checkbox选中状态
function clearChecked($checkbox) {
$checkbox.removeClass('checked').html(checkUnicode.unchecked);
... ... @@ -1820,13 +1897,45 @@ $('.filter-box').on('selectstart', '.attr, .brands-index span', function() {
//【分类】
$('.sort-pre').on('click', 'li', function() {
var $this = $(this),
index = $this.index();
index = $this.index(),
id = $this.data('id');
if ($this.hasClass('active')) {
// 选中时,再次点击取消选中
$this.removeClass('active');
$sortSub.children(':eq(' + index + ')').addClass('hide');
$sizeWrap.addClass('hide');
return;
}
$this.siblings('.active').removeClass('active');
$this.addClass('active');
$sortSub.children(':not(.hide)').addClass('hide');
$sortSub.children(':eq(' + index + ')').removeClass('hide');
if (sizeCache[id]) {
$sizeWrap.find('.attr-content').html(sizeCache[id]);
$sizeWrap.removeClass('hide');
} else {
$.ajax({
url: '/product/search/sortSize',
data: {
msort: id
}
}).then(function(res) {
if ($.type(res) === 'array' && res.length) {
sizeCache[id] = sizeTmpl({
size: res
});
$sizeWrap.find('.attr-content').html(sizeCache[id]);
$sizeWrap.removeClass('hide');
} else {
$sizeWrap.addClass('hide');
}
});
}
});
//【品牌】
... ... @@ -1867,10 +1976,17 @@ $brandMore.click(function() {
});
//【品牌】索引
$('.brands-index').on('click', 'span', function() {
$('.brands-index').on('mouseenter', 'span', function() {
var $this = $(this),
index = $this.data('index');
if ($this.hasClass('hover')) {
return;
}
$this.siblings('span.hover').removeClass('hover');
$this.addClass('hover');
if ($this.index() === 0) {
//全部
... ... @@ -2397,7 +2513,7 @@ $('.logo-brand').logoBrand({
'<div class="good-info">' +
'<div class="item-img">' +
'<a class="good-thumb" target="_blank" href="\{{url}}">' +
'<img class="lazy" data-original="\{{img}}">' +
'<img class="lazy" data-original="\{{thumb}}">' +
'</a>' +
'</div>' +
'<div class="good-detail-text">' +
... ... @@ -2479,6 +2595,10 @@ $('.logo-brand').logoBrand({
var nowIndex = $(this).index(),
sid = $(this).data('sid');
if ($(this).hasClass('current')) {
return;
}
//处理current样式
$(this).addClass('current').siblings().removeClass('current');
$('.floatlayer').find('li').removeClass('current').eq(nowIndex).addClass('current');
... ... @@ -2497,7 +2617,11 @@ $('.logo-brand').logoBrand({
$('.floatlayer').on('click', 'li', function() {
var nowIndex = $(this).index();
$('.hot-cate').find('li').trigger('click');
if ($(this).hasClass('current')) {
return;
}
$('.hot-cate').find('li').eq(nowIndex).trigger('click');
//处理current样式
$(this).addClass('current').siblings().removeClass('current');
... ... @@ -4510,6 +4634,18 @@ function pwdFn($obj) {
// Tips: 不可以在获得焦点的时候验证,获得焦点和失去焦点的间隔太小,如果中间存在ajax校验的话会出现问题
// ( ▼-▼ )注册页和信息完善页面接口不同
exports.init = function(page) {
$('#agree-terms').click(function() {
if ($(this).attr('notchecked')) {
console.log(1);
$(this).removeAttr('notchecked');
} else {
console.log(2);
$(this).attr('notchecked', 'true');
}
});
$registerPage.find('.va').keyup(function() {
var j,
... ... @@ -4531,7 +4667,7 @@ exports.init = function(page) {
}
if (statusLen === 4 && $('#agree-terms').is(':checked')) {
if (statusLen === 4 && !$('#agree-terms').attr('notchecked')) {
$registerBtn.removeClass('disable').removeAttr('disabled');
} else {
$registerBtn.addClass('disable').attr('disabled', 'true');
... ... @@ -4608,18 +4744,6 @@ exports.init = function(page) {
});
// 防止粘贴密码
/*$('#pwd, #repwd').keydown(function (event) {
console.log(event.ctrlKey);
console.log(isPwd);
console.log(event.keyCode);
if (event.ctrlKey && isPwd && event.keyCode === 86) {
$(this).val(pwdVal);
}
});*/
$pwd[0].onpaste = function() {
return false;
};
... ... @@ -5288,13 +5412,17 @@ $account.on('keyup', function() {
//密码
$password.on('blur', function() {
validatePassword();
if ($capsLock.hasClass('hide')) {
return;
}
$capsLock.addClass('hide');
}).on('keypress', function(e) {
var code = e.which,
isShift = e.shiftKey || (code === 16) || false;
var code = e.which;
//CapsLock检测
if ((!isShift && (code >= 65 && code <= 90)) ||
(isShift && (code >= 97 && code <= 122))) {
if (code >= 65 && code <= 90) {
$capsLock.removeClass('hide');
return;
}
... ... @@ -5353,7 +5481,7 @@ $('#login-btn').on('click', function() {
if (data.data) {
//防止data.data为undefined时下行语句执行出错而导致脚本不能走到complete去处理authing
location.href = data.data.href;
location.href = data.data.session;
}
} else {
$passwordTip.removeClass('hide').children('em').text(data.message);
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.