Authored by Rock Zhang

Merge branch 'develop/wap' into beta/wap

17.4 KB | W: | H:

17.3 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 var $ = require('jquery'), 6 var $ = require('jquery'),
7 Swiper = require('yoho.iswiper'), 7 Swiper = require('yoho.iswiper'),
8 lazyLoad = require('yoho.lazyload'), 8 lazyLoad = require('yoho.lazyload'),
  9 + noticeScroll = require('../plugin/notice-scroll'),
9 $mobileWrap = $('.mobile-wrap'), 10 $mobileWrap = $('.mobile-wrap'),
10 $overlay = $('.overlay'), 11 $overlay = $('.overlay'),
11 $sideNav = $('.side-nav'), 12 $sideNav = $('.side-nav'),
@@ -24,6 +25,7 @@ var start = 0, @@ -24,6 +25,7 @@ var start = 0,
24 isen = true; 25 isen = true;
25 26
26 lazyLoad($('img.lazy')); 27 lazyLoad($('img.lazy'));
  28 +noticeScroll('.notice', $('.notice').data('time') * 1000);
27 29
28 $('.nav-btn').on('touchstart', function() { 30 $('.nav-btn').on('touchstart', function() {
29 $sideNav.css('pointer-events', 'none'); 31 $sideNav.css('pointer-events', 'none');
@@ -3,7 +3,9 @@ @@ -3,7 +3,9 @@
3 * @author: bikai<kai.bi@yoho.cn> 3 * @author: bikai<kai.bi@yoho.cn>
4 * @date: 2015/11/12 4 * @date: 2015/11/12
5 */ 5 */
6 -var $ = require('jquery'); 6 +var $ = require('jquery'),
  7 + noticeScroll = require('../plugin/notice-scroll');
  8 +
7 var $userAvatar = $('.user-avatar'), 9 var $userAvatar = $('.user-avatar'),
8 $listItem = $('.list-item'); 10 $listItem = $('.list-item');
9 var myImage = new Image(), 11 var myImage = new Image(),
@@ -19,6 +21,8 @@ myImage.onload = function() { @@ -19,6 +21,8 @@ myImage.onload = function() {
19 $userAvatar.css('background-image', 'url(' + avatar + ')'); 21 $userAvatar.css('background-image', 'url(' + avatar + ')');
20 }; 22 };
21 23
  24 +noticeScroll('.notice', $('.notice').data('time') * 1000);
  25 +
22 $('.yoho-page').on('touchstart', '.list-item, .type-item, .order-title', function() { 26 $('.yoho-page').on('touchstart', '.list-item, .type-item, .order-title', function() {
23 $listItem.removeClass('highlight'); 27 $listItem.removeClass('highlight');
24 $(this).addClass('highlight'); 28 $(this).addClass('highlight');
  1 +/**
  2 + * 公告栏目滚动
  3 + * bikai kai.bi@yoho.cn
  4 + */
  5 +
  6 +var $ = require('jquery');
  7 +
  8 +function noticeScroll(selecter, time) {
  9 + var $notice = $(selecter),
  10 + $noticeItem = $notice.find('.notice-item'),
  11 + count = $noticeItem.length,
  12 + i = 1;
  13 +
  14 + selecter = selecter || '.notice';
  15 + time = time || 3000;
  16 +
  17 + if (count > 1) {
  18 + setInterval(function() {
  19 + if (i >= count) {
  20 + i = 0;
  21 + }
  22 + $noticeItem.fadeOut();
  23 + $notice.find('.item-' + i).fadeIn();
  24 + i++;
  25 + }, time);
  26 + }
  27 +}
  28 +
  29 +module.exports = noticeScroll;
This diff could not be displayed because it is too large.
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 @import "hot-category"; 17 @import "hot-category";
18 @import "home-header"; 18 @import "home-header";
19 @import "thumb-row"; 19 @import "thumb-row";
  20 +@import "notice";
20 21
21 .mobile-container{ 22 .mobile-container{
22 width: 100%; 23 width: 100%;
  1 +.notice-wrap {
  2 + .trend {
  3 + position: relative;
  4 + box-sizing: border-box;
  5 + float: left;
  6 + width: 170px;
  7 + height: 72px;
  8 + background: resolve('img/trend.png') no-repeat center center;
  9 + background-size: 90%;
  10 + background-color: #fff;
  11 +
  12 + &:after {
  13 + content: '';
  14 + position: absolute;
  15 + right: 0;
  16 + top: 16px;
  17 + width: 1px;
  18 + height: 40px;
  19 + background: #eee;
  20 + }
  21 + }
  22 +
  23 + .notice {
  24 + box-sizing: border-box;
  25 + float: left;
  26 + padding: 0 30px;
  27 + background: #fff;
  28 + width: 470px;
  29 + height: 72px;
  30 + overflow: hidden;
  31 +
  32 + .notice-item {
  33 + display: block;
  34 + width: 100%;
  35 + font-size: 24px;
  36 + line-height: 72px;
  37 + color: #444;
  38 + white-space: nowrap;
  39 + overflow: hidden;
  40 + text-overflow: ellipsis;
  41 + }
  42 +
  43 + .notice-icon {
  44 + display: inline-block;
  45 + margin-right: 10px;
  46 + width: 28px;
  47 + height: 28px;
  48 + background: url("/me/index/volume.png");
  49 + vertical-align: middle;
  50 + }
  51 +
  52 + span.notice-icon {
  53 + background-repeat: no-repeat !important;
  54 + }
  55 + }
  56 +}
@@ -33,6 +33,16 @@ @@ -33,6 +33,16 @@
33 <p>浏览记录</p> 33 <p>浏览记录</p>
34 </a> 34 </a>
35 </div> 35 </div>
  36 + {{#if notice.open}}
  37 + <div class="notice" data-time="{{notice.time}}">
  38 + {{#notice.list}}
  39 + <a class="notice-item item-{{@index}}" href="{{url}}">
  40 + <span class="notice-icon"></span>
  41 + {{title}}
  42 + </a>
  43 + {{/notice.list}}
  44 + </div>
  45 + {{/if}}
36 <div class="my-order"> 46 <div class="my-order">
37 <a class="order-title" href="/home/orders"> 47 <a class="order-title" href="/home/orders">
38 我的订单 48 我的订单
@@ -7,6 +7,10 @@ @@ -7,6 +7,10 @@
7 {{# iconsEnter}} 7 {{# iconsEnter}}
8 {{> home/icons_enter}} 8 {{> home/icons_enter}}
9 {{/ iconsEnter}} 9 {{/ iconsEnter}}
  10 + {{! 首页公告}}
  11 + {{# notice}}
  12 + {{> home/notice}}
  13 + {{/ notice}}
10 {{! 中间banner}} 14 {{! 中间banner}}
11 {{# banner}} 15 {{# banner}}
12 {{> home/banner}} 16 {{> home/banner}}
  1 +{{#if notice.open}}
  2 +<div class="notice-wrap clearfix">
  3 + <div class="trend">
  4 + </div>
  5 + <div class="notice" data-time="{{notice.time}}">
  6 + {{#notice.list}}
  7 + <a class="notice-item item-{{@index}}" href="{{url}}">
  8 + <span class="notice-icon"></span>
  9 + {{title}}
  10 + </a>
  11 + {{/notice.list}}
  12 + </div>
  13 +</div>
  14 +{{/if}}
@@ -71,7 +71,7 @@ class GirldayController extends HuodongAction @@ -71,7 +71,7 @@ class GirldayController extends HuodongAction
71 'getCouponUrl' => Helpers::url('/cuxiao/girlday/sendCoupon', array('uid' => $this->getLoggedUid())), 71 'getCouponUrl' => Helpers::url('/cuxiao/girlday/sendCoupon', array('uid' => $this->getLoggedUid())),
72 'banner' => array( 72 'banner' => array(
73 'img' => '', 73 'img' => '',
74 - 'url' => 'http://feature.yoho.cn/0310/0310APPHOME/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"YOHO!BUY有货【春潮新势力】", "url":"http://feature.yoho.cn/0310/0310APPHOME/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"382"},"param":{"share_id":"382"}}' 74 + 'url' => 'http://feature.yoho.cn/0310/0310APPHOME/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"YOHO!BUY有货【春潮新势力】", "url":"http://feature.yoho.cn/0310/0310APPHOME/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"382"},"param":{"share_id":"382"}}}'
75 ), 75 ),
76 'selectUrl' => 'http://m.yohobuy.com/home/coupons?openby:yohobuy={"action":"go.coupon"}', 76 'selectUrl' => 'http://m.yohobuy.com/home/coupons?openby:yohobuy={"action":"go.coupon"}',
77 'weixinUrl' => 'http://mp.weixin.qq.com/s?__biz=MjM5ODI5MDA4MA==&mid=201849402&idx=1&sn=c0089812f9769d82e0075f69d771f6e1#rd', // 微信关注地址 77 'weixinUrl' => 'http://mp.weixin.qq.com/s?__biz=MjM5ODI5MDA4MA==&mid=201849402&idx=1&sn=c0089812f9769d82e0075f69d771f6e1#rd', // 微信关注地址
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 use Plugin\Helpers; 4 use Plugin\Helpers;
  5 +// use Index\UserModel as UserModel;
5 6
6 /** 7 /**
7 * 男生首页 8 * 男生首页
@@ -29,12 +30,21 @@ class BoysController extends AbstractAction @@ -29,12 +30,21 @@ class BoysController extends AbstractAction
29 // 显示底部TAB 30 // 显示底部TAB
30 $this->setNavFooterTab(); 31 $this->setNavFooterTab();
31 32
  33 + $content = Index\HomeModel::getBoysFloor();
  34 + // $content[] = array(
  35 + // 'notice' => array(
  36 + // 'open' => true,
  37 + // 'list' => UserModel::getNoticeData(),
  38 + // 'time' => 3,
  39 + // )
  40 + // );
  41 +
32 // 渲染模板并输出 42 // 渲染模板并输出
33 $this->_view->display('index', array( 43 $this->_view->display('index', array(
34 'boysHomePage' => true, 44 'boysHomePage' => true,
35 'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')), 45 'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
36 'maybeLike' => true, 46 'maybeLike' => true,
37 - 'content' => Index\HomeModel::getBoysFloor(), 47 + 'content' => $content,
38 'pageFooter' => true, 48 'pageFooter' => true,
39 )); 49 ));
40 } 50 }
@@ -51,7 +51,7 @@ class HomeController extends AbstractAction @@ -51,7 +51,7 @@ class HomeController extends AbstractAction
51 'myIndexPage' => true, 51 'myIndexPage' => true,
52 'showDownloadApp' => true, 52 'showDownloadApp' => true,
53 'navHome' => true, 53 'navHome' => true,
54 - // 'notice' => UserModel::getNoticeData(), 54 + 'notice' => UserModel::getNoticeData(),
55 'pageFooter' => true, 55 'pageFooter' => true,
56 'cartUrl' => Helpers::url('/cart/index/index', null), 56 'cartUrl' => Helpers::url('/cart/index/index', null),
57 'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home'))), 57 'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home'))),