var ballIndex = localStorage.getItem("ballIndex"); var puid = localStorage.getItem("puid"); var tokens = localStorage.getItem("token") var flag = true; layui.use(['element','form','tree','layer'], function () { var element = layui.element; var form = layui.form; var tree = layui.tree; layer = layui.layer; init(); }); function init() { $.ajax({ type: 'get', url: dataUrl + "pictureWeb/getBallPictureByPuid", data: { puid: puid, token: tokens }, success: function (data) { $("#content").empty(); var html = ''; if(data != null && data != ""){ var path = systemPath + data[i].downName+"?token="+localStorage.getItem("token"); for(var i = 0;i < data.length; i++){ html += "
" + "" + "" + "" + "
" + "" + "" + data[i].fileName + "" + "
" + "
" } }else{ html += '
无数据
' } $("#content").append(html); }, error: function (err) { console.log("获取数据出错:", err); } }); } //全选按钮点击 function selectAlls(){ if(flag){ $(".checkbox").prop("checked",true); flag = false; }else{ $(".checkbox").prop("checked",false); flag = true; } } //下载图片 function downImgs(){ var chk_value=[]; var count=0; $('input[name="active"]:checked').each(function(){ // 遍历input输入框中name=active 选中状态的值。 chk_value.push($(this).val()); count+=1; }); console.info("所有为选中状态复选框的值:"+chk_value+",选中状态的个数:"+count) if (count == 0) { return layer.msg("请勾选要下载的数据", {icon: 7, time: 2000}); } if (count > 1) { return layer.msg("请不要勾选多个数据", {icon: 7, time: 2000}); } var form = {"id" : chk_value.toString()}; $.ajax({ type: 'post', url: dataUrl + 'pictureWeb/getPathById', contentType: "application/json; charset=utf-8", data: JSON.stringify(form), dataType: 'json', success: function (data) { if(data.length > 0){ for (var i = 0;i < data.length;i++){ window.open("http://112.31.70.193:1854/icvs/SG/VODFile.flv?path=" + (data[i].path + data[i].fileName) + "&token=" + data[i].token + "&idx=0&stream=0&startTime=20&puid=" + data[0].puid + "&durationSecond=" + data[0].durationSecond) } } } }) } //删除图片 function delImgs(){ var type = ''; var ids = ""; $("input:checkbox[class='checkbox']:checked").each(function(i){ if(0==i){ ids = $(this).next().val(); }else{ ids += (","+$(this).next().val()); } }); if(ids == ""){ return layer.msg('请勾选要删除的图片', {icon: 7, time: 2000}); }else{ layer.confirm('您确定要删除选中的图片吗?', function () { $.ajax({ type: 'post', url: ctxPath + '/picture/delPictureQueryById', contentType: "application/x-www-form-urlencoded; charset=UTF-8", data: { id: ids }, async: false, success: function (data) { if (data == "删除成功") { window.location.reload(); // 刷新页面 layer.msg('删除成功', {icon: 1, time: 3000}); } else { layer.msg('' + data + '', {icon: 2, time: 3000}); window.location.reload() // 刷新页面 } }, error: function (err) { console.log("获取数据出错:", err); } }); }) } }