Authored by 毕凯

首页增加 公告

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');
@@ -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 +}
@@ -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}}
@@ -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 }