Authored by whb

bug fixed

... ... @@ -180,30 +180,40 @@ define('admin/activity',function(require, exports)
var place = '';
var pic = $("#pic_val").val();
var start_time = $("#start_time").val();
var timestamp = Date.parse(start_time)/1000;
var parent_id = $("#create_activity_plan").attr("parent_id");
if(title == "" || content == "" || start_time == "" || pic == "")
{
box.alert('请把内容填完');
return;
}
$.ajax
({
type:"post",
url:"/admin/activity/setactivityplan",
data:{title:title,content:content,place:place,pic:pic, parent_id:parent_id,
start_time:start_time, end_time:'',id:id},
success:function(data)
{
if(data.status)
{
window.location.reload();
}
else
{
box.alert("操作失败");
}
}
});
if(timestamp>= $("#create_activity_plan").attr("start_time")
&& timestamp <= $("#create_activity_plan").attr("end_time"))
{
$.ajax
({
type:"post",
url:"/admin/activity/setactivityplan",
data:{title:title,content:content,place:place,pic:pic, parent_id:parent_id,
start_time:start_time, end_time:'',id:id},
success:function(data)
{
if(data.status)
{
window.location.reload();
}
else
{
box.alert("操作失败");
}
}
});
}
else
{
box.alert('活动时间不在主题时间有效期');
return;
}
}
};
... ... @@ -231,11 +241,24 @@ define('admin/activity',function(require, exports)
var place = $("#place").val();
var start_time = $("#start_time").val();
var end_time = $("#end_time").val();
var times = 0;
if(title == "" || start_time == "" || end_time == "" || place == "")
{
box.alert('请把内容填完');
return;
}
$("tr").each(function(i, v)
{
if(start_time == $(v).find("td:eq(1)").text())
{
times++;
}
});
if(times>1)
{
box.alert('开始时间有相同,请换一个吧。');
return;
}
$.ajax
({
type:"post",
... ...
... ... @@ -563,44 +563,46 @@ define('yohood', function(require, exports) {
html = html.replace("{titleStyle}", titleStyle);
return html;
}
$.ajax({
url: "/news/getdetailnews",
type: "post",
data: {
id: id
},
success: function(data) {
var isVideo, isTitleStyle;
if (data.code == 200) {
//推荐资讯
$.each(data.data.recom, function(i, v) {
isVideo = (v.tag == '视频') ? 1 : 0;
isTitleStyle = (v.main_title_type == 1) ? 1 : 0;
recom += template(v.id, tools.limitWords(v.title, 48), common.getImages(v.thumb, '0230x0230', 'blogimg', 'primary'),
'/news/detail/id/' + v.id, isVideo, isTitleStyle, v.title);
});
$.ajax({
url: "/news/getdetailnews",
type: "post",
data: {
id: id
},
success: function(data) {
var isVideo, isTitleStyle;
if (data.code == 200) {
//推荐资讯
$.each(data.data.recom, function(i, v) {
isVideo = (v.tag == '视频') ? 1 : 0;
isTitleStyle = (v.main_title_type == 1) ? 1 : 0;
recom += template(v.id, tools.limitWords(v.title, 48), common.getImages(v.thumb, '0230x0230', 'blogimg', 'primary'),
'/news/detail/id/' + v.id, isVideo, isTitleStyle, v.title);
});
//热门视频
$.each(data.data.hotVideo, function(i, v) {
isTitleStyle = (v.main_title_type == 1) ? 1 : 0;
hotVideo += template(v.id, v.title, common.getImages(v.thumb, '0230x0230', 'blogimg', 'primary'),
'/news/detail/id/' + v.id, 2, isTitleStyle, v.title);
});
//最新视频
$.each(data.data.lastVideo, function(i, v) {
isTitleStyle = (v.main_title_type == 1) ? 1 : 0;
lastVideo += template(v.id, v.title, common.getImages(v.thumb, '0230x0230', 'blogimg', 'primary'),
'/news/detail/id/' + v.id, 2, isTitleStyle, v.title);
});
$(".post-list").html(recom);
$(".side-related-list").eq(0).html(hotVideo);
$(".side-related-list").eq(1).html(lastVideo);
}
//热门视频
$.each(data.data.hotVideo, function(i, v) {
isTitleStyle = (v.main_title_type == 1) ? 1 : 0;
hotVideo += template(v.id, v.title, common.getImages(v.thumb, '0230x0230', 'blogimg', 'primary'),
'/news/detail/id/' + v.id, 2, isTitleStyle, v.title);
});
//最新视频
$.each(data.data.lastVideo, function(i, v) {
isTitleStyle = (v.main_title_type == 1) ? 1 : 0;
lastVideo += template(v.id, v.title, common.getImages(v.thumb, '0230x0230', 'blogimg', 'primary'),
'/news/detail/id/' + v.id, 2, isTitleStyle, v.title);
});
$(".post-list").html(recom);
$(".side-related-list").eq(0).html(hotVideo);
$(".side-related-list").eq(1).html(lastVideo);
}
});
}
//现场计划活动
exports.activityPlan = function() {
}
});
}
//现场计划活动
exports.activityPlan = function()
{
var timestamp = new Date().getTime() / 1000;
$('.site-activity-content').find('.layout-item').each(function() {
$(this).imgZoom({
imgTag: 'pic-tip'
... ... @@ -615,7 +617,7 @@ define('yohood', function(require, exports) {
distance,
eleTop,
tabPositionTop;
$(window).on('scroll', function() {
$(window).on('scroll', function() {
if (tabTop <= $(this).scrollTop()) {
$('.site-activity-tab').css({
"position": "fixed",
... ... @@ -625,15 +627,12 @@ define('yohood', function(require, exports) {
"marginLeft": "356px",
"marginTop": "10px"
})
mainBodyOffsetTop = $('.bd').offset().top;
mainBodyHeight = $('.bd').outerHeight();
tabOffsetHeightTop = oTab.offset().top + oTab.outerHeight();
distance = mainBodyHeight + mainBodyOffsetTop;
eleTop = distance - oTab.outerHeight();
tabPositionTop = 10;
if (tabOffsetHeightTop >= distance) {
oTab.css({
'position': 'absolute',
... ... @@ -650,11 +649,19 @@ define('yohood', function(require, exports) {
$('.site-activity-tab').removeAttr('style');
};
});
//日期自动定位
$(".site-activity-time").each(function()
{
if(timestamp >= $(this).attr("start_time") && timestamp <= $(this).attr("end_time"))
{
$("body").animate({"scrollTop": $(this).offset().top - 50 }, 1000);
return;
}
})
}
//视频
exports.video = function() {
//图片转换
imgTransform(".image-box img");
}
});
\ No newline at end of file
});
... ...
... ... @@ -25,6 +25,8 @@ class Controller_Activity extends Controller_Abstract
$topicIds = array();
//导航
$navList = array();
$today = strtotime(date('Y-m-d', time()));
$firstCurrentday = 0;
foreach($topics as $topic)
{
$startTime = strtotime(date('Y-m-d', $topic['start_time']));
... ... @@ -34,14 +36,21 @@ class Controller_Activity extends Controller_Abstract
{
$navList[$year] = array();
}
$enable = 0;
//导航
if(!in_array($startTime, $navList[$year]))
if(!in_array($startTime, array_keys($navList[$year])))
{
$navList[$year][] = array('timestamp' => $startTime,'enable' => 1);
$enable = $today >= $startTime ? 1 : 0;
if($enable && empty($firstCurrentday))
{
$firstCurrentday = $startTime;
}
$navList[$year][$startTime] = array('timestamp' => $startTime,'enable' => $enable);
}
//第一次,没有时间
if(empty($currentday))
{
$currentday = key($list);
$currentday = $firstCurrentday;
}
if($startTime == $currentday)
{
... ...
... ... @@ -7,7 +7,8 @@
<div class="layout-section">
<div class="site-activity-title">
<h4 class="site-activity-intro"><span></span><?php echo $topic['title'];?></h4>
<div class="site-activity-time"><?php echo sprintf('%s-%s', date('H:i', $topic['start_time']), date('H:i', $topic['end_time']));?></div>
<div class="site-activity-time"
start_time="<?php echo $topic['start_time']?>" end_time="<?php echo $topic['end_time']?>"><?php echo sprintf('%s-%s', date('H:i', $topic['start_time']), date('H:i', $topic['end_time']));?></div>
<i class="site-activity-icon"></i>
</div>
<?php
... ... @@ -39,10 +40,12 @@
<?php foreach($navs as $nav):?>
<li
<?php
$url = 'javascript:void(0)';
if($nav['enable']) $url = '/activity/plan/currentday/'.$nav['timestamp'];
if($nav['timestamp'] == $this->view->currentday && $nav['enable']) echo 'class="current"';
else if (!$nav['enable']) echo 'class="disable"';?>
>
<a href="/activity/plan/currentday/<?php echo $nav['timestamp'];?>"><?php echo date('Y-m-d', $nav['timestamp']);?></a>
>
<a href="<?php echo $url;?>"><?php echo date('Y-m-d', $nav['timestamp']);?></a>
</li>
<?php endforeach;?>
</ul>
... ...
... ... @@ -4,7 +4,8 @@
<table class="table">
<caption style="text-align:left; padding-bottom:5px;">
<button class="btn" id="create_activity_plan" style="float:left;" parent_id="<?php echo $this->view->topicInfo['id'];?>">
<button class="btn" id="create_activity_plan" style="float:left;" parent_id="<?php echo $this->view->topicInfo['id'];?>"
start_time="<?php echo $this->view->topicInfo['start_time'];?>" end_time="<?php echo $this->view->topicInfo['end_time'];?>">
添加现场活动
</button>
</caption>
... ... @@ -54,9 +55,12 @@
</td>
</tr>
<tr>
<td>活动时间<span class="text-error"> * </span</td>
<td>活动时间<span class="text-error"> * </span></td>
<td colspan="3">
<input value="" type="text" class="Wdate" name="start_time" id="start_time" title="点击选择时间">
<span class="text-error">
(<?php echo date('Y-m-d H:i:s', $this->view->topicInfo['start_time']).' -- '.date('Y-m-d H:i:s', $this->view->topicInfo['end_time']);?> )
</span>
</td>
</tr>
</tbody>
... ...