Authored by 毕凯

找回个人中心公告丢失的代码

... ... @@ -3,7 +3,9 @@
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/12
*/
var $ = require('jquery');
var $ = require('jquery'),
noticeScroll = require('../plugin/notice-scroll');
var $userAvatar = $('.user-avatar'),
$listItem = $('.list-item');
var myImage = new Image(),
... ... @@ -19,6 +21,8 @@ myImage.onload = function() {
$userAvatar.css('background-image', 'url(' + avatar + ')');
};
noticeScroll('.notice', $('.notice').data('time') * 1000);
$('.yoho-page').on('touchstart', '.list-item, .type-item, .order-title', function() {
$listItem.removeClass('highlight');
$(this).addClass('highlight');
... ...
/**
* 公告栏目滚动
* bikai kai.bi@yoho.cn
*/
var $ = require('jquery');
function noticeScroll(selecter, time) {
var $notice = $(selecter),
$noticeItem = $notice.find('.notice-item'),
count = $noticeItem.length,
i = 1;
selecter = selecter || '.notice';
time = time || 3000;
if (count > 1) {
setInterval(function() {
if (i >= count) {
i = 0;
}
$noticeItem.fadeOut();
$notice.find('.item-' + i).fadeIn();
i++;
}, time);
}
}
module.exports = noticeScroll;
... ...
... ... @@ -33,6 +33,16 @@
<p>浏览记录</p>
</a>
</div>
{{#if notice.open}}
<div class="notice" data-time="{{notice.time}}">
{{#notice.list}}
<a class="notice-item item-{{@index}}" href="{{url}}">
<span class="notice-icon"></span>
{{title}}
</a>
{{/notice.list}}
</div>
{{/if}}
<div class="my-order">
<a class="order-title" href="/home/orders">
我的订单
... ...
... ... @@ -51,7 +51,7 @@ class HomeController extends AbstractAction
'myIndexPage' => true,
'showDownloadApp' => true,
'navHome' => true,
// 'notice' => UserModel::getNoticeData(),
'notice' => UserModel::getNoticeData(),
'pageFooter' => true,
'cartUrl' => Helpers::url('/cart/index/index', null),
'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home'))),
... ...