Showing
5 changed files
with
114 additions
and
68 deletions
@@ -180,30 +180,40 @@ define('admin/activity',function(require, exports) | @@ -180,30 +180,40 @@ define('admin/activity',function(require, exports) | ||
180 | var place = ''; | 180 | var place = ''; |
181 | var pic = $("#pic_val").val(); | 181 | var pic = $("#pic_val").val(); |
182 | var start_time = $("#start_time").val(); | 182 | var start_time = $("#start_time").val(); |
183 | + var timestamp = Date.parse(start_time)/1000; | ||
183 | var parent_id = $("#create_activity_plan").attr("parent_id"); | 184 | var parent_id = $("#create_activity_plan").attr("parent_id"); |
184 | if(title == "" || content == "" || start_time == "" || pic == "") | 185 | if(title == "" || content == "" || start_time == "" || pic == "") |
185 | { | 186 | { |
186 | box.alert('请把内容填完'); | 187 | box.alert('请把内容填完'); |
187 | return; | 188 | return; |
188 | } | 189 | } |
189 | - $.ajax | ||
190 | - ({ | ||
191 | - type:"post", | ||
192 | - url:"/admin/activity/setactivityplan", | ||
193 | - data:{title:title,content:content,place:place,pic:pic, parent_id:parent_id, | ||
194 | - start_time:start_time, end_time:'',id:id}, | ||
195 | - success:function(data) | ||
196 | - { | ||
197 | - if(data.status) | ||
198 | - { | ||
199 | - window.location.reload(); | ||
200 | - } | ||
201 | - else | ||
202 | - { | ||
203 | - box.alert("操作失败"); | ||
204 | - } | ||
205 | - } | ||
206 | - }); | 190 | + if(timestamp>= $("#create_activity_plan").attr("start_time") |
191 | + && timestamp <= $("#create_activity_plan").attr("end_time")) | ||
192 | + { | ||
193 | + $.ajax | ||
194 | + ({ | ||
195 | + type:"post", | ||
196 | + url:"/admin/activity/setactivityplan", | ||
197 | + data:{title:title,content:content,place:place,pic:pic, parent_id:parent_id, | ||
198 | + start_time:start_time, end_time:'',id:id}, | ||
199 | + success:function(data) | ||
200 | + { | ||
201 | + if(data.status) | ||
202 | + { | ||
203 | + window.location.reload(); | ||
204 | + } | ||
205 | + else | ||
206 | + { | ||
207 | + box.alert("操作失败"); | ||
208 | + } | ||
209 | + } | ||
210 | + }); | ||
211 | + } | ||
212 | + else | ||
213 | + { | ||
214 | + box.alert('活动时间不在主题时间有效期'); | ||
215 | + return; | ||
216 | + } | ||
207 | } | 217 | } |
208 | }; | 218 | }; |
209 | 219 | ||
@@ -231,11 +241,24 @@ define('admin/activity',function(require, exports) | @@ -231,11 +241,24 @@ define('admin/activity',function(require, exports) | ||
231 | var place = $("#place").val(); | 241 | var place = $("#place").val(); |
232 | var start_time = $("#start_time").val(); | 242 | var start_time = $("#start_time").val(); |
233 | var end_time = $("#end_time").val(); | 243 | var end_time = $("#end_time").val(); |
244 | + var times = 0; | ||
234 | if(title == "" || start_time == "" || end_time == "" || place == "") | 245 | if(title == "" || start_time == "" || end_time == "" || place == "") |
235 | { | 246 | { |
236 | box.alert('请把内容填完'); | 247 | box.alert('请把内容填完'); |
237 | return; | 248 | return; |
238 | } | 249 | } |
250 | + $("tr").each(function(i, v) | ||
251 | + { | ||
252 | + if(start_time == $(v).find("td:eq(1)").text()) | ||
253 | + { | ||
254 | + times++; | ||
255 | + } | ||
256 | + }); | ||
257 | + if(times>1) | ||
258 | + { | ||
259 | + box.alert('开始时间有相同,请换一个吧。'); | ||
260 | + return; | ||
261 | + } | ||
239 | $.ajax | 262 | $.ajax |
240 | ({ | 263 | ({ |
241 | type:"post", | 264 | type:"post", |
@@ -563,44 +563,46 @@ define('yohood', function(require, exports) { | @@ -563,44 +563,46 @@ define('yohood', function(require, exports) { | ||
563 | html = html.replace("{titleStyle}", titleStyle); | 563 | html = html.replace("{titleStyle}", titleStyle); |
564 | return html; | 564 | return html; |
565 | } | 565 | } |
566 | - $.ajax({ | ||
567 | - url: "/news/getdetailnews", | ||
568 | - type: "post", | ||
569 | - data: { | ||
570 | - id: id | ||
571 | - }, | ||
572 | - success: function(data) { | ||
573 | - var isVideo, isTitleStyle; | ||
574 | - if (data.code == 200) { | ||
575 | - //推荐资讯 | ||
576 | - $.each(data.data.recom, function(i, v) { | ||
577 | - isVideo = (v.tag == '视频') ? 1 : 0; | ||
578 | - isTitleStyle = (v.main_title_type == 1) ? 1 : 0; | ||
579 | - recom += template(v.id, tools.limitWords(v.title, 48), common.getImages(v.thumb, '0230x0230', 'blogimg', 'primary'), | ||
580 | - '/news/detail/id/' + v.id, isVideo, isTitleStyle, v.title); | ||
581 | - }); | 566 | + $.ajax({ |
567 | + url: "/news/getdetailnews", | ||
568 | + type: "post", | ||
569 | + data: { | ||
570 | + id: id | ||
571 | + }, | ||
572 | + success: function(data) { | ||
573 | + var isVideo, isTitleStyle; | ||
574 | + if (data.code == 200) { | ||
575 | + //推荐资讯 | ||
576 | + $.each(data.data.recom, function(i, v) { | ||
577 | + isVideo = (v.tag == '视频') ? 1 : 0; | ||
578 | + isTitleStyle = (v.main_title_type == 1) ? 1 : 0; | ||
579 | + recom += template(v.id, tools.limitWords(v.title, 48), common.getImages(v.thumb, '0230x0230', 'blogimg', 'primary'), | ||
580 | + '/news/detail/id/' + v.id, isVideo, isTitleStyle, v.title); | ||
581 | + }); | ||
582 | 582 | ||
583 | - //热门视频 | ||
584 | - $.each(data.data.hotVideo, function(i, v) { | ||
585 | - isTitleStyle = (v.main_title_type == 1) ? 1 : 0; | ||
586 | - hotVideo += template(v.id, v.title, common.getImages(v.thumb, '0230x0230', 'blogimg', 'primary'), | ||
587 | - '/news/detail/id/' + v.id, 2, isTitleStyle, v.title); | ||
588 | - }); | ||
589 | - //最新视频 | ||
590 | - $.each(data.data.lastVideo, function(i, v) { | ||
591 | - isTitleStyle = (v.main_title_type == 1) ? 1 : 0; | ||
592 | - lastVideo += template(v.id, v.title, common.getImages(v.thumb, '0230x0230', 'blogimg', 'primary'), | ||
593 | - '/news/detail/id/' + v.id, 2, isTitleStyle, v.title); | ||
594 | - }); | ||
595 | - $(".post-list").html(recom); | ||
596 | - $(".side-related-list").eq(0).html(hotVideo); | ||
597 | - $(".side-related-list").eq(1).html(lastVideo); | ||
598 | - } | 583 | + //热门视频 |
584 | + $.each(data.data.hotVideo, function(i, v) { | ||
585 | + isTitleStyle = (v.main_title_type == 1) ? 1 : 0; | ||
586 | + hotVideo += template(v.id, v.title, common.getImages(v.thumb, '0230x0230', 'blogimg', 'primary'), | ||
587 | + '/news/detail/id/' + v.id, 2, isTitleStyle, v.title); | ||
588 | + }); | ||
589 | + //最新视频 | ||
590 | + $.each(data.data.lastVideo, function(i, v) { | ||
591 | + isTitleStyle = (v.main_title_type == 1) ? 1 : 0; | ||
592 | + lastVideo += template(v.id, v.title, common.getImages(v.thumb, '0230x0230', 'blogimg', 'primary'), | ||
593 | + '/news/detail/id/' + v.id, 2, isTitleStyle, v.title); | ||
594 | + }); | ||
595 | + $(".post-list").html(recom); | ||
596 | + $(".side-related-list").eq(0).html(hotVideo); | ||
597 | + $(".side-related-list").eq(1).html(lastVideo); | ||
599 | } | 598 | } |
600 | - }); | ||
601 | - } | ||
602 | - //现场计划活动 | ||
603 | - exports.activityPlan = function() { | 599 | + } |
600 | + }); | ||
601 | + } | ||
602 | + //现场计划活动 | ||
603 | + exports.activityPlan = function() | ||
604 | + { | ||
605 | + var timestamp = new Date().getTime() / 1000; | ||
604 | $('.site-activity-content').find('.layout-item').each(function() { | 606 | $('.site-activity-content').find('.layout-item').each(function() { |
605 | $(this).imgZoom({ | 607 | $(this).imgZoom({ |
606 | imgTag: 'pic-tip' | 608 | imgTag: 'pic-tip' |
@@ -615,7 +617,7 @@ define('yohood', function(require, exports) { | @@ -615,7 +617,7 @@ define('yohood', function(require, exports) { | ||
615 | distance, | 617 | distance, |
616 | eleTop, | 618 | eleTop, |
617 | tabPositionTop; | 619 | tabPositionTop; |
618 | - $(window).on('scroll', function() { | 620 | + $(window).on('scroll', function() { |
619 | if (tabTop <= $(this).scrollTop()) { | 621 | if (tabTop <= $(this).scrollTop()) { |
620 | $('.site-activity-tab').css({ | 622 | $('.site-activity-tab').css({ |
621 | "position": "fixed", | 623 | "position": "fixed", |
@@ -625,15 +627,12 @@ define('yohood', function(require, exports) { | @@ -625,15 +627,12 @@ define('yohood', function(require, exports) { | ||
625 | "marginLeft": "356px", | 627 | "marginLeft": "356px", |
626 | "marginTop": "10px" | 628 | "marginTop": "10px" |
627 | }) | 629 | }) |
628 | - | ||
629 | - | ||
630 | mainBodyOffsetTop = $('.bd').offset().top; | 630 | mainBodyOffsetTop = $('.bd').offset().top; |
631 | mainBodyHeight = $('.bd').outerHeight(); | 631 | mainBodyHeight = $('.bd').outerHeight(); |
632 | tabOffsetHeightTop = oTab.offset().top + oTab.outerHeight(); | 632 | tabOffsetHeightTop = oTab.offset().top + oTab.outerHeight(); |
633 | distance = mainBodyHeight + mainBodyOffsetTop; | 633 | distance = mainBodyHeight + mainBodyOffsetTop; |
634 | eleTop = distance - oTab.outerHeight(); | 634 | eleTop = distance - oTab.outerHeight(); |
635 | tabPositionTop = 10; | 635 | tabPositionTop = 10; |
636 | - | ||
637 | if (tabOffsetHeightTop >= distance) { | 636 | if (tabOffsetHeightTop >= distance) { |
638 | oTab.css({ | 637 | oTab.css({ |
639 | 'position': 'absolute', | 638 | 'position': 'absolute', |
@@ -650,11 +649,19 @@ define('yohood', function(require, exports) { | @@ -650,11 +649,19 @@ define('yohood', function(require, exports) { | ||
650 | $('.site-activity-tab').removeAttr('style'); | 649 | $('.site-activity-tab').removeAttr('style'); |
651 | }; | 650 | }; |
652 | }); | 651 | }); |
652 | + //日期自动定位 | ||
653 | + $(".site-activity-time").each(function() | ||
654 | + { | ||
655 | + if(timestamp >= $(this).attr("start_time") && timestamp <= $(this).attr("end_time")) | ||
656 | + { | ||
657 | + $("body").animate({"scrollTop": $(this).offset().top - 50 }, 1000); | ||
658 | + return; | ||
659 | + } | ||
660 | + }) | ||
653 | } | 661 | } |
654 | - | ||
655 | //视频 | 662 | //视频 |
656 | exports.video = function() { | 663 | exports.video = function() { |
657 | //图片转换 | 664 | //图片转换 |
658 | imgTransform(".image-box img"); | 665 | imgTransform(".image-box img"); |
659 | } | 666 | } |
660 | -}); | ||
667 | +}); |
@@ -25,6 +25,8 @@ class Controller_Activity extends Controller_Abstract | @@ -25,6 +25,8 @@ class Controller_Activity extends Controller_Abstract | ||
25 | $topicIds = array(); | 25 | $topicIds = array(); |
26 | //导航 | 26 | //导航 |
27 | $navList = array(); | 27 | $navList = array(); |
28 | + $today = strtotime(date('Y-m-d', time())); | ||
29 | + $firstCurrentday = 0; | ||
28 | foreach($topics as $topic) | 30 | foreach($topics as $topic) |
29 | { | 31 | { |
30 | $startTime = strtotime(date('Y-m-d', $topic['start_time'])); | 32 | $startTime = strtotime(date('Y-m-d', $topic['start_time'])); |
@@ -34,14 +36,21 @@ class Controller_Activity extends Controller_Abstract | @@ -34,14 +36,21 @@ class Controller_Activity extends Controller_Abstract | ||
34 | { | 36 | { |
35 | $navList[$year] = array(); | 37 | $navList[$year] = array(); |
36 | } | 38 | } |
39 | + $enable = 0; | ||
37 | //导航 | 40 | //导航 |
38 | - if(!in_array($startTime, $navList[$year])) | 41 | + if(!in_array($startTime, array_keys($navList[$year]))) |
39 | { | 42 | { |
40 | - $navList[$year][] = array('timestamp' => $startTime,'enable' => 1); | 43 | + $enable = $today >= $startTime ? 1 : 0; |
44 | + if($enable && empty($firstCurrentday)) | ||
45 | + { | ||
46 | + $firstCurrentday = $startTime; | ||
47 | + } | ||
48 | + $navList[$year][$startTime] = array('timestamp' => $startTime,'enable' => $enable); | ||
41 | } | 49 | } |
50 | + //第一次,没有时间 | ||
42 | if(empty($currentday)) | 51 | if(empty($currentday)) |
43 | { | 52 | { |
44 | - $currentday = key($list); | 53 | + $currentday = $firstCurrentday; |
45 | } | 54 | } |
46 | if($startTime == $currentday) | 55 | if($startTime == $currentday) |
47 | { | 56 | { |
@@ -7,7 +7,8 @@ | @@ -7,7 +7,8 @@ | ||
7 | <div class="layout-section"> | 7 | <div class="layout-section"> |
8 | <div class="site-activity-title"> | 8 | <div class="site-activity-title"> |
9 | <h4 class="site-activity-intro"><span></span><?php echo $topic['title'];?></h4> | 9 | <h4 class="site-activity-intro"><span></span><?php echo $topic['title'];?></h4> |
10 | - <div class="site-activity-time"><?php echo sprintf('%s-%s', date('H:i', $topic['start_time']), date('H:i', $topic['end_time']));?></div> | 10 | + <div class="site-activity-time" |
11 | + 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> | ||
11 | <i class="site-activity-icon"></i> | 12 | <i class="site-activity-icon"></i> |
12 | </div> | 13 | </div> |
13 | <?php | 14 | <?php |
@@ -39,10 +40,12 @@ | @@ -39,10 +40,12 @@ | ||
39 | <?php foreach($navs as $nav):?> | 40 | <?php foreach($navs as $nav):?> |
40 | <li | 41 | <li |
41 | <?php | 42 | <?php |
43 | + $url = 'javascript:void(0)'; | ||
44 | + if($nav['enable']) $url = '/activity/plan/currentday/'.$nav['timestamp']; | ||
42 | if($nav['timestamp'] == $this->view->currentday && $nav['enable']) echo 'class="current"'; | 45 | if($nav['timestamp'] == $this->view->currentday && $nav['enable']) echo 'class="current"'; |
43 | else if (!$nav['enable']) echo 'class="disable"';?> | 46 | else if (!$nav['enable']) echo 'class="disable"';?> |
44 | - > | ||
45 | - <a href="/activity/plan/currentday/<?php echo $nav['timestamp'];?>"><?php echo date('Y-m-d', $nav['timestamp']);?></a> | 47 | + > |
48 | + <a href="<?php echo $url;?>"><?php echo date('Y-m-d', $nav['timestamp']);?></a> | ||
46 | </li> | 49 | </li> |
47 | <?php endforeach;?> | 50 | <?php endforeach;?> |
48 | </ul> | 51 | </ul> |
@@ -4,7 +4,8 @@ | @@ -4,7 +4,8 @@ | ||
4 | 4 | ||
5 | <table class="table"> | 5 | <table class="table"> |
6 | <caption style="text-align:left; padding-bottom:5px;"> | 6 | <caption style="text-align:left; padding-bottom:5px;"> |
7 | - <button class="btn" id="create_activity_plan" style="float:left;" parent_id="<?php echo $this->view->topicInfo['id'];?>"> | 7 | + <button class="btn" id="create_activity_plan" style="float:left;" parent_id="<?php echo $this->view->topicInfo['id'];?>" |
8 | + start_time="<?php echo $this->view->topicInfo['start_time'];?>" end_time="<?php echo $this->view->topicInfo['end_time'];?>"> | ||
8 | 添加现场活动 | 9 | 添加现场活动 |
9 | </button> | 10 | </button> |
10 | </caption> | 11 | </caption> |
@@ -54,9 +55,12 @@ | @@ -54,9 +55,12 @@ | ||
54 | </td> | 55 | </td> |
55 | </tr> | 56 | </tr> |
56 | <tr> | 57 | <tr> |
57 | - <td>活动时间<span class="text-error"> * </span</td> | 58 | + <td>活动时间<span class="text-error"> * </span></td> |
58 | <td colspan="3"> | 59 | <td colspan="3"> |
59 | <input value="" type="text" class="Wdate" name="start_time" id="start_time" title="点击选择时间"> | 60 | <input value="" type="text" class="Wdate" name="start_time" id="start_time" title="点击选择时间"> |
61 | + <span class="text-error"> | ||
62 | + (<?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']);?> ) | ||
63 | + </span> | ||
60 | </td> | 64 | </td> |
61 | </tr> | 65 | </tr> |
62 | </tbody> | 66 | </tbody> |
-
Please register or login to post a comment