Authored by xuqi

plus+star list

@@ -397,6 +397,31 @@ @@ -397,6 +397,31 @@
397 397
398 ### PLUS+STAR 398 ### PLUS+STAR
399 399
  400 + //列表页
  401 + {
  402 + ps: {
  403 + star: [
  404 + {
  405 + deps: '',
  406 + //情况1:一张图
  407 + url: '',
  408 + img: '',
  409 + //情况2:多张图
  410 + imgs: [
  411 + {
  412 + url: '',
  413 + img: ''
  414 + },
  415 + ...
  416 + ]
  417 + }
  418 + ],
  419 + plus: [
  420 + ...
  421 + ]
  422 + }
  423 + }
  424 + //详情页
400 { 425 {
401 ps: { 426 ps: {
402 id: 1, 427 id: 1,
@@ -4,4 +4,5 @@ @@ -4,4 +4,5 @@
4 * @date: 2015/10/9 4 * @date: 2015/10/9
5 */ 5 */
6 6
7 -require('./plus-star');  
  7 +require('./plus-star/list');
  8 +require('./plus-star/detail');
1 /** 1 /**
2 - * PLUS+STAR 2 + * PLUS+STAR详情页
3 * @author: xuqi<qi.xu@yoho.cn> 3 * @author: xuqi<qi.xu@yoho.cn>
4 * @date: 2015/10/10 4 * @date: 2015/10/10
5 */ 5 */
@@ -12,7 +12,7 @@ var $intro = $('#intro'), @@ -12,7 +12,7 @@ var $intro = $('#intro'),
12 $imt = $('#intro-more-txt'), 12 $imt = $('#intro-more-txt'),
13 $infosContainer = $('#related-infos-container'); 13 $infosContainer = $('#related-infos-container');
14 14
15 -var info = require('./info'); 15 +var info = require('../info');
16 16
17 var mIntro, aIntro; 17 var mIntro, aIntro;
18 18
  1 +/**
  2 + * PLUS+STAR列表页
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/10/10
  5 + */
  6 +
  7 +var $ = require('yoho.zepto'),
  8 + lazyLoad = require('yoho.lazyload'),
  9 + Swiper = require('yoho.iswiper');
  10 +
  11 +var $navs = $('#nav-tab > li'),
  12 + $contents = $('#ps-content > .content');
  13 +
  14 +var mySwiper;
  15 +
  16 +lazyLoad($('img.lazy'));
  17 +
  18 +mySwiper = new Swiper('.swiper-container', {
  19 + lazyLoading: true,
  20 + pagination: '.swiper-pagination'
  21 +});
  22 +
  23 +$('#nav-tab').delegate('li', 'touchstart', function() {
  24 + if ($(this).hasClass('focus')) {
  25 + return;
  26 + }
  27 + $navs.toggleClass('focus');
  28 + $contents.toggleClass('hide');
  29 +});
@@ -19,7 +19,8 @@ @@ -19,7 +19,8 @@
19 "yoho.zepto": "1.1.60", 19 "yoho.zepto": "1.1.60",
20 "yoho.jquery": "1.8.3", 20 "yoho.jquery": "1.8.3",
21 "yoho.lazyload": "1.1.0", 21 "yoho.lazyload": "1.1.0",
22 - "mlellipsis": "0.0.6" 22 + "mlellipsis": "0.0.6",
  23 + "yoho.iswiper": "3.0.1"
23 }, 24 },
24 "devDependencies": { 25 "devDependencies": {
25 "expect.js": "0.3.1" 26 "expect.js": "0.3.1"
  1 +.ps-list-page {
  2 + background-color: #f0f0f0;
  3 +
  4 + .nav-tab, .ps-content {
  5 + width: 100%;
  6 + }
  7 +
  8 + .nav-tab {
  9 + height: 60rem / $pxConvertRem;
  10 + padding: 10rem / $pxConvertRem 0;
  11 + background-color: #fff;
  12 + }
  13 +
  14 + .star-nav, .plus-nav {
  15 + box-sizing: border-box;
  16 + float: left;
  17 + width: 50%;
  18 + height: 60rem / $pxConvertRem;
  19 + line-height: 60rem / $pxConvertRem;
  20 + font-size: 16px;
  21 + text-align: center;
  22 + color: #ccc;
  23 +
  24 + &.focus {
  25 + color: #000;
  26 + }
  27 + }
  28 +
  29 + .star-nav {
  30 + border-right: 1px solid #ccc;
  31 + }
  32 +
  33 + .plus-star-row {
  34 + margin-bottom: 10rem / $pxConvertRem;
  35 +
  36 + &:last-child {
  37 + margin-bottom: 0;
  38 + }
  39 + }
  40 +
  41 + .content.hide {
  42 + display: none;
  43 + }
  44 +
  45 + .swiper-container {
  46 + height: 310rem / $pxConvertRem;
  47 + }
  48 +
  49 + .swiper-pagination-bullet-active {
  50 + background: #fff;
  51 + }
  52 +
  53 + .brand-deps {
  54 + height: 40rem / $pxConvertRem;
  55 + line-height: 40rem / $pxConvertRem;
  56 + padding-left: 10rem / $pxConvertRem;
  57 + font-size: 14px;
  58 + background: #fff;
  59 + max-width: 100%;
  60 + overflow: hidden;
  61 + white-space: nowrap;
  62 + text-overflow: ellipsis;
  63 + }
  64 +}
  65 +
1 .ps-detail-page { 66 .ps-detail-page {
2 background-color: #f0f0f0; 67 background-color: #f0f0f0;
3 68
1 {{>layout/header}} 1 {{>layout/header}}
2 -  
3 -This is a test {{test}}  
4 - 2 +<div class="ps-list-page ps-page yoho-page">
  3 + {{# ps}}
  4 + <ul id="nav-tab" class="nav-tab clearfix">
  5 + <li class="star-nav focus">明星潮品</li>
  6 + <li class="plus-nav">原创潮牌</li>
  7 + </ul>
  8 + <div id="ps-content" class="ps-content">
  9 + <ul class="star-content content">
  10 + {{# star}}
  11 + {{> guang/ps_item}}
  12 + {{/ star}}
  13 + </ul>
  14 + <ul class="plus-content content">
  15 + {{# plus}}
  16 + {{> guang/ps_item}}
  17 + {{/ plus}}
  18 + </ul>
  19 + </div>
  20 + {{/ ps}}
  21 +</div>
5 {{>layout/footer}} 22 {{>layout/footer}}
  1 +<li class="plus-star-row">
  2 + {{#if imgs}}
  3 + <div class="swiper-container">
  4 + <div class="swiper-wrapper">
  5 + {{# imgs}}
  6 + <div class="swiper-slide">
  7 + <a href={{url}}>
  8 + <img class="swiper-lazy" data-src={{img}}>
  9 + </a>
  10 + </div>
  11 + {{/ imgs}}
  12 + </div>
  13 + <div class="swiper-pagination"></div>
  14 + </div>
  15 + {{^}}
  16 + <a href={{url}}>
  17 + <img class="lazy" data-original={{img}}>
  18 + </a>
  19 + {{/if}}
  20 + {{# deps}}
  21 + <p class="brand-deps">{{.}}</p>
  22 + {{/ deps}}
  23 +</li>
@@ -11,8 +11,31 @@ class PlusstarController extends AbstractAction @@ -11,8 +11,31 @@ class PlusstarController extends AbstractAction
11 */ 11 */
12 public function listAction() 12 public function listAction()
13 { 13 {
  14 + $data = array(
  15 + 'star' => array(
  16 + array(
  17 + 'imgs' => array(
  18 + array(
  19 + 'url' => 'http://stussy.m.yohobuy.com',
  20 + 'img' => 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/6KTZ_01.jpg'
  21 + ),
  22 + array(
  23 + 'url' => 'http://stussy.m.yohobuy.com',
  24 + 'img' =>'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/5HUF_01.jpg'
  25 + )
  26 + )
  27 + ),
  28 + array(
  29 + 'url' => 'http://stussy.m.yohobuy.com',
  30 + 'img' => 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/4STAYREAL_02.jpg',
  31 + 'deps' => '优秀的自助品牌,高瞻远瞩的建设性意见来测试文字溢出后的处理问题'
  32 + )
  33 + ),
  34 + 'plus' => array(
  35 + )
  36 + );
14 $this->_view->assign('title', 'YOHO!有货'); 37 $this->_view->assign('title', 'YOHO!有货');
15 - $this->_view->display('list', array('test' => 'hello world')); 38 + $this->_view->display('list', array('modulePath' => 'guang/plus-star/list', 'ps' => $data));
16 } 39 }
17 40
18 /** 41 /**
@@ -164,7 +187,7 @@ class PlusstarController extends AbstractAction @@ -164,7 +187,7 @@ class PlusstarController extends AbstractAction
164 ) 187 )
165 ); 188 );
166 $this->_view->assign('title', 'PLUS+STAR 详情页'); 189 $this->_view->assign('title', 'PLUS+STAR 详情页');
167 - $this->_view->display('detail', array('modulePath' => 'guang/plus-star', 'ps' => $data)); 190 + $this->_view->display('detail', array('modulePath' => 'guang/plus-star/detail', 'ps' => $data));
168 } 191 }
169 192
170 } 193 }