Authored by 周少峰

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

... ... @@ -8,6 +8,7 @@ use LibModels\Web\Product\SearchData;
use Api\Yohobuy;
use Api\Sign;
use Configs\ChannelConfig;
use Index\HomeModel;
/**
* 搜索辅助类
*/
... ... @@ -32,7 +33,7 @@ class HelperSearch
private static function setListNav()
{
$options = self::$options;
$cookieChannel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
$channel = HomeModel::getSwitchChannel();
if (isset($options['brandName']) && !empty($options['brandName'])) {
$initNav = $options['brandNameEn'] . $options['brandNameCn'];
}else{
... ... @@ -40,7 +41,7 @@ class HelperSearch
}
self::$listNav[0] = array(
'href' => '',
'name' => strtoupper($cookieChannel).'首页'
'name' => strtoupper($channel).'首页'
);
self::$listNav[1] = array(
'href' => '',
... ... @@ -1105,12 +1106,15 @@ class HelperSearch
$pattern = "/[img|IMG].*?src=['|\"](.*?(?:[.gif|.jpg]))['|\"].*?[\/]?>/";
preg_match_all($pattern,$string,$img);
foreach($href[1] as $key=>$vo){
$result[$key]['href'] = $vo;
$result[$key]['src'] = $img[1][$key];
foreach($img[1] as $key=>$vo){
if(strrchr($vo, '.swf') == '.swf'){
$result[$key]['isVedio'] = true;
$result[$key]['src'] = $vo;
}else{
$result[$key]['href'] = $href[1][$key];
$result[$key]['src'] = $vo;
}
}
return $result;
}
}
... ...
... ... @@ -799,7 +799,12 @@ class Helpers
*/
public static function syncUserSession($uid, $refer = '', $callback = 'call')
{
return 'http://mapi.yohobuy.com/Passport/session/index?callback=' . $callback
if(APPLICATION_ENV == 'production') {
$domain = 'http://mapi.yohobuy.com';
} else {
$domain = 'http://m1.yohobuy.com';
}
return $domain.'/Passport/session/index?callback=' . $callback
. '&sign=' . md5(md5($uid . 'Js8Yn0!EwPM45-ws')) . '&uid=' . $uid . '&go=' . $refer;
}
... ... @@ -815,7 +820,12 @@ class Helpers
*/
public static function logoutSession($token, $refer = '', $callback = 'call')
{
return 'http://mapi.yohobuy.com/Passport/session/logout?callback=' . $callback
if(APPLICATION_ENV == 'production') {
$domain = 'http://mapi.yohobuy.com';
} else {
$domain = 'http://m1.yohobuy.com';
}
return $domain.'/Passport/session/logout?callback=' . $callback
. '&sign=' . md5(md5('Js8Yn0!EwPM45-ws')) . '&token=' . $token . '&go=' . $refer;
}
... ...
... ... @@ -219,9 +219,9 @@ $yohoPage.on('touchstart', '.tap-hightlight', function() {
$(this).removeClass('highlight');
});
// $('.nav-home').on('touchstart', function() {
// $('.homebuttom').toggleClass('none');
// });
$('.nav-home').on('touchstart', function() {
$('.homebuttom').toggleClass('none');
});
(function() {
var lastTime = 0,
... ...
... ... @@ -144,6 +144,9 @@
overflow: hidden;
float: left;
text-align: center;
a{
color: #fff;
}
i{
width: 100%;
height: 40%;
... ...
... ... @@ -97,7 +97,7 @@
float: left;
color: #fff;
font-size: pxToRem(28px);
width: pxToRem(320px);
width: pxToRem(212px);
// width: pxToRem(213px); 三栏宽度
&.highlight {
... ...
... ... @@ -28,14 +28,10 @@
{{#isLogin}}{{brand_favorite_total}}{{/isLogin}}
<p>收藏的品牌</p>
</a>
{{!
<a class="link-item tap-hightlight" href="/home/record">
<!-- product_browse -->
{{#isLogin}}{{product_browse}}{{/isLogin}}
<p>浏览记录</p>
</a>
}}
</div>
<div class="my-order">
<a class="order-title" href="/home/orders">
... ...
... ... @@ -38,4 +38,13 @@
{{/ logisticDetail}}
</div>
</div>
<div class="banner">
{{#banner}}
<a href="{{url}}">
<img src="{{img}}" alt="img">
</a>
{{/banner}}
</div>
{{> home/maybe_like}}
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@
<a href="{{#if backUrl}}{{backUrl}}{{^}}javascript:history.go(-1);{{/if}}" class="iconfont nav-back">&#xe610;</a>
{{/navBack}}
{{#navHome}}
<a href="{{.}}" class="iconfont nav-home">&#xe611;</a>
<span class="iconfont nav-home">&#xe62d;</span>
{{/navHome}}
{{#currencyPage}}
<a href="/home/helpDetail?code=20151230-102233&caption=YOHO币介绍" class="iconfont nav-home">&#xe639;</a>
... ... @@ -18,32 +18,34 @@
{{#navTitle}}
<p class="nav-title">{{.}}</p>
{{/navTitle}}
{{# navBtn}}
<span class="nav-btn">{{.}}</span>
{{!--
<i class="iconfont nav-home">&#xe638;</i>
<div class="homebuttom none">
<ul>
<li>
</header>
<div class="homebuttom none">
<ul>
<li>
<a href="/">
<i class="iconfont">&#xe62a;</i>
<span>首页</span>
</li>
<li>
</a>
</li>
<li>
<a href="cate">
<i class="iconfont">&#xe62d;</i>
<span>分类</span>
</li>
<li>
</a>
</li>
<li>
<a href="cart/index/index">
<i class="iconfont">&#xe62c;</i>
<span>购物车</span>
</li>
<li>
</a>
</li>
<li>
<a href="/home">
<i class="iconfont">&#xe62b;</i>
<span>我的</span>
</li>
</ul>
</div>
--}}
{{/ navBtn}}
</header>
</a>
</li>
</ul>
</div>
{{/pageHeader}}
... ...
... ... @@ -79,6 +79,10 @@ var $ = require('yoho.jquery'),
var brandTpl,
brandHtml;
if (!data || data.length === 0) {
return;
}
that._createHelper();
brandHtml = '\{{#brandList logoBrand}}' +
'<a href="\{{href}}" target="_blank"><img class="lazy" data-original="\{{img}}" alt=""></a>' +
... ...
... ... @@ -174,6 +174,9 @@ $('.va').keyup(function() {
} else if (v.length < 6 || v.length > 20) {
$(this).addClass('error');
$pwdErr.removeClass('hide').find('em').text('密码只支持6-20位');
} else if (/^([a-zA-Z0-9\-\+_!@\#$%\^&\*\(\)\:\;\.=\[\]\\\',\?]){6,20}$/.test(v)) {
$(this).addClass('error');
$pwdErr.removeClass('hide').find('em').text('密码不能包含特殊字符');
} else {
$pwdErr.addClass('hide');
if ($repwd.val() !== '') {
... ...
... ... @@ -68,7 +68,7 @@ function closeMask() {
if ($target.hasClass('mask') || $target.hasClass('backdrop')) {
$('#alreayregist').hide();
}
})
});
}
function nextStep() {
... ...
... ... @@ -11,7 +11,7 @@ $('#brand-favor').on('click', function() {
uid = window.getUid();
if (!uid) {
location.href = '/signin.html?refer=' + location.href;
location.href = '/signin.html?refer=' + encodeURIComponent(location.href);
return;
}
... ...
... ... @@ -74,6 +74,14 @@ exports.init = function(num) {
};
}
function removeHtmlFn() {
$goodInfoMain.html('');
$goodSelectColor.html('');
$goodItemWrapper.css({
display: 'none'
});
}
productList.addHandler('MouseEnter', function(event) {
var itemMr = 10, //list的右边距
itemMb = 35, //list的下边距
... ... @@ -150,16 +158,9 @@ exports.init = function(num) {
$goodItemWrapper.mouseleave(function() {
// removeHtmlFn();
removeHtmlFn();
});
function removeHtmlFn() {
$goodInfoMain.html('');
$goodSelectColor.html('');
$goodItemWrapper.css({
display: 'none'
});
}
};
//鼠标放在颜色列表上效果
... ... @@ -173,6 +174,11 @@ $(document).on('hover', '.good-select-color li', function() {
$goodInfoMain.on('click', '.col-btn', function() {
var $this = $(this);
if (!window.getUid()) {
location.href = '/signin.html?refer=' + encodeURIComponent(location.href);
return;
}
$.ajax({
type: 'POST',
url: '/product/list/changeFavorite',
... ...
... ... @@ -6,4 +6,96 @@ if ($('.simple-header').size() > 0) {
}).on('mouseleave', function() {
$(this).find('.tool-select').fadeOut();
});
}
\ No newline at end of file
}
/**
* 格式化用户名
* @return {[type]} [description]
*/
function formatUsernName(userName) {
var name,
char,
_num = 0,
_length = 0,
t;
for (t = 0; t < userName.length; t++) {
char = userName.substr(t, 1);
if (/.*[\u4e00-\u9fa5]+.*$/.test(char)) {
_length += 2;
} else {
_length += 1;
}
}
if (_length <= 10) {
name = userName;
} else {
_num = 0;
name = '';
for (t = 0; t < userName.length; t++) {
if (_num < 10) {
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 += '...';
}
}
return name;
}
/**
* 设置简单头部登陆状态
* @return {[type]} [description]
*/
function setLoginStatus(_data) {
var loginHtml,
name;
if (_data && _data.href && _data.href.user) {
name = formatUsernName(_data.href.user);
loginHtml = '<span>Hi~</span><a href="">' +
name + '</a>&nbsp;<a href="' + _data.href.logout + '">[退出]</a>';
} else {
name = formatUsernName(_data.user);
loginHtml = '<span>Hi~</span><a href="">' +
name + '</a>&nbsp;<a href="http://www.yohobuy.com/signin.html">[请登录]</a>' +
'<a href="http://www.yohobuy.com/reg.html">[免费注册]</a>';
}
$('.header-tool li').eq(0).html(loginHtml);
}
/**
* 获取登录信息
* @return {[type]} [description]
*/
function actionLoginInfo() {
$.ajax({
type: 'GET',
url: '/common/getSimpleHeader',
data: {},
success: function(data) {
if (data.code === 200) {
setLoginStatus(data.data);
}
}
});
}
/**
* 初始化函数
* @return {[type]} [description]
*/
function init() {
actionLoginInfo(); //获取登录信息
}
init();
\ No newline at end of file
... ...
... ... @@ -71,7 +71,7 @@ class Bootstrap extends Bootstrap_Abstract
$controller = 'Index';
$action = 'Index';
// 二级域名
if (2 === $level) {
if (3 === $level) {
$url = strtolower($dispatcher->getRequest()->getRequestUri());
if(empty($url) || $url == '/index' || $url == '/') {
$urlAction = '/index';
... ...
... ... @@ -76,8 +76,23 @@ class BrandsModel
);
}
//根据品牌域名处理相关品牌参数
public static function getBrandByDomain($domain, $fields)
{
$brandInfo = BrandData::getBrandLogoByDomain($domain, $fields);
$result = array();
if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) {
$result['brandId'] = isset($brandInfo['data']['id']) ? $brandInfo['data']['id'] : '';
$result['node'] = isset($brandInfo['data']['static_content_code']) ? $brandInfo['data']['static_content_code'] : false;
$result['brandBanner'] = isset($brandInfo['data']['brand_banner']) ? $brandInfo['data']['brand_banner']: '';
$result['brandNameEn'] = isset($brandInfo['data']['brand_name_en']) ? $brandInfo['data']['brand_name_en'] : '';
$result['brandNameCn'] = isset($brandInfo['data']['brand_name_cn']) ? $brandInfo['data']['brand_name_cn'] : '';
$result['brandAbout'] = isset($brandInfo['data']['brand_intro']) ? $brandInfo['data']['brand_intro'] : '';
} else {
return false;
}
return $result;
}
... ...
<?php
use Action\WebAction;
use LibModels\Web\Product\BrandData;
use LibModels\Web\Product\FavoriteData;
use Product\BrandsModel;
use LibModels\Web\Product\HotrankData;
use product\HotrankModel;
... ... @@ -13,29 +13,24 @@ class IndexController extends WebAction
*/
public function brandAction()
{
//品牌域名
//品牌域名,没有获取到品牌域名的跳转首页
$domain = $this->param('named');
if (empty($domain)) {
$this->go(SITE_MAIN);
}
$uid = $this->getUid();
//根据品牌域名获取品牌id(同时判断品牌域名是否有效)
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页
$fields = 'id,brand_name,brand_name_cn,brand_name_en,brand_domain,brand_alif,brand_banner,brand_ico,static_content_code';
$brandInfo = BrandData::getBrandLogoByDomain($domain, $fields);
if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) {
$brandId = $brandInfo['data']['id'];
$node = isset($brandInfo['data']['static_content_code']) ? $brandInfo['data']['static_content_code'] : false;
$brandBanner = $brandInfo['data']['brand_banner'];
$brandNameEn = $brandInfo['data']['brand_name_en'];
$brandNameCn = $brandInfo['data']['brand_name_cn'];
} else {
$result = BrandsModel::getBrandByDomain($domain, $fields);
if (!$result) {
$this->go(SITE_MAIN);
}
//品牌ID参数
//获取uid
$uid = $this->getUid();
//传品牌ID参数
$condition = array();
$condition['brand'] = $brandId;
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
//品牌系列参数
$folderId = $this->get('folder_id');
... ... @@ -45,15 +40,17 @@ class IndexController extends WebAction
$options = array();
$options['brandName'] = $domain;
$options['uid'] = $uid;
$options['brandId'] = $brandId;
$options['node'] = $node;
$options['brandBanner'] = $brandBanner;
$options['brandNameEn'] = $brandNameEn;
$options['brandNameCn'] = $brandNameCn;
$options['brandId'] = isset($result['brandId']) ? $result['brandId'] : '';
$options['node'] = isset($result['node']) ? $result['node'] : '';
$options['brandBanner'] = isset($result['brandBanner']) ? $result['brandBanner'] : '';
$options['brandNameEn'] = isset($result['brandNameEn']) ? $result['brandNameEn'] : '';
$options['brandNameCn'] = isset($result['brandNameCn']) ? $result['brandNameCn'] : '';
$options['reviewNum'] = 6;
$options['controller'] = $this->_request->controller;
$options['action'] = $this->_request->action;
//调用模型获得数据
$data = Product\BrandsModel::getBrandSearchData($condition, $options);
$data = BrandsModel::getBrandSearchData($condition, $options);
$data = array(
//初始化js
... ... @@ -75,29 +72,28 @@ class IndexController extends WebAction
$this->go(SITE_MAIN);
}
$uid = $this->getUid();
//根据品牌域名获取品牌id(同时判断品牌域名是否有效)
$fields = 'id,brand_name,brand_name_cn,brand_banner,brand_ico,brand_intro';
$brandInfo = BrandData::getBrandLogoByDomain($domain, $fields);
if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) {
$brandId = $brandInfo['data']['id'];
$brandBanner = $brandInfo['data']['brand_banner'];
$brandAbout = $brandInfo['data']['brand_intro'];
} else {
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页
$fields = 'id,brand_name,brand_name_cn,brand_banner,brand_ico,brand_intro';
$result = BrandsModel::getBrandByDomain($domain, $fields);
if (!$result) {
$this->go(SITE_MAIN);
}
//品牌ID参数
$condition = array();
$condition['brand'] = $brandId;
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
//$options参数数组
$options = array();
$options['brandName'] = $domain;
$options['uid'] = $uid;
$options['brandId'] = $brandId;
$options['brandBanner'] = $brandBanner;
$options['brandAbout'] = $brandAbout;
$options['brandId'] = isset($result['brandId']) ? $result['brandId'] : '';
$options['brandBanner'] = isset($result['brandBanner']) ? $result['brandBanner'] : '';
$options['brandAbout'] = isset($result['brandAbout']) ? $result['brandAbout'] : '';
$options['controller'] = $this->_request->controller;
$options['action'] = $this->_request->action;
//调用模型获得数据
$data = Product\BrandsModel::getBrandIntro($condition, $options);
... ...
... ... @@ -12,7 +12,9 @@ class ListController extends WebAction
$condition = array();
$options = array(
'positionId' => $positionId,
'reviewNum' => 6
'reviewNum' => 6,
'controller' => $this->_request->controller,
'action' => $this->_request->action
);
$indexData = Product\IndexModel::getIndexData($condition, $options);
... ... @@ -41,7 +43,9 @@ class ListController extends WebAction
$newData = Product\NewModel::getNewSearchData($condition, $options);
$data = array(
'productListPage' => true,
'newSale' => $newData
'newSale' => $newData,
'controller' => $this->_request->controller,
'action' => $this->_request->action
);
$this->setWebNavHeader();
//渲染模板
... ... @@ -61,7 +65,9 @@ class ListController extends WebAction
$data = array(
//初始化js
'productListPage' => true,
'list' => $list
'list' => $list,
'controller' => $this->_request->controller,
'action' => $this->_request->action
);
$this->setWebNavHeader();
$this->_view->display('list', $data);
... ...
... ... @@ -41,6 +41,7 @@ class SaleController extends WebAction
$options = array(
'controller' => $this->_request->controller,
'action' => $this->_request->action,
'reviewNum' => 6
);
... ...