Authored by 张丽霞

Merge branch 'feature/mBrandShop' of git.dev.yoho.cn:web/yohobuywap into feature/mBrandShop

  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: haishengshen
  5 + * Date: 14-3-6
  6 + * Time: 下午1:15
  7 + */
  8 +namespace Plugin;
  9 +class Mobile
  10 +{
  11 + /**
  12 + * 获取用户User-Agent
  13 + * @return bool
  14 + */
  15 + public static function getUserAgent()
  16 + {
  17 + if (!isset($_SERVER['HTTP_USER_AGENT']) || empty($_SERVER['HTTP_USER_AGENT'])) {
  18 + return '';
  19 + }
  20 + return $_SERVER['HTTP_USER_AGENT'];
  21 + }
  22 +
  23 + /**
  24 + * 获取当前地址
  25 + * @return array
  26 + */
  27 + public static function getNowUrl()
  28 + {
  29 + return array('host'=>$_SERVER['HTTP_HOST'], 'uri'=> $_SERVER['REQUEST_URI']);
  30 + }
  31 +
  32 + /**
  33 + * 获取手机版的对应地址
  34 + * @param $host
  35 + * @return mixed
  36 + */
  37 + public static function newHost($host)
  38 + {
  39 + if ($host == 'www.yohobuy.com' || $host == 'new.yohobuy.com' || stristr($host, 'new.yohobuy.com')) {
  40 + return str_replace(array('www.yohobuy', 'new.yohobuy'), 'm.yohobuy', $host);
  41 + }
  42 +
  43 + if ($host == 'huodong.yohobuy.com') {
  44 + return str_replace('huodong.yohobuy', 'm.yohobuy', $host);
  45 + }
  46 + return str_replace('yohobuy.com', 'm.yohobuy.com', $host);
  47 + }
  48 +
  49 +
  50 + public static function match($url, $host, $uri)
  51 + {
  52 +// //guang.yohobuy.com
  53 +// //guang.yohobuy.com/1.html
  54 +// $list = array(
  55 +// array(
  56 +// 'match' => '#^([guang\.]*)yohobuy\.com(\/*)$#',
  57 +// ),
  58 +// array(
  59 +// 'match' => '#([guang\.]*)yohobuy.com/([0-9]+).html#',
  60 +// 'to' => 'guang.m.yohobuy.com/info/index?id='.substr($uri,1,(strpos($uri,'.')-1)) ,
  61 +// ),
  62 +// );
  63 +// foreach ($list as $value) {
  64 +// if (preg_match($value['match'], $url) && !empty($value['to'])) {
  65 +// return $value['to'];
  66 +// } else if (preg_match($value['match'], $url)) {
  67 +// $newHost = self::newHost($host);
  68 +// return $newHost . $uri;
  69 +// }
  70 +// }
  71 +//
  72 +// $continueList = array('www', 'list', 'search');
  73 +// $hostSplit = explode('.', $host);
  74 + // PC 跳 WAP 女生频道对应
  75 + if ($uri === '/woman') {
  76 + $uri = '/girls';
  77 + }
  78 + // 首页特殊跳转
  79 + if ($host === 'www.yohobuy.com') {
  80 + return 'm.yohobuy.com' . $uri;
  81 + }
  82 + $url = strtr($host, array('.yohobuy.com' => '.m.yohobuy.com')) . $uri;
  83 +
  84 + return $url;
  85 + }
  86 +
  87 + /**
  88 + * 获取新的URL
  89 + * @return string
  90 + */
  91 + public static function getNewUrl()
  92 + {
  93 + $url = self::getNowUrl();
  94 + return self::match($url['host'].$url['uri'], $url['host'], $url['uri']);
  95 + }
  96 +
  97 + /**
  98 + * 判断是否手机
  99 + * @return bool
  100 + */
  101 + public static function isMobile()
  102 + {
  103 + $userAgent = self::getUserAgent();
  104 + if (stristr($userAgent, 'ipad')) {
  105 + return false;
  106 + }
  107 + $mobileAgents = array('iphone','android',"240x320","acer","acoon","acs-","abacho","ahong","airness","alcatel","amoi","anywhereyougo.com","applewebkit/525","applewebkit/532","asus","audio","au-mic","avantogo","becker","benq","bilbo","bird","blackberry","blazer","bleu","cdm-","compal","coolpad","danger","dbtel","dopod","elaine","eric","etouch","fly ","fly_","fly-","go.web","goodaccess","gradiente","grundig","haier","hedy","hitachi","htc","huawei","hutchison","inno","ipad","ipaq","ipod","jbrowser","kddi","kgt","kwc","lenovo","lg ","lg2","lg3","lg4","lg5","lg7","lg8","lg9","lg-","lge-","lge9","longcos","maemo","mercator","meridian","micromax","midp","mini","mitsu","mmm","mmp","mobi","mot-","moto","nec-","netfront","newgen","nexian","nf-browser","nintendo","nitro","nokia","nook","novarra","obigo","palm","panasonic","pantech","philips","phone","pg-","playstation","pocket","pt-","qc-","qtek","rover","sagem","sama","samu","sanyo","samsung","sch-","scooter","sec-","sendo","sgh-","sharp","siemens","sie-","softbank","sony","spice","sprint","spv","symbian","tablet","talkabout","tcl-","teleca","telit","tianyu","tim-","toshiba","tsm","up.browser","utec","utstar","verykool","virgin","vk-","voda","voxtel","vx","wap","wellco","wig browser","wii","windows ce","wireless","xda","xde","zte");
  108 + $isMobile = false;
  109 + foreach ($mobileAgents as $device) {
  110 + if (stristr($userAgent, $device)) {
  111 + $isMobile = true;
  112 + break;
  113 + }
  114 + }
  115 + return $isMobile;
  116 + }
  117 +
  118 + /**
  119 + * 是否转到手机版
  120 + * @return bool
  121 + */
  122 + public static function isGoMobile()
  123 + {
  124 + if (empty($_COOKIE['m2w']) && self::isMobile()) {
  125 + header("HTTP/1.1 301 Moved Permanently");
  126 + header('Location:http://'.self::getNewUrl());
  127 + exit();
  128 + }
  129 + return true;
  130 + }
  131 +}
