Authored by lore-w

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

Showing 53 changed files with 653 additions and 749 deletions
... ... @@ -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));
}
... ...
... ... @@ -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::$shopsUrl,$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;
/**
* 搜索辅助类
*/
... ... @@ -110,12 +112,14 @@ class HelperSearch
$result['leftContent'][]['allSort'] = isset($data['sort']) ? self::groupSort($data['sort']['sort']) : 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['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);
//选中条件
if (self::getSelected()) {
$result['filters']['checkedConditions']['conditions'] = self::getSelected();
... ... @@ -127,7 +131,7 @@ class HelperSearch
if (isset($options['controller']) && $options['controller'] == 'Search') {
self::setSearchNav($data['product']['total']);
}
$result['pathNav'] = self::$listnav;
$result['pathNav'] = isset($options['controller']) && $options['controller'] == 'Sale' ? array() : self::$listnav;
return $result;
}
... ... @@ -552,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)
... ... @@ -589,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]
... ... @@ -1224,6 +1239,36 @@ class HelperSearch
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获取(获取用户浏览记录)
*/
... ... @@ -1292,4 +1337,36 @@ class HelperSearch
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
);
}
}
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -113,6 +113,10 @@ function showChooseGifDialog() {
}, function() {
window.location.href = cartContentShow().find('.freebie > a').attr('href');
}, function() {
var info = window.cookie('order-info');
if (info) {
window.setCookie('order-info', '');
}
window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
});
}
... ... @@ -188,6 +192,7 @@ if ($('.freebie').length > 0) {
$('.btn-balance').on('touchend', function() {
lowStockCount = 0;
var info = window.cookie('order-info');
if (shouldLowStocks()) {
tip.show('所选商品中有' + lowStockCount + '种库存不足的商品');
return false;
... ... @@ -199,6 +204,9 @@ $('.btn-balance').on('touchend', function() {
}
if (hasChecked()) {
if (info) {
window.setCookie('order-info', '');
}
window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
} else {
tip.show('请先勾选商品');
... ...
... ... @@ -105,7 +105,7 @@ $('.icon-del').on('touchstart', function(e) {
autoHide: true,
fast: true
});
window.setCookie('order-info', '');
//window.setCookie('order-info', '');
window.setCookie('_yoho-cart-refreshByDelete', true);
window.location.href = '/cart/index/index?cartType=' + $('#cartType').val();
} else {
... ...
... ... @@ -89,13 +89,8 @@ $('.invoice').on('touchend', '.checkbox', function() {
return false;
});
function orderCompute(firstEnter) {
function orderCompute() {
var yohoCoin = orderInfo('yohoCoin');
if (firstEnter) {
yohoCoin = 0;
}
$.ajax({
method: 'POST',
url: '/cart/index/orderCompute',
... ... @@ -133,9 +128,6 @@ function orderCompute(firstEnter) {
});
}
// 进入页面计算一次价格
//orderCompute(1);
function submitOrder() {
var invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
msg = $('#msg').find('input').val() || orderInfo('msg');
... ...
... ... @@ -11,7 +11,7 @@ require('../common');
function init() {
info = {
uid: window.getUid(),
deliveryId: 1,
deliveryId: $('.dispatch-mode .chosed').data('id') || 1,
deliveryTimeId: 1,
paymentTypeId: 1,
yohoCoin: 0,
... ... @@ -32,7 +32,7 @@ try {
info = JSON.parse(info);
// 2015/12/31 hf: fixes bug to 购物车页面调用该JS, 会导致有YOHO币,值却没有传给服务端. 因此需要再设置一下
// info.yohoCoin = $('.coin').data('yoho-coin') || 0;
//info['yohoCoin'] = $('.coin').data('yoho-coin') || 0;
} catch (e) {
init();
}
... ...
.yoho-coin-new-page {
padding-top: pxToRem(30px);
background-color: #f0f0f0;
margin-top: pxToRem(30px);
.coin{
text-align: center;
background-color: #fff;
}
.coin-num {
color: #d0021b;
... ... @@ -58,6 +60,7 @@
}
.banner {
margin-bottom: pxToRem(30px);
padding-top: pxToRem(30px);
border-top: 1px solid #e0e0e0;
}
}
... ...
... ... @@ -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);
... ...
... ... @@ -7,7 +7,7 @@
<a href="{{.}}" class="iconfont nav-home">&#xe611;</a>
{{/navHome}}
{{#currencyPage}}
<a href="/home/help" class="iconfont nav-home">&#xe639;</a>
<a href="/home/helpDetail?code=20111130-152530&caption=如何使用YOHO币支付" class="iconfont nav-home">&#xe639;</a>
{{/currencyPage}}
{{#navPhone}}
<a href="{{.}}" class="iconfont nav-home">&#xe641;</a>
... ...
... ... @@ -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>
... ...
... ... @@ -5,8 +5,10 @@
<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}}class="active"{{/if}}>
... ...
... ... @@ -1503,7 +1503,7 @@ moreUnicode = {
//品牌相关变量
var $brandDefault = $('.brand .default'),
$brandPanel = $('.brand .brand-panel'),
$brandAttrs = $('.brand .attr'),
$brandAttrs = $brandPanel.find('.attr'),
$brandMore = $('#brand-more'),
$brandMulti = $('#brand-multi');
... ... @@ -1590,7 +1590,7 @@ $brandMulti.click(function() {
if ($brandPanel.css('display') === 'none') {
//显示品牌面板
brandShowMore();
$brandMore.trigger('click');
}
$brandPanel.addClass('multi'); //显示出checkbox
... ... @@ -1663,9 +1663,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');
... ... @@ -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');
}
... ...
... ... @@ -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;
... ...
... ... @@ -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
... ...
... ... @@ -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,
... ...
... ... @@ -264,7 +264,7 @@ class DetailModel
'numInCart' => 0,
'goodsInstore' => $baseInfo['storage'], // 库存量
);
$soldOut = ($baseInfo['storage'] == 0) || ($baseInfo['status'] == 0);
$soldOut = ($baseInfo['storage'] == 0) || ($baseInfo['status'] == 0 || $totalStorageNum === 0);
$notForSale = $baseInfo['attribute'] == 2;
// 显示加入购物车链接
if (!$soldOut && !$notForSale) {
... ...
... ... @@ -283,7 +283,7 @@ class IndexController extends AbstractAction
$cartType = $this->get('cartType', '');
$cookieData = $this->getCookie('order-info', null);
$orderInfo = array();
if (empty($cartType) && !empty($cookieData)) {
if (!empty($cookieData)) {
$orderInfo = json_decode($cookieData, true);
$cartType = $orderInfo['cartType'];
}
... ...
... ... @@ -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;
}
... ...
... ... @@ -24,7 +24,7 @@ class SearchModel
* @param $option
* @return mixed
*/
public static function searchCondition($param, $option)
public static function searchCondition($param = array(), $option = array())
{
/* 过滤请求参数 */
$condition = filter_input_array(INPUT_GET, array(
... ... @@ -120,6 +120,7 @@ class SearchModel
$options = array_merge($options, $option);
$data['condition'] = $condition;
$data['options'] = $options;
return $data;
}
... ... @@ -196,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
{
/**
... ...
<?php
use Action\WebAction;
use LibModels\Web\Product\BrandData;
class IndexController extends WebAction
{
/**
* 品牌首页
*/
... ... @@ -24,80 +24,26 @@ class IndexController extends WebAction
$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);
}
... ...
... ... @@ -27,6 +27,7 @@ class ListController extends WebAction
'productListPage' => true,
'list' => $list
);
$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);
}
... ...
... ... @@ -15,4 +15,13 @@ class SearchController extends WebAction
$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);
}
}