Authored by wangqing

合并冲突

... ... @@ -17,15 +17,16 @@ class HelperSearch
public static $options = array();
//当前页
public static $page = 1;
//总页数
public static $pageTotal;
//总记录数
public static $total;
//接口返回搜索条件
public static $filter;
//选中的条件
public static $selected = array();
//list分类面包屑
public static $listNav = array();
//设置导航
private static function setListNav()
{
... ... @@ -78,9 +79,9 @@ class HelperSearch
//总页数
$result['page_total'] = isset($data['product']['page_total']) ? $data['product']['page_total'] : '';
self::$pageTotal = $result['page_total'];
self::$total = $data['product']['total'];
//当前页
$result['page'] = isset($data['product']['page']) ? $data['product']['page'] : '';
self::$page = $result['page'];
self::$page = $result['page'] = isset($data['product']['page']) ? $data['product']['page'] : '';
//筛选条件
$result['filters'] = isset($data['product']['filter']) ? self::filter() : array();
//排序方式、显示数量等其他选项
... ... @@ -145,7 +146,7 @@ class HelperSearch
* @author sefon 2015-12-21 17:24:04
* @return array
*/
public static function getProductList($product,$imgSize)
public static function getProductList($product, $imgSize)
{
$params = self::$params;
$goods = array();
... ... @@ -160,12 +161,26 @@ class HelperSearch
//即将售罄
$isFew = $val['is_soon_sold_out'] === 'Y' ? true : false;
//SALE
$isSale = ($val['is_discount'] == 'Y') ? true : false;
//新品节
//再到着
//年终大促
// 年中大促
$gender = 0;
if (isset(self::$options['gender'])) {
$genderArr = explode(',', self::$options['gender']);
$gender = $genderArr[0];
}
foreach($val['goods_list'] as $k => $v){
$goods_list[$k]['url'] = Helpers::getUrlBySkc($val['product_id'], $v['goods_id'], $val['cn_alphabet']);
//女封
if (isset($v['cover_1']) && $gender == 1) {
$val['default_images'] = $v['images_url'];
}
//男封
if (isset($v['cover_2']) && $gender == 2) {
$val['default_images'] = $v['images_url'];
}
//筛选符合颜色条件的封面图片
if (isset($params['color']) && $params['color'] == $v['color_id']) {
$val['default_images'] = $v['images_url'];
... ... @@ -175,11 +190,19 @@ class HelperSearch
if (!empty($val['default_images'])) {
$val['default_images'] = Images::getImageUrl($val['default_images'],$imgSize[0],$imgSize[1]);
}
//搜索关键字高亮
if (isset(self::$params['query']) && !empty(self::$params['query']) && preg_match("/".self::$params['query']."/i", $val['product_name'], $match)) {
foreach ($match as $k => &$v) {
$replace[$k] = '<span style="color: #cc0000">'.$v.'</span>';
$v = '/'.$v.'/';
}
$val['product_name'] = preg_replace($match, $replace, $val['product_name']);
}
$good = array(
'tags' => array(
'isNew' => $isNew,
'isLimit' => $isLimit
'isLimit' => $isLimit,
'isSale' => $isSale
),
'url' => self::fromPram($goods_list[0]['url'],++$key),
'thumb' => $val['default_images'],
... ... @@ -422,7 +445,7 @@ class HelperSearch
//已选中品牌数量
$existBrandNum = 0;
//已选中品牌标签名
$existName = '';
$existName = array();
foreach ($brand as $key => $v) {
$selectBrandIds = $brandIds;
//品牌已被选中
... ... @@ -433,10 +456,10 @@ class HelperSearch
'brand' => implode(',', $selectBrandIds)
)));
if ($existBrandNum === 0) {
$existName .= $v['brand_name'].'、';
$existName[] = $v['brand_name'];
}
if ($existBrandNum === 1){
$existName .= substr($v['brand_name'], 0, 3).'...';
$existName[]= substr($v['brand_name'], 0, 3).'...';
}
$existBrandNum++;
}
... ... @@ -474,7 +497,7 @@ class HelperSearch
//设置选中
if (isset(self::$params['brand']) && !empty(self::$params['brand'])) {
self::$selected['brand'] = array(
'name' => rtrim($existName, '、'),
'name' => implode($existName,'、'),
'href' => self::buildUrl($params)
);
}
... ... @@ -487,7 +510,6 @@ class HelperSearch
$result['brandIndex'][] = $index;
}
unset($brandList);
//搜索页已选中,返回空
if (self::checkSearch('brand')) {
return array();
... ... @@ -586,12 +608,16 @@ class HelperSearch
*/
public static function price($filter)
{
$result = array();
//商品记录小于10,不显示价格区间
if (self::$total < 10) {
return $result;
}
$params = self::$params;
$priceId = isset($params['price']) && !empty(self::$params['price']) ? self::$params['price'] : '';
if (isset($params['price'])) {
unset($params['price']);
}
$result = array();
//设置已选中价格
if (!empty($priceId)) {
$price = explode(',' ,$priceId);
... ...
... ... @@ -11,39 +11,15 @@
<title>{{title}}</title>
{{#if rlsEnv}}
<link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css">
<!--[if lt IE 9]>
<script src="http://cdn.yoho.cn/yohobuy/respond/respond.min.js"></script>
<link href="http://cdn.yoho.cn/yohobuy/respond/respond-proxy.html" id="respond-proxy" rel="respond-proxy" />
<script src="http://cdn.yoho.cn/yohobuy/respond/respond.proxy.js"></script>
<link href="http://cdn.yoho.cn/yohobuy/respond/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" />
<![endif]-->
{{/if}}
{{#if preEnv}}
<link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css">
<!--[if lt IE 9]>
<script src="http://cdn.yoho.cn/yohobuy/respond/respond.min.js"></script>
<link href="http://cdn.yoho.cn/yohobuy/respond/respond-proxy.html" id="respond-proxy" rel="respond-proxy" />
<script src="http://cdn.yoho.cn/yohobuy/respond/respond.proxy.js"></script>
<link href="http://cdn.yoho.cn/yohobuy/respond/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" />
<![endif]-->
{{/if}}
{{#if testEnv}}
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/yohobuy/{{version}}/index.css">
<!--[if lt IE 9]>
<script src="http://static.buy.test.yoho.cn/dist/yohobuy/respond/respond.min.js"></script>
<link href="http://static.buy.test.yoho.cn/dist/yohobuy/respond/respond-proxy.html" id="respond-proxy" rel="respond-proxy" />
<script src="http://static.buy.test.yoho.cn/dist/yohobuy/respond/respond.proxy.js"></script>
<link href="http://static.buy.test.yoho.cn/dist/yohobuy/respond/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" />
<![endif]-->
{{/if}}
{{#if devEnv}}
<link rel="stylesheet" href="http://webstatic.dev.yohobuy.com/css/index.css">
<!--[if lt IE 9]>
<script src="http://webstatic.dev.yohobuy.com/plugin/page/respond/respond.min.js"></script>
<link href="http://webstatic.dev.yohobuy.com/plugin/page/respond/respond-proxy.html" id="respond-proxy" rel="respond-proxy" />
<script src="http://webstatic.dev.yohobuy.com/plugin/page/respond/respond.proxy.js"></script>
<link href="http://webstatic.dev.yohobuy.com/plugin/page/respond/respond.proxy.gif" id="respond-redirect" rel="respond-redirect" />
<![endif]-->
{{/if}}
</head>
<body>
... ...
... ... @@ -6,6 +6,12 @@
var $ = require('yoho.jquery');
var $body = $('body');
require('./footer');
function cookie(name) {
var cookies = document.cookie,
cookieVal,
... ... @@ -92,20 +98,20 @@ function getShoppingKey() {
}
//YAS统计代码
//(function(w, d, s, j, f) {
// var a = d.createElement(s);
// var m = d.getElementsByTagName(s)[0];
//
// w.YohoAcquisitionObject = f;
//
// w[f] = function() {
// w[f].p = arguments;
// };
//
// a.async = 1;
// a.src = j;
// m.parentNode.insertBefore(a, m);
//})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.14/yas.js', '_yas');
(function(w, d, s, j, f) {
var a = d.createElement(s);
var m = d.getElementsByTagName(s)[0];
w.YohoAcquisitionObject = f;
w[f] = function() {
w[f].p = arguments;
};
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.14/yas.js', '_yas');
(function() {
var uid = getUid();
... ... @@ -119,6 +125,25 @@ function getShoppingKey() {
}
}());
//window.resize在width<1180时适配成990
$(window).on('resize', function() {
var w = $(this).width();
//return top
if (w < 1360) {
$('.return-top').addClass('min');
} else {
$('.return-top').removeClass('min');
}
//body
if (w < 1180) {
$body.addClass('min-screen');
} else {
$body.removeClass('min-screen');
}
}).trigger('resize');
window.cookie = cookie;
window.setCookie = setCookie;
... ... @@ -129,4 +154,3 @@ window.getUid = getUid;
window.getShoppingKey = getShoppingKey;
require('./footer');
\ No newline at end of file
... ...
... ... @@ -1533,5 +1533,5 @@ exports.init = function() {
actionLoginInfo(); //获取登录信息
actionCover(); //初次登录弹框
actionAddKeyWords(); //增加关键字
}
};
... ...
... ... @@ -10,11 +10,6 @@ $('#brand-favor').on('click', function() {
var $this = $(this),
uid = window.getUid();
if (!uid) {
location.href = '/signin.html?refer=' + encodeURIComponent(location.href);
return;
}
$.ajax({
type: 'post',
url: '/product/index/favoriteBrand',
... ... @@ -29,6 +24,8 @@ $('#brand-favor').on('click', function() {
} else {
$this.find('i').removeClass('coled');
}
} else if (res.code === 403) {
location.href = '/signin.html?refer=' + encodeURIComponent(location.href);
}
});
});
... ...
... ... @@ -95,11 +95,6 @@ exports.init = function(num) {
wrapperPt, //鼠标移入时弹层的上内边距
containerPt; //商品列表容器的上内边距
// 获取图片之前,先把获取上一张图片的ajax请求取消。 网络差的时候会出现错误
// if (getProductAjax && getProductAjax.readyState!= 4) {
// getProductAjax.abort();
// }
$.ajax({
type: 'POST',
url: '/product/list/getProductPic',
... ... @@ -174,11 +169,6 @@ $(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',
... ... @@ -189,6 +179,8 @@ $goodInfoMain.on('click', '.col-btn', function() {
}).then(function(res) {
if (res.code === 200) {
$this.toggleClass('coled');
} else if (res.code === 403) {
location.href = '/signin.html?refer=' + encodeURIComponent(location.href);
}
});
});
... ...
... ... @@ -96,5 +96,5 @@ function actionLoginInfo() {
*/
exports.init = function() {
actionLoginInfo(); //获取登录信息
}
};
... ...
... ... @@ -355,51 +355,46 @@
}
}
@media (max-width: 1360px) {
.yoho-footer .return-top {
left: 100%;
right: 20px;
margin-left: auto;
}
.yoho-footer .return-top.min {
left: 100%;
right: 20px;
margin-left: auto;
}
@media (max-width:1180px) {
.yoho-footer {
.index-foot dd {
width: 316px;
.two-dim {
margin-top: 26px;
margin-bottom: 10px;
overflow: hidden;
}
.min-screen .yoho-footer {
.index-foot dd {
width: 316px;
.dim-img {
width: 69px;
height: 69px;
}
.two-dim {
margin-top: 26px;
margin-bottom: 10px;
overflow: hidden;
}
.mobile img {
width: 85px;
height: 108px;
}
.dim-img {
width: 69px;
height: 69px;
}
.promise .left {
margin-right: 45px;
.mobile img {
width: 85px;
height: 108px;
}
}
.subscribe {
width: 200px;
.promise .left {
margin-right: 45px;
}
input {
width: 140px;
}
}
.subscribe {
width: 200px;
.footer-help li {
width: 150px;
input {
width: 140px;
}
}
.footer-help li {
width: 150px;
}
}
\ No newline at end of file
... ...
... ... @@ -80,10 +80,8 @@ input,textarea {
margin-right: auto;
}
@media (max-width: 1180px) {
.center-content {
width: 990px;
}
.min-screen .center-content {
width: 990px;
}
@import "home/index", "product/index", "guang/index", "passport/index", "error", "order/index", "sale/index";
... ...
... ... @@ -387,8 +387,6 @@
}
}
@media (max-width: 1180px) {
.filter-box .brand .attr {
width: 25%;
}
.min-screen .filter-box .brand .attr {
width: 25%;
}
... ...
... ... @@ -51,36 +51,33 @@
}
/*990px*/
@media (max-width: 1180px) {
.min-screen .product-list-page, .new-sale-page {
.product-list-page, .new-sale-page {
.list-right {
width: 810px;
}
.goods-container {
height: auto;
padding-top: 25px;
position: relative;
width: 810px + 10px;//每列增加右边距
.list-right {
width: 810px;
}
.good-info {
width: 195px;
.goods-container {
height: auto;
padding-top: 25px;
position: relative;
width: 810px + 10px;//每列增加右边距
.good-detail-img {
height: 261px;
}
}
.good-info {
width: 195px;
.block-next-page {
width: 195px;
.good-detail-img {
height: 261px;
}
}
.filter-box .brand .attr-content {
max-width: 570px;
.block-next-page {
width: 195px;
height: 261px;
}
}
.filter-box .brand .attr-content {
max-width: 570px;
}
}
\ No newline at end of file
... ...
... ... @@ -9,12 +9,11 @@
}
.goods {
width: 984px;
height: 241px;
margin: 30px 0;
overflow: hidden;
}
.good {
float: left;
margin-right: 14px;
... ... @@ -49,20 +48,26 @@
}
}
@media (max-width: 1180px) {
@media (min-width: 1180px) {
.latest-walk {
.goods {
width: 820px;
height: 301px;
min-width: 984px;
}
}
}
.good {
margin-right: 10px;
}
.min-screen .latest-walk {
.goods {
width: 820px;
height: 301px;
}
img {
width: 195px;
height: 261px;
}
.good {
margin-right: 10px;
}
img {
width: 195px;
height: 261px;
}
}
\ No newline at end of file
}
... ...
... ... @@ -212,21 +212,19 @@
}
}
@media (max-width: 1180px) {
.product-list-page .sort-intro {
.texts {
width: 346px;
height: 248px;
padding: 0 30px;
}
.min-screen .product-list-page .sort-intro {
.texts {
width: 346px;
height: 248px;
padding: 0 30px;
}
.name {
margin-top: 30px;
}
.name {
margin-top: 30px;
}
.img {
width: 400px;
height: 250px;
}
.img {
width: 400px;
height: 250px;
}
}
... ...
... ... @@ -190,8 +190,6 @@
}
}
@media (max-width: 1180px) {
.new-sale-page .new-brands .brands-wrap {
width: 730px;
}
.min-screen .new-sale-page .new-brands .brands-wrap {
width: 730px;
}
\ No newline at end of file
... ...
... ... @@ -19,30 +19,28 @@
/*990px*/
@media (max-width: 1180px) {
.product-search-page {
.goods-container {
height: auto;
padding-top: 25px;
position: relative;
width: 990px + 10px; //每列增加右边距
.good-info {
width: 190px;
.good-detail-img {
height: 255px;
}
}
.min-screen .product-search-page {
.goods-container {
height: auto;
padding-top: 25px;
position: relative;
width: 990px + 10px; //每列增加右边距
.block-next-page {
width: 190px;
.good-info {
width: 190px;
.good-detail-img {
height: 255px;
}
}
.filter-box .brand .attr-content {
max-width: 750px;
.block-next-page {
width: 190px;
height: 255px;
}
}
.filter-box .brand .attr-content {
max-width: 750px;
}
}
... ...
... ... @@ -155,7 +155,6 @@ class SearchModel
$urlList['sort'] = SearchData::getClassesUrl($searchCondition['sortCondition']);
// 组合搜索折扣区间url
$urlList['discount'] = SearchData::getDiscountUrl($searchCondition['condition']);
$result = Yohobuy::getMulti($urlList);
// 组织模板数据
$data = HelperSearch::getList($result, $searchCondition['options']);
... ... @@ -192,7 +191,7 @@ class SearchModel
$param['keyword'] = $searchCondition['condition']['query'];
$urlList['shop'] = SearchData::getShopUrl($param);
}
$data = Yohobuy::getMulti($urlList, array(), true);
$data = Yohobuy::getMulti($urlList);
//获取品牌商品分类
if (isset($data['shop']) && !empty($data['shop'])) {
$shopSortParam['brand'] = $data['shop']['id'];
... ...
... ... @@ -47,8 +47,10 @@ class SearchController extends WebAction
*/
public function sortSizeAction()
{
$condition['msort'] = $this->get('msort');
$size = SearchModel::getSortSize($condition);
$this->echoJson($size);
if (!$this->isAjax()) {
$condition['msort'] = $this->get('msort');
$size = SearchModel::getSortSize($condition);
$this->echoJson($size);
}
}
}
\ No newline at end of file
... ...