@@ -4,6 +4,8 @@ @@ -4,6 +4,8 @@
4 4
5 var $ = require('jquery'), 5 var $ = require('jquery'),
6 IScroll = require('iscroll/iscroll-probe'), 6 IScroll = require('iscroll/iscroll-probe'),
  7 + // lazyLoad = require('yoho.lazyload'),
  8 + Swiper = require('yoho.iswiper'),
7 activeTab, 9 activeTab,
8 myScroll, 10 myScroll,
9 imgH, 11 imgH,
@@ -17,21 +19,57 @@ var $ = require('jquery'), @@ -17,21 +19,57 @@ var $ = require('jquery'),
17 $nav2 = $('#pos-list'), 19 $nav2 = $('#pos-list'),
18 isIphone = navigator.userAgent.indexOf('iPhone') > 0 ? true : false;//判断浏览器类型 20 isIphone = navigator.userAgent.indexOf('iPhone') > 0 ? true : false;//判断浏览器类型
19 21
20 -$.jqtab = function(nav, main) { 22 +// lazyLoad($('img.lazy'));
  23 +
  24 +if ($('.banner-swiper').find('li').size() > 1) {
  25 + bannerSwiper = new Swiper('.banner-swiper', {
  26 + lazyLoading: true,
  27 + lazyLoadingInPrevNext: true,
  28 + loop: true,
  29 + autoplay: 3000,
  30 + autoplayDisableOnInteraction: false,
  31 + paginationClickable: true,
  32 + slideElement: 'li',
  33 + pagination: '.banner-top .pagination-inner'
  34 + });
  35 +}
  36 +
  37 +if ($('.multi-browse').find('li').size() > 1) {
  38 + multiSwiper = new Swiper('.multi-browse', {
  39 + lazyLoading: true,
  40 + lazyLoadingInPrevNext: true,
  41 + lazyLoadingOnTransitionStart: true,
  42 + grabCursor: true,
  43 + slidesPerView: 'auto',
  44 + slideElement: 'li',
  45 + watchSlidesVisibility: true
  46 + });
  47 +}
  48 +
  49 +function tabChange(dom, index) {
  50 + var li = dom.eq(index);
  51 +
  52 + dom.removeClass('active');
  53 + dom.removeClass('color');
  54 +
  55 + li.addClass('color');
  56 +
  57 + li.addClass('active');
  58 +}
  59 +
  60 +$.jqtab = function(nav, nav1, main) {
21 61
22 - $(nav + ' li').click(function() {  
23 - $(nav + ' li').removeClass('active');  
24 - $(nav + ' li').find('a').removeClass('color'); 62 + $(nav + ' li, ' + nav1 + ' li').on('touchstart', function() {
  63 + var index = $(this).index();
  64 +
  65 + tabChange($(nav + ' li'), index);
  66 + tabChange($(nav1 + ' li'), index);
25 67
26 - $(this).find('a').addClass('color');  
27 - activeTab = $(this).find('a').attr('tab');  
28 - $(main).hide();  
29 - $(this).addClass('active');  
30 - $('#' + activeTab).fadeIn();  
31 return false; 68 return false;
32 }); 69 });
33 }; 70 };
34 -$.jqtab('#nav', '.main'); 71 +$.jqtab('#nav','#pos-nav', '.main');
  72 +
