Authored by lore-w

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

Conflicts:
	template/www.yohobuy.com/partials/product/standard-content.phtml
@@ -297,6 +297,9 @@ @@ -297,6 +297,9 @@
297 } 297 }
298 ] 298 ]
299 } 299 }
  300 +### 无搜索/筛选结果提示
  301 +通过**goods**字段控制页面相关元素的渲染与否,若无结果,不要传goods字段
  302 +无搜索结果必须传递搜索的*searchActionUrl*,比如:search.yohobuy.com;可选字段为*keyWord*
300 303
301 ### 标准页面内容 304 ### 标准页面内容
302 305
@@ -462,12 +465,8 @@ @@ -462,12 +465,8 @@
462 href: '' 465 href: ''
463 } 466 }
464 ], 467 ],
465 - fivePerLine: true,  
466 - sixPerLineHref: '',  
467 - //or  
468 - sixPerLine: true,  
469 - fivePerLineHref: '',  
470 468
  469 + //重要提示:页面筛选无结果时,接下来的参数不用传;
471 countPerPage => 120, 470 countPerPage => 120,
472 pageCounts => [ 471 pageCounts => [
473 { 472 {
@@ -482,8 +481,10 @@ @@ -482,8 +481,10 @@
482 pageCount: 30, 481 pageCount: 30,
483 preHref: '', //若当前为第一页,不传此参数 482 preHref: '', //若当前为第一页,不传此参数
484 nexHref: '' //若当前为最后一页,不传此参数 483 nexHref: '' //若当前为最后一页,不传此参数
  484 + //重要提示END
485 }, 485 },
486 486
  487 + //重要提示:若无搜索或者筛选结果,则不传goods,totalCount和pager也都不传字段
487 goods: [ 488 goods: [
488 { 489 {
489 ...//good 490 ...//good
@@ -493,6 +494,12 @@ @@ -493,6 +494,12 @@
493 totalCount: 333, //共多少件商品 494 totalCount: 333, //共多少件商品
494 pager: '', //右下角分页HTML 495 pager: '', //右下角分页HTML
495 496
  497 + //若为搜索导致的无结果,则传递关键词字段;筛选导致的不传
  498 + keyWord: '...',
  499 + searchActionUrl: ''
  500 +
  501 + //重要提示END
  502 +
496 //最近浏览<搜索无此内容> 503 //最近浏览<搜索无此内容>
497 latestWalk: [ 504 latestWalk: [
498 { 505 {
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="new-sale-page product-page yoho-page"> 2 <div class="new-sale-page product-page yoho-page">
3 {{# newSale}} 3 {{# newSale}}
4 - {{# banner}} 4 + {{# saleBanner}}
5 <div class="banner-img" style="height: {{bannerHeight}}px;background:url({{img}}) no-repeat top center;"></div> 5 <div class="banner-img" style="height: {{bannerHeight}}px;background:url({{img}}) no-repeat top center;"></div>
6 - {{/ banner}} 6 + {{/ saleBanner}}
7 7
8 <div class="center-content clearfix"> 8 <div class="center-content clearfix">
9 - {{# title}} 9 + {{> layout/path-nav}}
  10 +
  11 + {{# saleTitle}}
10 <div class="header-title"> 12 <div class="header-title">
11 {{name}} 13 {{name}}
12 <p class="line-through"></p> 14 <p class="line-through"></p>
@@ -14,7 +16,7 @@ @@ -14,7 +16,7 @@
14 <span class="count">共{{count}}个结果</span> 16 <span class="count">共{{count}}个结果</span>
15 </p> 17 </p>
16 </div> 18 </div>
17 - {{/ title}} 19 + {{/ saleTitle}}
18 20
19 <div class="list-left pull-left"> 21 <div class="list-left pull-left">
20 {{> product/left-content}} 22 {{> product/left-content}}
  1 +<div class="no-result">
  2 + <p class="no-title">
  3 + 抱歉!没有找到{{# keyWord}}与"<b class="keyword">{{.}}</b>"{{/ keyWord}}相关的商品
  4 + </p>
  5 + <div class="search-again clearfix">
  6 + <form method="GET" action="{{searchActionUrl}}">
  7 + <input id="no-result-input" name="query" type="text" placeholder="换个关键词试试">
  8 + <span id="search-again-btn">
  9 + <i class="iconfont">&#xe611;</i>
  10 + </span>
  11 + </form>
  12 + </div>
  13 + <p class="no-tip">建议您:看看输入的文字是否有误 / 减少分类条件限制 / 重新搜索</p>
  14 +</div>
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 </a> 35 </a>
36 {{/ checks}} 36 {{/ checks}}
37 37
  38 + {{#if ../goods}}
38 <div class="pager-wrap"> 39 <div class="pager-wrap">
39 <div class="page-count"> 40 <div class="page-count">
40 <span id="count-per-page"> 41 <span id="count-per-page">
@@ -73,14 +74,15 @@ @@ -73,14 +74,15 @@
73 {{/if}} 74 {{/if}}
74 </p> 75 </p>
75 </div> 76 </div>
  77 + {{/if}}
76 </div> 78 </div>
77 {{/ opts}} 79 {{/ opts}}
78 80
79 -<div class="goods-container clearfix"> 81 +{{#if goods}}
  82 + <div class="goods-container clearfix">
80 {{#each goods}} 83 {{#each goods}}
81 {{> product/good}} 84 {{> product/good}}
82 {{/each}} 85 {{/each}}
83 -  
84 {{# hasNextPage}} 86 {{# hasNextPage}}
85 <div class="block-next-page"> 87 <div class="block-next-page">
86 <a href="{{href}}"> 88 <a href="{{href}}">
@@ -92,12 +94,15 @@ @@ -92,12 +94,15 @@
92 <div class="good-info-main"></div> 94 <div class="good-info-main"></div>
93 <div class="good-select-color"></div> 95 <div class="good-select-color"></div>
94 </div> 96 </div>
95 -</div> 97 + </div>
96 98
97 -<div class="product-pager clearfix"> 99 + <div class="product-pager clearfix">
98 <span class="total">{{opts.curPage}} - {{opts.pageCount}} / {{totalCount}}件商品</span> 100 <span class="total">{{opts.curPage}} - {{opts.pageCount}} / {{totalCount}}件商品</span>
99 101
100 <div class="pager"> 102 <div class="pager">
101 {{{pager}}} 103 {{{pager}}}
102 </div> 104 </div>
103 -</div>  
  105 + </div>
  106 +{{^}}
  107 + {{> product/no-result}}
  108 +{{/if}}
@@ -7,6 +7,8 @@ @@ -7,6 +7,8 @@
7 var $ = require('yoho.jquery'), 7 var $ = require('yoho.jquery'),
8 lazyLoad = require('yoho.lazyload'); 8 lazyLoad = require('yoho.lazyload');
9 9
  10 +require('yoho.placeholder');
  11 +
10 require('./filter'); 12 require('./filter');
11 13
12 require('./sort-pager'); 14 require('./sort-pager');
@@ -17,6 +19,15 @@ require('./product'); @@ -17,6 +19,15 @@ require('./product');
17 //最近浏览的商品Lazyload 19 //最近浏览的商品Lazyload
18 lazyLoad($('.latest-walk .lazy')); 20 lazyLoad($('.latest-walk .lazy'));
19 21
  22 +//无搜索结果
  23 +if ($('.no-result').length > 0) {
  24 + $('#no-result-input').placeholder();
  25 + $('#search-again-btn').click(function() {
  26 + $(this).closest('form').submit();
  27 + });
  28 +}
  29 +
  30 +//NEW页面图片轮播切换
20 (function() { 31 (function() {
21 var $brands = $('.brands'); 32 var $brands = $('.brands');
22 33
@@ -16,7 +16,8 @@ @@ -16,7 +16,8 @@
16 "yoho.lazyload": "1.0.0", 16 "yoho.lazyload": "1.0.0",
17 "yoho.handlebars": "3.0.3", 17 "yoho.handlebars": "3.0.3",
18 "yoho.jquery": "1.8.3", 18 "yoho.jquery": "1.8.3",
19 - "json2": "1.0.0" 19 + "json2": "1.0.0",
  20 + "yoho.placeholder": "0.0.1"
20 }, 21 },
21 "devDependencies": { 22 "devDependencies": {
22 "expect.js": "0.3.1" 23 "expect.js": "0.3.1"
1 -@import "search", "list", "new-sale", "filter-box", "sort-pager", "good", "latest-walk", "left-content"; 1 +@import "search", "list", "new-sale", "filter-box", "sort-pager", "good", "latest-walk", "left-content", "no-result";
2 2
3 .product-page { 3 .product-page {
4 4
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 position: relative; 3 position: relative;
4 width: 100%; 4 width: 100%;
5 height: 42px; 5 height: 42px;
6 - margin-top: 20px; 6 + margin: 20px 0;
7 text-align: center; 7 text-align: center;
8 font-size: 20px; 8 font-size: 20px;
9 9
  1 +.product-page .no-result {
  2 + border: 1px solid #eaeceb;
  3 + padding: 60px 0;
  4 + text-align: center;
  5 + margin-bottom: 20px;
  6 +
  7 + .no-title {
  8 + font-size: 16px;
  9 + }
  10 +
  11 + .keyword {
  12 + color: #ee0011;
  13 + }
  14 +
  15 + .search-again {
  16 + width: 490px;
  17 + margin: 15px auto;
  18 +
  19 + input {
  20 + float: left;
  21 + width: 380px;
  22 + height: 18px;
  23 + padding: 15px 5px;
  24 + border: 10px solid #343434;
  25 + color: #333;
  26 + outline: none;
  27 + }
  28 +
  29 + span {
  30 + float: left;
  31 + display: block;
  32 + width: 80px;
  33 + height: 24px;
  34 + line-height: 24px;
  35 + padding: 22px 0;
  36 + background: #343434;
  37 + vertical-align: middle;
  38 + color: #fff;
  39 + }
  40 + .iconfont {
  41 + font-size: 26px;
  42 + }
  43 + }
  44 +
  45 + .no-tip {
  46 + font-size: 12px;
  47 + color: #999;
  48 + }
  49 +}
@@ -73,8 +73,7 @@ @@ -73,8 +73,7 @@
73 .pager { 73 .pager {
74 float: left; 74 float: left;
75 font-size: 14px; 75 font-size: 14px;
76 - line-height: 15px;  
77 - margin: 0 20px; 76 + margin: -15px 20px 0;
78 77
79 .dis-icon { 78 .dis-icon {
80 color: #e6e6e6; 79 color: #e6e6e6;
@@ -290,8 +290,6 @@ class IndexController extends AbstractAction @@ -290,8 +290,6 @@ class IndexController extends AbstractAction
290 'href' => '' 290 'href' => ''
291 ) 291 )
292 ), 292 ),
293 - 'fivePerLine' => true,  
294 - 'sixPerLineHref' => '',  
295 'countPerPage' => '120', 293 'countPerPage' => '120',
296 'pageCounts' => array( 294 'pageCounts' => array(
297 array( 295 array(
@@ -311,6 +309,9 @@ class IndexController extends AbstractAction @@ -311,6 +309,9 @@ class IndexController extends AbstractAction
311 'pageCount' => 30, 309 'pageCount' => 30,
312 'nextHref' => 'hello' 310 'nextHref' => 'hello'
313 ), 311 ),
  312 + // 无搜索结果字段
  313 + // 'keyWord' => '123'
  314 + // 'searchActionUrl' => ''
314 'goods' => array( 315 'goods' => array(
315 0 => array( 316 0 => array(
316 'tags' => array( 317 'tags' => array(
@@ -968,6 +969,16 @@ class IndexController extends AbstractAction @@ -968,6 +969,16 @@ class IndexController extends AbstractAction
968 $data = array( 969 $data = array(
969 'productListPage' => true, 970 'productListPage' => true,
970 'newSale' => array( 971 'newSale' => array(
  972 + 'pathNav' => array(
  973 + array(
  974 + 'href' => 'new.yohobuy.com/girls',
  975 + 'name' => 'GRILS首页'
  976 + ),
  977 + array(
  978 + 'href' => '/?sort=1',
  979 + 'name' => '新品到着'
  980 + )
  981 + ),
971 'leftContent' => array( 982 'leftContent' => array(
972 array( 983 array(
973 'allSort' => array( 984 'allSort' => array(
@@ -1108,14 +1119,18 @@ class IndexController extends AbstractAction @@ -1108,14 +1119,18 @@ class IndexController extends AbstractAction
1108 ) 1119 )
1109 ) 1120 )
1110 ), 1121 ),
1111 - 'banner' => array(  
1112 - 'bannerHeight' => 350,  
1113 - 'img' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/08/02d4c26f19ca2e44359d69d5cff86167fb.jpg'  
1114 - ),  
1115 - 'title' => array(  
1116 - 'name' => '全部商品',  
1117 - 'count' => 540  
1118 - ), 1122 +
  1123 + //SALE页面内容
  1124 + // 'saleBanner' => array(
  1125 + // 'bannerHeight' => 350,
  1126 + // 'img' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/08/02d4c26f19ca2e44359d69d5cff86167fb.jpg'
  1127 + // ),
  1128 + // 'saleTitle' => array(
  1129 + // 'name' => '全部商品',
  1130 + // 'count' => 540
  1131 + // ),
  1132 +
  1133 + //NEW页面内容
1119 'newMain' => array( 1134 'newMain' => array(
1120 'banner' => 'http://img11.static.yhbimg.com/yhb-img01/2015/11/23/07/010a459d41b99a839cba9377532f1c19b2.jpg?imageView/3/w/970/h/200', 1135 'banner' => 'http://img11.static.yhbimg.com/yhb-img01/2015/11/23/07/010a459d41b99a839cba9377532f1c19b2.jpg?imageView/3/w/970/h/200',
1121 'date' => '12月16日', 1136 'date' => '12月16日',