Authored by Lynnic

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

Conflicts:
	static/js/product/detail/detail.js
	static/sass/product/_detail.scss
Showing 47 changed files with 306 additions and 366 deletions
... ... @@ -1096,13 +1096,13 @@
'vipLevel' : {
'list' : [
{
'text' : '¥284.00'
'text' : '¥284.00',
'currentLevel':true
},
...
]
},
'goodsDiscount' : {
'listLength' : 2,
'list' : [
{
'text' : '【BACK TO SCHOOL】满¥499赠送Paul Franke帽子一个,多买多送!'
... ... @@ -1234,12 +1234,29 @@
},
'cartInfo' : {
'numInCart' : 3,
'goodsInstore' : 0,
'isCollect':true//
'cartUrl':'购物车url',
'addToCartUrl':'添加购物车url',
'soldOut':'已售罄',
'notForSale':'非卖品'
},
'introUrl' : '',
'id' : '',
'preferenceUrl' :''
}
### 咨询列表页面
{
'link' : '咨询表单跳转url',
'consults':{
'list' : [
{
'question':'',
'time':'',
'answer':''
}
...
]
}
}
### 支付中心
{
... ...
... ... @@ -34,6 +34,7 @@ class AbstractAction extends Controller_Abstract
protected $_uid = 0;
protected $_uname = '';
protected $_vip;
protected $_useSession = true;
/**
* 存放模板数据
... ... @@ -53,16 +54,20 @@ class AbstractAction extends Controller_Abstract
switch (APPLICATION_ENV) {
case 'production': // 生产
$this->_view->assign('rlsEnv', true);
$this->_useSession = true;
break;
case 'preview': // 预览
$this->_view->assign('preEnv', true);
$this->_useSession = true;
break;
case 'testing': // 测试
$this->_view->assign('testEnv', true);
$this->_useSession = true;
break;
case 'develop': // 开发
default:
$this->_view->assign('devEnv', true);
$this->_useSession = false;
break;
}
}
... ... @@ -261,7 +266,9 @@ class AbstractAction extends Controller_Abstract
*/
public function setSession($name, $value)
{
Session::start('yohobuy_session', null, 'yohobuy.com')->__set($name, $value);
if ($this->_useSession) {
Session::start('yohobuy_session', null, 'yohobuy.com')->__set($name, $value);
}
}
/**
... ... @@ -272,7 +279,11 @@ class AbstractAction extends Controller_Abstract
*/
public function getSession($name)
{
return Session::start('yohobuy_session', null, 'yohobuy.com')->__get($name);
if ($this->_useSession) {
return Session::start('yohobuy_session', null, 'yohobuy.com')->__get($name);
} else {
return '';
}
}
/**
... ... @@ -283,26 +294,27 @@ class AbstractAction extends Controller_Abstract
*/
protected function getUid($useSession = false)
{
// @todo
$useSession = false;
// 控制是否启用SESSION
if (!$this->_useSession) {
$useSession = false;
}
if (!$this->_uid) {
$cookie = $this->getCookie('_UID');
if (!empty($cookie)) {
$uid = 0;
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
$uid = $cookieList[1];
if ($useSession) {
$token = $this->getSession('_TOKEN');
if ($token === Helpers::makeToken($cookieList[1])) {
$this->_uid = $cookieList[1];
}
} else {
$this->_uid = $cookieList[1];
}
$this->_uname = $cookieList[0];
$this->_vip = $cookieList[2];
}
// 服务端比较
if ($useSession && $uid) {
$token = $this->getSession('_TOKEN');
if ($token === Helpers::makeToken($uid)) {
$this->_uid = $uid;
}
}
}
}
return $this->_uid;
... ...
... ... @@ -2,7 +2,7 @@
/**
* 有货相关接口类
*
*
* @name Yohobuy
* @package library/Api
* @copyright yoho.inc
... ... @@ -35,8 +35,8 @@ class Yohobuy
/**
* 私钥列表
*
* @var array
*
* @var array
*/
private static $privateKeyList = array(
'android' => 'fd4ad5fcfa0de589ef238c0e7331b585',
... ... @@ -84,7 +84,7 @@ class Yohobuy
/**
* 取得公共的参数
*
*
* @return array
*/
public static function param()
... ... @@ -103,7 +103,7 @@ class Yohobuy
/**
* 构建URL
*
*
* @param string $url
* @param array $data
* @return string
... ... @@ -179,7 +179,7 @@ class Yohobuy
/**
* post提交数据
*
*
* @param string $url 接口URL
* @param array $data 参数列表
* @param bool $returnJson 控制是否返回json格式数据
... ... @@ -231,7 +231,7 @@ class Yohobuy
/**
* 批量调用接口
*
*
* @param array $urlList 接口列表
* @param array $options CURL设置项
* @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
... ... @@ -335,7 +335,7 @@ class Yohobuy
/**
* rpc调用远程服务(YAR)
*
*
* @see http://php.net/manual/zh/yar-client.setopt.php
* @param string $uri
* @param string $method
... ... @@ -384,7 +384,7 @@ class Yohobuy
/**
* 并行(异步)调用远程服务
*
*
* @see http://php.net/manual/zh/class.yar-concurrent-client.php
* @param string $uri
* @param string $method
... ...
... ... @@ -76,15 +76,4 @@ class LoginData
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 登出SESSION会话
*
* @param string $token 会话
* @return array
*/
public static function signoutSession($token)
{
return Yohobuy::get( Helpers::logoutSession($token) );
}
}
... ...
... ... @@ -42,7 +42,7 @@ class ListProcess
$products = array();
foreach ($data as $value) {
$products[] = Helpers::formatProduct($value, true, true, true);
$products[] = Helpers::formatProduct($value, true, true, true, 235, 314);
}
return $products;
... ... @@ -247,6 +247,9 @@ class ListProcess
private static function priceRange($data)
{
// 首先对价格进行排序
ksort($data, SORT_NUMERIC);
$result = array(
'title' => '价格',
'name' => '所有价格',
... ...
... ... @@ -43,7 +43,7 @@ class NewSaleProcess
// 处理商品
if (isset($products['product_list'])) {
foreach ($products['product_list'] as $single) {
$result['goods'][] = Helpers::formatProduct($single, true, false, false, 290, 388);
$result['goods'][] = Helpers::formatProduct($single, true, false, false, 235, 314);
}
}
... ...
... ... @@ -607,7 +607,7 @@ class Helpers
public static function syncUserSession($uid, $refer = '', $callback = 'call')
{
return 'http://mapi.yohobuy.com/Passport/session/index?callback=' . $callback
. '&sign=' . md5($uid . 'Js8Yn0!EwPM45-ws') . '&uid=' . $uid . '&go=' . $refer;
. '&sign=' . md5(md5($uid . 'Js8Yn0!EwPM45-ws')) . '&uid=' . $uid . '&go=' . $refer;
}
/**
... ... @@ -620,10 +620,10 @@ class Helpers
* @param string $callback 回调方法名
* @return string
*/
public static function logoutSession($token, $callback = 'call')
public static function logoutSession($token, $refer = '', $callback = 'call')
{
return 'http://mapi.yohobuy.com/Passport/session/logout?callback=' . $callback
. '&sign=' . md5('Js8Yn0!EwPM45-ws') . '&token=' . $token;
. '&sign=' . md5(md5('Js8Yn0!EwPM45-ws')) . '&token=' . $token . '&go=' . $refer;
}
}
... ...
... ... @@ -52,14 +52,15 @@ class Call extends Factory
$keys['code'] = $_REQUEST['code'];
$keys['redirect_uri'] = $this->apiConfig['appCallbackUrl'];
try
{
$token = $this->oauth->getAccessToken('code', $keys);
}
catch (Exception $e)
{
// do nothing
}
$token = $this->oauth->getAccessToken('code', $keys);
// try
// {
// $token = $this->oauth->getAccessToken('code', $keys);
// }
// catch (Exception $e)
// {
// // do nothing
// }
}
return $token;
... ...
... ... @@ -990,7 +990,11 @@ var $loading,
// 初始化
function init($container) {
var html = '<div class="loading-mask hide"><div class="loading"></div></div>';
var html = '<div class="loading-mask hide">' +
'<div class="loading">' +
'<div></div><div></div><div></div>' +
'</div>' +
'</div>';
hasInit = true;
if ($container === undefined) {
... ... @@ -1970,6 +1974,7 @@ var $icon = $('.search-icon');
var $form = $('#search-form');
var $history = $('.history');
var $historySearch = $('.history-search');
var $clearHistory = $('#clear-history');
... ... @@ -1984,6 +1989,8 @@ chHammer.on('tap', function() {
localStorage.removeItem('historys');
$history.html('');
$historySearch.hide();
$clearHistory.hide();
window.rePosFooter();
});
... ... @@ -2033,7 +2040,7 @@ $('#search').on('touchend', function() {
$history.html(html);
$clearHistory.removeClass('hide');
$historySearch.removeClass('hide');
window.rePosFooter();
}
}
... ... @@ -2206,24 +2213,12 @@ var $searchBox = $('.search-box'),
$box = $('.box'),
$indexSearch = $('.index-search'),
$indexLogo = $('.index-logo'),
$channelLink = $('.index-channel a'),
$win = $(window),
$doc = $(document),
$appFloatLayer = $('#float-layer-app');
$channelLink = $('.index-channel a');
var $search = $searchBox.children('input[type="text"]'),
$cancelSearch = $box.children('.no-search'),
$searchIcon = $searchBox.children('.search-icon');
// variables for calculate the app download layer position
var layerInit = false,
windowViewHeight = 0,
layerContentHeight = $appFloatLayer.height(),
layerPaddingTop = parseInt($appFloatLayer.css('padding-top')),
layerPaddingBottom = parseInt($appFloatLayer.css('padding-bottom')),
layerHeight = layerContentHeight + layerPaddingTop + layerPaddingBottom,
layerNewPos;
require("js/common");
$search.on('focus', function() {
... ... @@ -2255,6 +2250,15 @@ $searchBox.children('.search-icon').on('touchstart', function() {
$indexSearch.submit();
});
$searchBox.keyup(function(e) {
if (e.keyCode === 13) {
if (security.hasDangerInput()) {
return false;
}
$indexSearch.submit();
}
});
$('.index-channel img').on('load error', function() {
window.rePosFooter && window.rePosFooter();
});
... ... @@ -2278,43 +2282,6 @@ $channelLink.on('touchstart', function() {
});
});
function updateLayerPosition() {
var winHeight = window.innerHeight,
bodyHeight = $doc.height(),
scrollTopPosition = $win.scrollTop();
if (layerInit) {
//keyboard is shown
if (windowViewHeight - winHeight > 200) {
if (scrollTopPosition + windowViewHeight + layerHeight >= bodyHeight) {
layerNewPos = 0;
} else {
layerNewPos = bodyHeight - windowViewHeight - scrollTopPosition - layerHeight;
}
} else {
layerNewPos = bodyHeight - winHeight - scrollTopPosition;
}
} else {
windowViewHeight = winHeight;
layerNewPos = bodyHeight - winHeight - scrollTopPosition + layerHeight;
layerInit = true;
}
$appFloatLayer.css({
position: 'relative',
bottom: layerNewPos + 'px'
});
}
$(window).scroll(function() {
window.requestAnimationFrame(updateLayerPosition);
});
$doc.on('ready', updateLayerPosition);
});
define("js/passport/entry", ["jquery"], function(require, exports, module){
/**
... ... @@ -3299,7 +3266,7 @@ var winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
//默认筛选条件
var defaultOpt = require("js/product/extract-url");
var defaultOpt = require("js/product/query-param");
var storeOpt = $.extend({}, defaultOpt); //存储默认筛选条件以便重置
... ... @@ -3844,49 +3811,21 @@ exports.hideFilter = hideFilter;
exports.resetFilter = resetFilter;
});
define("js/product/extract-url", [], function(require, exports, module){
define("js/product/query-param", ["jquery"], function(require, exports, module){
/**
* 提取URL中的参数
* 提取查询参数
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/11/19
*/
var opt = {};
var paramStr = window.location.search.split('?')[1];
var keyVal = paramStr ? paramStr.split('&') : [];
var i, key, val;
for (i = keyVal.length; i > 0; i--) {
key = keyVal[i - 1].split('=');
val = key[1];
key = key[0];
var $ = require("jquery"),
opt = {};
//初始化默认参数
opt[key] = val;
$('.query-param').each(function() {
var $this = $(this);
//discount = p_d,同时需要两个参数
if (key === 'discount' || key === 'p_d') {
opt.discount = val;
opt.p_d = val;
}
}
if (typeof opt.gender === 'undefined') {
switch (window.cookie('_Channel')) {
case 'boys':
opt.gender = '1,3';
break;
case 'girls':
opt.gender = '2,3';
break;
default:
opt.gender = '1,2,3';
}
}
opt[$this.data('attr')] = $this.val();
});
module.exports = opt;
});
... ... @@ -3938,7 +3877,7 @@ var winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
//默认筛选条件
var defaultOpt = require("js/product/extract-url");
var defaultOpt = require("js/product/query-param");
var $listNav = $('#list-nav'),
... ... @@ -4324,7 +4263,7 @@ var $input = $('#search-input input'),
$clear = $('#search-input .clear-input');
//默认筛选条件
var defaultOpt = require("js/product/extract-url");
var defaultOpt = require("js/product/query-param");
var $listNav = $('#list-nav'),
... ... @@ -4771,10 +4710,8 @@ var goodsSwiper,
var goodsDiscountEl = document.getElementById('goodsDiscount'),
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl);
var $cart = $('.cart-bar'),
$goodsSubtitle = $('.goodsSubtitle'),
divH,
$goodsSubtitleSpan;
var $cart = $('.cart-bar');
var UA = navigator.userAgent.toLowerCase().toString();
require("js/product/detail/desc");
require("js/product/detail/comments-consults");
... ... @@ -4811,13 +4748,13 @@ goodsSwiper = new Swiper('.banner-swiper', {
//初始化goods-discount
if (0 === $('.goodsDiscount .discount-folder').children().length) {
if (0 === $discountFolder.children().length) {
$discountFolder.css('display', 'none');
$discountArrow.html('');
}
//goods-discount下拉按钮点击事件
if (goodsDiscountHammer) {
if (goodsDiscountHammer && $discountFolder.children().length > 0) {
goodsDiscountHammer.on('tap', function(e) {
if ($discountFolder.is(':hidden')) {
$discountArrow.removeClass('icon-down').addClass('icon-up').html('&#xe608;');
... ... @@ -4826,7 +4763,6 @@ if (goodsDiscountHammer) {
$discountArrow.removeClass('icon-up').addClass('icon-down').html('&#xe609;');
$discountFolder.slideUp();
}
return false;
});
}
... ... @@ -4841,13 +4777,8 @@ $.ajax({
}
});
//限制goodsSubtitle为两行
if ($goodsSubtitle[0]) {
divH = $goodsSubtitle.height();
$goodsSubtitleSpan = $goodsSubtitle.find('span');
while ($goodsSubtitleSpan.outerHeight() > divH) {
$goodsSubtitleSpan.text($goodsSubtitleSpan.text().replace(/(\s)*([a-zA-Z0-9]+|\W)(\.\.\.)?$/, '...'));
}
if (UA.indexOf('mqqbrowser') > -1) {
$('.detail > div').removeClass('column').addClass('oldbox');
}
require("js/product/detail/like");
... ... @@ -4908,6 +4839,8 @@ function search() {
$productDesc = $('#productDesc');
$productDesc.append(data);
window.rePosFooter();
lazyLoad($productDesc.find('img.lazy'));
//尺码信息左右滑动
... ... @@ -4960,17 +4893,14 @@ var $ = require("jquery"),
var commentsNum,consultsNum;
var consultFooterEle = document.getElementById('consult-content-footer'),
var consultFooterEle = $('.consult-content-footer')[0],
consultFooterHammer = consultFooterEle && new Hammer(consultFooterEle),
navtabEle = document.getElementById('nav-tab'),
navtabHammer = navtabEle && new Hammer(navtabEle),
gotoConsultEle = document.getElementById('goto-consult'),
gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle),
$gotoConsult = $('#goto-consult');
gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle);
(function() {
... ... @@ -5022,33 +4952,21 @@ if (navtabHammer) {
if (consultFooterHammer) {
consultFooterHammer.on('tap', function() {
location.href = $(consultFooterEle).find('a').attr('href');
location.href = $(consultFooterEle).data('href');
});
}
if (gotoConsultHammer) {
gotoConsultHammer.on('tap', function() {
location.href = $(gotoConsultEle).find('a').attr('href');
location.href = $(gotoConsultEle).data('href');
});
}
function fixConsultBar() {
if ($(window).scrollTop() > $('#yoho-header').outerHeight()) {
$gotoConsult.css('position', 'fixed');
$gotoConsult.css('top', '0');
} else {
$gotoConsult.css('position', 'static');
}
//咨询页面固定header
if ($('.goods-consults-page').length > 0) {
$('#yoho-header').css('position', 'fixed').css('top', '0');
}
//滚动时顶部固定 我要咨询
function scrollHandler() {
fixConsultBar();
}
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
});
define("js/product/recommend-for-you-product-desc", ["swiper","jquery","index"], function(require, exports, module){
... ... @@ -5078,6 +4996,9 @@ if (preferenceUrl) {
watchSlidesVisibility: true
});
}
window.rePosFooter();
}).fail(function() {
$recommendForYou.hide();
});
... ... @@ -5450,13 +5371,17 @@ function getOrders(option) {
if (opt.page === 1) {
$curContainer.html(data);
lazyLoad($curContainer.find('.lazy'));
lazyLoad($curContainer.find('.lazy'), {
try_again_css: 'order-failure'
});
} else {
num = $curContainer.children('.order').length;
$curContainer.append(data);
//lazyload
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'));
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'), {
try_again_css: 'order-failure'
});
}
window.rePosFooter(); //重新计算底部位置
... ... @@ -5470,7 +5395,9 @@ function getOrders(option) {
});
}
lazyLoad();
lazyLoad({
try_again_css: 'order-failure'
});
//初始化导航
(function() {
... ... @@ -5706,7 +5633,9 @@ var orderId = $('#order-detail').data('id');
var optHammer;
lazyLoad();
lazyLoad({
try_again_css: 'order-failure'
});
//订单删除
optHammer = new Hammer(document.getElementsByClassName('opt')[0]);
... ... @@ -5755,7 +5684,6 @@ var diaLog = require("js/me/dialog");
var $navLi = $('#fav-tab > li'),
$favContainer = $('.fav-content > .fav-type'),
$swiperList = '',
swiperObj = {},
favTabHammer,
favContentHammer,
... ... @@ -5780,22 +5708,30 @@ function showFavTab(index) {
}
//初始化swiper
function initSwiper() {
function initSwiper(data) {
var i,
id;
idStrReg = /container-(\d+)['"]{1}/gi,
idReg = /\d+/,
idArr = data.match(idStrReg),
idArrLen = idArr.length,
containerId;
$swiperList = $('.swiper-container');
for (i = 0; i < $swiperList.length; i++) {
id = $swiperList.eq(i).attr('data-id');
//$swiperList = $('.swiper-container');
for (i = 0; i < idArrLen; i++) {
/*id = $swiperList.eq(i).attr('data-id');
if (!!swiperObj[id]) {
swiperObj[id].destroy(true, true);
}
swiperObj[id] = new Swiper('#swiper-container-' + id, {
}*/
containerId = idArr[i].match(idReg)[0];
swiperObj[containerId] = new Swiper('#swiper-container-' + containerId, {
slidesPerView: 'auto',
grabCursor: true,
slideElement: 'li',
wrapperClass: 'swiper-wrapper-' + id,
wrapperClass: 'swiper-wrapper-' + containerId,
lazyLoading: true,
watchSlidesVisibility: true
});
... ... @@ -5836,7 +5772,7 @@ function loadData($parent, url, page) {
$parent.append(data);
$parent.closest('.fav-type').find('.fav-content-loading').remove();
if (url === 'favBrand') {
initSwiper();//如果是收藏品牌需要初始化swiper
initSwiper(data);//如果是收藏品牌需要初始化swiper
brandLockId = false;//请求成功后解锁品牌收藏page++
} else {
... ... @@ -6026,7 +5962,7 @@ $('#upload-img').uploadifive({
fileType: 'image*/*',
uploadScript: '/home/suggestimgUpload',
fileObjName: 'fileData',
fileSizeLimit: 1024,
fileSizeLimit: 300,
height: '100%',
width: '100%',
multi: false,
... ... @@ -7700,7 +7636,7 @@ function callpay(orderCode) {
function isWXOpen() {
var ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) === 'micromessenger') {
if (ua.indexOf('micromessenger') > 0) {
return true;
} else {
return false;
... ...
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.
This diff could not be displayed because it is too large.
... ... @@ -10,24 +10,12 @@ var $searchBox = $('.search-box'),
$box = $('.box'),
$indexSearch = $('.index-search'),
$indexLogo = $('.index-logo'),
$channelLink = $('.index-channel a'),
$win = $(window),
$doc = $(document),
$appFloatLayer = $('#float-layer-app');
$channelLink = $('.index-channel a');
var $search = $searchBox.children('input[type="text"]'),
$cancelSearch = $box.children('.no-search'),
$searchIcon = $searchBox.children('.search-icon');
// variables for calculate the app download layer position
var layerInit = false,
windowViewHeight = 0,
layerContentHeight = $appFloatLayer.height(),
layerPaddingTop = parseInt($appFloatLayer.css('padding-top')),
layerPaddingBottom = parseInt($appFloatLayer.css('padding-bottom')),
layerHeight = layerContentHeight + layerPaddingTop + layerPaddingBottom,
layerNewPos;
require('../common');
$search.on('focus', function() {
... ... @@ -59,6 +47,15 @@ $searchBox.children('.search-icon').on('touchstart', function() {
$indexSearch.submit();
});
$searchBox.keyup(function(e) {
if (e.keyCode === 13) {
if (security.hasDangerInput()) {
return false;
}
$indexSearch.submit();
}
});
$('.index-channel img').on('load error', function() {
window.rePosFooter && window.rePosFooter();
});
... ... @@ -81,40 +78,3 @@ $channelLink.on('touchstart', function() {
borderColor: '#fff'
});
});
function updateLayerPosition() {
var winHeight = window.innerHeight,
bodyHeight = $doc.height(),
scrollTopPosition = $win.scrollTop();
if (layerInit) {
//keyboard is shown
if (windowViewHeight - winHeight > 200) {
if (scrollTopPosition + windowViewHeight + layerHeight >= bodyHeight) {
layerNewPos = 0;
} else {
layerNewPos = bodyHeight - windowViewHeight - scrollTopPosition - layerHeight;
}
} else {
layerNewPos = bodyHeight - winHeight - scrollTopPosition;
}
} else {
windowViewHeight = winHeight;
layerNewPos = bodyHeight - winHeight - scrollTopPosition + layerHeight;
layerInit = true;
}
$appFloatLayer.css({
position: 'relative',
bottom: layerNewPos + 'px'
});
}
$(window).scroll(function() {
window.requestAnimationFrame(updateLayerPosition);
});
$doc.on('ready', updateLayerPosition);
... ...
... ... @@ -12,7 +12,6 @@ var diaLog = require('./dialog');
var $navLi = $('#fav-tab > li'),
$favContainer = $('.fav-content > .fav-type'),
$swiperList = '',
swiperObj = {},
favTabHammer,
favContentHammer,
... ... @@ -37,22 +36,30 @@ function showFavTab(index) {
}
//初始化swiper
function initSwiper() {
function initSwiper(data) {
var i,
id;
idStrReg = /container-(\d+)['"]{1}/gi,
idReg = /\d+/,
idArr = data.match(idStrReg),
idArrLen = idArr.length,
containerId;
$swiperList = $('.swiper-container');
for (i = 0; i < $swiperList.length; i++) {
id = $swiperList.eq(i).attr('data-id');
//$swiperList = $('.swiper-container');
for (i = 0; i < idArrLen; i++) {
/*id = $swiperList.eq(i).attr('data-id');
if (!!swiperObj[id]) {
swiperObj[id].destroy(true, true);
}
swiperObj[id] = new Swiper('#swiper-container-' + id, {
}*/
containerId = idArr[i].match(idReg)[0];
swiperObj[containerId] = new Swiper('#swiper-container-' + containerId, {
slidesPerView: 'auto',
grabCursor: true,
slideElement: 'li',
wrapperClass: 'swiper-wrapper-' + id,
wrapperClass: 'swiper-wrapper-' + containerId,
lazyLoading: true,
watchSlidesVisibility: true
});
... ... @@ -93,7 +100,7 @@ function loadData($parent, url, page) {
$parent.append(data);
$parent.closest('.fav-type').find('.fav-content-loading').remove();
if (url === 'favBrand') {
initSwiper();//如果是收藏品牌需要初始化swiper
initSwiper(data);//如果是收藏品牌需要初始化swiper
brandLockId = false;//请求成功后解锁品牌收藏page++
} else {
... ... @@ -105,7 +112,6 @@ function loadData($parent, url, page) {
} else {
return;
}
window.rePosFooter();
//},1000);
}
... ...
... ... @@ -12,7 +12,9 @@ var orderId = $('#order-detail').data('id');
var optHammer;
lazyLoad();
lazyLoad({
try_again_css: 'order-failure'
});
//订单删除
optHammer = new Hammer(document.getElementsByClassName('opt')[0]);
... ...
... ... @@ -58,13 +58,17 @@ function getOrders(option) {
if (opt.page === 1) {
$curContainer.html(data);
lazyLoad($curContainer.find('.lazy'));
lazyLoad($curContainer.find('.lazy'), {
try_again_css: 'order-failure'
});
} else {
num = $curContainer.children('.order').length;
$curContainer.append(data);
//lazyload
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'));
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'), {
try_again_css: 'order-failure'
});
}
window.rePosFooter(); //重新计算底部位置
... ... @@ -78,7 +82,9 @@ function getOrders(option) {
});
}
lazyLoad();
lazyLoad({
try_again_css: 'order-failure'
});
//初始化导航
(function() {
... ...
... ... @@ -92,7 +92,7 @@ function callpay(orderCode) {
function isWXOpen() {
var ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) === 'micromessenger') {
if (ua.indexOf('micromessenger') > 0) {
return true;
} else {
return false;
... ...
... ... @@ -39,7 +39,7 @@ $('#upload-img').uploadifive({
fileType: 'image*/*',
uploadScript: '/home/suggestimgUpload',
fileObjName: 'fileData',
fileSizeLimit: 1024,
fileSizeLimit: 300,
height: '100%',
width: '100%',
multi: false,
... ...
... ... @@ -18,6 +18,8 @@ var introUrl = $('#introUrl').val(),
var sizeSwiper,
refSwiper;
var UA = navigator.userAgent.toLowerCase().toString();
//判断是否要显示向左滑动提示
function hiddenTips($ele) {
var offsetContainer,
... ... @@ -53,6 +55,8 @@ function search() {
$productDesc = $('#productDesc');
$productDesc.append(data);
window.rePosFooter();
lazyLoad($productDesc.find('img.lazy'));
//尺码信息左右滑动
... ... @@ -67,7 +71,9 @@ function search() {
hiddenTips($('#size-swiper-container'));
hiddenTips($('#reference-swiper-container'));
if (UA.indexOf('mqqbrowser') > 0) {
$('.detail > div').removeClass('column').addClass('oldbox');
}
searching = false;
end = true;
loading.hideLoadingMask();
... ...
... ... @@ -17,6 +17,7 @@ var goodsDiscountEl = document.getElementById('goodsDiscount'),
var $cart = $('.cart-bar');
require('./desc');
require('./comments-consults');
require('../recommend-for-you-product-desc');
... ...
... ... @@ -28,6 +28,9 @@ if (preferenceUrl) {
});
}
}
window.rePosFooter();
}).fail(function() {
$recommendForYou.hide();
});
... ...
... ... @@ -21,7 +21,7 @@
"yoho.iswiper": "3.0.1",
"iscroll": "5.1.2",
"import-style": "1.0.0",
"yoho.lazyload": "1.1.2",
"yoho.lazyload": "1.1.3",
"yoho.handlebars": "3.0.3",
"yoho.hammer": "2.0.4"
},
... ...
.order-failure {
background-image: image-url('lazy-failure/order-good.jpg');
background-size: 100%;
}
\ No newline at end of file
... ...
... ... @@ -16,7 +16,7 @@
background-color: #FFF;
border-radius: 30rem / $pxConvertRem;
padding: 0 32rem / $pxConvertRem 0 52rem / $pxConvertRem;
a {
width: 100%;
height: 60rem / $pxConvertRem;
... ... @@ -77,6 +77,14 @@
.hot-brands {
padding-top: 178rem / $pxConvertRem;
.floor-header {
padding: 0;
}
.brands-swiper {
border-top: 0;
}
}
.hot-brand {
... ... @@ -194,7 +202,7 @@
.con {
padding-top: 10rem / $pxConvertRem;
}
.search-result {
padding-top: 176rem / $pxConvertRem;
}
... ...
... ... @@ -61,14 +61,14 @@
.brand:nth-child(5n) {
border-right: none;
}
.more {
float: left;
width: 317rem / $pxConvertRem;
height: 174rem / $pxConvertRem;
border-top: 1px solid #e0e0e0;
a {
display: block;
width: 100%;
... ... @@ -109,6 +109,7 @@
}
img {
display: inline-block;
max-width: 100%;
max-height: 100%;
vertical-align: middle;
... ... @@ -132,4 +133,4 @@
}
}
}
}
\ No newline at end of file
}
... ...
... ... @@ -143,6 +143,7 @@ a {
@import "layout/footer";
@import "layout/footer_tab";
@import "good";
@import "lazy-failure";
@import "filter";
@import "loading";
@import "passport/index";
... ...
... ... @@ -280,7 +280,7 @@
}
}
}
.comment-content-footer,
.consult-content-footer {
min-height: pxToRem(88px);
... ... @@ -290,7 +290,7 @@
line-height: pxToRem(88px);
font-size: pxToRem(28px);
a {
color: #e0e0e0;
color: #b0b0b0;
.iconfont {
font-size: inherit;
}
... ...
... ... @@ -48,8 +48,7 @@ $basicBtnC:#eb0313;
//padding: pxToRem(20px) pxToRem(12px);
padding: pxToRem(6px) 3%;
width: 49.9%;
border-bottom: pxToRem(4px) solid #fff;
border-right: pxToRem(4px) solid #fff;
border: 1px solid #fff;
font-size: pxToRem(24px);
background-color: $tableCellC;
word-wrap: break-word;
... ... @@ -69,8 +68,7 @@ $basicBtnC:#eb0313;
width: 49.9%;
background-color: $tableCellC;
box-sizing: border-box;
border-bottom: 1px solid #fff;
border-right: 1px solid #fff;
border: 1px solid #fff;
width: 49.9%;
height: 100%;
float: left;
... ...
... ... @@ -11,10 +11,6 @@
background-size: cover;
}
.detail{
// background-color: $tableCellC;
// &.table .inner-container{
// background-color: $tableCellC;
// }
margin-bottom: 1px;
}
.desc-text {
... ... @@ -42,30 +38,21 @@
.detail {
.material-item{
margin: pxToRem(10px) 0;
@include flexbox((
display: box,
box-align: center
), $version: 1);
@include flexbox((
display: flex,
align-items: center
));
width: 100%;
height: auto;
overflow: hidden;
display: block;
position: relative;
img {
margin: 0;
}
.material-image {
width: 23%;
@include flexbox((
box-flex: 1.0,
display: box,
box-pack: center
), $version: 1);
@include flexbox((
display: flex,
flex-basis: 23%,
justify-content: center
));
position: absolute;
left: 0;
top: 50%;
@include transform(translateY(-50%))
}
.material-desc {
font-size: pxToRem(24px);
... ... @@ -76,15 +63,8 @@
line-height: pxToRem(38px);
color: #4b4b4b;
word-wrap: break-word;
width: 76.9;
@include flexbox((
box-flex: 1.0,
display: box
), $version: 1);
@include flexbox((
display: flex,
flex-basis: 76.9%
));
width: 76.9%;
float: right;
}
&:last-child{
border-bottom: none;
... ... @@ -129,6 +109,13 @@
width: pxToRem(581px);
height:auto;
}
a {
color: #2f91f6;
text-decoration: underline;
}
}
margin-top: pxToRem(30px);
margin-bottom: pxToRem(30px);
... ...
... ... @@ -10,6 +10,12 @@
bottom: 70px;
z-index: 10;
a {
display: block;
width: 100%;
height: 100%;
}
.iconfont {
color: #fff;
font-size: 18px;
... ... @@ -26,4 +32,4 @@
right: 0;
color: #fff;
}
}
\ No newline at end of file
}
... ...
... ... @@ -13,7 +13,7 @@
{{/isLogin}}
{{^isLogin}}
<div class="user-info">
<a class="login-btn" href="/signin.html?refer=/home">
<a class="login-btn" href="{{signinUrl}}">
登录/注册
</a>
</div>
... ...
... ... @@ -36,7 +36,7 @@
<span class="icon iconfont icon-tel">&#xe63e;</span>
电话客服
<p>
400-889-9649 &nbsp;&nbsp; 09:00 - 22:30 &nbsp; (周一至周日)
400-889-9646 &nbsp;&nbsp; 09:00 - 22:30 &nbsp; (周一至周日)
</p>
</a>
... ...
... ... @@ -22,13 +22,9 @@
<p>{{answer}}</p>
</div>
</div>
{{/list}}
</div>
{{/ consults}}
{{#if loadmore}}
<input id="loadMoreUrl" type="hidden" value="{{loadMoreUrl}}">
{{/if}}
</div>
{{> layout/footer}}
... ...
<div class="hot-brands">
{{^ brandPage}}
{{> home/floor_header}}
{{/ brandPage}}
{{> home/floor_header}}
<div class="brands-swiper">
<ul class="brands-list swiper-wrapper clearfix">
{{# list}}
... ...
... ... @@ -48,6 +48,7 @@ class HomeController extends AbstractAction
'showDownloadApp' => true,
'pageFooter' => true,
'cartUrl' => Helpers::url('/cart/index/index', null),
'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home')) ),
);
$uid = $this->getUid(true);
if ($uid) {
... ...
... ... @@ -201,7 +201,7 @@ class UserModel
$datas[] = $product;
}
!empty($datas) && $result['hasFavProduct'] = $datas;
} else if ($page > 1 && isset($favProduct['code']) && $favProduct['code'] === 500) {
} else if ($page > 1 && (!$favProduct || (isset($favProduct['code']) && $favProduct['code'] === 500))) {
$result['end'] = true;
}
... ... @@ -259,7 +259,7 @@ class UserModel
$datas[] = $brand;
}
!empty($datas) && $result['hasFavBrand'] = $datas;
} else if ($page > 1 && isset($favBrand['code']) && $favBrand['code'] === 500) {
} else if ($page > 1 && (!$favBrand || (isset($favBrand['code']) && $favBrand['code'] === 500))) {
$result['end'] = true;
}
... ...
... ... @@ -157,8 +157,8 @@ class DetailModel
// 商品信息
if (!empty($baseInfo['goodsList'])) {
$colorGroup = array();
$sizeGroup = array();
// $colorGroup = array();
// $sizeGroup = array();
$goodsList = array();
$goodsGroup = array();
$colorId = 0;
... ... @@ -168,49 +168,44 @@ class DetailModel
if (isset($value['goodsImagesList'])) {
foreach ($value['goodsImagesList'] as $goods) {
$goodsList[$goods['goodsId']] = $colorId;
$goodsGroup[$colorId][] = array(
$goodsGroup[] = array(
'goodsId' => $goods['goodsId'],
'img' => $goods['imageUrl'],
);
$colorGroup[$colorId] = array(
'colorId' => $colorId,
'colorName' => $value['colorName'],
'colorImage' => Helpers::getImageUrl($value['colorImage'], 60, 60),
);
// $colorGroup[$colorId] = array(
// 'colorId' => $colorId,
// 'colorName' => $value['colorName'],
// 'colorImage' => Helpers::getImageUrl($value['colorImage'], 60, 60),
// );
}
}
// 商品的尺码列表
if (isset($value['goodsSizeBoList'])) {
foreach ($value['goodsSizeBoList'] as $size) {
$sizeGroup[$colorId] = array(
'sizeName' => $size['sizeName'],
'sizeSku' => $size['goodsSizeSkuId'],
'sizeStorage' => $size['goodsSizeStorageNum'],
);
}
}
// // 商品的尺码列表
// if (isset($value['goodsSizeBoList'])) {
// foreach ($value['goodsSizeBoList'] as $size) {
// $sizeGroup[$colorId] = array(
// 'sizeName' => $size['sizeName'],
// 'sizeSku' => $size['goodsSizeSkuId'],
// 'sizeStorage' => $size['goodsSizeStorageNum'],
// );
// }
// }
}
// 商品图
$goodsId = intval($goodsId);
if (isset($goodsList[$goodsId])) {
$colorId = $goodsList[$goodsId];
// 多个
if (isset($goodsGroup[$colorId][1])) {
foreach ($goodsGroup[$colorId] as $value) {
$result['bannerTop']['list'][] = array(
'img' => Helpers::getImageUrl($value['img'], 450, 600)
);
}
}
// 单个
elseif (isset($goodsGroup[$colorId][0])) {
$result['bannerTop'] = array(
'img' => Helpers::getImageUrl($goodsGroup[$colorId][0]['img'], 450, 600)
// 商品图: 多个
if (isset($goodsGroup[1])) {
foreach ($goodsGroup as $value) {
$result['bannerTop']['list'][] = array(
'img' => Helpers::getImageUrl($value['img'], 450, 600)
);
}
}
// 商品图: 单个
elseif (isset($goodsGroup[0])) {
$result['bannerTop'] = array(
'img' => Helpers::getImageUrl($goodsGroup[0]['img'], 450, 600)
);
}
}
// 悬浮的购物车信息
... ...
... ... @@ -213,7 +213,7 @@ class ListModel
}
// 调用接口查询数据
$brandLogo = BrandData::getBrandLogoByDomain($domain);
$brandLogo = BrandData::getBrandLogoByDomain($domain);
// 处理返回的数据
if (isset($brandLogo['data'])) {
$result = array(
... ...
... ... @@ -219,7 +219,7 @@ class NewsaleModel
if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
foreach ($data['data']['product_list'] as $val) {
$result['goods'][] = Helpers::formatProduct($val, true, false, false, 299, 388);
$result['goods'][] = Helpers::formatProduct($val, true, false, false, 235, 314);
}
}
... ...
... ... @@ -78,7 +78,7 @@ class LoginController extends AbstractAction
$refer = $this->server('HTTP_REFERER', SITE_MAIN);
$token = $this->get('token');
if (!empty($token)) {
LoginData::signoutSession($token);
$this->go( Helpers::logoutSession($token, $refer) );
}
$this->go($refer);
... ... @@ -188,6 +188,7 @@ class LoginController extends AbstractAction
}
if ($result['code'] == 200 && !empty($result['data']['uid'])) {
$this->setSession('_TOKEN', Helpers::makeToken($result['data']['uid']));
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
$this->go($refer);
... ... @@ -203,7 +204,7 @@ class LoginController extends AbstractAction
$access = $qqconnect->getAccessToken();
/* 获取QQ腾讯用户的详细信息 */
$partnerInfo = $qqconnect->getUserInfo($access);
$result = array();
if ($partnerInfo && is_array($partnerInfo)) {
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq');
... ... @@ -217,6 +218,7 @@ class LoginController extends AbstractAction
}
if ($result['code'] == 200 && !empty($result['data']['uid'])) {
$this->setSession('_TOKEN', Helpers::makeToken($result['data']['uid']));
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
$this->go($refer);
... ... @@ -229,9 +231,9 @@ class LoginController extends AbstractAction
public function sinacallbackAction()
{
$sina = Factory::create('sinaweibo');
$access = $sina->getAccessToken();
$access = $sina->getAccessToken();
/* 获取用户的详细信息 */
$partnerInfo = $sina->getUserInfo($access);
$partnerInfo = $sina->getUserInfo($access);
$result = array();
if ($partnerInfo && is_array($partnerInfo)) {
... ... @@ -246,6 +248,7 @@ class LoginController extends AbstractAction
}
if ($result['code'] == 200 && !empty($result['data']['uid'])) {
$this->setSession('_TOKEN', Helpers::makeToken($result['data']['uid']));
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
} else {
$this->go($refer);
... ...
... ... @@ -217,7 +217,7 @@ class IndexController extends AbstractAction
// 右下角的购物车链接
$data['goodList']['cartUrl'] = Helpers::url('/cart/index/index', null);
//$data['goodList'] += $condition;
$data['goodList'] += $condition;
$data['pageFooter'] = true;
if ($title === '') {
... ...
... ... @@ -177,7 +177,7 @@ class NewsaleController extends AbstractAction
$color = $this->get('color', null);
$size = $this->get('size', null);
$price = $this->get('price', null);
$p_d = $this->get('discount', null);
$p_d = '0.1,0.3';
$dayLimit = $this->get('dayLimit', null);
$limit = $this->get('limit', 60);
$page = $this->get('page', 1);
... ...
... ... @@ -33,12 +33,12 @@ application.debug = False
application.servers.config = APPLICATION_PATH "/configs/core"
;出错的时候是否抛出异常
application.dispatcher.throwException = True
application.dispatcher.throwException = False
;是否使用默认的异常 捕获Controller, 如果开启, 在有未捕获的异常的时候,
;控制权会交给ErrorController的errorAction 方法,
;可以通过$request->getException()获得此异常对象
application.dispatcher.catchException = True
application.dispatcher.catchException = False
;模板预编译目录,该目录需要有读写权限
application.template.compile = ROOT_PATH "/compile/m.yohobuy.com"
... ...
... ... @@ -33,12 +33,12 @@ application.debug = True
application.servers.config = APPLICATION_PATH "/configs/core"
;出错的时候是否抛出异常
application.dispatcher.throwException = True
application.dispatcher.throwException = False
;是否使用默认的异常 捕获Controller, 如果开启, 在有未捕获的异常的时候,
;控制权会交给ErrorController的errorAction 方法,
;可以通过$request->getException()获得此异常对象 False
application.dispatcher.catchException = True
application.dispatcher.catchException = False
;模板预编译目录,该目录需要有读写权限
application.template.compile = ROOT_PATH "/compile/m.yohobuy.com"
... ...