123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- {extend name="public/layout"}
- {block name="body"}
- <style>
- html,body {
- background-color: #fff;
- }
- a {
- color: blue;
- }
- .layui-table thead tr,
- .layui-table-header {
- background-color: #D8E6F1 !important;
- }
- a:hover {
- color: blue;
- cursor: pointer;
- text-decoration: underline;
- }
- .layui-btn-xs,.layui-btn-xs:hover {
- border: 1px solid #249EFB;
- background-color: #fff;
- color: #249EFB;
- padding: 0px 10px;
- }
- .layui-btn-danger,.layui-btn-danger:hover{
- color: #FF5722;
- background-color: #fff;
- border: 1px solid #FF5722;
- padding: 0px 10px;
- }
- </style>
- <body>
- <div class="layui-fluid">
- <div class="layui-row layui-col-space15">
- <div class="layui-col-md12">
- <div class="layui-card">
- <div class="layui-card-body">
- <div class="layui-form">
- <span style="color: darkgreen;margin-left: 15px;">注:只有激活的活动能设置相关录制视频播放,且只能设置一个播放源。</span>
- </div>
- <table class="layui-hide" id="records" lay-filter="records"></table>
- </div>
- </div>
- </div>
- </div>
- </div>
- {/block}
- {block name="js"}
- <script src="__STATIC__/js/jquery.min.js"></script>
- <script type="text/html" id="nameTpl">
- <span>{{d.customed_name?d.customed_name:d.vod_name}}</span>
- </script>
- <script type="text/html" id="durationTpl">
- <span>{{d.duration_text}}</span>
- </script>
- <script type="text/html" id="statusTpl">
- <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>
- </script>
- <script type="text/html" id="pipeTpl">
- <span>{{d.vod_name.indexOf('_cut') > 0?'视频剪辑' : '客户推流'}}</span>
- </script>
- <script type="text/html" id="viewvod">
- <a class="layui-btn layui-btn-xs" lay-event="preview" style="{{d.handle_status?'display:none;': ''}}">预览</a>
- {{# if(d.vod_status == 2){ }}
- <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>
- <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>
- {{# } }}
- <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>
- </script>
- <script type="text/html" id="switchTpl">
- <input type="checkbox" name="state" value="{{d.id}}" lay-skin="switch" lay-text="开|关" lay-filter="state" {{
- d.state== 1 ? 'checked ' : '' }} {{d.handle_status?'disabled="disabled"':''}} >
- </script>
- <script>
- var vodurl = '{:url("broad/course_record_list")}';
- var addurl = '{:url("course/add")}';
- var editurl = '{:url("course/edit")}';
- var delurl = '{:url("course/delete")}';
- var linksurl = '{:url("course/links")}';
- var lookurl = '{:url("course/total")}';
- var vodprevivewurl = '{:url("course/recordpreview")}';
- var vodediturl = '{:url("course/recordedit")}';
- var delvodurl = '{:url("course/voddelete")}';
- var checkEditTimesUrl = '{:url("course/checkeditnum")}';
- var ta;
- layui.use(['table', 'form'], function () {
- var form = layui.form
- , table = layui.table
- , $ = layui.jquery
- , active = {
- reload : function () {
- var title = $('#title');
- //执行重载
- table.reload('recordTable', {
- page : {
- curr: 1 //重新从第 1 页开始
- }
- , where: {
- title: title.val()
- }
- });
- },
- preview : function () {
- var vid = this.data.id;
- layer.open({
- title: ['预览', 'color:#333333;background-color:#D8E6F1;'],
- type : 2,
- content: vodprevivewurl + '?vid=' + vid,
- resize: false,
- area : ['80%', '80%']
- });
- }
- , links : function () {
- layer.open({
- title: ['直播流地址', 'color:#333333;background-color:#D8E6F1;']
- , type : 2
- , content: linksurl + '?cid=' + this.data.cid
- , resize: false
- , area : ['80%', '80%']
- });
- }
- , add : function () {
- location.href = addurl;
- }
- , edit : function () {
- var cid = this.data.cid;
- var vid = this.data.id;
- $.get(checkEditTimesUrl+'?cid='+cid, function (res) {
- if (res.code == 0) {
- if(!res.number || res.number < 3){
- layer.open({
- title: ['剪辑', 'color:#333333;background-color:#D8E6F1;'],
- type : 2,
- content: vodediturl + '?vid=' + vid,
- resize: false,
- area : ['80%', '80%']
- });
- }else{
- layer.msg('视频编辑不能超过三次', {anim: 6});
- }
- } else {
- layer.msg(res.msg, {anim: 6});
- }
- });
- }
- , data : function () {
- var id = this.data.cid;
- $.get(lookurl + '?id=' + id, function (res) {
- layer.open({
- type : 1,
- title: ['观摩统计', 'color:#333333;background-color:#D8E6F1;'],
- resize: false,
- content: res.data
- });
- })
- }, del : function () {
- var vid = this.data.id;
- layer.confirm('确定要删除选中的视频?',{title: ['信息', 'color:#333333;background-color:#D8E6F1;'],}, function (index) {
- $.post(delvodurl, {'vid': vid}, function (res) {
- if (res.code == 0) {
- layer.msg('删除成功', {anim: 0}, function () {
- location.reload();
- });
- } else {
- layer.msg(res.mgs, {anim: 6});
- }
- });
- });
- }
- };
- //展示已知数据
- ta = table.render({
- elem : '#records'
- , url : vodurl + '?cid=' + '{$cid}'
- , page : true
- , height : 'full-80'
- , autoSort: true
- , cols : [[ //标题栏
- {type: 'numbers', title: '序号', fixed: 'left', width: 50}
- , {title: '文件名', width: 120, templet: '#nameTpl'}
- // , {field: 'vod_name', title: '文件名', width: 120}
- // , {field: 'recording_starts_at', title: '开始时间', width: 120, sort: true}
- , {title: '来源', width: 100, templet: '#pipeTpl'}
- , {field: 'recording_ends_at', title: '更新时间', width: 120, sort: true}
- , {title: '时长', templet: '#durationTpl'}
- , {title: '状态', templet: '#statusTpl'}
- , {field: 'state', title: '状态', width: 80, templet: '#switchTpl', unresize: true}
- , {title: '操作', toolbar: '#viewvod', width: 160}
- ]]
- , id : 'recordTable'
- });
- $('.layui-form>.layui-btn').on('click', function () {
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- table.on('sort(records)', function (obj) {
- table.reload('recordTable', {
- initSort: obj
- , where : obj
- });
- });
- table.on('toolbar(records)', function (obj) {
- var type = obj.event;
- active[type] ? active[type].call(this) : '';
- });
- table.on('tool(records)', function (obj) {
- var type = obj.event;
- active[type] ? active[type].call(obj) : '';
- })
- form.on('switch(state)', function (obj) {
- var id = this.value;
- var cid = '{$cid}';
- if (!obj.elem.checked) {
- var state = false;
- } else {
- state = true;
- }
- $.post('{:url("course/vodstate")}', {id: id, cid: cid, state: state}, function (res) {
- if (res.code == 0) {
- layer.msg(res.msg, {anim: 0}, function () {
- });
- } else {
- layer.msg(res.msg, {anim: 6});
- }
- table.reload('recordTable', {
- page: {
- curr: 1 //重新从第 1 页开始
- }
- });
- });
- });
- });
- </script>
- {/block}
|