events_article.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <{include file="header.html"}>
  2. <{include file="nav.html"}>
  3. <style>
  4. .praise {cursor: pointer;}
  5. </style>
  6. <!--公用标题居中显示-->
  7. <{include file="common_header.html"}>
  8. <div class="wrapper clear">
  9. <div class="arti_body">
  10. <div class="arti_title"><{$article.article_title}></div>
  11. <div class="arti_info">
  12. <span><{$article.begin_time|date_format:'%Y-%m-%d'}></span><span><{if $article.article_author}>作者:<{$article.article_author}><{/if}></span>
  13. </div>
  14. <div class="arti_content clear"><{$article.article_text}></div>
  15. <div class="clear"></div>
  16. <div class="vogue_read"><{if $article.article_original_url}><a href="<{$article.article_original_url}>">阅读原文</a> <{/if}>阅读 <{$clickNum}> <span class="praise"><i class="fa <{if $isHasLikes}>fa-thumbs-up<{else}>fa-thumbs-o-up<{/if}>"></i> <em><{$likes}></em></span></div>
  17. <div class="clear"></div>
  18. </div>
  19. </div>
  20. <input name="events_id" type="hidden" value="<{$article.id}>"/>
  21. <script>
  22. KISSY.use('node, io', function (S, Node, IO) {
  23. var $ = S.all;
  24. //视频自适应
  25. var screenWidth = $(window).width();
  26. var baseWidth = 510;
  27. var video_scale = screenWidth / baseWidth;
  28. $(".video_iframe").each(function () {
  29. var new_width = $(this).width() * video_scale;
  30. $(this).width(new_width - 20);
  31. var new_height = $(this).height() * video_scale;
  32. $(this).height(new_height - 20);
  33. });
  34. $('.vogue_add_btn').on('click', function() {
  35. $('#add_tips').show();
  36. });
  37. $('.add_join_btn').on('click', function () {
  38. $('#add_tips').hide();
  39. });
  40. $(".praise").on('click', function () {
  41. var num = $('em', $(this)).text();
  42. if ($('i', $(this)).hasClass('fa-thumbs-up')) { //已赞过
  43. $('em', $(this)).text(--num);
  44. submit(2);
  45. $('i', $(this)).replaceClass('fa-thumbs-up', 'fa-thumbs-o-up');
  46. } else { //未赞过
  47. $('em', $(this)).text(++num);
  48. submit(1);
  49. $('i', $(this)).replaceClass('fa-thumbs-o-up', 'fa-thumbs-up');
  50. }
  51. });
  52. function submit(type) {
  53. var events_id = $("input[name=events_id]").val();
  54. new IO({
  55. type: "post"
  56. , url: VG.conf.root_domain + '/?c=EventsArticle&a=Likes'
  57. , data: {'events_id':events_id, 'type': type}
  58. , success: function (data) {}
  59. , error: function (NULL, textStatus) {
  60. alert("请求服务器失败,原因:"+textStatus);
  61. }
  62. , dataType: "json"
  63. });
  64. }
  65. });
  66. </script>
  67. <{include file="bottom.html"}>