Authored by 梁志锋

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

... ... @@ -283,23 +283,21 @@ class AbstractAction extends Controller_Abstract
*/
protected function getUid($useSession = false)
{
// @todo debug 因登录没有写老的SESSION会话,此处使用COOKIE
$useSession = false;
if (!$this->_uid) {
// 从SESSION获取
if ($useSession) {
$this->_uid = $this->getSession('_UID');
}
// 从COOKIE获取
else {
$cookie = $this->getCookie('_UID');
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
$this->_uid = $cookieList[1];
$this->_uname = $cookieList[0];
$this->_vip = $cookieList[2];
$cookie = $this->getCookie('_UID');
if (!empty($cookie)) {
$uid = 0;
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
$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;
}
}
}
... ... @@ -335,6 +333,7 @@ class AbstractAction extends Controller_Abstract
* @param bool $showMore 是否显示更多内容
* @return void
*/
protected function setTitle($title, $showMore = true, $sign = ' | ')
{
$this->_view->assign('title_more', $showMore);
... ... @@ -399,29 +398,30 @@ class AbstractAction extends Controller_Abstract
$header['navBtn'] = true;
}
$controller = $this->getRequest()->getControllerName();
if ($controller !== 'Home') {
// 根据COOKIE记录的频道进行导航定位
$channel = Helpers::getChannelByCookie();
switch ($channel) {
default:
case 1:
$header['boys'] = true;
break;
case 2:
$header['girls'] = true;
break;
case 3:
$header['kids'] = true;
break;
case 4:
$header['lifeStyle'] = true;
break;
}
}
$controller = $this->getRequest()->getControllerName();
if ($controller !== 'Home') {
// 根据COOKIE记录的频道进行导航定位
$channel = Helpers::getChannelByCookie();
switch ($channel) {
default:
case 1:
$header['boys'] = true;
break;
case 2:
$header['girls'] = true;
break;
case 3:
$header['kids'] = true;
break;
case 4:
$header['lifeStyle'] = true;
break;
}
}
$this->_view->assign('pageHeader', $header);
}
/**
* 设置网站导航底部信息
*
... ...
... ... @@ -602,7 +602,7 @@ class Helpers
*/
public static function syncUserSession($uid, $refer = '', $callback = 'call')
{
return 'http://m1.yohobuy.com/Passport/session/index?callback=' . $callback
return 'http://mapi.yohobuy.com/Passport/session/index?callback=' . $callback
. '&sign=' . md5($uid . 'Js8Yn0!EwPM45-ws') . '&uid=' . $uid . '&go=' . $refer;
}
... ... @@ -618,7 +618,7 @@ class Helpers
*/
public static function logoutSession($token, $callback = 'call')
{
return 'http://m1.yohobuy.com/Passport/session/logout?callback=' . $callback
return 'http://mapi.yohobuy.com/Passport/session/logout?callback=' . $callback
. '&sign=' . md5('Js8Yn0!EwPM45-ws') . '&token=' . $token;
}
... ...
server
{
listen 80;
server_name m.yohobuy.com *.m.yohobuy.com;
#access_log /Data/logs/access.buy.test.yoho.cn.log combined;
error_log /Data/logs/nginx/error.m.yohobuy.com.log warn;
root /Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public;
location ~* \.(ico|woff)$ {
expires 7d;
}
location = /crossdomain.xml {
expires 7d;
}
location = /appembed {
default_type application/json;
return 200 '{"code":200,"message":"appembed","data":{"open":"N","url":"http://m.yohobuy.com"}}';
}
location = /reg.html {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /signin.html {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /login.html {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /emailback.html {
root /Data/code/git/yohobuy/yohobuy/assets;
expires 7d;
}
location = /phoneback.html {
root /Data/code/git/yohobuy/yohobuy/assets;
expires 7d;
}
location = /error.html {
root /Data/code/git/yohobuy/yohobuy/assets;
expires 7d;
}
location ^~ /passport {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = / {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /boys {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /girls {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /kids {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /lifestyle {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /girl {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /boys/bottomBanner {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /girls/bottomBanner {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /cate {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /brands {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /sale {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /brands/search {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /product/new {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /hotrank {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /product/newsale/ {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /product/opt/ {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /product/recom/ {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /product/pro_ {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /product/intro_ {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /product/detail/ {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /guang/ {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /tags/index {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /author/index {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /info/index {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /plustar {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /search {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /index/search {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /home {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /home/message {
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.yohobuy.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /home/orders/detail {
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.yohobuy.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /home/orders/cancel {
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.yohobuy.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location / {
proxy_redirect off;
proxy_pass http://61.155.222.163;
proxy_set_header Host m.yohobuy.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
}
server
{
listen 80;
server_name cdn.yoho.cn;
#access_log /Data/logs/nginx/access.static.m.yohobuy.com.log combined;
#error_log /Data/logs/nginx/error.static.m.yohobuy.com.log warn;
root /Data/code/git/yohobuy/static/dist;
location / {
log_not_found off;
access_log off;
expires 30d;
}
location ~* \.(svg|eot|ttf|woff|otf)$ {
add_header Access-Control-Allow-Origin *;
expires 30d;
}
}
... ...
... ... @@ -112,11 +112,15 @@ function getShoppingKey() {
//根据页面内容重新设置通用底部的显示
function rePosFooter() {
var winH;
if ($footer.length === 0) {
return;
}
if ($('body').height() <= $(window).height() - parseInt($footer.css('height'), 0)) {
winH = Math.min($(window).height(), window.screen.availHeight);
if ($('body').height() <= winH - parseInt($footer.css('height'), 0)) {
$footer.addClass('bottom');
} else {
$footer.removeClass('bottom');
... ... @@ -488,10 +492,10 @@ function searchResult() {
brandHtml.push('<p><a href="' + brand.url + '">' + brand.name);
if (brand.isNew) {
brandHtml.push('<i class="icon-hot">HOT</i>');
brandHtml.push('<i class="icon-new">NEW</i>');
}
if (brand.isHot) {
brandHtml.push('<i class="icon-new">NEW</i>');
brandHtml.push('<i class="icon-hot">HOT</i>');
}
brandHtml.push('</a></p>');
});
... ... @@ -1980,6 +1984,8 @@ chHammer.on('tap', function() {
localStorage.removeItem('historys');
$history.html('');
window.rePosFooter();
});
$input.on('input', function() {
... ... @@ -2027,6 +2033,8 @@ $('#search').on('touchend', function() {
$history.html(html);
$clearHistory.removeClass('hide');
window.rePosFooter();
}
}
}());
... ... @@ -2794,6 +2802,8 @@ $loginBtn.on('touchstart', function() {
return;
}
$loginBtn.text('正在登录...').addClass('disable');
//验证账号(数字或者邮箱)和密码合理性
if ((/^[0-9]+$/.test(acc) || api.emailRegx.test(acc)) && api.pwdValidate(pwd)) {
$.ajax({
... ... @@ -2804,28 +2814,40 @@ $loginBtn.on('touchstart', function() {
password: pwd
},
success: function(data) {
var res;
var res,
time;
if (data.code === 200) {
res = data.data;
showErrTip('登录成功');
$.ajax({
url: res.session,
dataType: 'jsonp'
dataType: 'jsonp',
success: function() {
clearTimeout(time);
//Cookie写入成功后,1s后跳转页面
setTimeout(function() {
location.href = res.href;
}, 1000);
}
});
//2s后跳转页面
setTimeout(function() {
//3秒后强制跳转
time = setTimeout(function() {
location.href = res.href;
}, 2000);
}, 3000);
showErrTip('登录成功');
} else {
showErrTip(data.message);
}
},
error: function() {
showErrTip('网络断开连接啦~');
},
complete: function() {
$loginBtn.text('登录').removeClass('disable');
}
});
} else {
... ... @@ -2927,6 +2949,8 @@ $loginBtn.on('touchstart', function() {
return;
}
$loginBtn.text('正在登录...').addClass('disable');
if (api.phoneRegx[areaCode].test(pn) && api.pwdValidate(pwd)) {
$.ajax({
type: 'POST',
... ... @@ -2937,7 +2961,8 @@ $loginBtn.on('touchstart', function() {
password: pwd
},
success: function(data) {
var res;
var res,
time;
if (data.code === 200) {
res = data.data;
... ... @@ -2945,19 +2970,32 @@ $loginBtn.on('touchstart', function() {
$.ajax({
url: res.session,
dataType: 'jsonp'
dataType: 'jsonp',
success: function() {
clearTimeout(time);
//Cookie写入成功后,1s后跳转页面
setTimeout(function() {
location.href = res.href;
}, 1000);
}
});
//2000ms后跳转页面
setTimeout(function() {
//3秒后强制跳转
time = setTimeout(function() {
location.href = res.href;
}, 2000);
}, 3000);
showErrTip('登录成功');
} else {
showErrTip(data.message);
}
},
error: function() {
showErrTip('网络断开连接啦~');
},
complete: function() {
$loginBtn.text('登录').removeClass('disable');
}
});
} else {
... ... @@ -4733,7 +4771,10 @@ var goodsSwiper,
var goodsDiscountEl = document.getElementById('goodsDiscount'),
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl);
var $cart = $('.cart-bar');
var $cart = $('.cart-bar'),
$goodsSubtitle = $('.goodsSubtitle'),
divH,
$goodsSubtitleSpan;
require("js/product/detail/desc");
require("js/product/detail/comments-consults");
... ... @@ -4800,6 +4841,14 @@ $.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)(\.\.\.)?$/, '...'));
}
}
require("js/product/detail/like");
});
... ... @@ -4912,7 +4961,16 @@ var $ = require("jquery"),
var commentsNum,consultsNum;
var consultFooterEle = document.getElementById('consult-content-footer'),
consultFooterHammer = consultFooterEle && new Hammer(consultFooterEle);
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');
(function() {
... ... @@ -4938,32 +4996,60 @@ var consultFooterEle = document.getElementById('consult-content-footer'),
})();
$('#nav-tab li').on('touchend', function() {
var index = $(this).index();
if (navtabHammer) {
navtabHammer.on('tap', function(e) {
var $this = $(e.target).closest('li');
var index = $this.index();
if ($(this).hasClass('comment-nav') && 0 === commentsNum) {
tip.show('暂无商品评价');
} else {
if (!$(this).hasClass('focus')) {
if ($this.hasClass('comment-nav') && 0 === commentsNum) {
tip.show('暂无商品评价');
} else {
if (!$this.hasClass('focus')) {
$('#nav-tab li').each(function() {
$(this).removeClass('focus');
});
$('#feedback-content .content').each(function() {
$(this).addClass('hide');
});
$('#nav-tab li').each(function() {
$(this).removeClass('focus');
});
$('#feedback-content .content').each(function() {
$(this).addClass('hide');
});
$(this).addClass('focus');
$('#feedback-content .content:eq(' + index + ')').removeClass('hide');
$this.addClass('focus');
$('#feedback-content .content:eq(' + index + ')').removeClass('hide');
}
}
}
});
});
}
if (consultFooterHammer) {
consultFooterHammer.on('tap', function() {
location.href = $(consultFooterEle).find('a').attr('href');
});
}
if (gotoConsultHammer) {
gotoConsultHammer.on('tap', function() {
location.href = $(gotoConsultEle).find('a').attr('href');
});
}
function fixConsultBar() {
if ($(window).scrollTop() > $('#yoho-header').outerHeight()) {
$gotoConsult.css('position', 'fixed');
$gotoConsult.css('top', '0');
} else {
$gotoConsult.css('position', 'static');
}
}
//滚动时顶部固定 我要咨询
function scrollHandler() {
fixConsultBar();
}
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
});
define("js/product/recommend-for-you-product-desc", ["swiper","jquery","index"], function(require, exports, module){
/**
... ... @@ -5155,7 +5241,9 @@ $consultForm.on('submit', function() {
loading.hideLoadingMask();
} else {
tip.show('提交成功~');
setTimeout(window.history.go(-1), 3000);
setTimeout(function() {
window.history.go(-1);
}, 3000);
}
}).fail(function() {
tip.show('网络出了点问题~');
... ... @@ -5206,11 +5294,14 @@ function hotrank(page, sort, tabId, notab) {
}
} else {
$('.no-result').remove();
$('.rank-main').remove();
if (page === 1) {
$('.rank-main').remove();
}
$('#hotRank').append(data);
}
lazyLoad($('img.lazy'));
$('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top');
$('.rank-main ul li:gt(9)').find('.item-content i').removeClass('top');
winH = $(window).height();
if ($('.rank-main').length !== 0) {
$('#yoho-footer').css('position', 'static');
... ... @@ -5338,7 +5429,7 @@ function getOrders(option) {
page: order.page + 1
};
var show = option && option.showLoadingMask;
var show = option && !option.noLoadingMask;
if (inAjax) {
return;
... ... @@ -5484,7 +5575,7 @@ orderHammer.on('tap', function(e) {
}
});
});
} else {
} else if ($cur.closest('.order-goods').length > 0) {
//Location to order detail
url = $order.data('href');
... ... @@ -5552,6 +5643,7 @@ exports.showDialog = function(data, callback) {
var dialogStr = dialogTemplate(data),
$dialogBox,
defaultHideDuraton,
dialogWrapperHammer;
$('.dialog-wrapper').remove();
... ... @@ -5578,9 +5670,13 @@ exports.showDialog = function(data, callback) {
//隐藏
if (data.autoHide) {
defaultHideDuraton = 1000;
if (data.autoHide > 1) {
defaultHideDuraton = data.autoHide;
}
setTimeout(function() {
$dialogWrapper.fadeOut();
}, 1000);
}, defaultHideDuraton);
}
dialogWrapperHammer.on('tap', function(event) {
... ... @@ -5591,12 +5687,8 @@ exports.showDialog = function(data, callback) {
callback();
}
});
};
exports.hideDialog = function() {
$dialogWrapper.fadeOut();
};
});
define("js/me/order-detail", ["jquery","lazyload","hammer"], function(require, exports, module){
... ... @@ -5959,11 +6051,21 @@ lazyLoad();
headerNavHammer = new Hammer(document.getElementById('yoho-header'));
headerNavHammer.on('tap', function(e) {
var suggestText = $('#suggest-textarea').val();
var suggestText = $('#suggest-textarea').val(),
textReg = /\S+/;
if ($(e.target).hasClass('nav-btn')) {
if (!textReg.test(suggestText)) {
diaLog.showDialog({
autoHide: true,
dialogText: '意见不能为空'
});
return;
}
$.ajax({
method: 'post',
url: '/home/savesuggest',
... ... @@ -5980,10 +6082,18 @@ headerNavHammer.on('tap', function(e) {
setTimeout(function() {
location.pathname = 'home/suggest';
}, 2000);
} else {
diaLog.showDialog({
autoHide: true,
dialogText: '提交失败~'
});
}
}).fail(function() {
//TODO
diaLog.showDialog({
autoHide: true,
dialogText: '网络错误~'
});
});
}
});
... ... @@ -7089,12 +7199,9 @@ define("js/me/address", ["jquery"], function(require, exports, module){
var $ = require("jquery"),
tip = require("js/plugin/tip"),
security = require("js/plugin/security"),
loading = require("js/plugin/loading");
var $action = $('.action'),
$addressForm = $('.edit-address'),
$submit = $('.submit'),
$addAddress = $('.add-address'),
$footer = $('#yoho-footer'),
$confim = $('.confim-mask'),
... ... @@ -7107,12 +7214,13 @@ $pageWrap.first().css('min-height', function() {
});
window.rePosFooter();
$confim.on('touchend', '.cancel', function() {
$confim.on('touchend', '.cancel', function(e) {
deleteId = null;
$confim.hide();
$confim.fadeOut();
return false;
}).on('touchend', '.confim', function() {
loading.showLoadingMask();
$confim.hide();
$confim.fadeOut();
$.ajax({
method: 'POST',
url: '/home/delAddress',
... ... @@ -7135,6 +7243,7 @@ $confim.on('touchend', '.cancel', function() {
}).always(function() {
deleteId = null;
});
return false;
});
... ... @@ -7152,19 +7261,7 @@ $addAddress.on('touchend', function() {
// 删除
$action.on('touchend', '.del', function() {
deleteId = $(this).data('id');
$confim.show();
});
$submit.on('touchend', function() {
if (security.hasDangerInput(false)) {
return false;
}
$addressForm.submit();
return false;
}).on('touchstart', function() {
$(this).addClass('highlight');
}).on('touchend touchcancel', function() {
$(this).removeClass('highlight');
$confim.fadeIn();
});
});
... ... @@ -7279,17 +7376,14 @@ $page.on('touchstart', '.del-icon', function() {
success: function(data) {
if (data.code === 200) {
dialog.showDialog({
dialogText: '删除浏览记录成功',
autoHide: true,
fast: true
});
dialogText: '删除浏览记录成功',
autoHide: 2000,
fast: true
});
setTimeout(function() {
window.history.go(0);
}, 2500);
}, 1200);
}
},
complete: function() {
dialog.hideDialog(); //隐藏dialog
}
});
});
... ... @@ -7399,6 +7493,9 @@ $addressForm.on('submit', function() {
});
$submit.on('touchend', function() {
if (security.hasDangerInput(false)) {
return false;
}
$input.blur();
$addressForm.submit();
return false;
... ... @@ -7508,16 +7605,100 @@ $(document).ready(addFooterTopBorder);
});
define("js/me/pay", ["jquery"], function(require, exports, module){
define("js/me/pay", ["jquery","hammer"], function(require, exports, module){
/**
* 支付页面
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2015/12/03
*/
var loading = require("js/plugin/loading");
var $ = require("jquery");
var loading = require("js/plugin/loading"),
tip = require("js/plugin/tip"),
Hammer = require("hammer");
var theOrderCode = document.getElementById('ordercode').value;
var wxPayEl = document.getElementById('weixin'),
wxHammer = wxPayEl && new Hammer(wxPayEl);
var appIconPosition = {
baidu: '-2.7rem',
weixin: '-1.2rem',
QQ: '-5.4rem',
bank: '-4rem'
};
//隐藏微信分享选项
if (window.wx) {
wx.hideOptionMenu();
}
function onBridgeReady() {
document.addEventListener('WeixinJSBridgeReady', function() {
window.WeixinJSBridge && window.WeixinJSBridge.call('hideOptionMenu');
});
}
if (typeof WeixinJSBridge === undefined) {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
}
onBridgeReady();
} else {
onBridgeReady();
}
//调用微信JS api 支付
function jsApiCall(orderCode, jsApiParameters) {
//防止重复操作弹框
window.WeixinJSBridge && window.WeixinJSBridge.invoke(
'getBrandWCPayRequest',
jsApiParameters,
function(res) {
window.location.href = '/home/orders/detail?order_code=' + orderCode;
}
);
}
//微信支付
function callpay(orderCode) {
var jsApiParameters;
if (typeof WeixinJSBridge === undefined) {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
}
} else {
$.ajax({
type: 'GET',
url: '/shopping/pay/wechatwapapi?order_code=' + orderCode,
dataType: 'json',
success: function(res) {
if (res.code === 200) {
jsApiParameters = res.data.jsApiParameters;
jsApiCall(orderCode, jsApiParameters);
} else {
tip.show('微信支付调取失败');
}
},
error: function() {
tip.show('请刷新本页面,完成微信支付');
}
});
}
}
function isWXOpen() {
var ua = navigator.userAgent.toLowerCase();
var ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) === 'micromessenger') {
return true;
... ... @@ -7527,11 +7708,11 @@ function isWXOpen() {
}
function hideWeChatPay() {
var payApps = document.getElementsByClassName('app');
var $payApps = $('.app');
[].forEach.call(payApps, function(app, index) {
if (app.innerHTML.indexOf('微信') !== -1) {
app.parentNode.style.display = 'none';
$payApps.each(function(idx, app) {
if ($(app).parent().attr('id') === 'weixin') {
$(app).parent().css('display', 'none');
return false;
}
});
... ... @@ -7543,47 +7724,37 @@ function handleForWX() {
}
}
function setIcon(div, appName) {
if (appName.indexOf('百度') !== -1) {
div.style.backgroundPositionY = '-2.7rem';
return false;
}
if (appName.indexOf('微信') !== -1) {
div.style.backgroundPositionY = '-1.2rem';
return false;
}
if (appName.indexOf('银联') !== -1) {
div.style.backgroundPositionY = '-4rem';
return false;
}
if (appName.indexOf('QQ') !== -1) {
div.style.backgroundPositionY = '-5.4rem';
return false;
}
function setAppIcon(el, position) {
$(el).css('background-position-y', position);
}
function loadIcon() {
var boxs = document.getElementsByClassName('box');
var div = null;
var appName = null;
[].forEach.call(boxs, function(box, index) {
div = box.getElementsByClassName('icon')[0].getElementsByTagName('div')[0];
if (div) {
appName = box.getElementsByClassName('app')[0].innerHTML;
setIcon(div, appName);
var $boxs = $('.box');
var $div = null;
var appid = null;
$boxs.each(function(idx, box) {
$div = $(box).find('.icon').find('div');
if ($div.length > 0) {
appid = $(box).attr('id');
if (appid !== 'alipay') {
setAppIcon($div, appIconPosition[appid]);
}
}
});
}
function showPage() {
var pageList = document.getElementsByClassName('payapp-list')[0];
var $pageList = $('.payapp-list');
pageList.style.visibility = 'visible';
$pageList.css('visibility', 'visible');
}
if (wxHammer) {
wxHammer.on('tap', function() {
callpay(theOrderCode);
});
}
function main() {
... ...
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.
... ... @@ -16,10 +16,7 @@ var consultFooterEle = document.getElementById('consult-content-footer'),
navtabHammer = navtabEle && new Hammer(navtabEle),
gotoConsultEle = document.getElementById('goto-consult'),
gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle),
$gotoConsult = $('#goto-consult');
gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle);
(function() {
... ... @@ -81,20 +78,8 @@ if (gotoConsultHammer) {
});
}
function fixConsultBar() {
if ($(window).scrollTop() > $('#yoho-header').outerHeight()) {
$gotoConsult.css('position', 'fixed');
$gotoConsult.css('top', '0');
} else {
$gotoConsult.css('position', 'static');
}
}
//滚动时顶部固定 我要咨询
function scrollHandler() {
fixConsultBar();
//咨询页面固定header
if ($('.goods-consults-page').length > 0) {
$('#yoho-header').css('position', 'fixed').css('top', '0');
}
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
... ...
... ... @@ -15,10 +15,7 @@ var goodsSwiper,
var goodsDiscountEl = document.getElementById('goodsDiscount'),
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl);
var $cart = $('.cart-bar'),
$goodsSubtitle = $('.goodsSubtitle'),
divH,
$goodsSubtitleSpan;
var $cart = $('.cart-bar');
require('./desc');
require('./comments-consults');
... ... @@ -85,12 +82,4 @@ $.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)(\.\.\.)?$/, '...'));
}
}
require('./like');
... ...
... ... @@ -41,6 +41,8 @@
.goods-consults-page {
background-color: #f0f0f0;
.goto-consult {
position: fixed;
top: 2.25rem;
width: 100%;
box-sizing:border-box;
padding: 0 pxToRem(28px);
... ... @@ -63,6 +65,8 @@
}
}
.goods-consults {
margin-top: 5.25rem;
overflow: hidden;
.consult-item {
margin-top: pxToRem(30px);
padding: pxToRem(20px) pxToRem(28px);
... ...
... ... @@ -211,18 +211,26 @@ $basicBtnC:#eb0313;
background-color: #515150;
}
.goodsSubtitle {
// display: table;
height: pxToRem(88px);
font-size: pxToRem(24px);
color: $subFontC;
padding-left: pxToRem(28px);
padding-right: pxToRem(28px);
padding-top: pxToRem(14px);
border-bottom: 1px solid $borderC;
background-color: #f4f4f4;
background-color: $pageBgC;
display: flex;
align-items: center;
span{
display: block;
// display: table-cell;
display: -webkit-box;
line-height: pxToRem(36px);
margin: 0;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
}
.price-date {
... ...
... ... @@ -41,7 +41,7 @@ class HomeController extends AbstractAction
{
// 设置网站标题
$this->setTitle('个人中心');
$this->setNavHeader('个人中心');
$this->setNavHeader('个人中心', SITE_MAIN . '/?go=1');
$data = array(
'myIndexPage' => true,
... ... @@ -137,7 +137,7 @@ class HomeController extends AbstractAction
if ($this->isAjax()) {
$uid = $this->getUid(true);
$page = $this->post('page', 1);
$gender = Helpers::getGenderByCookie();
$gender = Helpers::getGenderByCookie();
$result = UserModel::getFavBrandData($uid, $gender, $page, 10);
}
... ... @@ -636,6 +636,7 @@ class HomeController extends AbstractAction
* 我的订单页面,获得nav导航条焦点。并且异步请求订单详情列表页(getOrders)
*
*/
public function ordersAction()
{
// 审判跳转登录页
... ... @@ -773,6 +774,7 @@ class HomeController extends AbstractAction
/*
* 我的订单-付款跳转页
*/
public function payAction()
{
// 审判跳转登录页
... ...
... ... @@ -61,7 +61,7 @@ class OrderModel
{
$result = array();
//调用接口获得数据
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
// 判断是否还有数据, 没有数据则返回空
if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) {
return $result;
... ... @@ -69,19 +69,20 @@ class OrderModel
//检查数据返回是否正常,正常则处理数据
if (!empty($data['data']['order_list'])) {
// 订单的状态列表
$orderStatus = Helpers::getOrderStatus();
//$orderStatus = Helpers::getOrderStatus();
foreach ($data['data']['order_list'] as $key => $vo) {
if ($vo['payment_status'] == 'Y' && $vo['status'] == 0) {
$vo['status'] = 1;
}
// if ($vo['payment_status'] == 'Y' && $vo['status'] == 0) {
// $vo['status'] = 1;
// }
//订单号,支付状态,订单商品数量,订单总价格
$result[$key]['orderNum'] = $vo['order_code'];
$result[$key]['orderStatus'] = ($vo['is_cancel'] === 'Y') ? '已取消' : $orderStatus[ $vo['payment_type'] ][ $vo['status'] ];
//$result[$key]['orderStatus'] = ($vo['is_cancel'] === 'Y') ? '已取消' : $orderStatus[ $vo['payment_type'] ][ $vo['status'] ];
$result[$key]['orderStatus'] = $vo['status_str'];
$result[$key]['count'] = count($vo['order_goods']);
$result[$key]['sumCost'] = $vo['amount'];
//类内调用格式化订单商品数据方法
$result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods']);
$result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods']);
$result[$key]['detailUrl'] = Helpers::url('/home/orders/detail', array('order_code' => $vo['order_code'], 't' => time()));
//根据订单status判断订单处于什么状态。
do {
... ...
... ... @@ -165,31 +165,31 @@ class DetailModel
foreach ($baseInfo['goodsList'] as $value) {
$colorId = intval($value['colorId']);
// 商品按颜色进行分类分组
if (isset($value['goodsImagesList'])) {
foreach ($value['goodsImagesList'] as $goods) {
$goodsList[$goods['goodsId']] = $colorId;
$goodsGroup[$colorId][] = array(
'goodsId' => $goods['goodsId'],
'img' => $goods['imageUrl'],
);
$colorGroup[$colorId] = array(
'colorId' => $colorId,
'colorName' => $value['colorName'],
'colorImage' => Helpers::getImageUrl($value['colorImage'], 60, 60),
);
}
}
if (isset($value['goodsImagesList'])) {
foreach ($value['goodsImagesList'] as $goods) {
$goodsList[$goods['goodsId']] = $colorId;
$goodsGroup[$colorId][] = array(
'goodsId' => $goods['goodsId'],
'img' => $goods['imageUrl'],
);
$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'],
);
}
}
}
// 商品图
... ... @@ -218,11 +218,20 @@ class DetailModel
'cartUrl' => Helpers::url('/cart/index/index', null), // 购物车链接
'numInCart' => 0,
'goodsInstore' => $baseInfo['storage'], // 库存量
'soldOut' => $baseInfo['storage'] == 0, // 已售磬
'notForSale' => $baseInfo['attribute'] == 2, // 非卖品
);
if (!$result['cartInfo']['soldOut'] && !$result['cartInfo']['notForSale']) {
$result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html'); // 加入购物车链接
$soldOut = $baseInfo['storage'] == 0;
$notForSale = $baseInfo['attribute'] == 2;
// 显示加入购物车链接
if (!$soldOut && !$notForSale) {
$result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html'); //
}
// 非卖品
elseif ($notForSale) {
$result['cartInfo']['notForSale'] = true;
}
// 已售磬
elseif ($soldOut) {
$result['cartInfo']['soldOut'] = true;
}
// 是否收藏
... ... @@ -413,7 +422,11 @@ class DetailModel
// 详情配图
if (isset($sizeInfo['productIntroBo']['productIntro'])) {
$productIntro = $sizeInfo['productIntroBo']['productIntro'];
$productIntro = '';
if (!empty($sizeInfo['productDescBo']['phrase'])) {
$productIntro .= $sizeInfo['productDescBo']['phrase'];
}
$productIntro .= $sizeInfo['productIntroBo']['productIntro'];
if ($productIntro) {
$result['productDetail'] = array(
'title' => '商品详情',
... ...
... ... @@ -18,12 +18,6 @@ class LoginController extends AbstractAction
public function indexAction()
{
$refer = $this->get('refer');
// 已登录则直接跳回
$uid = $this->getUid();
if ($uid) {
$refer = empty($refer) ? SITE_MAIN . '/?go=1' : rawurldecode($refer);
$this->go($refer);
}
if (!empty($refer)) {
$this->setCookie('refer', $refer);
}
... ... @@ -54,12 +48,6 @@ class LoginController extends AbstractAction
public function internationalAction()
{
$refer = $this->get('refer');
// 已登录则直接跳回
$uid = $this->getUid();
if ($uid) {
$refer = empty($refer) ? SITE_MAIN . '/?go=1' : rawurldecode($refer);
$this->go($refer);
}
if (!empty($refer)) {
$this->setCookie('refer', $refer);
}
... ... @@ -73,7 +61,6 @@ class LoginController extends AbstractAction
$data['isPassportPage'] = true; // 模板中模块标识
$data['areaCode'] = '+86'; // 默认区号
$data['countrys'] = RegData::getAreasData(); // 地区信息列表
// 渲染模板
$this->_view->display('international', $data);
}
... ... @@ -83,10 +70,12 @@ class LoginController extends AbstractAction
*/
public function outAction()
{
// 清除客户端
$this->setCookie('_UID', '');
// 清除服务端会话
$this->setSession('_TOKEN', '');
$refer = $this->server('HTTP_REFERER', SITE_MAIN);
$token = $this->get('token');
if (!empty($token)) {
LoginData::signoutSession($token);
... ... @@ -142,6 +131,8 @@ class LoginController extends AbstractAction
}
$data['data']['session'] = Helpers::syncUserSession($data['data']['uid']);
$data['data']['href'] = $refer;
$this->setSession('_TOKEN', Helpers::makeToken($data['data']['uid']));
} while (false);
$this->echoJson($data);
... ...
[memcached]
master.hosts=127.0.0.1:11212,127.0.0.1:11213
slave.hosts=127.0.0.1:11212,127.0.0.1:11213
session.hosts=127.0.0.1:11212,127.0.0.1:11213
[redis]
servers.hosts = 127.0.0.1:6379
\ No newline at end of file
... ...
... ... @@ -45,7 +45,7 @@ routes.logout.type = "rewrite"
routes.logout.match = "/passport/signout/index"
routes.logout.route.module = Passport
routes.logout.route.controller = Login
routes.logout.route.action = out
routes.logout.route.action = Out
; 找回密码(手机号)
routes.phoneback.type = "rewrite"
... ...