Authored by whb

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy.git into develop

... ... @@ -838,6 +838,14 @@
},
...
],
defaultSizes: [
{
numZero: true,
name: 'X',
numStr: '0/10'
},
...
]
totalNum: 20
}
... ...
... ... @@ -18,7 +18,6 @@ var $chosePanel = $('#chose-panel'),
$chosed,
$imgsThumb,
$leftNum,
$leftNumHtml,
leftNum,
confirming,
curColorIndex,
... ... @@ -32,7 +31,6 @@ var $chosePanel = $('#chose-panel'),
queryString,
$yohoPage = $('.yoho-page');
//初始化购物车面板显示
function init() {
hasChooseColor = false;
... ... @@ -43,8 +41,6 @@ function init() {
$allChoseItems = $('.chose-items');
$sizeRowList = $('.size-list ul');
$leftNum = $('#left-num');
$leftNumHtml =
$sizeRowList.eq(0).toggleClass('hide');
}
function checkColorSizeNum() {
... ...
... ... @@ -34,16 +34,22 @@
<div class="size-list block-list">
<span>尺码</span>
{{# sizes}}
<ul class="size-row clearfix hide">
{{# size}}
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id="{{id}}" data-colorid="{{colorId}}" data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodsId}}">
{{name}}
</li>
{{/ size}}
</ul>
<ul class="size-row clearfix hide">
{{# size}}
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id="{{id}}" data-colorid="{{colorId}}" data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodsId}}">
{{name}}
</li>
{{/ size}}
</ul>
{{/ sizes}}
{{#if defaultSizes}}
<ul class="size-row clearfix default-size">
{{#each defaultSizes}}
<li class="block {{#if numZero}}zero-stock{{/if}}" data-numstr="{{numStr}}">{{name}}</li>
{{/each}}
</ul>
{{/if}}
</div>
<p>
<div class="num">
... ...
... ... @@ -13,6 +13,7 @@
<script>
seajs.use(['js/product/list', 'js/product/product'], function (list, product) {
product.init(5);
window.onresize = function () {
setTimeout(function () {
product.init(5);
... ... @@ -28,6 +29,7 @@
<script>
seajs.use(['js/product/list', 'js/product/product'], function (list, product) {
product.init(4);
window.onresize = function () {
setTimeout(function () {
product.init(4);
... ...
... ... @@ -26,7 +26,7 @@
<div class="attr-content clearfix">
{{#each channel}}
<a class="attr" href="{{href}}">
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">
{{name}}
</a>
{{/each}}
... ... @@ -42,7 +42,7 @@
<ul class="sort-pre clearfix">
{{#each sort}}
<li>
<span class="attr">
<span class="attr {{#if checked}}checked{{/if}}">
{{name}}
</span>
</li>
... ... @@ -53,7 +53,7 @@
{{#each sort}}
<ul class="sort-sub clearfix hide">
{{#each sub}}
<li class="attr">
<li class="attr {{#if checked}}checked{{/if}}">
<a href="{{href}}">{{name}}</a>
</li>
{{/each}}
... ... @@ -71,7 +71,7 @@
<div class="attr-content">
<ul class="default clearfix">
{{# default}}
<li class="attr">
<li class="attr {{#if checked}}checked{{/if}}">
<a href="{{href}}" title="{{name}}">{{name}}</a>
</li>
{{/ default}}
... ... @@ -82,7 +82,7 @@
<em>更多</em>
<i class="iconfont">&#xe600;</i>
</span>
<span id="brand-multi" class="multi-select">多选 +</span>
</div>
... ... @@ -128,7 +128,7 @@
<div class="attr-content clearfix">
{{# price}}
<a class="attr" href="{{href}}">¥{{name}}</a>
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">¥{{name}}</a>
{{/ price}}
<div class="ud-price-range">
... ... @@ -146,10 +146,10 @@
{{#if color}}
<div class="color section">
<span class="title">颜色:</span>
<div class="attr-content clearfix">
{{# color}}
<a class="attr" href="{{href}}">
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">
<i class="color-block" style="background: {{rgb}}"></i>
{{name}}
</a>
... ... @@ -164,7 +164,7 @@
<div class="attr-content clearfix">
{{# size}}
<a class="attr" href="{{href}}">{{name}}</a>
<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">{{name}}</a>
{{/ size}}
</div>
</div>
... ... @@ -194,7 +194,7 @@
{{/if}}
<ul class="clearfix check-container">
{{#each sub}}
<li class="attr">
<li class="attr {{#if checked}}checked{{/if}}">
<a href="{{href}}">
<span class="iconfont checkbox" data-id="{{id}}">&#xe613;</span>
<span>{{name}}</span>
... ... @@ -212,4 +212,4 @@
</div>
</div>
{{/if}}
</div>
\ No newline at end of file
</div>
... ...
... ... @@ -9,7 +9,9 @@ var $ = require('yoho.jquery');
var handlebars = require('yoho.handlebars');
var json2 = require('json2');
var noticeSuccess = false;
var apiDomain = 'http://api.open.yohobuy.com';
var vipInfoCombine = null;
var loginInfoCombine = null;
/**
* 判断为1的helper
* @param {[type]} v1 [description]
... ... @@ -24,6 +26,37 @@ handlebars.registerHelper('equalone', function(v1, options) {
return options.inverse(this);
}
});
/**
* 判断等级为3的helper
* @param {[type]} v1 [description]
* @param {[type]} options) { if (v1 [description]
* @return {[type]} [description]
*/
handlebars.registerHelper('equallevelthree', function(v1, options) {
if (v1 === '3') {
return options.fn(this);
} else {
return options.inverse(this);
}
});
/**
* 判断为0的helper
* @param {[type]} v1 [description]
* @param {[type]} options) { if (v1 [description]
* @return {[type]} [description]
*/
handlebars.registerHelper('equalzero', function(v1, options) {
if (v1 === '0') {
return options.fn(this);
} else {
return options.inverse(this);
}
});
require('../plugin/yohocookie');
require('../plugin/yohocart');
/**
... ... @@ -817,6 +850,7 @@ function actionExeTemplate() {
var resulthtml = $('#goodcartempwarpper').html().replace(/\\/g, '');
$('#goodcartempwarpper').html(resulthtml);
vipInfoCombine = handlebars.compile($('#tmpl-my-login-new').html())
}
/**
* 执行搜索
... ... @@ -828,6 +862,138 @@ function actionSearch() {
$('#query_key').search(searchDomain);
}
/**
* 获取登录状态
* @return {[type]} [description]
*/
function actionLoginState(_data) {
var timestamp = new Date().getTime();
var noLoginHtml = '<span>Hi~</span>[<a href="http://www.yohobuy.com/signin.html" class="list-a login-out ">请登录</a>]&nbsp;[<a href="http://www.yohobuy.com/reg.html" class="list-a login-out" onclick="">免费注册</a>]'
var loginHtml = '<span>Hi~<a href="http://www.yohobuy.com/home?t=' + timestamp + '">{{user_name}}</a></span>&nbsp;'+
'{{#equalone is_login}}'+
'[<a href="{{logout}}" class="list-a login-out">退出</a>]'+
'{{else}}'+
'[<a href="http://www.yohobuy.com/signin.html" class="list-a login-out">请登录</a>]&nbsp;'+
'[<a href="http://www.yohobuy.com/reg.html" onclick="" class="list-a login-out">免费注册</a>]'+
'{{/equalone}}';
var boxObj = $('#loginBox');
var info = $.cookie('_UID');
loginInfoCombine = handlebars.compile(loginHtml);
if (typeof info == 'undefined' || info == null) {
boxObj.html(noLoginHtml);
return false;
}
var user = info.split('::');
if (typeof user == 'undefined' || user.length < 4) {
boxObj.html(noLoginHtml);
return false;
}
var userName = user[0] || ' ';
var name = '';
var _length = 0;
for (var t = 0; t < userName.length; t++) {
var char = userName.substr(t, 1);
if (/.*[\u4e00-\u9fa5]+.*$/.test(char)) {
_length += 2;
} else {
_length += 1;
}
}
if (_length <= 10) {
name = userName;
} else {
_num = 0;
for (var t = 0; t < userName.length; t++) {
if (_num < 10) {
var char = userName.substr(t, 1);
if (char != '*') {
if (/.*[\u4e00-\u9fa5]+.*$/.test(char)) {
_num += 2;
} else {
_num += 1;
}
}
name += char;
}
}
if (name.length < userName.length) {
name += '...';
}
}
var _logout = '';
if (/http:\/\//.test(user[3])) {
_logout = user[3].replace('www.yohobuy.com', 'www.yohobuy.com');
} else {
_logout = 'http://www.yohobuy.com/logout_' + user[3] + '.html';
}
var data = {
"user_name": name,
"logout": _logout,
"random": Math.random()
};
var is_login = '1';
if (_data.result === -1) {
is_login = '-1';
}
data['is_login'] = is_login;
boxObj.html(loginInfoCombine(data));
}
/**
* 获得vip用户信息
* @return {[type]} [description]
*/
function actionVipInfo(_data) {
if (_data.result == 1) {
var vipInfo = _data.data;
if (typeof vipInfo == undefined || vipInfo.length < 1) {
return false;
}
$('#myYohoBox').mouseenter(function() {
$(this).addClass('acttags');
$('#myYohoBox .myyoho-info').show().html(vipInfoCombine(vipInfo));
var headUrl = $('.myyoho-photo img').attr('data-url');
if ($._checkUrlState == 1) {
$('.myyoho-photo').show().find('img').attr('src', headUrl);
return;
}
if (headUrl == '' || $._checkUrl != '') {
return;
}
$.ajax({
url: headUrl,
type: 'GET',
complete: function(response) {
if (response.status == 200 || response.status == 0) {
$('.myyoho-photo').show().find('img').attr('src', headUrl);
$._checkUrlState = 1;
}
$._checkUrl = headUrl;
}
});
;
});
$('#myYohoBox').mouseleave(function() {
$(this).removeClass('acttags');
$('#myYohoBox .myyoho-info').hide()
});
} else {}
}
/**
* 获取登录信息
* @return {[type]} [description]
*/
function actionLoginInfo() {
var param = {
method: 'open.passport.get'
};
$.getData(apiDomain, param, function(_data) {
actionLoginState(_data); // 更改登录状态
actionVipInfo(_data);//获得vip;
});
}
/**
* 初始化函数
* @return {[type]} [description]
*/
... ... @@ -849,6 +1015,7 @@ function init() {
actionClickMiniCartBox(); //点击购物车跳转
actionListenDelCarGoods(); //监听购物车删除
actionListenCartMore(); //
actionLoginInfo();//获取登录信息
}
init();
\ No newline at end of file
... ...
... ... @@ -143,22 +143,22 @@ exports.init = function(num) {
display: 'none'
});
});
//鼠标放在颜色列表上效果
$(document).on('hover', '.good-select-color li', function() {
var coverImg = $(this).find('img').attr('data-cover'),
$coverImg = $(this).closest('.good-item-wrapper').find('.good-detail-img').find('img');
$coverImg.attr('src', coverImg);
});
// 左侧导航
$productListNav.click(function() {
if ($(this).hasClass('active')) {
$(this).find('.sort-child-list').stop(true, true).slideUp();
} else {
$(this).find('.sort-child-list').stop(true, true).slideDown();
}
$(this).toggleClass('active');
});
};
\ No newline at end of file
};
//鼠标放在颜色列表上效果
$(document).on('hover', '.good-select-color li', function() {
var coverImg = $(this).find('img').attr('data-cover'),
$coverImg = $(this).closest('.good-item-wrapper').find('.good-detail-img').find('img');
$coverImg.attr('src', coverImg);
});
// 左侧导航
$productListNav.click(function() {
if ($(this).hasClass('active')) {
$(this).find('.sort-child-list').stop(true, true).slideUp();
} else {
$(this).find('.sort-child-list').stop(true, true).slideDown();
}
$(this).toggleClass('active');
});
\ No newline at end of file
... ...
... ... @@ -12,7 +12,7 @@
}
}
.title {
.title {
float: left;
width: 90px;
line-height: 30px;
... ... @@ -44,6 +44,14 @@
margin-left: 0;
}
&.checked {
color: #e01;
a {
color: #e01;
}
}
-moz-user-select: none;
}
... ... @@ -287,4 +295,4 @@
.multi .checkbox {
display: inline;
}
}
\ No newline at end of file
}
... ...
... ... @@ -44,7 +44,8 @@ class Index1Controller extends AbstractAction
'channel' => array(
array(
'href' => '/?gender=1,3',
'name' => 'BOYS'
'name' => 'BOYS',
'checked' => true
),
array(
'href' => '/?gender=2,3',
... ... @@ -63,10 +64,12 @@ class Index1Controller extends AbstractAction
array(
'id' => '1',
'name' => '上衣',
'checked' => true,
'sub' => array(
array(
'href' => '',
'name' => 'T恤'
'name' => 'T恤',
'checked' => true
),
array(
'href' => '',
... ... @@ -95,7 +98,8 @@ class Index1Controller extends AbstractAction
'default' => array(
array(
'href' => '',
'name' => 'CLOT'
'name' => 'CLOT',
'checked' => true
),
array(
'href' => '',
... ... @@ -133,7 +137,8 @@ class Index1Controller extends AbstractAction
'brandIndex' => array(
array(
'index' => 'all',
'name' => '全部'
'name' => '全部',
'checked' => true
),
array(
'index' => '0-9',
... ... @@ -185,7 +190,8 @@ class Index1Controller extends AbstractAction
'price' => array(
array(
'href' => '',
'name' => '0-239'
'name' => '0-239',
'checked' => true
),
array(
'href' => '',
... ... @@ -196,7 +202,8 @@ class Index1Controller extends AbstractAction
array(
'href' => '',
'name' => '黑色',
'rgb' => '#000'
'rgb' => '#000',
'checked' => true
),
array(
'href' => '',
... ... @@ -207,7 +214,8 @@ class Index1Controller extends AbstractAction
'size' => array(
array(
'href' => '',
'name' => 'S'
'name' => 'S',
'checked' => true
),
array(
'href' => '',
... ... @@ -223,7 +231,8 @@ class Index1Controller extends AbstractAction
array(
'id' => '1',
'href' => '',
'name' => '街头'
'name' => '街头',
'checked' => true
),
array(
'id' => '2',
... ... @@ -239,7 +248,8 @@ class Index1Controller extends AbstractAction
array(
'id' => '1',
'href' => '',
'name' => '春天'
'name' => '春天',
'checked' => true
),
array(
'id' => '2',
... ... @@ -1544,4 +1554,4 @@ class Index1Controller extends AbstractAction
$this->echoJson($data);
}
}
\ No newline at end of file
}
... ...