35 73
36 $(function(){ 74 $(function(){
37 // if (!isIphone) { 75 // if (!isIphone) {
@@ -56,7 +94,6 @@ $(function(){ @@ -56,7 +94,6 @@ $(function(){
56 94
57 myScroll.on('scroll', function() { 95 myScroll.on('scroll', function() {
58 var sTop = -this.y; 96 var sTop = -this.y;
59 - console.log(sTop)  
60 97
61 if (sTop < imgH) { 98 if (sTop < imgH) {
62 if (!$nav1.hasClass('hide')) { 99 if (!$nav1.hasClass('hide')) {
@@ -78,9 +115,7 @@ $(function(){ @@ -78,9 +115,7 @@ $(function(){
78 $nav1.addClass('fixed-top') 115 $nav1.addClass('fixed-top')
79 .removeClass('absolute') 116 .removeClass('absolute')
80 .css({ 117 .css({
81 - transform: 'translate(0, ' + (- scH) +  
82 -  
83 -'px)' 118 + transform: 'translate(0, ' + (- scH) + 'px)'
84 }); 119 });
85 } 120 }
86 } else if (sTop < imgH + nav1H + main1H) { 121 } else if (sTop < imgH + nav1H + main1H) {
@@ -89,9 +124,7 @@ $(function(){ @@ -89,9 +124,7 @@ $(function(){
89 .removeClass('fixed-top'); 124 .removeClass('fixed-top');
90 } 125 }
91 $nav1.css({ 126 $nav1.css({
92 - transform: 'translate(0, ' + (imgH + main1H -  
93 -  
94 -sTop - scH) + 'px)' 127 + transform: 'translate(0, ' + (imgH + main1H - sTop - scH) + 'px)'
95 }); 128 });
96 } 129 }
97 } else { 130 } else {
@@ -107,9 +140,7 @@ sTop - scH) + 'px)' @@ -107,9 +140,7 @@ sTop - scH) + 'px)'
107 $nav2.addClass('fixed-top') 140 $nav2.addClass('fixed-top')
108 .removeClass('absolute') 141 .removeClass('absolute')
109 .css({ 142 .css({
110 - transform: 'translate(0, ' + (- scH) +  
111 -  
112 -'px)' 143 + transform: 'translate(0, ' + (- scH) + 'px)'
113 }); 144 });
114 } 145 }
115 } else { 146 } else {
@@ -118,25 +149,32 @@ sTop - scH) + 'px)' @@ -118,25 +149,32 @@ sTop - scH) + 'px)'
118 .removeClass('fixed-top'); 149 .removeClass('fixed-top');
119 } 150 }
120 $nav2.css({ 151 $nav2.css({
121 - transform: 'translate(0, ' + (imgH + nav1H +  
122 -  
123 -main1oH + main2oH -sTop - scH) + 'px)' 152 + transform: 'translate(0, ' + (imgH + nav1H + main1oH + main2oH -sTop - scH) + 'px)'
124 }); 153 });
125 } 154 }
126 } 155 }
127 }); 156 });
128 }) 157 })
129 158
130 - //window onload 后重新refresh iscroll  
131 - window.onload = function() {  
132 - myScroll && myScroll.refresh();  
133 - imgH = $('#nav-top').outerHeight();  
134 - nav1H = $('#nav').outerHeight();  
135 - main1H = $('#nav-main').height();  
136 - main1oH = $('#nav-main').outerHeight();  
137 - nav2H = $('#list-nav').outerHeight();  
138 - main2oH = $('#goods-container').outerHeight();  
139 - scH = $('#scroller').outerHeight();  
140 - console.log(imgH + main1H)  
141 - console.log(imgH + nav1H + main1H)  
142 - };  
  159 +//window onload 后重新refresh iscroll
  160 +window.onload = function() {
  161 + myScroll && myScroll.refresh();
  162 + imgH = $('#nav-top').outerHeight();
  163 + nav1H = $('#nav').outerHeight();
  164 + main1H = $('#nav-main').height();
  165 + main1oH = $('#nav-main').outerHeight();
  166 + nav2H = $('#list-nav').outerHeight();
  167 + main2oH = $('#goods-container').outerHeight();
  168 + scH = $('#scroller').outerHeight();
  169 +};
  170 +
  171 +// $(nav + ' li, ' + nav1 + ' li').on('touchstart', function() {
  172 +// $.ajax({
  173 +// url:,
  174 +// data:,
  175 +// xxx:,
  176 +// success:function(data){
  177 +// $('#nav-main').append(data);
  178 +// }
  179 +// });
  180 +// });
@@ -51,15 +51,17 @@ @@ -51,15 +51,17 @@
51 border-left: 1px solid #e1e1e1; 51 border-left: 1px solid #e1e1e1;
52 margin-top: 30rem / $pxConvertRem; 52 margin-top: 30rem / $pxConvertRem;
53 border-sizing: border-box; 53 border-sizing: border-box;
  54 + color: #b1b1b1;
54 55
55 &:first-child { 56 &:first-child {
56 border-left: none; 57 border-left: none;
57 } 58 }
58 - }  
59 59
60 - a {  
61 - color: #b1b1b1; 60 + a {
  61 + color: #b1b1b1;
  62 + }
62 } 63 }
  64 +
63 .color { 65 .color {
64 color: #000; 66 color: #000;
65 } 67 }
@@ -71,6 +73,19 @@ @@ -71,6 +73,19 @@
71 overflow: hidden; 73 overflow: hidden;
72 } 74 }
73 75
  76 + .banner-area {
  77 + @extend .banner-top;
  78 +
  79 + .banner-swiper ul {
  80 + height: 6.5rem;
  81 + }
  82 +
  83 + .swiper-pagination {
  84 + bottom: 1.5rem;
  85 + }
  86 +
  87 + }
  88 +
74 .hide { 89 .hide {
75 display: hidden; 90 display: hidden;
76 } 91 }
@@ -91,37 +106,39 @@ @@ -91,37 +106,39 @@
91 106
92 .multi-brands { 107 .multi-brands {
93 width: 100%; 108 width: 100%;
94 - height: 260rem / $pxConvertRem; 109 + height: 270rem / $pxConvertRem;
95 background: #fff; 110 background: #fff;
96 border: 1px solid #e1e1e1; 111 border: 1px solid #e1e1e1;
97 border-top: none; 112 border-top: none;
98 font-size: 20px; 113 font-size: 20px;
99 text-align: center; 114 text-align: center;
100 - padding-top: 25rem / $pxConvertRem; 115 + padding-top: 25rem / $pxConvertRem;
  116 + margin-bottom: 30rem / $pxConvertRem;
101 } 117 }
102 118
  119 + .multi-browse {
  120 + margin-top: 50rem / $pxConvertRem;
  121 + overflow: hidden;
  122 + }
  123 +
