Authored by hf

do fixes bug to category default choosed

framework @ 75bbc3b0
1 -Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05 1 +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
1 {{>layout/header}} 1 {{>layout/header}}
2 2
3 <div class="index-page yoho-page"> 3 <div class="index-page yoho-page">
4 -  
5 <div class="index-container"> 4 <div class="index-container">
6 <div class="index-header clearfix"> 5 <div class="index-header clearfix">
7 <div class="iconfont index-logo">&#xe60e;</div> 6 <div class="iconfont index-logo">&#xe60e;</div>
8 - <form action="http://search.m.yohobuy.com" class="index-search"> 7 + <form action="{{searchUrl}}" class="index-search">
9 <a href="javascript:void(0);" class="no-search">取消</a> 8 <a href="javascript:void(0);" class="no-search">取消</a>
10 <div class="search-box"> 9 <div class="search-box">
11 <input type="text" name="query" placeholder="搜索"> 10 <input type="text" name="query" placeholder="搜索">
@@ -21,11 +20,8 @@ @@ -21,11 +20,8 @@
21 <a href="/boys"><img class="homestyle" src="http://img10.static.yhbimg.com/adpic/2015/09/28/18/01bdbd27952eb5f780ac23641e70fd6e12.png"></a> 20 <a href="/boys"><img class="homestyle" src="http://img10.static.yhbimg.com/adpic/2015/09/28/18/01bdbd27952eb5f780ac23641e70fd6e12.png"></a>
22 <a href="/girls"><img class="homestyle" src="http://img13.static.yhbimg.com/adpic/2015/09/28/18/025a4056cad1c2b6704a5d7c83066a2d25.png"></a> 21 <a href="/girls"><img class="homestyle" src="http://img13.static.yhbimg.com/adpic/2015/09/28/18/025a4056cad1c2b6704a5d7c83066a2d25.png"></a>
23 </div> 22 </div>
24 -  
25 </div> 23 </div>
26 -  
27 </div> 24 </div>
28 </div> 25 </div>
29 -  
30 {{>layout/footer}} 26 {{>layout/footer}}
31 {{> layout/download_app}} 27 {{> layout/download_app}}
1 -{{> layout/header}}  
2 -<div class="good-list-page yoho-page">  
3 - {{# goodList}}  
4 - {{# search}}  
5 - <div id="search-input" class="search-input">  
6 - <form action="/product/list/index" method="get">  
7 - <i class="search-icon iconfont">&#xe60f;</i>  
8 - <input type="text" value={{default}} name="query">  
9 - <i class="clear-input iconfont hide">&#xe61a;</i>  
10 - <button id="search" class="search" type="submit">搜索</button>  
11 - </form>  
12 - </div>  
13 - {{/ search}}  
14 -  
15 - {{# brandWay}}  
16 - <div class="brand-way">  
17 - <a href={{url}}>  
18 - <img class="brand-thumb" src={{thumb}}>  
19 - <span>{{name}}</span>  
20 - <span class="entry">  
21 - 进入品牌  
22 - <i class="iconfont">&#xe614;</i>  
23 - </span>  
24 - </a>  
25 - </div>  
26 - {{/ brandWay}}  
27 -  
28 - {{# brandHome}}  
29 - <div id="brand-header" class="brand-header" data-id={{id}}>  
30 - <img class="lazy" data-original={{banner}}>  
31 - <a class="btn-intro" href="javascript:void(0);">  
32 - 品牌介绍  
33 - </a>  
34 - <a class="btn-col" href="javascript:void(0);">  
35 - <span class="iconfont">&#xe622;</span>  
36 - 收藏  
37 - </a>  
38 - </div>  
39 - <div id="intro-box" class="brand-intro-box hide">  
40 - <div id="brand-intro" class="brand-intro">  
41 - <h2>品牌介绍</h2>  
42 - <div class="con">  
43 - {{{intro}}}  
44 - </div>  
45 - <p class="fo">  
46 - <span></span>  
47 - 100%品牌授权正品  
48 - </p>  
49 - <span class="iconfont close-intro">&#xe623;</span>  
50 - </div>  
51 - </div>  
52 - {{/ brandHome}}  
53 -  
54 - <ul id="list-nav" class="list-nav clearfix">  
55 - <li class="new active">  
56 - <a href="javascript:void(0);">  
57 - 最新  
58 - <span class="iconfont cur">&#xe616;</span>  
59 - </a>  
60 - </li>  
61 - <li class="price">  
62 - <a href="javascript:void(0);">  
63 - 价格  
64 - <span class="icon">  
65 - <i class="iconfont up">&#xe615;</i>  
66 - <i class="iconfont down cur">&#xe616;</i>  
67 - </span>  
68 - </a>  
69 - </li>  
70 - <li class="discount">  
71 - <a href="javascript:void(0);">  
72 - 折扣  
73 - <span class="icon">  
74 - <i class="iconfont up">&#xe615;</i>  
75 - <i class="iconfont down cur">&#xe616;</i>  
76 - </span>  
77 - </a>  
78 - </li>  
79 - <li class="filter">  
80 - <a href="javascript:void(0);">  
81 - 筛选  
82 - <span class="iconfont">&#xe613;</span>  
83 - </a>  
84 - </li>  
85 - </ul>  
86 - <div id="goods-container" class="goods-container">  
87 - <div class="new-goods container">  
88 - {{# new}}  
89 - {{> good}}  
90 - {{/ new}}  
91 - </div>  
92 - <div class="price-goods container hide"></div>  
93 - <div class="discount-goods container hide"></div>  
94 -  
95 - {{> filter}}  
96 - </div>  
97 -  
98 - {{#if brand}}  
99 - <input id="brand" type="hidden" value={{brand}}>  
100 - {{/if}}  
101 -  
102 - {{#if gender}}  
103 - <input id="gender" type="hidden" value={{gender}}>  
104 - {{/if}}  
105 -  
106 - {{#if sort}}  
107 - <input id="sort" type="hidden" value={{sort}}>  
108 - {{/if}}  
109 -  
110 - {{#if color}}  
111 - <input id="color" type="hidden" value={{color}}>  
112 - {{/if}}  
113 -  
114 - {{#if size}}  
115 - <input id="size" type="hidden" value={{size}}>  
116 - {{/if}}  
117 -  
118 - {{#if price}}  
119 - <input id="price" type="hidden" value={{price}}>  
120 - {{/if}}  
121 -  
122 - {{#if discount}}  
123 - <input id="discount" type="hidden" value={{discount}}>  
124 - {{/if}}  
125 - {{/ goodList}}  
126 -</div>  
127 -{{> layout/footer}}  
1 -{{# new}}  
2 - {{> good}}  
3 -{{/ new}}  
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <html> 2 <html>
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 -<title>{{title}}YOHO!有货</title> 5 +<title>{{title}}Yoho!Buy有货</title>
6 <meta name="keywords" content="{{keywords}}Yoho! 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款"> 6 <meta name="keywords" content="{{keywords}}Yoho! 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款">
7 <meta name="description" content="{{description}}YOHO! 有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和中国最流行的商品,也是国内最大的原创文化商品平台,也是香港,台湾地区流行商品的集中地。同时包含日本、韩国等众多国外潮流品牌,带给您全新潮流购物体验。"> 7 <meta name="description" content="{{description}}YOHO! 有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和中国最流行的商品,也是国内最大的原创文化商品平台,也是香港,台湾地区流行商品的集中地。同时包含日本、韩国等众多国外潮流品牌,带给您全新潮流购物体验。">
8 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> 8 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
1 <?php 1 <?php
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
  4 +use Plugin\Helpers;
4 5
5 /** 6 /**
6 * 频道选择 7 * 频道选择
@@ -20,7 +21,8 @@ class IndexController extends AbstractAction @@ -20,7 +21,8 @@ class IndexController extends AbstractAction
20 $this->_view->display('index', array( 21 $this->_view->display('index', array(
21 'background' => Index\HomeModel::getBgImage(), 22 'background' => Index\HomeModel::getBgImage(),
22 'channelPage' => true, 23 'channelPage' => true,
23 - 'showDownloadApp'=>true 24 + 'showDownloadApp'=>true,
  25 + 'searchUrl' => Helpers::url('', null, 'search'),
24 )); 26 ));
25 } 27 }
26 28
@@ -16,40 +16,8 @@ class SearchController extends AbstractAction @@ -16,40 +16,8 @@ class SearchController extends AbstractAction
16 */ 16 */
17 public function indexAction() 17 public function indexAction()
18 { 18 {
19 - $data = array(  
20 - array(  
21 - 'hot' => array(  
22 - array(  
23 - 'name' => '夹克',  
24 - 'url' => 'm.yohobuy.com'  
25 - ),  
26 - array(  
27 - 'name' => '休闲运动鞋',  
28 - 'url' => 'm.yohobuy.com'  
29 - ),  
30 - array(  
31 - 'name' => 'Into the Rainbow',  
32 - 'url' => 'm.yohobuy.com'  
33 - )  
34 - ),  
35 - 'history' => array(  
36 - array(  
37 - 'name' => 'what',  
38 - 'url' => 'm.yohobuy.com'  
39 - ),  
40 - array(  
41 - 'name' => 'the',  
42 - 'url' => 'm.yohobuy.com'  
43 - ),  
44 - array(  
45 - 'name' => 'fuck',  
46 - 'url' => 'm.yohobuy.com'  
47 - )  
48 - )  
49 - )  
50 - );  
51 $this->_view->display('index', array( 19 $this->_view->display('index', array(
52 - 'search' => $data, 20 + 'search' => array('url' => Helpers::url('', null, 'search')),
53 'searchPage' => true, 21 'searchPage' => true,
54 'pageFooter' => true 22 'pageFooter' => true
55 )); 23 ));
@@ -38,14 +38,8 @@ class ClassModel @@ -38,14 +38,8 @@ class ClassModel
38 } 38 }
39 39
40 do { 40 do {
41 - $num = 1;  
42 $data = ClassData::getClassesData(); 41 $data = ClassData::getClassesData();
43 -  
44 - if (!isset($data['code']) || $data['code'] !== 200) {  
45 - break;  
46 - }  
47 -  
48 - if (!isset($data['data'])) { 42 + if (empty($data['data'])) {
49 break; 43 break;
50 } 44 }
51 45
@@ -53,9 +47,6 @@ class ClassModel @@ -53,9 +47,6 @@ class ClassModel
53 $item = array(); 47 $item = array();
54 foreach ($data['data'] as $k => $v) { 48 foreach ($data['data'] as $k => $v) {
55 $oneClass = array('name' => $k, 'ca' => array()); 49 $oneClass = array('name' => $k, 'ca' => array());
56 - if ($num === 1) {  
57 - $oneClass['focus'] = true;  
58 - }  
59 50
60 foreach ($v as $val) { 51 foreach ($v as $val) {
61 $item = array(); 52 $item = array();
@@ -69,14 +60,12 @@ class ClassModel @@ -69,14 +60,12 @@ class ClassModel
69 'sort' => $value['relation_parameter']['sort'], 60 'sort' => $value['relation_parameter']['sort'],
70 'sort_name' => $value['category_name'] 61 'sort_name' => $value['category_name']
71 ), 'list'); 62 ), 'list');
72 -  
73 $item['sub'][] = $subitem; 63 $item['sub'][] = $subitem;
74 } 64 }
75 65
76 $oneClass['ca'][] = $item; 66 $oneClass['ca'][] = $item;
77 } 67 }
78 68
79 - $num++;  
80 $result[] = $oneClass; 69 $result[] = $oneClass;
81 } 70 }
82 71
@@ -10,22 +10,24 @@ class ClassController extends AbstractAction @@ -10,22 +10,24 @@ class ClassController extends AbstractAction
10 { 10 {
11 public function indexAction() 11 public function indexAction()
12 { 12 {
  13 + $channel = Helpers::getChannelByCookie();
13 $classes = ClassModel::getClassData(); 14 $classes = ClassModel::getClassData();
  15 + // 根据频道设置默认的焦点
  16 + if (!empty($classes)) {
  17 + $classes[$channel - 1]['focus'] = true;
  18 + }
  19 +
  20 + $this->setTitle('商品分类');
  21 + $this->setNavHeader('商品分类');
14 22
15 $data = array( 23 $data = array(
16 'categoryPage' => true, 24 'categoryPage' => true,
17 - 'pageHeader' => array (  
18 - 'navBack' => true,  
19 - 'navHome' => '/',  
20 - 'navTitle' => '商品分类'  
21 - ),  
22 'category' => array( 25 'category' => array(
23 - 'class' => $classes 26 + 'class' => $classes,
  27 + 'searchUrl' => Helpers::url('/search.html', null, 'search'),
24 ) 28 )
25 ); 29 );
26 30
27 - $this->setTitle('商品分类');  
28 -  
29 $this->_view->display('index', $data); 31 $this->_view->display('index', $data);
30 } 32 }
31 } 33 }