topBar.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <div id="tabs-container">
  2. <ul class="tabs-menu">
  3. <a href="/broadcast/myAlbum/auditing"><li class="Auditing"><span>UNDER REVIEW</span></li></a>
  4. <a href="/broadcast/myAlbum/pass"><li class="Pass"><span>APPROVED</span></li></a>
  5. <a href="/broadcast/myAlbum/failed"><li class="Failed"><span>REJECTED</span></li></a>
  6. </ul>
  7. <ul class="plusBtn">
  8. <li>
  9. <a id="Photo" href="javascript:;"><div class="plusPhoto">+ Photo</div></a>
  10. </li>
  11. <li>
  12. <a id="Video" href="javascript:;"><div class="plusVideo">+ Video</div></a>
  13. </li>
  14. <li>
  15. <a id="Paragraph" href="javascript:;"><div class="plusText">+ Text</div></a>
  16. </li>
  17. </ul>
  18. </div>
  19. <script>
  20. $(function(){
  21. //查看视频
  22. $('.video').on('click', function(){
  23. var videoUrl = $(this).attr('data-video');
  24. var status = $(this).attr('data-status');
  25. if(status == 1){
  26. parent.layer.open({
  27. type: 2,
  28. title: '',
  29. closeBtn: 0,
  30. resize: false,
  31. area : ['640px', '519px'],
  32. content: '/broadcast/albumLayer/playVideo?videoUrl='+videoUrl,
  33. success: function(layero){
  34. setTimeout(function() {
  35. layero.removeClass('layer-anim');
  36. }, 0);
  37. },
  38. });
  39. }else{
  40. parent.layer.open({
  41. type: 2,
  42. title: '',
  43. closeBtn: 0,
  44. resize: false,
  45. area : ['640px', '522px'],
  46. content: '/broadcast/albumLayer/playError'
  47. });
  48. }
  49. })
  50. //查看图片
  51. var showOriginal = 0;
  52. $('.showOriginal').on('click', function(){
  53. if(showOriginal) {
  54. return false;
  55. }
  56. showOriginal = 1;
  57. var img = $(this).attr('data-img');
  58. var image = new Image();
  59. image.src = img;
  60. image.onload = function(){
  61. var width = image.width;
  62. var height = image.height;
  63. // width = width*0.9;
  64. // height = height*0.9;
  65. var windowHeigth = $(parent).height();
  66. var windowWidth = $(parent).width();
  67. var imgHeigth = '';
  68. var imgWidth = '';
  69. if(windowHeigth <= height || windowWidth <= width){
  70. windowHeigth = parseInt(windowHeigth * 0.6);
  71. windowWidth = parseInt(windowWidth * 0.6);
  72. height = windowHeigth;
  73. width = windowWidth;
  74. imgHeigth = windowHeigth;
  75. imgWidth = windowWidth;
  76. }else{
  77. imgHeigth = height;
  78. imgWidth = width;
  79. }
  80. width = width + 20 + 'px';
  81. height = height + 50 + 'px';
  82. parent.layer.open({
  83. type: 2,
  84. title: '',
  85. closeBtn: 0,
  86. resize: false,
  87. shadeClose: true,
  88. area : [width, height],
  89. content: '/broadcast/albumLayer/showOriginal?img='+img+'&width='+imgWidth+'&height='+imgHeigth,
  90. end:function(){
  91. showOriginal = 0;
  92. }
  93. });
  94. }
  95. })
  96. //添加视频
  97. $('#Video').on('click', function(){
  98. parent.layer.open({
  99. type: 2,
  100. title: '',
  101. closeBtn: 0,
  102. resize: false,
  103. area : ['556px', '235px'],
  104. content: '/broadcast/albumLayer/addVideo',
  105. end:function(){
  106. var status = Cookies.getJSON('add_success_video');
  107. Cookies.remove('add_success_video');
  108. if(status && status.status == 1){
  109. window.location.reload();
  110. }
  111. }
  112. });
  113. })
  114. //添加图片
  115. $('#Photo').on('click', function(){
  116. parent.layer.open({
  117. type: 2,
  118. title: '',
  119. closeBtn: 0,
  120. resize: false,
  121. shadeClose: true,
  122. area : ['556px', '165px'],
  123. content: '/broadcast/albumLayer/addPhoto',
  124. end:function(){
  125. var status = Cookies.getJSON('add_success_photo');
  126. Cookies.remove('add_success_photo');
  127. if(status && status.status == 1){
  128. window.location.reload();
  129. }
  130. }
  131. });
  132. })
  133. //添加文本
  134. $('#Paragraph').on('click', function(){
  135. parent.layer.open({
  136. type: 2,
  137. title: '',
  138. closeBtn: 0,
  139. resize: false,
  140. shadeClose: true,
  141. area : ['556px', '216px'],
  142. content: '/broadcast/albumLayer/addParagraph',
  143. end:function(){
  144. var status = Cookies.getJSON('add_success_paragraph');
  145. Cookies.remove('add_success_paragraph');
  146. if(status && status.status == 1){
  147. window.location.reload();
  148. }
  149. }
  150. });
  151. })
  152. //记录排序的数组
  153. var sortData = '';
  154. Sort();
  155. //排序
  156. function Sort(){
  157. $(".albumList li").addClass('shadow');
  158. $(".albumList" ).sortable({
  159. cursor: "move",
  160. items :"li",
  161. opacity: 0.6,
  162. revert: true,
  163. update : function(event, ui){
  164. sortData = $(this).sortable("toArray");
  165. saveSort();
  166. }
  167. });
  168. }
  169. //保存
  170. function saveSort(){
  171. $( ".albumList" ).sortable( "destroy" );
  172. var minSort = '<%= minSort %>';
  173. //如果排序没有改变则不提交
  174. if(sortData){
  175. $.post('/broadcast/albumLayer/reorder', {minSort:minSort, sortData:sortData}, function(data){
  176. sortData = '';
  177. if(data.errno==0){
  178. parent.layer.msg('Saved successfully');
  179. Sort();
  180. }else{
  181. parent.layer.alert('Failed to save. Please try again.',{
  182. title:'',
  183. closeBtn: 0,
  184. shade:0,
  185. btnAlign:'c'
  186. });
  187. }
  188. })
  189. }
  190. }
  191. })
  192. </script>