103 .brand-img { 124 .brand-img {
104 - margin-top: 65rem / $pxConvertRem; 125 + margin-left: 30rem / $pxConvertRem;
  126 + width: 30%;
  127 + height: 55%;
105 overflow: hidden; 128 overflow: hidden;
  129 + padding-bottom: 20rem / $pxConvertRem;
  130 + float: left;
106 131
107 - img {  
108 - // width: 130rem / $pxConvertRem;  
109 - // height: 110rem / $pxConvertRem;  
110 - float: left;  
111 - margin-left: 30rem / $pxConvertRem;  
112 - 132 + p {
  133 + font-size: 25rem / $pxConvertRem;
  134 + color: #b1b1b1;
  135 + padding-top: 10rem / $pxConvertRem;
113 } 136 }
114 -  
115 - }  
116 -  
117 - .centerimg {  
118 - margin-top: 30rem / $pxConvertRem;  
119 } 137 }
120 138
121 .spring { 139 .spring {
122 margin: 0; 140 margin: 0;
123 overflow: hidden; 141 overflow: hidden;
124 - padding: 30rem / $pxConvertRem 0;  
125 142
126 li { 143 li {
127 width: 50%; 144 width: 50%;
@@ -315,6 +332,23 @@ @@ -315,6 +332,23 @@
315 display: none; 332 display: none;
316 } 333 }
317 334
  335 + .nav-title {
  336 + position: absolute;
  337 + margin-left: 200rem / $pxConvertRem;
  338 + height: 100%;
  339 + font-size: 36rem / $pxConvertRem;
  340 + color: #fff;
  341 + font-weight: bold;
  342 + top: 0;
  343 + right: 0;
  344 + left: 0;
  345 + overflow: hidden;
  346 + white-space: nowrap;
  347 + text-overflow: ellipsis;
  348 + text-align: center;
  349 +
  350 + }
  351 +
318 // .fixed-top { 352 // .fixed-top {
319 // position: fixed; 353 // position: fixed;
320 // top: 0; 354 // top: 0;
1 {{> layout/header}} 1 {{> layout/header}}
2 - {{# brands}} 2 + {{# content}}
3 <a class="brand-list" href="{{url}}"> 3 <a class="brand-list" href="{{url}}">
4 - {{brandname}} 4 + {{brand_name}}
5 </a> 5 </a>
6 - {{/ brands}} 6 + {{/ content}}
7 {{> layout/footer}} 7 {{> layout/footer}}
@@ -3,6 +3,9 @@ @@ -3,6 +3,9 @@
3 <div class="shop-index yoho-page" id="wrapper"> 3 <div class="shop-index yoho-page" id="wrapper">
4 <div id="scroller"> 4 <div id="scroller">
5 <div id="nav-top"> 5 <div id="nav-top">
  6 + {{# headerBanner}}
  7 + {{> product/banner-swipe-and-single}}
  8 + {{/ headerBanner}}
6 <div class="search-area"> 9 <div class="search-area">
7 <div id="search-input" class="search-input"> 10 <div id="search-input" class="search-input">
8 <form id="search-form" action={{url}} method="get"> 11 <form id="search-form" action={{url}} method="get">
@@ -20,103 +23,98 @@ @@ -20,103 +23,98 @@
20 </div> 23 </div>
21 </div> 24 </div>
22 25
23 - <ul id="nav" class="nav home-nav">  
24 - <li class="active">  
25 - <a href="#" tab="home-page" class="color" >首页</a>  
26 - </li>  
27 - <li>  
28 - <a href="#" tab="new-arrival">上新</a>  
29 - </li>  
30 - <li>  
31 - <a href="#" tab="popularity">人气</a>  
32 - </li> 26 + <ul id="nav" class="nav">
  27 + <li class="active color" tab="home-page">首页</li>
  28 + <li tab="new-arrival">上新</li>
  29 + <li tab="popularity">人气</li>
33 <li> 30 <li>
34 <a href="#" target="_blank">全部商品</a> 31 <a href="#" target="_blank">全部商品</a>
35 </li> 32 </li>
36 </ul> 33 </ul>
37 -  
38 - <ul id="main">  
39 - <li id="home-page" class="main">  
40 - <div id="nav-main">  
41 - {{#unless brands}}  
42 - <div class="multi-brands">  
43 - <h2>品牌一览</h2>  
44 - <div class="brand-img">  
45 - {{#each brandImg}}  
46 - <img src="{{brandType}}">  
47 - {{/each}}  
48 - </div>  
49 - </div>  
50 - {{/unless}}  
51 -  
52 - <div class="centerimg">  
53 - <img src="{{preferential}}"> 34 +
  35 + <div id="home-page">
  36 + <div id="nav-main" class="main">
  37 + {{#unless brands}}
  38 + <div class="multi-brands">
  39 + <h2>品牌一览</h2>
  40 + <div class="multi-browse swiper-container">
  41 + <ul class="swiper-wrapper">
  42 + {{#each multiList}}
  43 + <li class="swiper-slide brand-img">
  44 + <a href="{{url}}">
  45 + <img src="{{img}}">
  46 + </a>
  47 + <p>{{brandName}}</p>
  48 + </li>
  49 + {{/each}}
  50 + </ul>
54 </div> 51 </div>
  52 + </div>
  53 + {{/unless}}
55 54
56 - <ul class="spring">  
57 - {{#each spring}}  
58 - <li> 55 + <div class="banner-area">
  56 + {{# bannerTop}}
  57 + {{> home/banner_top}}
  58 + {{/ bannerTop}}
  59 + </div>
  60 +
  61 + <ul class="spring">
  62 + {{#each spring}}
  63 + <li>
  64 + <a href="{{url}}">
59 <img src="{{springType}}"> 65 <img src="{{springType}}">
60 - </li>  
61 - {{/each}}  
62 - </ul> 66 + </a>
  67 + </li>
  68 + {{/each}}
  69 + </ul>
63 70
64 - {{! 热门品类}}  
65 - {{# hotCategory}}  
66 - {{> home/hot_category}}  
67 - {{/ hotCategory}} 71 + {{! 热门品类}}
  72 + {{# hotCategory}}
  73 + {{> home/hot_category}}
  74 + {{/ hotCategory}}
68 75
69 - <div class="title">  
70 - 人气单品  
71 - <a class="more" href="{{more_url}}">&#xe618;</a>  
72 - </div>  
73 -  
74 - <ul class="product-list">  
75 - {{#each hotList}}  
76 - <li>  
77 - <img src="{{listUrl}}">  
78 - <div class="list-price">  
79 - <p>VANS AP M BERZE</p>  
80 - <p><span class="red">{{originalPrice}}</span>  
81 - <span>{{presentPrice}}</span>  
82 - </p>  
83 - </div>  
84 - </li>  
85 - {{/each}}  
86 - </ul> 76 + <div class="title">
  77 + 人气单品
  78 + <a class="more" href="{{more_url}}">&#xe618;</a>
87 </div> 79 </div>
  80 +
  81 + <ul class="product-list">
  82 + {{#each hotList}}
  83 + <li>
  84 + <a href="{{url}}">
  85 + <img src="{{listUrl}}">
  86 + </a>
  87 + <div class="list-price">
  88 + <p>VANS AP M BERZE</p>
  89 + <p><span class="red">{{originalPrice}}</span>
  90 + <span>{{presentPrice}}</span>
  91 + </p>
  92 + </div>
  93 + </li>
  94 + {{/each}}
  95 + </ul>
  96 + </div>
88 97
89 - <div class="discount-area"> 98 + <div class="discount-area">
90 {{> product/goods-nav-top}} 99 {{> product/goods-nav-top}}
91 - </div>  
92 - </li>  
93 -  
94 - <li id="new-arrival" class="main list hide"></li> 100 + </div>
  101 + </div>
  102 +
  103 + <div id="new-arrival" class=""></div>
  104 + <div id="popularity" class=""></div>
95 105
96 - <li id="popularity" class="main list hide"></li>  
97 - </ul>  
98 </div> 106 </div>
99 - {{> product/shop-footer}}  
100 107
101 - <ul id="pos-nav" class="nav home-nav">  
102 - <li class="active">  
103 - <a href="#" tab="home-page" class="color" >首页</a>  
104 - </li>  
105 - <li>  
106 - <a href="#" tab="new-arrival">上新</a>  
107 - </li>  
108 - <li>  
109 - <a href="#" tab="popularity">人气</a>  
110 - </li> 108 + <ul id="pos-nav" class="nav hide">
  109 + <li class="active color">首页</li>
  110 + <li>上新</li>
  111 + <li>人气</li>
111 <li> 112 <li>
112 <a href="#" target="_blank">全部商品</a> 113 <a href="#" target="_blank">全部商品</a>
113 </li> 114 </li>
114 </ul> 115 </ul>
115 - <ul id="pos-list" class="nav hide">  
116 - <li>最新</li>  
117 - <li>价格</li>  
118 - <li>折扣</li>  
119 - <li>筛选</li> 116 + <ul id="pos-list" class="nav hide discount-area">
  117 + {{> product/goods-nav-top}}
120 </ul> 118 </ul>
121 </div> 119 </div>
122 {{/ shopIndex}} 120 {{/ shopIndex}}
@@ -334,20 +334,17 @@ @@ -334,20 +334,17 @@
334 seajs.use('js/me/currency'); 334 seajs.use('js/me/currency');
335 </script> 335 </script>
336 {{/if}} 336 {{/if}}
337 -  
338 {{#if currencyPage}} 337 {{#if currencyPage}}
339 <script> 338 <script>
340 seajs.use('js/me/currency-new'); 339 seajs.use('js/me/currency-new');
341 </script> 340 </script>
342 {{/if}} 341 {{/if}}
343 -  
344 {{!-- 品牌分类 --}} 342 {{!-- 品牌分类 --}}
345 {{#if productCategoryPage}} 343 {{#if productCategoryPage}}
346 <script> 344 <script>
347 seajs.use('js/product/product-category'); 345 seajs.use('js/product/product-category');
348 </script> 346 </script>
349 {{/if}} 347 {{/if}}
350 -  
351 {{!-- 品牌店铺首页 --}} 348 {{!-- 品牌店铺首页 --}}
352 {{#if shopPage}} 349 {{#if shopPage}}
353 <script> 350 <script>
@@ -170,8 +170,6 @@ class ListModel @@ -170,8 +170,6 @@ class ListModel
170 170
171 // 调用接口查询数据 171 // 调用接口查询数据
172 $brandLogo = BrandData::getBrandLogo($id); 172 $brandLogo = BrandData::getBrandLogo($id);
173 - var_dump($brandLogo);  
174 - exit;  
175 // 处理返回的数据 173 // 处理返回的数据
176 if (isset($brandLogo['data'][0])) { 174 if (isset($brandLogo['data'][0])) {
177 $result = array( 175 $result = array(
@@ -346,7 +344,7 @@ class ListModel @@ -346,7 +344,7 @@ class ListModel
346 } 344 }
347 345
348 /** 346 /**
349 - * @param $data 传入的从接口传来的数据 347 + * @param $data
350 * @return array 返回的处理好的数据 348 * @return array 返回的处理好的数据
351 * @author chengyao.guo 349 * @author chengyao.guo
352 */ 350 */
@@ -358,18 +356,27 @@ class ListModel @@ -358,18 +356,27 @@ class ListModel
358 foreach ($data as &$item) { 356 foreach ($data as &$item) {
359 array_push($result['class'], array('name' => $item['category_name'])); 357 array_push($result['class'], array('name' => $item['category_name']));
360 foreach ($item['sub'] as &$item2) { 358 foreach ($item['sub'] as &$item2) {
361 - $item2['url'] = Helpers::url(''); // tar mark 还不知道链接是啥样的 359 + $item2['url'] = Helpers::url('/product/index/index',array(
  360 + 'shop_id' => '326'
  361 + )); // tar mark 还不知道链接是啥样的
362 } 362 }
363 array_push($result['category'], array('subcategory' => $item['sub'])); 363 array_push($result['category'], array('subcategory' => $item['sub']));
364 } 364 }
365 return $result; 365 return $result;
366 } 366 }
367 367
  368 + /**
  369 + * 店铺所有品牌信息处理
  370 + * @author chengyao.guo
  371 + * @param $data
  372 + * @return mixed
  373 + */
368 public static function brandData($data) 374 public static function brandData($data)
369 { 375 {
370 // 处理图片链接 376 // 处理图片链接
371 foreach ($data as &$item) { 377 foreach ($data as &$item) {
372 $item['brand_ico'] = Images::getImageUrl($item['brand_ico'], 0, 0); 378 $item['brand_ico'] = Images::getImageUrl($item['brand_ico'], 0, 0);
  379 + $item['url'] = Helpers::url('',array(),$item['brand_domain']);
373 } 380 }
374 return $data; 381 return $data;
375 } 382 }
@@ -4,6 +4,7 @@ use Action\AbstractAction; @@ -4,6 +4,7 @@ use Action\AbstractAction;
4 use Plugin\Helpers; 4 use Plugin\Helpers;
5 use LibModels\Wap\Product\ShopData; 5 use LibModels\Wap\Product\ShopData;
6 use Product\ListModel; 6 use Product\ListModel;
  7 +use Plugin\Mobile;
7 8
8 /** 9 /**
9 * 商品列表相关的控制器 10 * 商品列表相关的控制器
@@ -27,6 +28,7 @@ class IndexController extends AbstractAction @@ -27,6 +28,7 @@ class IndexController extends AbstractAction
27 { 28 {
28 // 过滤请求参数 29 // 过滤请求参数
29 $condition = filter_input_array(INPUT_GET, array( 30 $condition = filter_input_array(INPUT_GET, array(
  31 + 'shop_id'=>FILTER_DEFAULT,
30 'brand' => FILTER_DEFAULT, 32 'brand' => FILTER_DEFAULT,
31 'sort' => FILTER_DEFAULT, 33 'sort' => FILTER_DEFAULT,
32 'msort' => FILTER_DEFAULT, 34 'msort' => FILTER_DEFAULT,
@@ -39,6 +41,10 @@ class IndexController extends AbstractAction @@ -39,6 +41,10 @@ class IndexController extends AbstractAction
39 'gender' => FILTER_DEFAULT, 41 'gender' => FILTER_DEFAULT,
40 'p_d' => FILTER_DEFAULT,), false); 42 'p_d' => FILTER_DEFAULT,), false);
41 43
  44 + // 转义店铺
  45 + if (isset($condition['shop_id'])) {
  46 + $condition['shop_id'] = rawurldecode($condition['shop_id']);
  47 + }
42 // 转义品牌 48 // 转义品牌
43 if (isset($condition['brand'])) { 49 if (isset($condition['brand'])) {
44 $condition['brand'] = rawurldecode($condition['brand']); 50 $condition['brand'] = rawurldecode($condition['brand']);
@@ -143,6 +149,7 @@ class IndexController extends AbstractAction @@ -143,6 +149,7 @@ class IndexController extends AbstractAction
143 149
144 /* 过滤请求参数 */ 150 /* 过滤请求参数 */
145 $condition = filter_input_array(INPUT_GET, array( 151 $condition = filter_input_array(INPUT_GET, array(
  152 + 'shop_id' => FILTER_DEFAULT,
146 'sort' => FILTER_DEFAULT, 153 'sort' => FILTER_DEFAULT,
147 'msort' => FILTER_DEFAULT, 154 'msort' => FILTER_DEFAULT,
148 'misort' => FILTER_DEFAULT, 155 'misort' => FILTER_DEFAULT,
@@ -154,6 +161,10 @@ class IndexController extends AbstractAction @@ -154,6 +161,10 @@ class IndexController extends AbstractAction
154 'gender' => FILTER_DEFAULT, 161 'gender' => FILTER_DEFAULT,
155 'p_d' => FILTER_DEFAULT,), false); 162 'p_d' => FILTER_DEFAULT,), false);
156 $condition['brand'] = $brandId; 163 $condition['brand'] = $brandId;
  164 + // 转义店铺
  165 + if (isset($condition['shop_id'])) {
  166 + $condition['shop_id'] = rawurldecode($condition['shop_id']);
  167 + }
157 // 转义分类 168 // 转义分类
158 if (isset($condition['sort'])) { 169 if (isset($condition['sort'])) {
159 $condition['sort'] = rawurldecode($condition['sort']); 170 $condition['sort'] = rawurldecode($condition['sort']);
@@ -231,7 +242,7 @@ class IndexController extends AbstractAction @@ -231,7 +242,7 @@ class IndexController extends AbstractAction
231 } 242 }
232 243
233 /** 244 /**
234 - * 店铺全部品牌页面 245 + * 店铺全部品牌页面
235 * @author chengyao.guo 246 * @author chengyao.guo
236 * @return mixed 247 * @return mixed
237 */ 248 */
@@ -248,6 +259,12 @@ class IndexController extends AbstractAction @@ -248,6 +259,12 @@ class IndexController extends AbstractAction
248 if($resource['code'] === 200){ 259 if($resource['code'] === 200){
249 $result = ListModel::brandData($resource['data']); 260 $result = ListModel::brandData($resource['data']);
250 } 261 }
  262 +// ShopData::debugOut($resource);
  263 + if(Mobile::isMobile()){
  264 + $this->setTitle('品牌');
  265 + }else{
  266 + $this->setNavHeader('品牌', true, SITE_MAIN);
  267 + }
251 return $this->_view->display('brand', array( 268 return $this->_view->display('brand', array(
252 'content' => $result, 269 'content' => $result,
253 )); 270 ));
@@ -272,6 +289,12 @@ class IndexController extends AbstractAction @@ -272,6 +289,12 @@ class IndexController extends AbstractAction
272 if ($resource['code'] === 200) { 289 if ($resource['code'] === 200) {
273 $result = ListModel::categoryData($resource['data']); 290 $result = ListModel::categoryData($resource['data']);
274 } 291 }
  292 + if(Mobile::isMobile()){
  293 + $this->setTitle('品类');
  294 + }else{
  295 + $this->setNavHeader('品类', true, SITE_MAIN);
  296 + }
  297 +// ShopData::debugOut($resource);
275 return $this->_view->display('category', array( 298 return $this->_view->display('category', array(
276 'productCategoryPage' => true, 299 'productCategoryPage' => true,
277 'content' => $result, 300 'content' => $result,
@@ -296,126 +319,16 @@ class IndexController extends AbstractAction @@ -296,126 +319,16 @@ class IndexController extends AbstractAction
296 if ($resource['code'] === 200) { 319 if ($resource['code'] === 200) {
297 $result = $resource['data']; 320 $result = $resource['data'];
298 } 321 }
  322 + if(Mobile::isMobile()){
  323 + $this->setTitle('店铺简介');
  324 + }else{
  325 + $this->setNavHeader('店铺简介', true, SITE_MAIN);
  326 + }
  327 +// ShopData::debugOut($resource);
299 return $this->_view->display('intro', array( 328 return $this->_view->display('intro', array(
300 'content' => $result, 329 'content' => $result,
301 )); 330 ));
302 331
303 } 332 }
304 333
305 - /**  
306 - * 店铺内全部商品页面  
307 - * @author chengyao.guo  
308 - * @return mixed  
309 - */  
310 - public function allProductAction()  
311 - {  
312 - $result = array();  
313 - return $this->_view->display('allproduct', array(  
314 - 'content' => $result,  
315 - ));  
316 - }  
317 -  
318 - /**  
319 - * 店铺分类品类页数据模拟  
320 - *  
321 - * @return array  
322 - */  
323 - public function getCategoryContent()  
324 - {  
325 - return array(// 数据模拟  
326 - 'class' => array(  
327 - array(  
328 - 'name' => '上衣',  
329 - ),  
330 - array(  
331 - 'name' => '裤装',  
332 - ),  
333 - array(  
334 - 'name' => '鞋靴',  
335 - ),  
336 - array(  
337 - 'name' => '包类',  
338 - )  
339 - ),  
340 - 'category' => array(  
341 - array(  
342 - 'subcategory' => array(  
343 - array(  
344 - 'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',  
345 - 'name' => '上衣衣1'  
346 - ),  
347 - array(  
348 - 'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',  
349 - 'name' => '上衣衣2'  
350 - ),  
351 - array(  
352 - 'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',  
353 - 'name' => '上衣衣3'  
354 - ),  
355 -  
356 - )  
357 - ),  
358 - array(  
359 - 'subcategory' => array(  
360 - array(  
361 - 'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',  
362 - 'name' => '裤装1'  
363 - ),  
364 - array(  
365 - 'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',  
366 - 'name' => '裤装2'  
367 - ),  
368 - array(  
369 - 'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',  
370 - 'name' => '裤装3'  
371 - ),  
372 - )  
373 - ),  
374 - array(  
375 - 'subcategory' => array(  
376 - array(  
377 - 'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',  
378 - 'name' => '鞋靴1'  
379 - ),  
380 - array(  
381 - 'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',  
382 - 'name' => '鞋靴2'  
383 - ),  
384 - array(  
385 - 'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',  
386 - 'name' => '鞋靴3'  
387 - )  
388 - )  
389 - ),  
390 - array(  
391 - 'subcategory' => array(  
392 - array(  
393 - 'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',  
394 - 'name' => '包类1'  
395 - ),  
396 - array(  
397 - 'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',  
398 - 'name' => '包类2'  
399 - ),  
400 - array(  
401 - 'url' => 'http://img02.yohoboys.com/staticimg/2016/04/20/16/029d5f3c8dcb63249ac9bf42e7cf9c190c.jpg',  
402 - 'name' => '包类3'  
403 - )  
404 - )  
405 - )  
406 -  
407 - )  
408 - );  
409 - }  
410 -  
411 - /**  
412 - * 店铺简介数据模拟  
413 - *  
414 - * @return array  
415 - */  
416 - public function getIntroContent()  
417 - {  
418 - return array(// 数据模拟  
419 - );  
420 - }  
421 } 334 }
@@ -17,25 +17,47 @@ class ShopController extends AbstractAction @@ -17,25 +17,47 @@ class ShopController extends AbstractAction
17 */ 17 */
18 public function indexAction() 18 public function indexAction()
19 { 19 {
20 - 20 +
21 $data = array( 21 $data = array(
22 - 'branerImg' => '', 22 + 'branerImg' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026e96d1b403d28407650c7228bb4ca405.jpg?imageView2/2/w/640/h/200',
23 'goodList' => 'http://www.baidu.com', 23 'goodList' => 'http://www.baidu.com',
24 'brands' => false, 24 'brands' => false,
25 - 'brandImg' => array( 25 + 'multiList' => array(
26 array( 26 array(
27 - 'brandType' => '' 27 + 'url' => '',
  28 + 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403',
  29 + 'brandName' => '123re34456556900'
28 ), 30 ),
29 array( 31 array(
30 - 'brandType' => ''  
31 - ) 32 + 'url' => '',
  33 + 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403',
  34 + 'brandName' => '123re344565'
  35 + ),
  36 + array(
  37 + 'url' => '',
  38 + 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403',
  39 + 'brandName' => '123re344565'
  40 + )
  41 + ),
  42 + 'bannerTop' => array(
  43 + 'list' => array(
  44 + array(
  45 + 'url' => '',
  46 + 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/19/11/02039485d87cc1b100b883244cf386e62d.jpg?imageView/2/w/640/h/200',
  47 + ),
  48 + array(
  49 + 'url' => '',
  50 + 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/19/11/02039485d87cc1b100b883244cf386e62d.jpg?imageView/2/w/640/h/200',
  51 + ),
  52 + )
32 ), 53 ),
33 - 'preferential' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/19/11/02039485d87cc1b100b883244cf386e62d.jpg?imageView/2/w/640/h/200',  
34 'spring' => array( 54 'spring' => array(
35 array( 55 array(
  56 + 'url' => '',
36 'springType' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/01ea96f5fd2ea8ef99d37d00f39d8e57f0.jpg?imageView/2/w/275/h/160' 57 'springType' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/01ea96f5fd2ea8ef99d37d00f39d8e57f0.jpg?imageView/2/w/275/h/160'
37 ), 58 ),
38 array( 59 array(
  60 + 'url' => '',
39 'springType' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160' 61 'springType' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'
40 ) 62 )
41 ), 63 ),
@@ -43,7 +65,7 @@ class ShopController extends AbstractAction @@ -43,7 +65,7 @@ class ShopController extends AbstractAction
43 'name' => '热门品类', 65 'name' => '热门品类',
44 'list' => array( 66 'list' => array(
45 array( 67 array(
46 - 'url' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160', 68 + 'url' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/15/02/0295b83dc3bcef5bd59f339841f9ee92d1.jpg?imageView2/2/w/640/h/403',
47 'img' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160', 69 'img' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',
48 ), 70 ),
49 array( 71 array(
@@ -78,6 +100,7 @@ class ShopController extends AbstractAction @@ -78,6 +100,7 @@ class ShopController extends AbstractAction
78 ), 100 ),
79 'hotList' => array( 101 'hotList' => array(
80 array( 102 array(
  103 + 'url' => '',
81 'listUrl' => 'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80', 104 'listUrl' => 'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80',
82 'originalPrice' => '¥599.00', 105 'originalPrice' => '¥599.00',
83 'presentPrice' => '¥399.00' 106 'presentPrice' => '¥399.00'
@@ -178,6 +201,36 @@ class ShopController extends AbstractAction @@ -178,6 +201,36 @@ class ShopController extends AbstractAction
178 'is_limited' => false 201 'is_limited' => false
179 ), 202 ),
180 'is_soon_sold_out' => false 203 'is_soon_sold_out' => false
  204 + ),
  205 + array(
  206 + 'url' => 'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html',
  207 + 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314',
  208 + 'name' => 'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣',
  209 + 'salePrice' => '759.00',
  210 + 'price' => '799.00',
  211 + 'tags' => array(
  212 + 'is_new' => true,
  213 + 'is_advance' => false,
  214 + 'is_discount' => false,
  215 + 'is_yohoood' => false,
  216 + 'is_limited' => false
  217 + ),
  218 + 'is_soon_sold_out' => false
  219 + ),
  220 + array(
  221 + 'url' => 'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html',
  222 + 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314',
  223 + 'name' => 'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣',
  224 + 'salePrice' => '759.00',
  225 + 'price' => '799.00',
  226 + 'tags' => array(
  227 + 'is_new' => true,
  228 + 'is_advance' => false,
  229 + 'is_discount' => false,
  230 + 'is_yohoood' => false,
  231 + 'is_limited' => false
  232 + ),
  233 + 'is_soon_sold_out' => false
181 ) 234 )
182 ) 235 )
183 ); 236 );