Authored by 梁志锋

Merge remote-tracking branch 'origin/develop' into beta

... ... @@ -23,18 +23,18 @@ class Yohobuy
const SERVICE_URL = 'http://service.api.yohobuy.com/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';**/
const API_URL = 'http://apih5.yoho.cn/';
const API_URL2 = 'http://apih5.yoho.cn/';
const SERVICE_URL = 'http://serviceh5.yoho.cn/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://api2.open.yohobuy.com/';
// const API_URL = 'http://apih5.yoho.cn/';
// const API_URL2 = 'http://apih5.yoho.cn/';
// const SERVICE_URL = 'http://serviceh5.yoho.cn/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
// /* 测试环境 */
// const API_URL = 'http://192.168.102.205:8080/gateway/'; // 先临时使用网关
/* const API_URL = 'http://testapi.yoho.cn:28078/';
const API_URL = 'http://testapi.yoho.cn:28078/';
const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://test2.open.yohobuy.com/';*/
const API_OLD = 'http://test2.open.yohobuy.com/';
/* 预览环境 */
// const API_URL = 'http://preapi.yoho.cn/';
... ...
... ... @@ -151,7 +151,7 @@ function changeSizeChosed(newSizeIndex) {
}
}
//老的选中尺码在新选中的颜色对应尺码中不存在,需要下述1,2,3,4
//特殊处理: 老的选中尺码在新选中的颜色对应尺码中不存在,需要下述1,2,3
// 1.重置尺码选择的标志变量.
$curSizeBlock = null;
hasChooseSize = false;
... ... @@ -161,9 +161,7 @@ function changeSizeChosed(newSizeIndex) {
// 3.目标颜色行第一行显示
$colorRowList.eq(0).removeClass('hide');
// 4.老的选中颜色去掉勾选,新的选中颜色加上勾选
//changeColorChosed(0);
curColorIndex = 0;
return -1;
}
... ... @@ -235,14 +233,6 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
$sizeRowList.eq(index + 1).removeClass('hide');
curSizeIndex = index + 1;
// 特殊处理
//if (-1 === curGoodNum) {
//
// //index = $this.data('index') - 1;
//
//}
$curColorBlock = $this;
// 修改颜色时修改商品图片
... ... @@ -251,7 +241,15 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
// 颜色块切换勾选样式
$this.siblings('.chosed').removeClass('chosed');
$this.toggleClass('chosed');
// 特殊处理
if (-1 === curGoodNum) {
$curColorBlock = $($colorRowList.eq(0).children().get(index));
$curColorBlock.addClass('chosed');
} else {
$this.toggleClass('chosed');
}
$('#good-num').val(1);
// 设置按钮的样式和文字
... ...
... ... @@ -5,7 +5,7 @@
*/
function getGender() {
return window.cookie('_Channel');
return window.cookie('_Channel') || 'boys';
}
require('../home/maybe-like')(getGender());
... ...
... ... @@ -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.
... ... @@ -72,12 +72,15 @@ class PassportModel
$resource = IndexData::getResourceData($code);
if(isset($resource['data'][0]))
{
$val = current($resource['data'][0]['data']);
if($resource['data'][0]['template_name'] == 'single_image') {
$val = current($resource['data'][0]['data']);
} else if($resource['data'][0]['template_name'] == 'single_name_image') {
$val = $resource['data'][0]['data'];
}
$ret['img'] = Images::getImageUrl($val['src'], 252, 190);
$ret['url'] = $val['url'];
}
else
{
else {
$ret['img'] = 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190';
$ret['url'] = '';
}
... ...