Authored by whb

bug fixed

... ... @@ -180,12 +180,16 @@ 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;
}
if(timestamp>= $("#create_activity_plan").attr("start_time")
&& timestamp <= $("#create_activity_plan").attr("end_time"))
{
$.ajax
({
type:"post",
... ... @@ -205,6 +209,12 @@ define('admin/activity',function(require, exports)
}
});
}
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",
... ...
... ... @@ -600,7 +600,9 @@ define('yohood', function(require, exports) {
});
}
//现场计划活动
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'
... ... @@ -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,8 +649,16 @@ 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() {
//图片转换
... ...
... ... @@ -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>
... ...