pass.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <style>
  2. .right-content{
  3. padding-top:54px!important; padding-left:0!important; width:970px!important;
  4. }
  5. </style>
  6. <div class="content">
  7. <% include ../leftBar.html %>
  8. <!-- right content start -->
  9. <div class="right-content myCover-underReview">
  10. <div class="pageInfo">My Cover</div>
  11. <% include topBar.html %>
  12. <div class="covers-photos">
  13. <%if(data.length){%>
  14. <ul>
  15. <%for(let val of data){%>
  16. <li class="covers" id="<%=val.id%>" style="width: 210px;">
  17. <img src="<%=val.img%>" alt=""/>
  18. <!--<div>-->
  19. <!--<ul class="edit">-->
  20. <!--<%if(val.is_use == 1){%>-->
  21. <!--<li>-->
  22. <!--<a class="coverDelete" href="javascript:;">-->
  23. <!--<div><img src="<%=public_path%>/img/u155.png" alt=""/></div>-->
  24. <!--<div>Delete</div>-->
  25. <!--</a>-->
  26. <!--</li>-->
  27. <!--<%}else{%>-->
  28. <!--<li>-->
  29. <!--<a class="coverUse" href="javascript:;">-->
  30. <!--<div><img src="<%=public_path%>/img/u167.png" alt=""/></div>-->
  31. <!--<div>Set as Using</div>-->
  32. <!--</a>-->
  33. <!--</li>-->
  34. <!--<li>-->
  35. <!--<a class="coverDelete" href="javascript:;">-->
  36. <!--<div><img src="<%=public_path%>/img/u155.png" alt=""/></div>-->
  37. <!--<div>Delete</div>-->
  38. <!--</a>-->
  39. <!--</li>-->
  40. <!--<%}%>-->
  41. <!--</ul>-->
  42. <!--</div>-->
  43. <div class="using" <%if(val.is_use == 1){%>style="display:block;" <%}%> >Using</div>
  44. </li>
  45. <%}%>
  46. </ul>
  47. <%}else{%>
  48. <div class="noData">No photos approved.</div>
  49. <%}%>
  50. </div>
  51. <div id="page" class="pagenation"></div>
  52. </div>
  53. <!-- right content end -->
  54. </div>
  55. <script>
  56. $(function(){
  57. //显示修改和删除
  58. $('.covers').mouseenter(function(){
  59. $(this).find('ul.edit').stop();
  60. $(this).find('ul.edit').slideDown(300);
  61. })
  62. $('.covers').mouseleave(function(){
  63. $(this).find('ul.edit').stop();
  64. $(this).find('ul.edit').slideUp(300);
  65. })
  66. /**
  67. * 删除封面
  68. */
  69. $('.coverDelete').on('click', function () {
  70. let id = $(this).parents('li.covers').attr('id');
  71. let length = $('.covers').length;
  72. if(length < 4){
  73. parent.layer.msg('Can not delete a cover photo when there are less than 4 cover photos.');
  74. return false;
  75. }
  76. parent.layer.confirm('Are you sure you wish to delete this photo?', {
  77. btn:['Cancel', 'Yes'],
  78. title:'',
  79. btnAlign:'c',
  80. closeBtn: 0,
  81. shadeClose:true,
  82. shade:0.01
  83. }, function(){
  84. parent.layer.msg('Cancel Delete');
  85. }, function(){
  86. $.post('/broadcast/cover/deleteCover',{id:id},function(data){
  87. if(data.errno == 0){
  88. window.location.reload();
  89. parent.layer.msg('deleted');
  90. }else{
  91. parent.layer.msg('Failed to delete');
  92. }
  93. })
  94. });
  95. })
  96. /**
  97. * 设置封面为使用中
  98. */
  99. $('.coverUse').on('click', function(){
  100. let id = $(this).parents('li.covers').attr('id');
  101. $.post('/broadcast/cover/useCover',{id:id},function(data){
  102. if(data.errno == 0){
  103. parent.layer.msg('Successfully set as using.');
  104. window.location.reload();
  105. }else{
  106. parent.layer.msg(data.data.errmsg);
  107. }
  108. })
  109. })
  110. //分页
  111. var pages = Math.ceil('<%=count.total%>'/8);
  112. if(pages>1) {
  113. page('page', pages);
  114. }
  115. })
  116. </script>