index.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <style>
  2. .helper{
  3. display: none;
  4. }
  5. </style>
  6. <link type="text/css" rel="stylesheet" href="/css/needDetail.css"/>
  7. <div class="main-content-inner" style="height: 500px;width: 94%;">
  8. <div class="layout-gap">
  9. <span style="float: left">
  10. <div id="clearCopied" class="anc-finish-btn i_fl select_file" style="height: 32px;line-height: 32px;margin-top: 5px;">清空全部已复制</div>
  11. <span style="height: 32px;line-height: 32px;margin-top: 5px; margin-left:5px;color: red;">下载链接有效期为24小时</span>
  12. </span>
  13. <span style="float: right">
  14. <div class="dataTables_paginate paging_simple_numbers" id="datatable-checkbox_paginate">
  15. <div class="row" style="padding-top:10px;">
  16. <div style="font-size: 16px">
  17. <div class="dataTables_paginate paging_simple_numbers"
  18. style="vertical-align:sub;">
  19. <ul id="yw0" class="yiiPager">
  20. <li>
  21. <?php echo $page;?>/<?php echo $pages['totalPage'];?>
  22. </li>
  23. <?php
  24. if ($page > 1) {
  25. echo '<li class="previous"><a href="' . $this->createUrl('downloadtask/index') . '?page=' . ($page - 1) . '">上一页</a></li>';
  26. }
  27. if ($page < $pages['totalPage']) {
  28. echo '<li class="next"><a href="' . $this->createUrl('downloadtask/index') . '?page=' . ($page + 1) . '">下一页</a></li>';
  29. }
  30. ?>
  31. </ul>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </span>
  37. </div>
  38. <section>
  39. <div class="x_content">
  40. <div class="row" style="margin:0px;">
  41. <div class="col-xs-12">
  42. <!-- PAGE CONTENT BEGINS -->
  43. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  44. <div class="row">
  45. <div class="dataTables_length margin-zy">
  46. <table id="datatable" class="table table-striped table-bordered"
  47. style="margin-left: 30px;">
  48. <thead>
  49. <tr>
  50. <th>名称</th>
  51. <th>班级</th>
  52. <th>打包人数</th>
  53. <th>状态</th>
  54. <th>操作</th>
  55. </tr>
  56. </thead>
  57. <tbody>
  58. <?php if(empty($dataList)):?>
  59. <tr><td colspan="5" style="text-align: center;vertical-align: center;font-size: 20px">暂无数据</td></tr>
  60. <?php endif;?>
  61. <?php foreach ($dataList as $loop): ?>
  62. <tr>
  63. <td><?php echo $loop['product_name'] ?></td>
  64. <td><?php echo $loop['class_name'] ?></td>
  65. <td><?php echo $loop['student_count'] ?></td>
  66. <td style="color:
  67. <?php
  68. switch ($loop['pack_status']) {
  69. case 0:
  70. echo 'red';
  71. break;
  72. case 1:
  73. echo 'orange';
  74. break;
  75. case 2:
  76. echo 'black';
  77. break;
  78. case 3:
  79. echo 'green';
  80. break;
  81. }
  82. ?>
  83. ;"><?php echo $loop['status'] ?></td>
  84. <td id="copyUrl">
  85. <?php if ($loop['pack_status'] == 1 || $loop['pack_status'] == 3): ?>
  86. <span style="padding:5px;color:white;background: #2977ff;cursor: pointer"
  87. data-url="<?php echo $loop['pack_url']; ?>"
  88. data-id="<?php echo $loop['id']; ?>"
  89. >复制下载链接</span>
  90. <?php endif; ?>
  91. </td>
  92. </tr>
  93. <?php endforeach; ?>
  94. </tbody>
  95. </table>
  96. </div>
  97. </section>
  98. </div>
  99. <script src="/js/jquery-2.2.2.min.js"></script>
  100. <script src="/js/layer/layer.js"></script>
  101. <script>
  102. $('#clearCopied').click(function () {
  103. layer.msg("确定清除已复制的下载任务吗?", {
  104. time: 0,
  105. btn: ['确定', '取消'],
  106. offset: ['300px', '350px'],
  107. yes: function (index) {
  108. layer.close(index);
  109. $.ajax({
  110. type: 'GET',
  111. url: "<?php echo $this->createUrl("downloadtask/clear");?>",
  112. success: function (data) {
  113. layer.alert('清空成功!', {
  114. icon: 1,
  115. offset: ['300px', '350px'],
  116. yes: function () {
  117. location.reload();
  118. }
  119. });
  120. }
  121. });
  122. }
  123. })
  124. });
  125. $('#copyUrl span').click(function () {
  126. var taskId = $(this).attr('data-id');
  127. var url = $(this).attr('data-url');
  128. Copy(url);
  129. $.ajax({
  130. type: 'GET',
  131. url: "<?php echo $this->createUrl("downloadtask/ajaxCopy");?>",
  132. data: {"id": taskId},
  133. success: function (data) {
  134. layer.alert('复制成功!', {
  135. icon: 1,
  136. offset: ['300px', '350px'],
  137. yes: function () {
  138. location.reload();
  139. }
  140. });
  141. }
  142. })
  143. });
  144. // 复制微信号函数
  145. function Copy(str) {
  146. var save = function (e) {
  147. e.clipboardData.setData('text/plain', str);
  148. e.preventDefault();
  149. };
  150. document.addEventListener('copy', save);
  151. document.execCommand('copy');
  152. document.removeEventListener('copy', save);
  153. console.log('复制成功');
  154. }
  155. </script>