course_recordtheme.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. {extend name="public/layout"}
  2. {block name="body"}
  3. <style>
  4. html,body {
  5. background-color: #fff;
  6. }
  7. a {
  8. color: blue;
  9. }
  10. .layui-table thead tr,
  11. .layui-table-header {
  12. background-color: #D8E6F1 !important;
  13. }
  14. a:hover {
  15. color: blue;
  16. cursor: pointer;
  17. text-decoration: underline;
  18. }
  19. .layui-btn-xs,.layui-btn-xs:hover {
  20. border: 1px solid #249EFB;
  21. background-color: #fff;
  22. color: #249EFB;
  23. padding: 0px 10px;
  24. }
  25. .layui-btn-danger,.layui-btn-danger:hover{
  26. color: #FF5722;
  27. background-color: #fff;
  28. border: 1px solid #FF5722;
  29. padding: 0px 10px;
  30. }
  31. </style>
  32. <body>
  33. <div class="layui-fluid">
  34. <div class="layui-row layui-col-space15">
  35. <div class="layui-col-md12">
  36. <div class="layui-card">
  37. <div class="layui-card-body">
  38. <div class="layui-form">
  39. <span style="color: darkgreen;margin-left: 15px;">注:只有激活的活动能设置相关录制视频播放,且只能设置一个播放源。</span>
  40. </div>
  41. <table class="layui-hide" id="records" lay-filter="records"></table>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. {/block}
  48. {block name="js"}
  49. <script src="__STATIC__/js/jquery.min.js"></script>
  50. <script type="text/html" id="nameTpl">
  51. <span>{{d.customed_name?d.customed_name:d.vod_name}}</span>
  52. </script>
  53. <script type="text/html" id="durationTpl">
  54. <span>{{d.duration_text}}</span>
  55. </script>
  56. <script type="text/html" id="statusTpl">
  57. <span style=" {{d.handle_status?'':d.vod_name.indexOf('_cut') > 0?'color:green' : 'color:red'}} ">{{d.handle_status?d.handle_status+'...':d.vod_name.indexOf('_cut') > 0?'[已剪辑]' : '[原视频]'}}</span>
  58. </script>
  59. <script type="text/html" id="pipeTpl">
  60. <span>{{d.vod_name.indexOf('_cut') > 0?'视频剪辑' : '客户推流'}}</span>
  61. </script>
  62. <script type="text/html" id="viewvod">
  63. <a class="layui-btn layui-btn-xs" lay-event="preview" style="{{d.handle_status?'display:none;': ''}}">预览</a>
  64. {{# if(d.vod_status == 2){ }}
  65. <a class="layui-btn layui-btn-xs" lay-event="edit" style="{{d.handle_status?'display:none;': d.vod_name.indexOf('_cut') > 0 ? 'display:none;' :'display:inline-block;'}}">编辑</a>
  66. <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del" style="{{d.handle_status?'display:none;': d.vod_name.indexOf('_cut') > 0 ? 'display:inline-block;' : 'display:none;'}}">删除</a>
  67. {{# } }}
  68. <a class="layui-btn layui-btn-xs" style="{{d.handle_status?'display:none;': ''}}" href="{{d.vod_media_url}}?download_name={{d.vod_name}}.MP4" target="_blank" download>下载</a>
  69. </script>
  70. <script type="text/html" id="switchTpl">
  71. <input type="checkbox" name="state" value="{{d.id}}" lay-skin="switch" lay-text="开|关" lay-filter="state" {{
  72. d.state== 1 ? 'checked ' : '' }} {{d.handle_status?'disabled="disabled"':''}} >
  73. </script>
  74. <script>
  75. var vodurl = '{:url("broad/course_record_list")}';
  76. var addurl = '{:url("course/add")}';
  77. var editurl = '{:url("course/edit")}';
  78. var delurl = '{:url("course/delete")}';
  79. var linksurl = '{:url("course/links")}';
  80. var lookurl = '{:url("course/total")}';
  81. var vodprevivewurl = '{:url("course/recordpreview")}';
  82. var vodediturl = '{:url("course/recordedit")}';
  83. var delvodurl = '{:url("course/voddelete")}';
  84. var checkEditTimesUrl = '{:url("course/checkeditnum")}';
  85. var ta;
  86. layui.use(['table', 'form'], function () {
  87. var form = layui.form
  88. , table = layui.table
  89. , $ = layui.jquery
  90. , active = {
  91. reload : function () {
  92. var title = $('#title');
  93. //执行重载
  94. table.reload('recordTable', {
  95. page : {
  96. curr: 1 //重新从第 1 页开始
  97. }
  98. , where: {
  99. title: title.val()
  100. }
  101. });
  102. },
  103. preview : function () {
  104. var vid = this.data.id;
  105. layer.open({
  106. title: ['预览', 'color:#333333;background-color:#D8E6F1;'],
  107. type : 2,
  108. content: vodprevivewurl + '?vid=' + vid,
  109. resize: false,
  110. area : ['80%', '80%']
  111. });
  112. }
  113. , links : function () {
  114. layer.open({
  115. title: ['直播流地址', 'color:#333333;background-color:#D8E6F1;']
  116. , type : 2
  117. , content: linksurl + '?cid=' + this.data.cid
  118. , resize: false
  119. , area : ['80%', '80%']
  120. });
  121. }
  122. , add : function () {
  123. location.href = addurl;
  124. }
  125. , edit : function () {
  126. var cid = this.data.cid;
  127. var vid = this.data.id;
  128. $.get(checkEditTimesUrl+'?cid='+cid, function (res) {
  129. if (res.code == 0) {
  130. if(!res.number || res.number < 3){
  131. layer.open({
  132. title: ['剪辑', 'color:#333333;background-color:#D8E6F1;'],
  133. type : 2,
  134. content: vodediturl + '?vid=' + vid,
  135. resize: false,
  136. area : ['80%', '80%']
  137. });
  138. }else{
  139. layer.msg('视频编辑不能超过三次', {anim: 6});
  140. }
  141. } else {
  142. layer.msg(res.msg, {anim: 6});
  143. }
  144. });
  145. }
  146. , data : function () {
  147. var id = this.data.cid;
  148. $.get(lookurl + '?id=' + id, function (res) {
  149. layer.open({
  150. type : 1,
  151. title: ['观摩统计', 'color:#333333;background-color:#D8E6F1;'],
  152. resize: false,
  153. content: res.data
  154. });
  155. })
  156. }, del : function () {
  157. var vid = this.data.id;
  158. layer.confirm('确定要删除选中的视频?',{title: ['信息', 'color:#333333;background-color:#D8E6F1;'],}, function (index) {
  159. $.post(delvodurl, {'vid': vid}, function (res) {
  160. if (res.code == 0) {
  161. layer.msg('删除成功', {anim: 0}, function () {
  162. location.reload();
  163. });
  164. } else {
  165. layer.msg(res.mgs, {anim: 6});
  166. }
  167. });
  168. });
  169. }
  170. };
  171. //展示已知数据
  172. ta = table.render({
  173. elem : '#records'
  174. , url : vodurl + '?cid=' + '{$cid}'
  175. , page : true
  176. , height : 'full-80'
  177. , autoSort: true
  178. , cols : [[ //标题栏
  179. {type: 'numbers', title: '序号', fixed: 'left', width: 50}
  180. , {title: '文件名', width: 120, templet: '#nameTpl'}
  181. // , {field: 'vod_name', title: '文件名', width: 120}
  182. // , {field: 'recording_starts_at', title: '开始时间', width: 120, sort: true}
  183. , {title: '来源', width: 100, templet: '#pipeTpl'}
  184. , {field: 'recording_ends_at', title: '更新时间', width: 120, sort: true}
  185. , {title: '时长', templet: '#durationTpl'}
  186. , {title: '状态', templet: '#statusTpl'}
  187. , {field: 'state', title: '状态', width: 80, templet: '#switchTpl', unresize: true}
  188. , {title: '操作', toolbar: '#viewvod', width: 160}
  189. ]]
  190. , id : 'recordTable'
  191. });
  192. $('.layui-form>.layui-btn').on('click', function () {
  193. var type = $(this).data('type');
  194. active[type] ? active[type].call(this) : '';
  195. });
  196. table.on('sort(records)', function (obj) {
  197. table.reload('recordTable', {
  198. initSort: obj
  199. , where : obj
  200. });
  201. });
  202. table.on('toolbar(records)', function (obj) {
  203. var type = obj.event;
  204. active[type] ? active[type].call(this) : '';
  205. });
  206. table.on('tool(records)', function (obj) {
  207. var type = obj.event;
  208. active[type] ? active[type].call(obj) : '';
  209. })
  210. form.on('switch(state)', function (obj) {
  211. var id = this.value;
  212. var cid = '{$cid}';
  213. if (!obj.elem.checked) {
  214. var state = false;
  215. } else {
  216. state = true;
  217. }
  218. $.post('{:url("course/vodstate")}', {id: id, cid: cid, state: state}, function (res) {
  219. if (res.code == 0) {
  220. layer.msg(res.msg, {anim: 0}, function () {
  221. });
  222. } else {
  223. layer.msg(res.msg, {anim: 6});
  224. }
  225. table.reload('recordTable', {
  226. page: {
  227. curr: 1 //重新从第 1 页开始
  228. }
  229. });
  230. });
  231. });
  232. });
  233. </script>
  234. {/block}