Authored by 梁志锋

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

Showing 47 changed files with 1414 additions and 1368 deletions
framework @ 75bbc3b0
Subproject commit e9d066dd88a8e7e37103021c427a205a5cfcdcec
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
... ...
... ... @@ -32,14 +32,14 @@ class IndexData
* @param string $client_type
* @return array
*/
public static function getResourceData($content_code, $client_type = 'android')
public static function getResourceData($content_code, $client_type = 'web')
{
// 构建必传参数
$params = Yohobuy::param();
$params['content_code'] = $content_code;
$params['client_type'] = $client_type;
$params['private_key'] = Yohobuy::$privateKeyList[$client_type];
$params['client_secret'] = Sign::getSign($params);
return Yohobuy::get(Yohobuy::SERVICE_URL . self::URL_OPERATIONS_RESOURCE_GET, $params);
}
}
\ No newline at end of file
... ...
... ... @@ -19,8 +19,8 @@ class SaleData
* 获取专区信息
* @param $specialId 专区ID
*/
public static function getSpecial($specialsaleId) {
public static function getSpecial($specialsaleId)
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_SALE_SPECIAL, 'getOneSpecial', array($specialsaleId));
}
... ...
... ... @@ -4,7 +4,7 @@ namespace LibModels\Web\Product;
use Api\Yohobuy;
class SearchData extends \LibModels\Wap\Product\SearchData
{
public static $shops_url = 'http://101.200.31.165/yohosearch/shops.json';
public static $shopsUrl = 'http://101.200.31.165/yohosearch/shops.json';
/**
* 获取搜索的服务地址
*
... ... @@ -19,12 +19,9 @@ class SearchData extends \LibModels\Wap\Product\SearchData
case 'release':
if($type == 'sort'){
return 'http://100.98.132.63/yohosearch/sortgroup.json';
}elseif($type == 'discount'){
return 'http://100.98.132.63/yohosearch/discount.json';
}elseif($type == 'recent'){
return 'http://100.98.132.63/yohosearch/recent.json';
}elseif($type == 'review'){
}
elseif($type == 'suggest'){
return 'http://100.98.132.63/yohosearch/suggest.json';
}
return 'http://100.98.132.63/yohosearch/search.json';
case 'test':
... ... @@ -34,14 +31,10 @@ class SearchData extends \LibModels\Wap\Product\SearchData
if($type == 'sort'){
return 'http://101.200.31.165/yohosearch/sortgroup.json';
}
elseif($type == 'discount'){
return 'http://101.200.31.165/yohosearch/discount.json';
}
elseif($type == 'recent'){
return 'http://101.200.31.165/yohosearch/recent.json';
}elseif($type == 'review'){
return 'http://itemapi.yohobuy.com/item/item/recentreview';
elseif($type == 'suggest'){
return 'http://101.200.31.165/yohosearch/suggest.json';
}
return 'http://101.200.31.165/yohosearch/search.json';
}
}
... ... @@ -116,36 +109,19 @@ class SearchData extends \LibModels\Wap\Product\SearchData
}
/**
* 获取折扣区间
*/
public static function getDiscount(){
return Yohobuy::get(self::getUrl('discount'));
}
/**
* 获取最新上架
*/
public static function recentShelve(){
return Yohobuy::get(self::getUrl('recent'));
}
/**
* 搜索品牌店铺信息
* @param array $params 参数
* 获取搜索提示
* @param $param
* @param $cache
* @return array
*/
public static function getShop(array $params)
{
return Yohobuy::get(self::$shops_url,$params);
}
/**
* 获取最近浏览记录
* @param int $limit
* @return json
*/
public static function getRecentReview($limit = 0)
public static function getSuggest($param, $cache = false)
{
if (empty($param['query'])) {
return array();
}
if (empty($param['size'])) {
$param['size'] = 10;
}
return Yohobuy::get(self::getUrl('suggest'),$param, $cache);
}
}
\ No newline at end of file
... ...
<?php
namespace Plugin;
use Plugin\Paging;
use LibModels\Web\Product\BrandData;
use Api\Yohobuy;
use Api\Sign;
/**
* 搜索辅助类
*/
... ... @@ -62,13 +65,13 @@ class HelperSearch
unset(self::$params['page']);
unset(self::$params['/sale']);
unset(self::$params['sale']);
$filter = $data['data']['filter'];
$filter = $data['product']['filter'];
//产品列表
$result['goods'] = self::getProductList($data['data']['product_list'], $options['imgSize']);
$result['goods'] = self::getProductList($data['product']['product_list'], $options['imgSize']);
//总页数
$result['page_total'] = $data['data']['page_total'];
$result['page_total'] = $data['product']['page_total'];
//当前页
$result['page'] = $data['data']['page'];
$result['page'] = $data['product']['page'];
self::$page = $result['page'];
//清除选中
$result['filters']['checkedConditions']['clearUrl'] = self::current();
... ... @@ -98,27 +101,37 @@ class HelperSearch
//可选每页显示数量
$result['opts']['pageCounts'] = self::viewNum();
$result['opts']['curPage'] = self::$page;
$result['opts']['pageCount'] = $data['data']['page_total'];
$result['opts']['nextHref'] = ($next = self::next($data['data']['page_total'],$data['data']['filter'])) ? $next['href'] : '';
$result['hasNextPage'] = self::next($data['data']['page_total']);
$result['opts']['pageCount'] = $data['product']['page_total'];
$result['opts']['nextHref'] = ($next = self::next($data['product']['page_total'],$data['product']['filter'])) ? $next['href'] : '';
$result['hasNextPage'] = self::next($data['product']['page_total']);
//全部折扣
$result['leftContent'][]['allDiscount'] = isset($data['discount']) ? self::getDiscount($data['discount']['discount']) : array();
//分类条件
$result['filters']['sort'] = isset($filter['group_sort']) ? self::searchSort($filter['group_sort']) : array();
$result['filters']['sort'] = isset($data['sort']) ? self::searchSort($data['sort']['sort']) : array();
//左侧分类分类
$result['leftContent'][]['allSort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort']) : array();
$result['leftContent'][]['allSort'] = isset($data['sort']) ? self::groupSort($data['sort']['sort']) : array();
//一周新品上架
$result['leftContent'][]['newSales'] = isset($filter['recent']) ? self::recentShelve($filter['recent']) : array();
//全部折扣
$result['leftContent'][]['allDiscount'] = isset($filter['discount']) ? self::getDiscount($filter['discount']) : array();
$result['leftContent'][]['newSales'] = isset($data['recent']) ? self::recentShelve($data['recent']['recent']) : array();
//品牌banner
$result['brandBanner'] = isset($data['banner']) && isset($data['brand']) ? self::getBannerFormat($data['banner'],$data['brand']) : array();
//总记录数
$result['totalCount'] = $data['data']['total'];
$result['totalCount'] = $data['product']['total'];
//品牌店铺信息
$result['shopEntry'] = isset($data['shop']) && !empty($data['shop']) ? self::shop($data['shop'], $data['sort']['sort']) : array();
//分页
$result['pager'] = self::pager($result['totalCount'],$options['viewNum']);
$result['pager'] = self::pager($result['totalCount'],$options['viewNum']-1);
//选中条件
$result['filters']['checkedConditions']['conditions'] = self::getSelected();
if (self::getSelected()) {
$result['filters']['checkedConditions']['conditions'] = self::getSelected();
}
//没有选中
else{
$result['filters']['checkedConditions'] = array();
}
if (isset($options['controller']) && $options['controller'] == 'Search') {
self::setSearchNav($data['data']['total']);
self::setSearchNav($data['product']['total']);
}
$result['pathNav'] = self::$listnav;
$result['pathNav'] = isset($options['controller']) && $options['controller'] == 'Sale' ? array() : self::$listnav;
return $result;
}
... ... @@ -128,7 +141,8 @@ class HelperSearch
* @author sefon 2015-12-21 17:24:04
* @return array
*/
public static function getProductList($product,$imgSize){
public static function getProductList($product,$imgSize)
{
$goods = array();
foreach($product as $key => $val){
//NEW
... ... @@ -171,7 +185,8 @@ class HelperSearch
* @param $filter
* @return array
*/
public static function standard($filter) {
public static function standard($filter)
{
$params = self::$params;
$result = array();
foreach ($filter as $key => $val) {
... ... @@ -199,7 +214,7 @@ class HelperSearch
'href' => self::buildUrl(array_merge($params, array(
'parameter_' . $val['standard_id'] => $pval['standard_id']
))) ,
'selected' => isset(self::$params['parameter_' . $val['standard_id']]) && self::$params['parameter_' . $val['standard_id']] == $pval['standard_id'] ? true : false
'checked' => isset(self::$params['parameter_' . $val['standard_id']]) && self::$params['parameter_' . $val['standard_id']] == $pval['standard_id'] ? true : false
);
}
if (!empty($sub) && count($sub) > 1) {
... ... @@ -216,7 +231,8 @@ class HelperSearch
* 性别
* @return array
*/
public static function gender($filter) {
public static function gender($filter)
{
if (empty($filter) || !isset($filter['gender']) || empty($filter['gender'])) {
return array();
}
... ... @@ -241,8 +257,9 @@ class HelperSearch
$result[] = array(
'name' => $val,
'href' => self::buildUrl(array_merge($params, array(
'gender' => $key
'gender' => $key,
))) ,
'checked' => isset(self::$params['gender']) && self::$params['gender'] == $key ? true : false
);
}
return $result;
... ... @@ -342,7 +359,8 @@ class HelperSearch
* @param array $filter
* @return array
*/
public static function brand($filter) {
public static function brand($filter)
{
$options = self::$options;
//品牌列表返回空
if (isset($options['brandName'])) {
... ... @@ -388,8 +406,8 @@ class HelperSearch
'id' => $v['id'],
'href' => $url,
'name' => $v['brand_name'],
'key' => $v['brand_name'],
'active' => in_array($v['id'], $brandIds) ? true : false
'key' => strtolower($v['brand_name']),
'checked' => in_array($v['id'], $brandIds) ? true : false
);
if (is_numeric($v['brand_alif'])) {
$this_brand['index'] = '0-9';
... ... @@ -421,7 +439,7 @@ class HelperSearch
//品牌列表排序, 添加品牌索引
$index_key = array();
foreach ($brandList as $key => $val) {
if ($key && !in_array($key, $index_key)) {
if ($key && !in_array($key, $index_key) && !is_numeric($key)) {
$index['index'] = strtolower(($key));
$index['name'] = $key;
$result['brandIndex'][] = $index;
... ... @@ -446,7 +464,8 @@ class HelperSearch
* @param array $filter
* @return array
*/
public static function size($filter) {
public static function size($filter)
{
$params = self::$params;
$sizeId = isset($params['size']) && !empty($params['size']) ? $params['size'] : '';
if (isset($params['size'])) {
... ... @@ -483,7 +502,8 @@ class HelperSearch
* @param array $filter
* @return array
*/
public static function color($filter) {
public static function color($filter)
{
$params = self::$params;
$colorId = isset($params['color']) && !empty(self::$params['color']) ? self::$params['color'] : '';
if (isset($params['color'])) {
... ... @@ -519,7 +539,8 @@ class HelperSearch
* @param array $filter
* @return array
*/
public static function price($filter) {
public static function price($filter)
{
$params = self::$params;
$priceId = isset($params['price']) && !empty(self::$params['price']) ? self::$params['price'] : '';
if (isset($params['price'])) {
... ... @@ -535,7 +556,12 @@ class HelperSearch
}else{
$price = explode(',', $priceId);
if (count($price) == 2) {
if (!$price[0]) {
$price[0] = 0;
}
if (!$price[1]) {
$price[1] = 99999;
}
self::$selected['price'] = array(
'name' => self::$params['price'] == '2000,99999' ? '¥2000以上' : '¥' . (int)$price[0] . '-' . (int)$price[1],
'href' => self::buildurl($params)
... ... @@ -561,7 +587,8 @@ class HelperSearch
/**
* 获取自定义价格要提交的地址
*/
public static function customPrice($filter) {
public static function customPrice($filter)
{
$params = self::$params;
$result = array(
'min' => '',
... ... @@ -571,6 +598,12 @@ class HelperSearch
if (isset($params['price']) && !isset($filter['price'][$priceId]) ) {
$price = explode(',', $params['price']);
unset($params['price']);
if (!$price[0]) {
$price[0] = 0;
}
if (!$price[1]) {
$price[1] = 99999;
}
$result = array(
'min' => $price[0],
'max' => $price[1]
... ... @@ -584,7 +617,8 @@ class HelperSearch
* @param array $filter
* @return array
*/
public static function style($filter) {
public static function style($filter)
{
$params = self::$params;
$styleIds = isset($params['style']) && !empty($params['style']) ? explode(',', $params['style']) : array();
if (isset($params['style'])) {
... ... @@ -975,7 +1009,8 @@ class HelperSearch
/**
* 当前页地址
*/
public static function current(){
public static function current()
{
$url = explode('?', $_SERVER['REQUEST_URI']);
self::$listnav[0]['href'] = $url[0];
return $url[0];
... ... @@ -983,7 +1018,8 @@ class HelperSearch
/**
* 下一页
*/
public static function next($total){
public static function next($total)
{
$param = self::$params;
$page = self::$page;
$next = array();
... ... @@ -1024,13 +1060,14 @@ class HelperSearch
* @param $viewNum
* @return mixed
*/
public static function pager($total,$viewNum){
public static function pager($total, $viewNum){
$Paging = new Paging('Yoho');
return $Paging->setTotal($total)->setSize($viewNum)->view(0);
}
//组织静态资源数据格式
public static function formatNodeContent($code){
public static function formatNodeContent($code)
{
$nodeContent = BrandData::getByNodeContent($code);
if (isset($nodeContent['code']) && $nodeContent['code'] === 200) {
$result = array();
... ... @@ -1052,13 +1089,16 @@ class HelperSearch
/**
* 组织品牌店铺信息
* @param $shop
* @param $shopSort
* @return array
*/
public static function shop($shop)
public static function shop($shop, $shopSort)
{
$url = Helpers::url('','',$shop['brand_domain']);
$shopEntry = array();
$sort = array();
foreach ($shop['sort'] as $msort) {
foreach ($shopSort as $msort) {
if (!isset($msort['sub']) || empty($msort['sub'])) {
continue;
}
... ... @@ -1112,4 +1152,221 @@ class HelperSearch
}
}
/**
* 并行调接口url获取(搜索产品数据)
* @param
*/
public static function getProductUrl($condition)
{
// 排序数据映射表
$orderMaps = array(
's_t_desc' => 'shelve_time:desc',
's_t_asc' => 'shelve_time:asc',
's_p_asc' => 'sales_price:asc',
's_p_desc' => 'sales_price:desc',
'p_d_desc' => 'discount:desc',
'p_d_asc' => 'discount:asc',
'skn_desc' => 'product_skn:desc',
'skn_asc' => 'product_skn:asc',
'activities_desc' => 'activities.order_by:desc',
'activities_asc' => 'activities.order_by:asc',
's_n_asc' => 'sales_num:asc',
's_n_desc' => 'sales_num:desc',
'activities_id_desc' => 'activities.activity_id:desc',
'activities_id_asc' => 'activities.activity_id:asc',
);
$param = array();
$param['status'] = 1; // 是否上架,1表示在架,2表示不在
$param['sales'] = 'Y'; // 只搜索销售的产品
$param['stocknumber'] = 1; // 过滤掉已售罄的商品
// $param['needFilter'] = 1; // 是否需要返回筛选条件
if (!isset($condition['order'])) {
$param['order'] = $orderMaps['s_t_desc'];
} else {
$param['order'] = $orderMaps[$condition['order']];
}
if (!isset($condition['page'])) {
$param['page'] = 1;
}
if(isset($condition['viewNum'])) {
$param['viewNum'] = $condition['viewNum'];
} else if (!isset($condition['limit'])) {
$param['viewNum'] = 60;
} else {
$param['viewNum'] = $condition['limit'];
unset($condition['limit']);
}
if (!empty($condition)) {
$param += $condition;
}
return Yohobuy::httpBuildQuery(self::getUrl(), $param);
}
/**
* 并行调接口url获取(产品分类)
* @param
*/
public static function getClassesUrl($condition)
{
$condition['sales'] = 'Y'; //在销售商品分类
$condition['status'] = 1; //上架商品分类
$condition['stocknumber'] = 1; //过滤掉已售罄
return Yohobuy::httpBuildQuery(self::getUrl('sort'), $condition);
}
/**
* 并行调接口url获取(获取折扣区间)
* @param
*/
public static function getDiscountUrl($param = array())
{
return Yohobuy::httpBuildQuery(self::getUrl('discount'), $param);
}
/**
* 并行调接口url获取(获取最新上架)
*/
public static function getRecentShelveUrl($param = array())
{
return Yohobuy::httpBuildQuery(self::getUrl('recent'), $param);
}
/**
* 并行调接口url获取(获取品牌数据)
*/
public static function getBrandUrl($customOptions = array())
{
// 构建必传参数
$param = Yohobuy::param();
$param['brand_id'] = $customOptions['brandId'];
$param['uid'] = $customOptions['uid'];
$param['method'] = 'app.brand.getBrandIntro';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
}
/**
* 并行调接口url获取(获取品牌banner数据)
*/
public static function getBannerUrl($customOptions = array())
{
// 构建必传参数
$param = Yohobuy::param();
$param['brand_id'] = $customOptions['brandId'];
$param['method'] = 'app.brand.banner';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
}
/**
* 并行调接口url获取(获取用户浏览记录)
*/
// public static function getReviewUrl($param = array())
// {
// return Yohobuy::httpBuildQuery(self::getUrl('review'), $param);
// }
/**
* 获取品牌店铺接口地址
* @param $param
* @return string
*/
public static function getShopUrl($param)
{
return Yohobuy::httpBuildQuery(self::getUrl('shop'), $param);
}
/**
* 获取搜索的服务地址
*
* 备注:此处是根据环境来确定使用阿里云内网还是外网的URL
*
* @return string
*/
private static function getUrl($type = 'search')
{
defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer');
switch (APPLICATION_ENV) {
case 'release':
if ($type == 'sort') {
return 'http://100.98.132.63/yohosearch/sortgroup.json';
}
elseif ($type == 'discount') {
return 'http://100.98.132.63/yohosearch/discount.json';
}
elseif ($type == 'recent') {
return 'http://100.98.132.63/yohosearch/recent.json';
}
// elseif ($type == 'review') {
//
// }
elseif ($type == 'shop') {
return 'http://100.98.132.63/yohosearch/shops.json';
}
return 'http://100.98.132.63/yohosearch/search.json';
case 'test':
case 'preview':
case 'developer':
default:
if ($type == 'sort') {
return 'http://101.200.31.165/yohosearch/sortgroup.json';
}
elseif ($type == 'discount') {
return 'http://101.200.31.165/yohosearch/discount.json';
}
elseif ($type == 'recent') {
return 'http://101.200.31.165/yohosearch/recent.json';
}
// elseif ($type == 'review') {
//
// }
elseif ($type == 'shop') {
return 'http://101.200.31.165/yohosearch/shops.json';
}
return 'http://101.200.31.165/yohosearch/search.json';
}
}
/**
* 获取品牌首页banner条
*
* @return array 品牌banner条数据
*/
public static function getBannerFormat($banner, $brand)
{
// 根据品牌Id获取品牌banner图
if (isset($banner['banner'])) {
$bannerImg = Helpers::getImageUrl($banner['banner'], '', 150);
}
$is_favorite = false;
$shopName = false;
if(isset($brand)){
// 获取是否收藏
if ($brand['is_favorite'] == 'Y') {
$is_favorite = true;
} elseif ($brand['is_favorite'] == 'N') {
$is_favorite = false;
}
}
// 返回banner数据
return array(
'bannerHeight' => '150',
'coled' => $is_favorite,
'banner' => $bannerImg
);
}
}
... ...
... ... @@ -86,6 +86,7 @@ $('.invoice').on('touchend', '.checkbox', function() {
if ($this.hasClass('icon-checkbox')) {
$('.invoice').removeClass('focus');
}
return false;
});
function orderCompute(firstEnter) {
... ...
... ... @@ -303,6 +303,7 @@ $basicBtnC:#eb0313;
font-size: pxToRem(24px);
float: right;
color: #d0021b;
margin-right: 1.4rem;
h1 {
display: inline-block;
line-height: pxToRem(88px);
... ...
... ... @@ -21,7 +21,7 @@
</span>
{{/ comments}}
</div>
<a class="comment-content-footer tap-hightlight" href="{{commentsUrl}}">
<a class="comment-content-footer tap-hightlight" href="{{commentsUrl}}">
查看更多
<span class="iconfont">&#xe604;</span>
</a>
... ... @@ -37,7 +37,7 @@
<div class="consult-content-main content-main">
{{# consults}}
<div class="question">
<span class="iconfont">&#xe639;</span>
<span class="iconfont">&#xe644;</span>
<p>
{{question}}<br>
<span class="time">{{time}}</span>
... ... @@ -45,7 +45,7 @@
</div>
<div class="answer">
<span class="iconfont">&#xe63f;</span>
<span class="iconfont">&#xe642;</span>
<p>{{answer}}</p>
</div>
{{/ consults}}
... ...
... ... @@ -8,7 +8,7 @@
{{! 新品速报}}
{{# newReport}}
<div class="new-report clearfix">
<div class="new-report imgopacity clearfix">
{{> index/floor-header}}
<ul class="report-list clearfix">
... ... @@ -40,7 +40,7 @@
<div class="preference-brand">
{{> index/floor-header}}
<div class="img-brand">
<ul class="img-list clearfix">
<ul class="img-list imgopacity clearfix">
{{# imgBrand}}
<li class="img-item">
<a href="{{href}}" target= "_blank">
... ... @@ -58,7 +58,7 @@
</a>
</div>
</div>
<div class="logo-brand" data-url="{{brandUrl}}"></div>
<div class="logo-brand imgopacity" data-url="{{brandUrl}}"></div>
</div>
{{/ preferenceBrands}}
... ...
... ... @@ -14,14 +14,14 @@
{{/ category}}
</div>
</div>
<div class="tpl-brands clearfix">
<div class="tpl-brands imgopacity clearfix">
<ul>
{{#each brands}}
<li><a title="{{name}}" href="{{href}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a></li>
{{/each}}
</ul>
</div>
<div class="tpl-types clearfix">
<div class="tpl-types imgopacity clearfix">
<ul>
{{#each types}}
<li><a title="{{name}}" href="{{href}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a></li>
... ... @@ -29,7 +29,7 @@
</ul>
</div>
</div>
<div class="tpl-products clearfix">
<div class="tpl-products imgopacity clearfix">
<ul>
{{#each products}}
<li><a href="{{href}}" title="{{name}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a></li>
... ...
<div class="singlehot clearfix">
{{> index/floor-header}}
<ul class="g-list">
<ul class="g-list imgopacity">
{{#each imgHot}}
<li><a class="impo{{@index}}" href="{{href}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a></li>
{{/each}}
... ...
{{> index/floor-header}}
<div class="categorys-list">
<div class="categorys-list imgopacity">
<ul class="clearfix">
{{# list}}
<li class="cate-item{{@index}}">
... ...
... ... @@ -14,12 +14,12 @@
{{/ category}}
</div>
</div>
<div class="tpl-brands clearfix">
<div class="tpl-brands imgopacity clearfix">
{{#each brands}}
<a title="{{name}}" href="{{href}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a>
{{/each}}
</div>
<div class="tpl-types clearfix">
<div class="tpl-types imgopacity clearfix">
<ul>
{{#each types}}
<li><a title="{{name}}" href="{{href}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a></li>
... ...
<div class="commodity clearfix">
{{> index/floor-header}}
<div class="commodity-list">
<ul class="g-list clearfix">
<ul class="g-list imgopacity clearfix">
{{#each imgHot}}
<li>
<a href="{{href}}" target= "_blank"><div class="commodity-img">
... ... @@ -16,7 +16,7 @@
{{/each}}
</ul>
</div>
<div class="commodity-brands clearfix">
<div class="commodity-brands imgopacity clearfix">
{{#each brands}}
<a href="{{href}}" title="{{name}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a>
{{/each}}
... ...
{{> index/floor-header}}
<div class="preference-brand">
<div class="preference-brand imgopacity">
<div class="img-slider-wrapper clearfix">
<div class="img-brand-switch">
<a class="prev iconfont" href="javascript:;">&#xe60f;</a>
... ... @@ -15,6 +15,6 @@
</ul>
</div>
</div>
<div class="logo-brand" data-url="{{brandUrl}}">
<div class="logo-brand " data-url="{{brandUrl}}">
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -12,14 +12,14 @@
<script src="http://static.buy.test.yoho.cn/dist/yohobuy/{{version}}/index-debug.js"></script>
{{/if}}
{{#if devEnv}}
<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
<script src="http://localhost:8001/static/js/sea.js?nowrap"></script>
<script>
seajs.config({
base: 'http://localhost:8000/'
base: 'http://localhost:8001/'
});
</script>
{{/if}}
{{> layout/use}}
{{> layout/analysis}}
</body>
</html>
\ No newline at end of file
</html>
... ...
<div class="register-page">
<!--<form id="register-form" class="register-form" method="POST" action="{{actionUrl}}" autocomplete="off">-->
<ul>
<li class="clearfix">
<select id="region" class="region" name="region">
{{#each region}}
<option {{#if selected}}selected="selected"{{/if}} value="{{areaCode}}">{{name}}</option>
{{/each}}
</select>
</li>
<li class="clearfix" data-index="0">
<span id="country-code" class="country-code">{{location}}</span>
<input value="" id="phone-num" class="input va phone-num" type="text" name="phoneNum" placeholder="请输入手机号码" autocomplete="off">
</li>
<li class="w330 clearfix" data-index="1">
<input id="captcha" class="input va captcha" type="text" name="captcha" placeholder="图形验证码" autocomplete="off" maxlength="4">
<img id="captcha-img" class="captcha-img" src="{{captchaUrl}}" alt="">
<a class="link change-captcha">换一张</a>
</li>
<li class="clearfix" data-index="2">
<input id="msg-captcha" class="input va msg-captcha" type="text" name="msgCaptcha" placeholder="短信验证码" autocomplete="off" maxlength="4">
<input id="send-captcha" class="btn send-captcha disable" type="button" value="获取短信验证码">
<span id="msg-tip" class="hide msg-tip">短信验证码已发送至您的手机,请查收</span>
</li>
<li class="clearfix" data-index="3">
<input id="pwd" class="input va pwd" name="pwd" placeholder="设置密码" autocomplete="off" maxlength="20" type="password">
<div class="pwd-intensity-container">
<span class="pwd-intensity low">低</span>
<span class="pwd-intensity mid">中</span>
<span class="pwd-intensity high">高</span>
</div>
<div id="pwd-tips" class="hide pwd-tips">
<div class="default" id="pwd-tip1"><i></i>密码只支持6-20位字符</div>
<div class="default" id="pwd-tip2"><i></i>建议由字母、 数字、 符号两种以上组合</div>
</div>
</li>
<ul>
<li class="clearfix">
<select id="region" class="region" name="region">
{{#each region}}
<option {{#if selected}}selected="selected"{{/if}} value="{{areaCode}}">{{name}}</option>
{{/each}}
</select>
</li>
<li class="clearfix" data-index="0">
<span id="country-code" class="country-code">{{location}}</span>
<input value="" id="phone-num" class="input va phone-num" type="text" name="phoneNum" placeholder="请输入手机号码" autocomplete="off">
</li>
<li class="w330 clearfix" data-index="1">
<input id="captcha" class="input va captcha" type="text" name="captcha" placeholder="图形验证码" autocomplete="off" maxlength="4">
<img id="captcha-img" class="captcha-img" src="{{captchaUrl}}" alt="">
<a class="link change-captcha">换一张</a>
</li>
<li class="clearfix" data-index="2">
<input id="msg-captcha" class="input va msg-captcha" type="text" name="msgCaptcha" placeholder="短信验证码" autocomplete="off" maxlength="4">
<input id="send-captcha" class="btn send-captcha disable" type="button" value="获取短信验证码">
<span id="msg-tip" class="hide msg-tip">短信验证码已发送至您的手机,请查收</span>
</li>
<li class="clearfix" data-index="3">
<input id="pwd" class="input va pwd" name="pwd" placeholder="设置密码" autocomplete="off" maxlength="20" type="password">
<div class="pwd-intensity-container">
<span class="pwd-intensity low">低</span>
<span class="pwd-intensity mid">中</span>
<span class="pwd-intensity high">高</span>
</div>
<div id="pwd-tips" class="hide pwd-tips">
<div class="default" id="pwd-tip1"><i></i>密码只支持6-20位字符</div>
<div class="default" id="pwd-tip2"><i></i>建议由字母、 数字、 符号两种以上组合</div>
</div>
</li>
<li class="items-container clearfix">
<input id="agree-terms" class="agree-terms" type="checkbox" checked="">
<span>
我已阅读并同意遵守
<a class="link go-yoho-items" href="{{itemUrl}}">YOHO!有货服务条款</a>
</span>
</li>
<li class="clearfix">
<input name="refer" id="refer" type="hidden" value="{{referUrl}}">
<input id="register-btn" class="btn register-btn disable" type="submit" value="{{regBtnText}}" disabled="">
</li>
{{# loginUrl}}
<li class="quick-login-container">
我已注册YOHO!有货账号
<a class="link go-login" href="{{.}}">完善信息</a>
</li>
{{/loginUrl}}
<li class="items-container clearfix">
<input id="agree-terms" class="agree-terms" type="checkbox" checked="">
<span>
我已阅读并同意遵守
<a class="link go-yoho-items" href="{{itemUrl}}">YOHO!有货服务条款</a>
</span>
</li>
<li class="clearfix">
<input name="refer" id="refer" type="hidden" value="{{referUrl}}">
<input id="register-btn" class="btn register-btn disable" type="submit" value="{{regBtnText}}" disabled="">
</li>
{{# loginUrl}}
<li class="quick-login-container">
我已注册YOHO!有货账号
<a class="link go-login" href="{{.}}">快速登录</a>
</li>
{{/loginUrl}}
{{# skipUrl}}
<li class="skip-user-info">
<a href="{{.}}">跳过此步</a>
</li>
{{/skipUrl}}
{{# skipUrl}}
<li class="skip-user-info">
<a href="{{.}}">跳过此步</a>
</li>
{{/skipUrl}}
</ul>
<div id="err-tip" class="err-tip hide">
<span></span>
<b></b>
</div>
<!--</form>-->
</ul>
<div id="err-tip" class="err-tip hide">
<span></span>
<b></b>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -39,12 +39,12 @@
<div class="good-detail-text">
<a href="{{url}}">{{name}}</a>
<p class="price">
<span class="sale-price{{#unless marketPrice}}prime-cost{{/unless}}">
¥{{salePrice}}
</span>
{{# marketPrice}}
<span class="market-price">¥{{.}}</span>
{{/ marketPrice}}
<span class="sale-price{{#unless marketPrice}}prime-cost{{/unless}}">
¥{{salePrice}}
</span>
</p>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -5,11 +5,13 @@
<div class="sort-container">
<ul class="sort-child-list new-sale">
<li>
<a href="{{href}}">全部折扣</a>
<span>{{updateNum}}</span>
<h2>
<a href="{{href}}">全部折扣</a>
<span>{{updateNum}}</span>
</h2>
</li>
{{#each list}}
<li {{#if active}}active{{/if}}>
<li {{#if active}}class="active"{{/if}}>
<a href="{{href}}">{{name}}</a>
<span>{{num}}</span>
</li>
... ... @@ -80,4 +82,4 @@
{{/each}}
</ul>
{{/ picLink}}
{{/ leftContent}}
\ No newline at end of file
{{/ leftContent}}
... ...
... ... @@ -1483,308 +1483,308 @@ require("js/product/sort-pager");
require("js/product/product");
});
define("js/product/filter", ["jquery"], function(require, exports, module){
/**
* 商品筛选逻辑
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/12/4
*/
var $ = require("jquery");
var checkUnicode = {
unchecked: '&#xe613;',
checked: '&#xe612;'
},
moreUnicode = {
up: '&#xe610;',
down: '&#xe600;'
};
//品牌相关变量
var $brandDefault = $('.brand .default'),
$brandPanel = $('.brand .brand-panel'),
$brandAttrs = $('.brand .attr'),
$brandMore = $('#brand-more'),
$brandMulti = $('#brand-multi');
var $brandMoreTxt, $brandMoreIcon;
//价格相关变量
var $udPrice = $('.ud-price-range'),
interReg = /^\d+$/,
$limit, $min, $max, $btn;
//分类相关变量
var $sortSub = $('.sort-sub-wrap');
//高级选项相关变量
var $seniorSubWrap = $('.senior-sub-wrap'),
$seniorAttrWrap = $('.senior-attr-wrap');
var seniorHoverTime, hoveredIndex;
//清除checkbox选中状态
function clearChecked($checkbox) {
$checkbox.removeClass('checked').html(checkUnicode.unchecked);
}
//显示更多品牌面板
function brandShowMore() {
$brandDefault.addClass('hide');
$brandPanel.removeClass('hide');
}
//隐藏更多品牌面板
function brandHideMore() {
$brandPanel.addClass('hide');
$brandDefault.removeClass('hide');
}
//url构造&跳转
function uriLoc(attr, val) {
var href = decodeURIComponent(window.location.search),
query = attr + '=' + val,
newHref;
if (href === '') {
newHref = '?' + query;
} else {
newHref = href + '&' + query;
}
window.location.href = newHref;
}
//隐藏高级选项面板
function hideSeniorPanel(index) {
$seniorSubWrap.children('.senior-sub:eq(' + hoveredIndex + ')').addClass('hide');
$seniorAttrWrap.children('.attr:eq(' + hoveredIndex + ')').removeClass('hover');
hoveredIndex = -1;
}
//屏蔽筛选项双击文字选中
$('.filter-box').on('selectstart', '.attr, .brands-index span', function() {
return false;
});
//【分类】
$('.sort-pre').on('click', 'li', function() {
var $this = $(this),
index = $this.index();
$this.siblings('.active').removeClass('active');
$this.addClass('active');
$sortSub.children(':not(.hide)').addClass('hide');
$sortSub.children(':eq(' + index + ')').removeClass('hide');
});
//【品牌】
if ($brandMore.length > 0) {
$brandMoreTxt = $brandMore.children('em');
$brandMoreIcon = $brandMore.children('.iconfont');
}
//【品牌】多选
$brandMulti.click(function() {
if ($brandPanel.css('display') === 'none') {
//显示品牌面板
brandShowMore();
}
$brandPanel.addClass('multi'); //显示出checkbox
$(this).addClass('hide');
});
//【品牌】更多
$brandMore.click(function() {
var $this = $(this);
if ($this.hasClass('more')) {
brandHideMore();
$brandMoreTxt.text('更多');
$brandMoreIcon.html(moreUnicode.down);
} else {
brandShowMore();
$brandMoreTxt.text('收起');
$brandMoreIcon.html(moreUnicode.up);
}
$(this).toggleClass('more');
});
//【品牌】索引
$('.brands-index').on('click', 'span', function() {
var $this = $(this),
index = $this.data('index');
if ($this.index() === 0) {
//全部
$brandAttrs.removeClass('hide');
} else {
$brandAttrs.addClass('hide').filter('[data-index=' + index + ']').removeClass('hide');
}
});
//【品牌】搜索
$('#brand-search-input').keyup(function() {
var val = $(this).val().toLowerCase();
if (val === '') {
$brandAttrs.removeClass('hide');
} else {
$brandAttrs.addClass('hide').filter('[data-key*="' + val + '"]').removeClass('hide');
}
});
//【品牌】多选确定
$('#brand-multi-ok').click(function() {
var val = '';
if ($(this).hasClass('dis')) {
return;
}
$brandPanel.find('.checked').each(function() {
var id = $(this).data('id');
val += (val === '') ? id : (',' + id);
});
uriLoc('brand', val);
});
//【品牌/高级选项】多选取消
$('.multi-select-cancel').click(function() {
var $panel = $(this).closest('.multi');
if ($panel.hasClass('brand-panel')) {
brandHideMore();
$brandMulti.removeClass('hide'); //显示多选按钮
}
$panel.removeClass('multi');
clearChecked($panel.find('.checkbox.checked')); //清除选中状态
});
//【品牌/高级选项】checkbox
$('.check-container').on('click', '.attr', function() {
var $this = $(this),
$check = $this.find('.checkbox'),
$btnOk = $this.parent('.check-container').next('.btns').find('.multi-select-ok');
$check.toggleClass('checked');
if ($check.hasClass('checked')) {
$check.html(checkUnicode.checked);
} else {
$check.html(checkUnicode.unchecked);
}
//更新按钮状态
if ($check.hasClass('checked') ||
$this.siblings('.attr').find('.checked').length > 0) {
$btnOk.removeClass('dis');
} else {
$btnOk.addClass('dis');
}
});
//【品牌/高级选项】当多选时阻止链接默认跳转
$('.brand, .senior').on('click', '.attr > a', function(e) {
if ($(this).closest('.multi').length > 0) {
e.preventDefault();
}
});
//【价格】用户定义价格处理
if ($udPrice.length > 0) {
$limit = $udPrice.find('.limit');
$min = $limit.filter('.min');
$max = $limit.filter('.max');
$btn = $udPrice.find('.price-sure');
//【价格】输入
$limit.keyup(function() {
var min = $.trim($min.val()),
max = $.trim($max.val()),
isMinInt = interReg.test(min),
isMaxInt = interReg.test(max);
if (isMaxInt && (min === '' || isMinInt) ||
isMinInt && (max === '' || isMaxInt)
) {
$btn.removeClass('hide');
} else {
$btn.addClass('hide');
}
});
//【价格】多项查询
$btn.click(function() {
var min = $.trim($min.val()),
max = $.trim($max.val()),
tmp;
//对于min大于max的情况,交换位置
if (min !== '' && max !== '' && +min > +max) {
tmp = max;
max = min;
min = tmp;
}
uriLoc('price', min + ',' + max);
});
}
//【高级选项】鼠标移入显示子项
$seniorAttrWrap.on('mouseenter', '.attr', function() {
var $this = $(this);
var index = $this.index();
$this.addClass('hover').siblings().removeClass('hover');
$seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide');
}).on('mouseleave', '.attr', function() {
var $this = $(this),
index = $this.index();
hoveredIndex = index;
seniorHoverTime = setTimeout(function() {
hideSeniorPanel();
}, 100);
});
//【高级选项】多选
$('.senior-sub').on('click', '.multi-select', function() {
$(this).closest('.senior-sub').addClass('multi');
}).on('click', '.multi-select-ok', function() {
var $btn = $(this),
$sub = $btn.closest('.senior-sub'),
val = '';
if ($btn.hasClass('dis')) {
return;
}
$sub.find('.checked').each(function() {
var id = $(this).data('id');
val += (val === '') ? id : (',' + id);
});
uriLoc($sub.data('attr'), val);
}).on('mouseenter', function() {
clearTimeout(seniorHoverTime);
}).on('mouseleave', function() {
hideSeniorPanel();
});
/**
* 商品筛选逻辑
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/12/4
*/
var $ = require("jquery");
var checkUnicode = {
unchecked: '&#xe613;',
checked: '&#xe612;'
},
moreUnicode = {
up: '&#xe610;',
down: '&#xe600;'
};
//品牌相关变量
var $brandDefault = $('.brand .default'),
$brandPanel = $('.brand .brand-panel'),
$brandAttrs = $('.brand .attr'),
$brandMore = $('#brand-more'),
$brandMulti = $('#brand-multi');
var $brandMoreTxt, $brandMoreIcon;
//价格相关变量
var $udPrice = $('.ud-price-range'),
interReg = /^\d+$/,
$limit, $min, $max, $btn;
//分类相关变量
var $sortSub = $('.sort-sub-wrap');
//高级选项相关变量
var $seniorSubWrap = $('.senior-sub-wrap'),
$seniorAttrWrap = $('.senior-attr-wrap');
var seniorHoverTime, hoveredIndex;
//清除checkbox选中状态
function clearChecked($checkbox) {
$checkbox.removeClass('checked').html(checkUnicode.unchecked);
}
//显示更多品牌面板
function brandShowMore() {
$brandDefault.addClass('hide');
$brandPanel.removeClass('hide');
}
//隐藏更多品牌面板
function brandHideMore() {
$brandPanel.addClass('hide');
$brandDefault.removeClass('hide');
}
//url构造&跳转
function uriLoc(attr, val) {
var href = decodeURIComponent(window.location.search),
query = attr + '=' + val,
newHref;
if (href === '') {
newHref = '?' + query;
} else {
newHref = href + '&' + query;
}
window.location.href = newHref;
}
//隐藏高级选项面板
function hideSeniorPanel(index) {
$seniorSubWrap.children('.senior-sub:eq(' + hoveredIndex + ')').addClass('hide');
$seniorAttrWrap.children('.attr:eq(' + hoveredIndex + ')').removeClass('hover');
hoveredIndex = -1;
}
//屏蔽筛选项双击文字选中
$('.filter-box').on('selectstart', '.attr, .brands-index span', function() {
return false;
});
//【分类】
$('.sort-pre').on('click', 'li', function() {
var $this = $(this),
index = $this.index();
$this.siblings('.active').removeClass('active');
$this.addClass('active');
$sortSub.children(':not(.hide)').addClass('hide');
$sortSub.children(':eq(' + index + ')').removeClass('hide');
});
//【品牌】
if ($brandMore.length > 0) {
$brandMoreTxt = $brandMore.children('em');
$brandMoreIcon = $brandMore.children('.iconfont');
}
//【品牌】多选
$brandMulti.click(function() {
if ($brandPanel.css('display') === 'none') {
//显示品牌面板
$brandMore.trigger('click');
}
$brandPanel.addClass('multi'); //显示出checkbox
$(this).addClass('hide');
});
//【品牌】更多
$brandMore.click(function() {
var $this = $(this);
if ($this.hasClass('more')) {
brandHideMore();
$brandMoreTxt.text('更多');
$brandMoreIcon.html(moreUnicode.down);
} else {
brandShowMore();
$brandMoreTxt.text('收起');
$brandMoreIcon.html(moreUnicode.up);
}
$(this).toggleClass('more');
});
//【品牌】索引
$('.brands-index').on('click', 'span', function() {
var $this = $(this),
index = $this.data('index');
if ($this.index() === 0) {
//全部
$brandAttrs.removeClass('hide');
} else {
$brandAttrs.addClass('hide').filter('[data-index=' + index + ']').removeClass('hide');
}
});
//【品牌】搜索
$('#brand-search-input').keyup(function() {
var val = $(this).val().toLowerCase();
if (val === '') {
$brandAttrs.removeClass('hide');
} else {
$brandAttrs.addClass('hide').filter('[data-key*="' + val + '"]').removeClass('hide');
}
});
//【品牌】多选确定
$('#brand-multi-ok').click(function() {
var val = '';
if ($(this).hasClass('dis')) {
return;
}
$brandPanel.find('.checked').each(function() {
var id = $(this).data('id');
val += (val === '') ? id : (',' + id);
});
uriLoc('brand', val);
});
//【品牌/高级选项】多选取消
$('.multi-select-cancel').click(function() {
var $panel = $(this).closest('.multi');
if ($panel.hasClass('brand-panel')) {
$brandMulti.removeClass('hide'); //显示多选按钮
$brandMore.trigger('click');
}
$panel.removeClass('multi');
clearChecked($panel.find('.checkbox.checked')); //清除选中状态
});
//【品牌/高级选项】checkbox
$('.check-container').on('click', '.attr', function() {
var $this = $(this),
$check = $this.find('.checkbox'),
$btnOk = $this.parent('.check-container').next('.btns').find('.multi-select-ok');
$check.toggleClass('checked');
if ($check.hasClass('checked')) {
$check.html(checkUnicode.checked);
} else {
$check.html(checkUnicode.unchecked);
}
//更新按钮状态
if ($check.hasClass('checked') ||
$this.siblings('.attr').find('.checked').length > 0) {
$btnOk.removeClass('dis');
} else {
$btnOk.addClass('dis');
}
});
//【品牌/高级选项】当多选时阻止链接默认跳转
$('.brand, .senior').on('click', '.attr > a', function(e) {
if ($(this).closest('.multi').length > 0) {
e.preventDefault();
}
});
//【价格】用户定义价格处理
if ($udPrice.length > 0) {
$limit = $udPrice.find('.limit');
$min = $limit.filter('.min');
$max = $limit.filter('.max');
$btn = $udPrice.find('.price-sure');
//【价格】输入
$limit.keyup(function() {
var min = $.trim($min.val()),
max = $.trim($max.val()),
isMinInt = interReg.test(min),
isMaxInt = interReg.test(max);
if (isMaxInt && (min === '' || isMinInt) ||
isMinInt && (max === '' || isMaxInt)
) {
$btn.removeClass('hide');
} else {
$btn.addClass('hide');
}
});
//【价格】多项查询
$btn.click(function() {
var min = $.trim($min.val()),
max = $.trim($max.val()),
tmp;
//对于min大于max的情况,交换位置
if (min !== '' && max !== '' && +min > +max) {
tmp = max;
max = min;
min = tmp;
}
uriLoc('price', min + ',' + max);
});
}
//【高级选项】鼠标移入显示子项
$seniorAttrWrap.on('mouseenter', '.attr', function() {
var $this = $(this);
var index = $this.index();
$this.addClass('hover').siblings().removeClass('hover');
$seniorSubWrap.children('.senior-sub:eq(' + index + ')').removeClass('hide').siblings().addClass('hide');
}).on('mouseleave', '.attr', function() {
var $this = $(this),
index = $this.index();
hoveredIndex = index;
seniorHoverTime = setTimeout(function() {
hideSeniorPanel();
}, 100);
});
//【高级选项】多选
$('.senior-sub').on('click', '.multi-select', function() {
$(this).closest('.senior-sub').addClass('multi');
}).on('click', '.multi-select-ok', function() {
var $btn = $(this),
$sub = $btn.closest('.senior-sub'),
val = '';
if ($btn.hasClass('dis')) {
return;
}
$sub.find('.checked').each(function() {
var id = $(this).data('id');
val += (val === '') ? id : (',' + id);
});
uriLoc($sub.data('attr'), val);
}).on('mouseenter', function() {
clearTimeout(seniorHoverTime);
}).on('mouseleave', function() {
hideSeniorPanel();
});
});
define("js/product/sort-pager", ["jquery"], function(require, exports, module){
... ... @@ -2658,6 +2658,13 @@ require("js/common/logo-brand");
require("js/common/accordion");
$(document).on('mouseenter', '.imgopacity a img', function() {
$(this).css('opacity', 0.8);
});
$(document).on('mouseout', '.imgopacity a img', function() {
$(this).css('opacity', 1);
});
if (homePage === 'brands') {
require("js/home/brands");
}
... ... @@ -3586,235 +3593,235 @@ $brand.hover(function() {
});
define("js/common/new-arrivls", ["jquery","lazyload","handlebars","source-map"], function(require, exports, module){
var $ = require("jquery"),
lazyload = require("lazyload");
var Handlebars = require("handlebars");
function InfiniteLoad(options) {
var defaults = {
index: 0,
isload: true,//是否正在加载
isrun: true,//判断是否执行
offset: {
height: null,
width: null
}
};
this.registerEvent = {
before: [],
change: [],
after: []
};
this.options = $.extend(true, {}, defaults, options);
return this;
}
InfiniteLoad.prototype.on = function(name, callback) {
var g = this;
var _e = g.registerEvent[name];
if (_e) {
_e.push(callback);
}
return _e;
};
InfiniteLoad.prototype.exect = function(key, params) {
var g = this;
var e;
if (g.registerEvent[key] && g.registerEvent[key].length > 0) {
for (e in g.registerEvent[key]) {
if (g.registerEvent[key].hasOwnProperty(e)) {
g.registerEvent[key][e](params);
}
}
}
};
InfiniteLoad.prototype.init = function() {
var g = this;
var p = this.options;
function __loadMore() {
if (p.isrun && p.isload && g.__directionCalculation()) {
p.isload = false;
p.index++;
g.exect('after', p);
}
g.exect('change', p);
}
g.exect('before', p);
$(window).scroll(__loadMore);
};
InfiniteLoad.prototype.emit = function() {
var p = this.options;
p.isload = true;
};
InfiniteLoad.prototype.stop = function() {
var p = this.options;
p.isrun = false;
p.isload = false;
};
InfiniteLoad.prototype.__directionCalculation = function() {
var p = this.options;
if (p.offset.height && p.offset.height() > 0 && $(window).scrollTop() + $(window).height() >= p.offset.height()) {
return true;
}
return false;
};
module.exports = function(data) {
var $container = $('#newarrivals .goods-container');
var $load = $('.loading a');
var load = new InfiniteLoad({
index: 1,
isload: false,
offset: {
height: function() {
return parseFloat($container.offset().top) + parseFloat($container.height()) - 200;
}
}
});
var loadAjax;
var url = data.url,
count = data.count,
rows = data.rows;
data.pageIndex = 0;
delete data.url;
delete data.count;
delete data.rows;
loadAjax = function(url, data, count) {
var options = {
type: 'POST',
url: url,
success: function(result) {
var code = result.code;
var myTemplate,len,pos;
if (code === 200) {
len = result.goods.length % count;
pos = result.goods.length - len - 1;
result.goods.splice(pos, len);
myTemplate = Handlebars.compile(load.tpl);
$container.append(myTemplate(result.goods));
data.pageIndex = data.pageIndex + result.goods.length;
//懒加载插件貌似有点问题,图片先直接展示
lazyload($container.find('img.lazy'));
load.emit();
} else {
load.stop();
$load.html('查看更多');
}
},
error: function() {
load.stop();
$load.html('网络断开连接了~');
}
};
options.data = data;
$.ajax(options);
};
load.on('after', function(p) {
data.pageCount = count * rows[1];
loadAjax(url, data);
});
load.on('before', function(p) {
load.tpl = '{{#each this}}';
load.tpl += '<div class="good-info" data-skn="{{skn}}">';
load.tpl += ' <div class="tag-container clearfix">';
load.tpl += ' {{# tags}}';
load.tpl += ' {{# isNew}}';
load.tpl += ' <span class="good-tag new-tag">NEW</span>';
load.tpl += ' {{/ isNew}}';
load.tpl += ' {{# isReNew}}';
load.tpl += ' <span class="good-tag renew-tag">再到着</span>';
load.tpl += ' {{/ isReNew}}';
load.tpl += ' {{# isSale}}';
load.tpl += ' <span class="good-tag sale-tag">SALE</span>';
load.tpl += ' {{/ isSale}}';
load.tpl += ' {{# isNewFestival}}';
load.tpl += ' <span class="good-tag new-festival-tag">新品节</span>';
load.tpl += ' {{/ isNewFestival}}';
load.tpl += ' {{# isLimit}}';
load.tpl += ' <span class="good-tag limit-tag">限量商品</span>';
load.tpl += ' {{/ isLimit}}';
load.tpl += ' {{# isYearEndPromotion}}';
load.tpl += ' <span class="good-tag yep-tag">年终大促</span>';
load.tpl += ' {{/ isYearEndPromotion}}';
load.tpl += ' {{# isYearMidPromotion}}';
load.tpl += ' <span class="good-tag ymp-tag">年中热促</span>';
load.tpl += ' {{/ isYearMidPromotion}}';
load.tpl += ' {{/ tags}}';
load.tpl += ' </div>';
load.tpl += ' <div class="good-detail-img">';
load.tpl += ' <a class="good-thumb" href="{{url}}" target= "_blank">';
load.tpl += ' <img class="lazy" data-original="{{thumb}}">';
load.tpl += ' </a>';
load.tpl += ' {{# isFew}}';
load.tpl += ' <p class="few-tag">即将售罄</p>';
load.tpl += ' {{/ isFew}}';
load.tpl += ' {{#if showColBtn}}';
load.tpl += ' <span class="col-btn iconfont{{#if coled}} coled{{/if}}">&#xe616;</span>';
load.tpl += ' {{/if}}';
load.tpl += ' </div>';
load.tpl += ' <div class="good-detail-text">';
load.tpl += ' <a href="{{url}}" target= "_blank">{{name}}</a>';
load.tpl += ' <p class="price">';
load.tpl += ' <span class="sale-price{{#unless marketPrice}}prime-cost{{/unless}}">';
load.tpl += ' ¥{{salePrice}}';
load.tpl += ' </span>';
load.tpl += ' {{# marketPrice}}';
load.tpl += ' <span class="market-price">¥{{.}}</span>';
load.tpl += ' {{/ marketPrice}}';
load.tpl += ' </p>';
load.tpl += ' </div>';
load.tpl += '</div>';
load.tpl += '{{/each}}';
data.pageCount = count * rows[0];
loadAjax(url, data, data.count);
//load.emit();
});
load.init();
var $ = require("jquery"),
lazyload = require("lazyload");
var Handlebars = require("handlebars");
function InfiniteLoad(options) {
var defaults = {
index: 0,
isload: true,//是否正在加载
isrun: true,//判断是否执行
offset: {
height: null,
width: null
}
};
this.registerEvent = {
before: [],
change: [],
after: []
};
this.options = $.extend(true, {}, defaults, options);
return this;
}
InfiniteLoad.prototype.on = function(name, callback) {
var g = this;
var _e = g.registerEvent[name];
if (_e) {
_e.push(callback);
}
return _e;
};
InfiniteLoad.prototype.exect = function(key, params) {
var g = this;
var e;
if (g.registerEvent[key] && g.registerEvent[key].length > 0) {
for (e in g.registerEvent[key]) {
if (g.registerEvent[key].hasOwnProperty(e)) {
g.registerEvent[key][e](params);
}
}
}
};
InfiniteLoad.prototype.init = function() {
var g = this;
var p = this.options;
function __loadMore() {
if (p.isrun && p.isload && g.__directionCalculation()) {
p.isload = false;
p.index++;
g.exect('after', p);
}
g.exect('change', p);
}
g.exect('before', p);
$(window).scroll(__loadMore);
};
InfiniteLoad.prototype.emit = function() {
var p = this.options;
p.isload = true;
};
InfiniteLoad.prototype.stop = function() {
var p = this.options;
p.isrun = false;
p.isload = false;
};
InfiniteLoad.prototype.__directionCalculation = function() {
var p = this.options;
if (p.offset.height && p.offset.height() > 0 && $(window).scrollTop() + $(window).height() >= p.offset.height()) {
return true;
}
return false;
};
module.exports = function(data) {
var $container = $('#newarrivals .goods-container');
var $load = $('.loading a');
var load = new InfiniteLoad({
index: 1,
isload: false,
offset: {
height: function() {
return parseFloat($container.offset().top) + parseFloat($container.height()) - 200;
}
}
});
var loadAjax;
var url = data.url,
count = data.count,
rows = data.rows;
data.pageIndex = 0;
delete data.url;
delete data.count;
delete data.rows;
loadAjax = function(url, data, count) {
var options = {
type: 'POST',
url: url,
success: function(result) {
var code = result.code;
var myTemplate,len,pos;
if (code === 200) {
len = result.goods.length % count;
pos = result.goods.length - len - 1;
result.goods.splice(pos, len);
myTemplate = Handlebars.compile(load.tpl);
$container.append(myTemplate(result.goods));
data.pageIndex = data.pageIndex + result.goods.length;
//懒加载插件貌似有点问题,图片先直接展示
lazyload($container.find('img.lazy'));
load.emit();
} else {
load.stop();
$load.html('查看更多');
}
},
error: function() {
load.stop();
$load.html('网络断开连接了~');
}
};
options.data = data;
$.ajax(options);
};
load.on('after', function(p) {
data.pageCount = count * rows[1];
loadAjax(url, data);
});
load.on('before', function(p) {
load.tpl = '{{#each this}}';
load.tpl += '<div class="good-info imgopacity" data-skn="{{skn}}">';
load.tpl += ' <div class="tag-container clearfix">';
load.tpl += ' {{# tags}}';
load.tpl += ' {{# isNew}}';
load.tpl += ' <span class="good-tag new-tag">NEW</span>';
load.tpl += ' {{/ isNew}}';
load.tpl += ' {{# isReNew}}';
load.tpl += ' <span class="good-tag renew-tag">再到着</span>';
load.tpl += ' {{/ isReNew}}';
load.tpl += ' {{# isSale}}';
load.tpl += ' <span class="good-tag sale-tag">SALE</span>';
load.tpl += ' {{/ isSale}}';
load.tpl += ' {{# isNewFestival}}';
load.tpl += ' <span class="good-tag new-festival-tag">新品节</span>';
load.tpl += ' {{/ isNewFestival}}';
load.tpl += ' {{# isLimit}}';
load.tpl += ' <span class="good-tag limit-tag">限量商品</span>';
load.tpl += ' {{/ isLimit}}';
load.tpl += ' {{# isYearEndPromotion}}';
load.tpl += ' <span class="good-tag yep-tag">年终大促</span>';
load.tpl += ' {{/ isYearEndPromotion}}';
load.tpl += ' {{# isYearMidPromotion}}';
load.tpl += ' <span class="good-tag ymp-tag">年中热促</span>';
load.tpl += ' {{/ isYearMidPromotion}}';
load.tpl += ' {{/ tags}}';
load.tpl += ' </div>';
load.tpl += ' <div class="good-detail-img">';
load.tpl += ' <a class="good-thumb" href="{{url}}" target= "_blank">';
load.tpl += ' <img class="lazy" data-original="{{thumb}}">';
load.tpl += ' </a>';
load.tpl += ' {{# isFew}}';
load.tpl += ' <p class="few-tag">即将售罄</p>';
load.tpl += ' {{/ isFew}}';
load.tpl += ' {{#if showColBtn}}';
load.tpl += ' <span class="col-btn iconfont{{#if coled}} coled{{/if}}">&#xe616;</span>';
load.tpl += ' {{/if}}';
load.tpl += ' </div>';
load.tpl += ' <div class="good-detail-text">';
load.tpl += ' <a href="{{url}}" target= "_blank">{{name}}</a>';
load.tpl += ' <p class="price">';
load.tpl += ' <span class="sale-price{{#unless marketPrice}}prime-cost{{/unless}}">';
load.tpl += ' ¥{{salePrice}}';
load.tpl += ' </span>';
load.tpl += ' {{# marketPrice}}';
load.tpl += ' <span class="market-price">¥{{.}}</span>';
load.tpl += ' {{/ marketPrice}}';
load.tpl += ' </p>';
load.tpl += ' </div>';
load.tpl += '</div>';
load.tpl += '{{/each}}';
data.pageCount = count * rows[0];
loadAjax(url, data, data.count);
//load.emit();
});
load.init();
};
});
define("js/passport/entry", ["jquery","jquery.placeholder"], function(require, exports, module){
... ... @@ -3859,7 +3866,9 @@ var $pwdIntensity = $('.pwd-intensity'),
//signup验证
var $region = $('#country-code'),
$regionSelect = $('#region');
$regionSelect = $('#region'),
isPwd = false,
pwdVal;
setTimeout(function() {
$pn.val('');
... ... @@ -3873,10 +3882,13 @@ setTimeout(function() {
$ca.attr('maxlength', caCount);
//密码规则提示
$pwd.focus(function() {
$pwd.focus(function(event) {
$pwdTips.removeClass('hide');
isPwd = true;
pwdVal = $(this).val();
}).blur(function() {
$pwdTips.addClass('hide');
isPwd = false;
});
... ... @@ -4339,6 +4351,23 @@ exports.init = function(page) {
});
});
// 防止粘贴密码
/*$('#pwd, #repwd').keydown(function (event) {
console.log(event.ctrlKey);
console.log(isPwd);
console.log(event.keyCode);
if (event.ctrlKey && isPwd && event.keyCode === 86) {
$(this).val(pwdVal);
}
});*/
$pwd[0].onpaste = function() {
return false;
};
//ajax表单提交
$registerBtn.click(function() {
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -56,7 +56,7 @@ gulp.task('compass-watch', function() {
// start spm server
gulp.task('spm-doc', function() {
var sd = cp.exec('spm doc');
var sd = cp.exec('spm doc watch --port 8001'); // pc用8001,h5用8000, 跑两个服务器,不冲突
// sd.stdout.on('data', function(data) {
// console.log(data);
... ... @@ -197,4 +197,4 @@ gulp.task('business', ['libs'], function() {
gulp.task('script', function() {
gulp.src('plugin/page/**/*')
.pipe(gulp.dest(rootDist));
});
\ No newline at end of file
});
... ...
... ... @@ -165,7 +165,7 @@ module.exports = function(data) {
load.tpl = '{{#each this}}';
load.tpl += '<div class="good-info" data-skn="{{skn}}">';
load.tpl += '<div class="good-info imgopacity" data-skn="{{skn}}">';
load.tpl += ' <div class="tag-container clearfix">';
load.tpl += ' {{# tags}}';
load.tpl += ' {{# isNew}}';
... ...
... ... @@ -16,6 +16,13 @@ require('../common/logo-brand');
require('../common/accordion');
$(document).on('mouseenter', '.imgopacity a img', function() {
$(this).css('opacity', 0.8);
});
$(document).on('mouseout', '.imgopacity a img', function() {
$(this).css('opacity', 1);
});
if (homePage === 'brands') {
require('./brands');
}
... ...
... ... @@ -29,7 +29,9 @@ var $pwdIntensity = $('.pwd-intensity'),
//signup验证
var $region = $('#country-code'),
$regionSelect = $('#region');
$regionSelect = $('#region'),
isPwd = false,
pwdVal;
setTimeout(function() {
$pn.val('');
... ... @@ -43,10 +45,13 @@ setTimeout(function() {
$ca.attr('maxlength', caCount);
//密码规则提示
$pwd.focus(function() {
$pwd.focus(function(event) {
$pwdTips.removeClass('hide');
isPwd = true;
pwdVal = $(this).val();
}).blur(function() {
$pwdTips.addClass('hide');
isPwd = false;
});
... ... @@ -509,6 +514,23 @@ exports.init = function(page) {
});
});
// 防止粘贴密码
/*$('#pwd, #repwd').keydown(function (event) {
console.log(event.ctrlKey);
console.log(isPwd);
console.log(event.keyCode);
if (event.ctrlKey && isPwd && event.keyCode === 86) {
$(this).val(pwdVal);
}
});*/
$pwd[0].onpaste = function() {
return false;
};
//ajax表单提交
$registerBtn.click(function() {
... ...
... ... @@ -18,7 +18,7 @@ moreUnicode = {
//品牌相关变量
var $brandDefault = $('.brand .default'),
$brandPanel = $('.brand .brand-panel'),
$brandAttrs = $('.brand .attr'),
$brandAttrs = $brandPanel.find('.attr'),
$brandMore = $('#brand-more'),
$brandMulti = $('#brand-multi');
... ... @@ -105,7 +105,7 @@ $brandMulti.click(function() {
if ($brandPanel.css('display') === 'none') {
//显示品牌面板
brandShowMore();
$brandMore.trigger('click');
}
$brandPanel.addClass('multi'); //显示出checkbox
... ... @@ -178,9 +178,9 @@ $('.multi-select-cancel').click(function() {
var $panel = $(this).closest('.multi');
if ($panel.hasClass('brand-panel')) {
brandHideMore();
$brandMulti.removeClass('hide'); //显示多选按钮
$brandMore.trigger('click');
}
$panel.removeClass('multi');
... ...
... ... @@ -221,6 +221,7 @@
background-color: rgb(255,87,92);
color: #fff;
border-radius: 30px;
z-index: 2;
}
.commodity-img{
position: relative;
... ...
... ... @@ -27,7 +27,7 @@
outline: none;
}
input {
input.input {
height: 43px;
line-height: 43px;
font-size: 16px;
... ... @@ -53,28 +53,26 @@
float: left;
}
&.send-captcha {
top: 0;
background: #ff1901;
position: absolute;
width: 100px;
right: 0;
font-size: 12px;
text-indent: 0;
letter-spacing: 0;
&.disable {
background: #555;
}
}
&.agree-terms {
width: initial;
height: initial;
vertical-align: middle;
}
}
input.send-captcha {
top: 0;
background: #ff1901;
position: absolute;
width: 100px;
right: 0;
font-size: 12px;
text-indent: 0;
letter-spacing: 0;
&.disable {
background: #555;
}
}
.link {
text-decoration: underline;
color: #ff1901;
... ...
... ... @@ -3,12 +3,13 @@
.section {
padding: 10px 15px;
font-size: 14px;
font-size: 12px;
border-top: 1px solid #dfdfdf;
&:first-child {
border-top: none;
background: #eaeceb;
padding: 5px 15px;
}
}
... ... @@ -54,15 +55,23 @@
-moz-user-select: none;
}
.color .attr {
margin-right: 0;
}
.checked-conditions {
line-height: 30px;
.title {
margin-top: 5px;
}
.tag {
display: block;
float: left;
padding: 0 10px;
margin-right: 30px;
margin: 5px 30px 5px 0;
background: #000;
color: #fff;
cursor: pointer;
... ... @@ -76,9 +85,14 @@
}
.clear-checked {
margin-top: 5px;
color: #999;
float: right;
}
.close {
font-size: 14px;
}
}
.sort-pre .active .attr {
... ... @@ -157,7 +171,7 @@
margin-right: 5px;
span {
margin: 0 2px;
margin: 0 3px;
cursor: pointer;
-moz-user-select: none;
... ... @@ -184,9 +198,12 @@
}
.btn {
position: relative;
display: inline-block;
top: -1px;
width: 55px;
height: 18px;
height: 20px;
line-height: 20px;
background: #3a3a3a;
color: #fff;
text-align: center;
... ... @@ -224,8 +241,8 @@
border: none;
background: #000;
color: #fff;
font-size: 15px;
margin-right: 15px;
font-size: 14px;
margin-right: 20px;
cursor: pointer;
&.dis {
... ... @@ -329,9 +346,19 @@
.checkbox {
display: none;
float: left;
}
.multi .checkbox {
display: inline;
display: block;
color: #ccc;
font-size: 12px;
margin-right: 3px;
}
}
@media (max-width: 1180px) {
.filter-box .brand .attr {
width: 25%;
}
}
\ No newline at end of file
... ...
... ... @@ -52,6 +52,11 @@
> .price {
margin-top: 10px;
}
.market-price {
text-decoration: line-through;
color: #999;
}
}
.col-btn {
... ...
... ... @@ -45,10 +45,6 @@
}
}
.panel-body .attr {
width: 25%;
}
.filter-box .brand .attr-content {
max-width: 730px;
}
... ...
... ... @@ -73,6 +73,12 @@
&.new-sale {
display: block;
}
h2 a {
color: #000;
padding-left: 0;
}
li {
color: #bbb;
... ... @@ -80,6 +86,7 @@
padding-left: 5px;
}
}
a {
color: #666;
padding-left: 10px;
... ...
... ... @@ -6,12 +6,12 @@
.sort-type,
.checks {
color: #ccc;
font-size: 14px;
color: #999;
font-size: 12px;
padding: 0 10px;
.iconfont {
font-size: 14px;
font-size: 12px;
}
&.active,
... ...
... ... @@ -71,7 +71,7 @@ class Bootstrap extends Bootstrap_Abstract
$controller = 'Index';
$action = 'Index';
// 二级域名
if (2 === $level) {
if (3 === $level) {
$subDomain = strval($hostParts[0]);
switch (strtolower($subDomain)) {
case 'www': // 主站
... ... @@ -79,8 +79,8 @@ class Bootstrap extends Bootstrap_Abstract
case 'dev': // 开发环境
break;
case 'search': // 搜索
$controller = 'Search';
$action = 'List';
$searchRequest = new Yaf\Request\Http('/product/search/index');
$dispatcher->setRequest($searchRequest);
break;
case 'guang': // 逛
$module = 'Guang';
... ...
... ... @@ -2,138 +2,95 @@
namespace Product;
use Plugin\Helpers;
use Api\Yohobuy;
use Plugin\HelperSearch;
use LibModels\Web\Product\BrandData;
use LibModels\Wap\Product\SearchData;
use LibModels\Web\Product\SearchData as WebProduct;
use Product\SearchModel;
/**
* 品牌首页模板数据模型
*
* @author Administrator
*/
class BrandsModel {
const URL_BRAND_INDEX = '/product/index/brand';
public static $shopName;
public static $home;
class BrandsModel
{
/**
* 搜索品牌数据
*
* @param $condition array
* 搜索数据的条件
* @param $condition array 搜索数据的条件
* @param $options array
* @return array
*/
public static function getBrandSearchData($condition, $options, $domain, $uid, $brandId,$node) {
// 调用商品搜索接口
$data = SearchData::searchElasticByCondition($condition);
//获取品牌banner数据
$banner = self::getBannerByDomain($domain, $brandId, $uid = '');
$brandName = self::$shopName;
$options['brandName'] = $brandName;
public static function getBrandSearchData($condition, $options)
{
// 并行调用品牌相关接口并封装数据
$data = self::getBrandData($condition, $options);
if (isset($data['code']) && $data['code'] === 200) {
//获取分类列表数据
$param = array();
$param['brand'] = $condition['brand'];
$classes = WebProduct::getClassesData($param);
if (isset($classes['code']) && $classes['code'] === 200) {
$data['data']['filter']['group_sort'] = $classes['data']['sort'];
}
//用户浏览记录
// 组织模板数据
$list = HelperSearch::getList($data, $options);
//合并商品搜索数据与品牌banner数据
$list = array_merge_recursive($list,$banner);
$data = array(
//初始化js
'productListPage' => true,
'list' => $list
);
} else {
$data = array();
}
//获取品牌系列数据
$adNav = self::getAdNav($condition['brand']);
$data['list']['leftContent'][] = array('picLink' => $adNav);
$adNav = self::getAdNav($options['brandId']);
$data['leftContent'][] = array('picLink' => $adNav);
//获取静态内容(20141219-100447)
if($node){
$nodeContent = HelperSearch::formatNodeContent($node);
$data['list']['leftContent'][]['picLink']['list'] = $nodeContent;
//获取静态内容(eg:20141219-100447)
if($options['node']){
$nodeContent = HelperSearch::formatNodeContent($options['node']);
$data['leftContent'][]['picLink']['list'] = $nodeContent;
}
return $data;
}
/**
* 获取品牌首页banner条
* @string $domain 品牌域名
* @int $brandId 品牌id
* @int $uid 用户id
*
* @return array 品牌banner条数据
*/
public static function getBannerByDomain($domain, $brandId, $uid = '') {
// 构造品牌主页url
self::$home = Helpers::url('', '', $domain) . self::URL_BRAND_INDEX;
// 根据品牌Id获取品牌banner图
$bannerImg = BrandData::getBrandBanner($brandId);
if (isset($bannerImg['data'])) {
$bannerImg = Helpers::getImageUrl($bannerImg['data']['banner'], '', 150);
}
// 根据品牌Id获取品牌(简介)、收藏
$intro = BrandData::getBrandIntro($brandId, $uid);
$is_favorite = false;
$shopName = false;
if(isset($intro['data'])){
// 获取是否收藏
if ($intro['data']['is_favorite'] == 'Y') {
$is_favorite = true;
} elseif ($intro['data']['is_favorite'] == 'N') {
$is_favorite = false;
}
// 获取品牌名
self::$shopName = $intro['data']['brand_name'];
}
// 返回banner数据
return array(
'brandBanner' => array(
'bannerHeight' => '150',
'coled' => $is_favorite,
'banner' => $bannerImg
)
);
}
//获取品牌系列数据
public static function getAdNav($brandId, $status = 1) {
public static function getAdNav($brandId, $status = 1)
{
//调用接口获得数据
$advNav = BrandData::getFolderByBrand($brandId, $status);
$result = array();
if (isset($advNav['data']) && $advNav['code'] === 200) {
foreach ($advNav['data'] as $key => $value) {
$result['list'][$key]['href'] = self::$home . '?folder_id=' . $value['id'];
$result['list'][$key]['href'] = '?folder_id=' . $value['id'];
$result['list'][$key]['src'] = $value['brand_sort_ico'];
}
$result['picTitle'] = '经典系列';
}
$result['picTitle'] = '经典系列';
return $result;
}
/**
* 根据条件获取搜索数据
* @param array $customCondition
* @param array $customOptions
* @return array
*/
public static function getBrandData($customCondition = array(), $customOptions = array())
{
$urlList = array();
//获取$condition和$option 筛选条件和排序条件
$searchCondition = SearchModel::searchCondition($customCondition, $customOptions);
// 组合搜索商品url
$urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']);
// 组合搜索分类url
$urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['condition']);
//组合搜索品牌url
$urlList['brand'] = HelperSearch::getBrandUrl($customOptions);
//组合获取品牌banner url
$urlList['banner'] = HelperSearch::getBannerUrl($customOptions);
//组合用户浏览记录url
//$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
//批量调接口
$result = Yohobuy::getMulti($urlList, array(), true);
//组织模板数据格式
$data = HelperSearch::getList($result, $searchCondition['options']);
return $data;
}
}
... ...
... ... @@ -2,11 +2,10 @@
namespace Product;
use LibModels\Wap\Product\SearchData;
use LibModels\Web\Product\SearchData as WebProduct;
use Plugin\HelperSearch;
use \LibModels\Web\Product\SearchData as Search;
use Plugin\Images;
use Product\SearchModel;
use Api\Yohobuy;
/**
* sale首页模板数据模型
*
... ... @@ -14,33 +13,24 @@ use Plugin\Images;
class NewModel
{
public static function getNewSearchData($params, $options)
public static function getNewSearchData($customCondition, $customOptions)
{
$data = array();
// 调用接口查询商品数据
$result = SearchData::searchElasticByCondition($params);
if (isset($result['code']) && $result['code'] === 200) {
// 调用分类信息
$category = Search::getClassesData();
if (isset($category['code']) && $category['code'] === 200) {
$result['data']['filter']['group_sort'] = $category['data']['sort'];
}
// 调用折扣区间
$discount = Search::getDiscount();
if (isset($discount['code']) && $discount['code'] === 200) {
$result['data']['filter']['discount'] = $discount['data']['discount'];
}
// 调用最新上架
$recent = Search::recentShelve();
if (isset($discount['code']) && $discount['code'] === 200) {
$result['data']['filter']['recent'] = $recent['data']['recent'];
}
//用户浏览记录
$result['data']['filter']['review'] = Search::getRecentReview();
// 组织模板数据
$data = HelperSearch::getList($result, $options);
//new页面模拟数据
$urlList = array();
$searchCondition = SearchModel::searchCondition($customCondition, $customOptions);
// 组合搜索商品url
$urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']);
// 组合搜索分类url
$urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['condition']);
// 组合搜索最新上架url
$urlList['recent'] = HelperSearch::getRecentShelveUrl($searchCondition['condition']);
//用户浏览记录
//$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
$result = Yohobuy::getMulti($urlList, array(), true);
// 组织模板数据
$data = HelperSearch::getList($result, $searchCondition['options']);
//new页面模拟数据
$data['newMain'] = array(
'banner' => 'http://img11.static.yhbimg.com/yhb-img01/2015/11/23/07/010a459d41b99a839cba9377532f1c19b2.jpg?imageView/3/w/970/h/200',
'date' => '12月16日',
... ... @@ -72,12 +62,8 @@ class NewModel
)
)
);
}
return array(
'productListPage' => true,
'newSale' => $data
);
return $data;
}
}
... ...
... ... @@ -2,8 +2,7 @@
namespace Product;
use LibModels\Wap\Product\SearchData;
use LibModels\Web\Product\SearchData as WebProduct;
use Api\Yohobuy;
use Plugin\HelperSearch;
use Plugin\Images;
/**
... ... @@ -13,33 +12,27 @@ use Plugin\Images;
class SaleModel
{
public static function getSaleSearchData($params, $options, $specialInfo)
public static function getSaleSearchData($customCondition, $customOptions, $specialInfo)
{
$data = SearchData::searchElasticByCondition($params);
$urlList = array();
if (isset($data['code']) && $data['code'] === 200) {
//获取分类列表数据
$classes = WebProduct::getClassesData();
if (isset($classes['code']) && $classes['code'] === 200) {
$data['data']['filter']['group_sort'] = $classes['data']['sort'];
}
//用户浏览记录
// 组织模板数据
$list = HelperSearch::getList($data, $options);
//删除面包屑导航数据
unset($list['pathNav']);
$data = array(
//初始化js
'productListPage' => true,
'newSale' => $list
);
} else {
$data = array();
}
//获取$condition和$option 筛选条件和排序条件
$searchCondition = SearchModel::searchCondition($customCondition, $customOptions);
// 组合搜索商品url
$urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']);
// 组合搜索分类url
$urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['condition']);
//组合用户浏览记录url
//$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
//批量调接口
$result = Yohobuy::getMulti($urlList, array(), true);
//组织模板数据格式
$data = HelperSearch::getList($result, $searchCondition['options']);
//组织sale数据
if (isset($specialInfo['data']) && !empty($specialInfo['data']['banner_img'])) {
... ... @@ -52,15 +45,14 @@ class SaleModel
}
//Sale首页 banner数据
$data['newSale']['saleBanner']['bannerHeight'] = $special['banner'][0]['height'];
$data['newSale']['saleBanner']['img'] = $special['banner'][0]['img'];
$data['newSale']['saleTitle']['name'] = '全部商品';
$data['newSale']['saleTitle']['count'] = $data['newSale']['totalCount'];
$data['saleBanner']['bannerHeight'] = $special['banner'][0]['height'];
$data['saleBanner']['img'] = $special['banner'][0]['img'];
$data['saleTitle']['name'] = '全部商品';
$data['saleTitle']['count'] = $data['totalCount'];
//获取广告位数据
$nodeContent = HelperSearch::formatNodeContent($special['left_ad_code']);
$data['newSale']['leftContent'][]['picLink']['list'] = $nodeContent;
$data['leftContent'][]['picLink']['list'] = $nodeContent;
return $data;
}
... ...
<?php
namespace Product;
use Api\Yohobuy;
use Plugin\Helpers;
use Plugin\HelperSearch;
use \LibModels\Web\Product\SearchData;
... ... @@ -17,68 +19,163 @@ class SearchModel
{
/**
* 根据条件获取搜索数据
*
* @param $condition 搜索数据的条件
* @param $options Array([imgSize]
* => Array([0] => 235[1] => 314)[minImgSize] => Array([0] => 60[1] => 80)[gender] => 1[needPd] => Y[rowNum] => 5[viewNum] => 60)
* @author sefon 2015-12-17 16:12:18
* @return array
* 搜索相关页面公共条件处理
* @param $param
* @param $option
* @return mixed
*/
public static function getSearchData($condition, $options)
public static function searchCondition($param = array(), $option = array())
{
$data = array();
// 调用接口查询商品数据
$result = SearchData::searchElasticByCondition($condition);
if (isset($result['code']) && $result['code'] === 200) {
// 调用分类信息
$category = SearchData::getClassesData($condition);
if (isset($category['code']) && $category['code'] === 200) {
$result['data']['filter']['group_sort'] = $category['data']['sort'];
/* 过滤请求参数 */
$condition = filter_input_array(INPUT_GET, array(
'query' => FILTER_SANITIZE_STRING,
'brand' => FILTER_SANITIZE_STRING,
'sort' => FILTER_VALIDATE_INT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_DEFAULT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'gender' => FILTER_SANITIZE_STRING,
'p_d' => FILTER_DEFAULT,
'shelve_time' => FILTER_DEFAULT,
'isNew' => FILTER_DEFAULT,
'specialoffer' => FILTER_DEFAULT,
'limited' => FILTER_DEFAULT,
'order' => FILTER_DEFAULT,
'viewNum' => FILTER_VALIDATE_INT,
'rowNum' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT), false);
//关键字
if (isset($condition['query']) && !empty($condition['query'])) {
$condition['query'] = rawurldecode($condition['query']);
}
//品牌
if (isset($condition['brand']) && !empty($condition['brand'])) {
$condition['brand'] = rawurldecode($condition['brand']);
}
//性别
if (isset($condition['gender']) && !empty($condition['gender'])) {
$condition['gender'] = rawurldecode($condition['gender']);
}
else {
$condition['gender'] = Helpers::getGenderByCookie();
}
//每页显示商品数
$viewNumArray = array(60, 100, 200);
if(!isset($condition['viewNum']) || empty($condition['viewNum'])){
$condition['viewNum'] =60;
}
if (!in_array($condition['viewNum'], $viewNumArray)) {
$condition['viewNum'] = 60;
}
//每行显示的商品数量
if(!isset($condition['rowNum']) || empty($condition['rowNum'])){
$condition['rowNum'] =5;
}
if ($condition['rowNum'] == 6) {
$imgSize = array(195, 260);
$minImgSize = array(50, 67);
}
else {
$condition['rowNum'] = 5;
$imgSize = array(235, 314);
$minImgSize = array(60, 80);
}
//自定义搜索价格
if (isset($condition['price']) && !empty($condition['price'])) {
$price = explode(',', $condition['price']);
if (!$price[0]) {
$price[0] = 0;
}
// 调用折扣区间
$discount = SearchData::getDiscount();
if (isset($discount['code']) && $discount['code'] === 200) {
$result['data']['filter']['discount'] = $discount['data']['discount'];
if (!$price[1]) {
$price[1] = 99999;
}
// 调用最新上架
$recent = SearchData::recentShelve();
if (isset($discount['code']) && $discount['code'] === 200) {
$result['data']['filter']['recent'] = $recent['data']['recent'];
$condition['price'] = implode(',', $price);
}
//返回搜索条件
$condition['needFilter'] = 1;
//过滤赠品
$condition['attribute_not'] = 2;
//默认排序
if (!isset($condition['order']) || empty($condition['order'])) {
$condition['order'] = 's_n_desc';
}
$options = array(
'imgSize' => $imgSize,
'minImgSize' => $minImgSize,
'rowNum' =>$condition['rowNum'],
'viewNum' =>$condition['viewNum'],
);
//接收高级选项
foreach ($_GET as $key =>$val) {
if (strpos('parameter_',$key) !== false) {
$condition[$key] = (int) $val;
}
//用户浏览记录
$result['data']['filter']['review'] = SearchData::getRecentReview();
// 组织模板数据
$data = HelperSearch::getList($result, $options);
}
//每页记录数减1,下一页占位
$condition['viewNum'] = $condition['viewNum'] - 1;
$condition = array_merge($condition, $param);
$options = array_merge($options, $option);
$data['condition'] = $condition;
$data['options'] = $options;
return $data;
}
/**
* 根据条件获取搜索数据
* @param array $customCondition
* @param array $customOptions
* @return array
*/
public static function getListData($customCondition = array(), $customOptions = array())
{
$urlList = array();
$searchCondition = self::searchCondition($customCondition, $customOptions);
// 组合搜索商品url
$urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']);
// 组合搜索分类url
$urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['condition']);
// 组合搜索折扣区间url
$urlList['discount'] = HelperSearch::getDiscountUrl($searchCondition['condition']);
// 组合搜索最新上架url
$urlList['recent'] = HelperSearch::getRecentShelveUrl($searchCondition['condition']);
//用户浏览记录
//$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
$result = Yohobuy::getMulti($urlList, array(), true);
// 组织模板数据
$data = HelperSearch::getList($result, $searchCondition['options']);
return $data;
}
/**
* 搜索页面获取搜索数据
* @param $condition
* @param $options
* @param $customCondition
* @param $customOptions
* @return array
*/
public static function searchData($condition, $options){
$data = self::getSearchData($condition, $options);
//获取品牌店铺信息
if (isset($condition['query'])) {
$param['keyword'] = $condition['query'];
$result = SearchData::getShop($param);
if (isset($result['code']) && $result['code'] === 200 && isset($result['data']) && !empty($result['data'])) {
//调用品牌分类
$class['brand'] = $result['data']['id'];
$brandSort = SearchData::getClassesData($class);
$shop = $result['data'];
if (isset($brandSort['data']['sort']) && !empty($brandSort['data']['sort']))
$shop['sort'] = $brandSort['data']['sort'];
$shopEntry = HelperSearch::shop($shop);
}
public static function searchData($customCondition, $customOptions)
{
$urlList = array();
$searchCondition = self::searchCondition($customCondition, $customOptions);
// 组合搜索商品url
$urlList['product'] = HelperSearch::getProductUrl($searchCondition['condition']);
// 组合搜索分类url
$urlList['sort'] = HelperSearch::getClassesUrl($searchCondition['condition']);
// 组合搜索店铺url
if (isset($param['keyword'])) {
$param['keyword'] = $searchCondition['condition']['query'];
$urlList['shop'] = HelperSearch::getShopUrl($param);
}
$data['shopEntry'] = isset($shopEntry) ? $shopEntry : array();
//用户浏览记录
//$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']);
$result = Yohobuy::getMulti($urlList, array(), true);
// 组织模板数据
$data = HelperSearch::getList($result, $searchCondition['options']);
return $data;
}
/**
* 根据product_sn查询产品图片信息
... ... @@ -100,4 +197,14 @@ class SearchModel
}
echo json_encode($data);
}
/**
* 查询搜索提示
* @param $query
*/
public static function getSuggest($query)
{
$result = SearchData::getSuggest();
return $result;
}
}
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@ use LibModels\Web\Passport\RegData;
use Plugin\Helpers;
use Plugin\Cache;
use Passport\PassportModel;
use LibModels\Web\Passport\BindData;
use LibModels\Wap\Passport\BindData;
class RegisterController extends WebAction
{
/**
... ...
... ... @@ -2,7 +2,7 @@
use Action\AbstractAction;
class RegisterController extends AbstractAction
class Register1Controller extends AbstractAction
{
/**
* 登录页
... ... @@ -49,7 +49,7 @@ class RegisterController extends AbstractAction
'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190'
)
);
$this->_view->display('index', $data);
$this->_view->display('../register/index', $data);
}
public function checkmobileAction()
... ...
<?php
use Action\WebAction;
use LibModels\Web\Product\BrandData;
class IndexController extends WebAction
{
/**
* 品牌首页
*/
... ... @@ -17,87 +17,33 @@ class IndexController extends WebAction
$uid = $this->getUid();
//根据品牌域名获取品牌id(同时判断品牌域名是否有效)
$brandInfo = BrandData::getBrandLogoByDomain($domain);
if(!empty($brandInfo['data']) && $brandInfo['code'] === 200){
if (!empty($brandInfo['data']) && $brandInfo['code'] === 200) {
$brandId = $brandInfo['data']['id'];
$node = isset($brandInfo['static_content_code']) ? $brandInfo['static_content_code'] : false;
}else{
} else {
$this->go(SITE_MAIN);
}
/* 过滤请求参数 */
//品牌ID参数
$condition = array();
$condition = filter_input_array(INPUT_GET, array(
//'query' => FILTER_SANITIZE_STRING,
'sort' => FILTER_VALIDATE_INT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_VALIDATE_INT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,
'shelve_time' => FILTER_DEFAULT,
'isNew' => FILTER_DEFAULT,
'specialoffer' => FILTER_DEFAULT,
'limited' => FILTER_DEFAULT,
'order' => FILTER_DEFAULT,
'viewNum' => FILTER_VALIDATE_INT,
'rowNum' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT,), false);
//字符转码
if (!empty($condition)) {
foreach ($condition as &$value) {
$value = rawurldecode($value);
}
}
//传品牌ID参数
$condition['brand'] = $brandId;
//获取性别数据
$gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : (!isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1));
$condition['gender'] = $gender;
//$options参数数组
$options = array();
$options['brandName'] = $domain;
$options['uid'] = $uid;
$options['brandId'] = $brandId;
$options['node'] = $node;
//每页显示商品数
if(!isset($condition['viewNum']) || empty($condition['viewNum'])){
$condition['viewNum'] =60;
}
$view_num_arr = array(60, 100, 200);
if (!in_array($condition['viewNum'], $view_num_arr)) {
$condition['viewNum'] = 60;
}
//每行显示的商品数量
if(!isset($condition['rowNum']) || empty($condition['rowNum'])){
$condition['rowNum'] =5;
}
if ($condition['rowNum'] == 6) {
$imgSize = array(195, 260);
$minImgSize = array(50, 67);
} else {
$condition['rowNum'] = 5;
$imgSize = array(235, 314);
$minImgSize = array(60, 80);
}
//搜索词
//$query = $this->get('query');
$condition['needFilter'] = 1;
$options = array(
'imgSize' => $imgSize,
'minImgSize' => $minImgSize,
'gender' => $gender,
'needPd' => 'Y',
'rowNum' => $condition['rowNum'],
'viewNum' => $condition['viewNum'],
//调用模型获得数据
$data = Product\BrandsModel::getBrandSearchData($condition, $options);
$data = array(
//初始化js
'searchListPage' => true,
'list' => $data
);
$params = $condition + $_GET;
$params = array_filter($params);
//每页记录数减1,下一页占位
$params['viewNum'] = $params['viewNum'] - 1;
$data = Product\BrandsModel::getBrandSearchData($params,$options,$domain,$uid,$brandId,$node);
$cate = array('boys','girls','kids','lifestyle');
$this->setWebNavHeader($cate[$gender-1]);
$this->setWebNavHeader();
//渲染模板
$this->_view->display('list',$data);
}
... ...
... ... @@ -17,87 +17,17 @@ class ListController extends WebAction
*/
public function saleAction()
{
/* 过滤请求参数 */
$condition = filter_input_array(INPUT_GET, array(
//'query' => FILTER_SANITIZE_STRING,
'brand' => FILTER_VALIDATE_INT,
'sort' => FILTER_VALIDATE_INT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_DEFAULT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,
'shelve_time' => FILTER_DEFAULT,
'isNew' => FILTER_DEFAULT,
'specialoffer' => FILTER_DEFAULT,
'limited' => FILTER_DEFAULT,
'order' => FILTER_DEFAULT,
'viewNum' => FILTER_VALIDATE_INT,
'rowNum' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT), false);
//字符转码
if (!empty($condition)) {
foreach ($condition as $key => $val) {
$condition[$key] = rawurldecode($val);
}
}
//性別(频道)
$gender_cookie = !isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1);
$gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : $gender_cookie ;
$condition['gender'] = $gender;
//每页显示商品数
if(!isset($condition['viewNum']) || empty($condition['viewNum'])){
$condition['viewNum'] =60;
}
$view_num_arr = array(60, 100, 200);
if (!in_array($condition['viewNum'], $view_num_arr)) {
$condition['viewNum'] = 60;
}
//每行显示的商品数量
if(!isset($condition['rowNum']) || empty($condition['rowNum'])){
$condition['rowNum'] =5;
}
if ($condition['rowNum'] == 6) {
$imgSize = array(195, 260);
$minImgSize = array(50, 67);
} else {
$condition['rowNum'] = 5;
$imgSize = array(235, 314);
$minImgSize = array(60, 80);
}
//返回搜索条件
$condition['needFilter'] = 1;
//过滤赠品
$condition['attribute_not'] = 2;
/*sale*/
//默认排序
if (!isset($condition['order']) || empty($condition['order'])) {
$condition['order'] = 's_n_desc';
}
if (!isset($condition['p_d']) || empty($condition['p_d'])) {
$condition['p_d'] = '0,0.9';
}
$options = array(
'imgSize' => $imgSize,
'minImgSize' => $minImgSize,
'rowNum' =>$condition['rowNum'],
'viewNum' =>$condition['viewNum'],
);
$params = $condition + $_GET;
$params = array_filter($params);
//每页记录数减1,下一页占位
$params['viewNum'] = $params['viewNum'] - 1;
$list = SearchModel::getSearchData($params,$options);
//排序
$condition['order'] = 's_n_desc';
//打折
$condition['p_d'] = '0,0.9';
$list = SearchModel::getListData($condition);
$data = array(
//初始化js
'productListPage' => true,
'list' => $list
);
$cate = array('boys','girls','kids','lifestyle');
$this->setWebNavHeader($cate[$gender-1]);
$this->setWebNavHeader();
$this->_view->display('list', $data);
}
... ...
<?php
use Action\WebAction;
/**
* new页
*
*/
class NewController extends WebAction
{
public function indexAction()
{
$condition = array(
'order' => 's_t_desc'
);
$options = array(
'specialsale_id' => 'Y',
'needDay' => 'Y'
);
$newData = Product\NewModel::getNewSearchData($condition, $options);
$data = array(
'productListPage' => true,
'newSale' => $newData
);
$this->setWebNavHeader();
//渲染模板
$this->_view->display('new-sale', $data);
}
}
... ...
... ... @@ -27,39 +27,11 @@ class SaleController extends WebAction
$this->go(SITE_MAIN);
}
/* 过滤请求参数 */
$condition = array();
$condition = filter_input_array(INPUT_GET, array(
//'query' => FILTER_SANITIZE_STRING,
'sort' => FILTER_VALIDATE_INT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_VALIDATE_INT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,
'shelve_time' => FILTER_DEFAULT,
'isNew' => FILTER_DEFAULT,
'specialoffer' => FILTER_DEFAULT,
'limited' => FILTER_DEFAULT,
'order' => FILTER_DEFAULT,
'viewNum' => FILTER_VALIDATE_INT,
'rowNum' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT,), false);
//字符转码
if (!empty($condition)) {
foreach ($condition as &$value) {
$value = rawurldecode($value);
}
}
//传品牌ID参数
if(!empty($special['brand_id'])){
$condition['brand'] = $special['brand_id'];
}
//传促销id
if(!empty($special['ispromotion'])){
$condition['promotion'] = $special['ispromotion'];
... ... @@ -67,52 +39,18 @@ class SaleController extends WebAction
$condition['promotion'] = $promotion;
}
//获取性别数据
$gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : (!isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender'] == '2,3' ? 2 : 1));
$condition['gender'] = $gender;
//每页显示商品数
if (!isset($condition['viewNum']) || empty($condition['viewNum'])) {
$condition['viewNum'] = 60;
}
$view_num_arr = array(60, 100, 200);
if (!in_array($condition['viewNum'], $view_num_arr)) {
$condition['viewNum'] = 60;
}
//每行显示的商品数量
if (!isset($condition['rowNum']) || empty($condition['rowNum'])) {
$condition['rowNum'] = 5;
}
if ($condition['rowNum'] == 6) {
$imgSize = array(195, 260);
$minImgSize = array(50, 67);
} else {
$condition['rowNum'] = 5;
$imgSize = array(235, 314);
$minImgSize = array(60, 80);
}
//搜索词
//$query = $this->get('query');
$condition['needFilter'] = 1;
$options = array(
'imgSize' => $imgSize,
'minImgSize' => $minImgSize,
'gender' => $gender,
'needPd' => 'Y',
'rowNum' => $condition['rowNum'],
'viewNum' => $condition['viewNum'],
'specialsale_id' => 'Y'
'specialsale_id' => 'Y',
'controller' => $this->_request->controller
);
$params = $condition + $_GET;
$params['attribute_not'] = 2;
$params = array_filter($params);
//每页记录数减1,下一页占位
$params['viewNum'] = $params['viewNum'] - 1;
$data = Product\SaleModel::getSaleSearchData($params, $options, $specialInfo);
$cate = array('boys', 'girls', 'kids', 'lifestyle');
$this->setWebNavHeader($cate[$gender - 1]);
$saleData = Product\SaleModel::getSaleSearchData($condition, $options, $specialInfo);
$data = array(
//初始化js
'productListPage' => true,
'newSale' => $saleData
);
$this->setWebNavHeader();
//渲染模板
$this->_view->display('new-sale', $data);
}
... ...
... ... @@ -5,98 +5,23 @@ class SearchController extends WebAction
{
public function indexAction()
{
/* 过滤请求参数 */
$condition = filter_input_array(INPUT_GET, array(
'query' => FILTER_SANITIZE_STRING,
'brand' => FILTER_VALIDATE_INT,
'sort' => FILTER_VALIDATE_INT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_DEFAULT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,
'shelve_time' => FILTER_DEFAULT,
'isNew' => FILTER_DEFAULT,
'specialoffer' => FILTER_DEFAULT,
'limited' => FILTER_DEFAULT,
'order' => FILTER_DEFAULT,
'viewNum' => FILTER_VALIDATE_INT,
'rowNum' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT), false);
//字符转码
foreach($condition as $key => $val){
$condition[$key] = rawurldecode($val);
}
//性別(频道)
$gender_cookie = !isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1);
$gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : $gender_cookie ;
$condition['gender'] = $gender;
//每页显示商品数
if(!isset($condition['viewNum']) || empty($condition['viewNum'])){
$condition['viewNum'] =60;
}
$view_num_arr = array(60, 100, 200);
if (!in_array($condition['viewNum'], $view_num_arr)) {
$condition['viewNum'] = 60;
}
//每行显示的商品数量
if(!isset($condition['rowNum']) || empty($condition['rowNum'])){
$condition['rowNum'] =5;
}
if ($condition['rowNum'] == 6) {
$imgSize = array(195, 260);
$minImgSize = array(50, 67);
} else {
$condition['rowNum'] = 5;
$imgSize = array(235, 314);
$minImgSize = array(60, 80);
}
//自定义搜索价格
if (isset($condition['price']) && !empty($condition['price'])) {
$price = explode(',', $condition['price']);
if (!$price[0]) {
$price[0] = 0;
}
if (!$price[1]) {
$price[1] = 99999;
}
$condition['price'] = implode(',', $price);
}
//返回搜索条件
$condition['needFilter'] = 1;
//过滤赠品
$condition['attribute_not'] = 2;
/*sale*/
//默认排序
if (!isset($condition['order']) || empty($condition['order'])) {
$condition['order'] = 's_n_desc';
}
if (!isset($condition['p_d']) || empty($condition['p_d'])) {
$condition['p_d'] = '0,0.9';
}
$options = array(
'imgSize' => $imgSize,
'minImgSize' => $minImgSize,
'rowNum' =>$condition['rowNum'],
'viewNum' =>$condition['viewNum'],
);
$params = $condition + $_GET;
$params = array_filter($params);
//每页记录数减1,下一页占位
$params['viewNum'] = $params['viewNum'] - 1;
$options['controller'] = $this->_request->controller;
$searchData = SearchModel::searchData($params,$options);
$cate = array('boys','girls','kids','lifestyle');
$this->setWebNavHeader($cate[$gender-1]);
$searchData = SearchModel::searchData(array(),$options);
$data = array(
//初始化js
'searchListPage' => true,
'search' => $searchData
);
$this->setWebNavHeader();
$this->_view->display('search', $data);
}
public function suggest()
{
$query = rawurldecode($this->get('query'));
if ($query) {
$param['query'] = $query;
$result = SearchModel::getSuggest($param);
}
}
}
\ No newline at end of file
... ...
<?php
use Action\WebAction;
use LibModels\Web\Product\SaleData;
/**
* new页
*
*/
class NewController extends WebAction
{
public function indexAction()
{
/* 过滤请求参数 */
$condition = array();
$condition = filter_input_array(INPUT_GET, array(
//'query' => FILTER_SANITIZE_STRING,
'sort' => FILTER_VALIDATE_INT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_VALIDATE_INT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,
'shelve_time' => FILTER_DEFAULT,
'isNew' => FILTER_DEFAULT,
'specialoffer' => FILTER_DEFAULT,
'limited' => FILTER_DEFAULT,
'order' => FILTER_DEFAULT,
'viewNum' => FILTER_VALIDATE_INT,
'rowNum' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT,), false);
//字符转码
if (!empty($condition)) {
foreach ($condition as &$value) {
$value = rawurldecode($value);
}
}
//获取性别数据
$gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : (!isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender'] == '2,3' ? 2 : 1));
$condition['gender'] = $gender;
//每页显示商品数
if (!isset($condition['viewNum']) || empty($condition['viewNum'])) {
$condition['viewNum'] = 60;
}
$view_num_arr = array(60, 100, 200);
if (!in_array($condition['viewNum'], $view_num_arr)) {
$condition['viewNum'] = 60;
}
//每行显示的商品数量
if (!isset($condition['rowNum']) || empty($condition['rowNum'])) {
$condition['rowNum'] = 5;
}
if ($condition['rowNum'] == 6) {
$imgSize = array(195, 260);
$minImgSize = array(50, 67);
} else {
$condition['rowNum'] = 5;
$imgSize = array(235, 314);
$minImgSize = array(60, 80);
}
//搜索词
//$query = $this->get('query');
$condition['needFilter'] = 1;
$options = array(
'imgSize' => $imgSize,
'minImgSize' => $minImgSize,
'gender' => $gender,
'needPd' => 'Y',
'rowNum' => $condition['rowNum'],
'viewNum' => $condition['viewNum'],
'specialsale_id' => 'Y'
);
$params = $condition + $_GET;
$params['attribute_not'] = 2;
$params = array_filter($params);
//每页记录数减1,下一页占位
$params['viewNum'] = $params['viewNum'] - 1;
$data = Product\NewModel::getNewSearchData($params, $options);
$cate = array('boys', 'girls', 'kids', 'lifestyle');
$this->setWebNavHeader($cate[$gender - 1]);
//渲染模板
$this->_view->display('new-sale', $data);
}
}