135 lines
3.9 KiB
JavaScript
135 lines
3.9 KiB
JavaScript
function getVideo(id){
|
|
$.ajax({
|
|
url:"../../dataservice?serviceobj=UIvio&action=getAllVideo",
|
|
data:{"id":id},
|
|
type: "post",
|
|
dataType: "json",
|
|
success:function(jsonDate){
|
|
var obj = JSON.stringify(jsonDate);
|
|
obj = JSON.parse(obj);
|
|
for(var key in obj) { //第一层循环取到各个list
|
|
var List = obj[key];
|
|
var str ="";
|
|
for(var student in List) { //第二层循环取list中的对象
|
|
str+='<ul style="width: auto;">'
|
|
+'<li style="width: auto;">'
|
|
+'<img src="/ect/upload/videos/image/'+List[student].url+'.jpg" onclick="paluVido('+List[student].id+');" width="250" height="150"/>'
|
|
+'<p>名称:'+List[student].name+'</p>'
|
|
+'<p>上传时间:'+List[student].startTime+'</p>'
|
|
+'<p>视频类型:'+List[student].type+'</p>'
|
|
+'<p>下载次数:'+List[student].dowloadMum+'</p>';
|
|
if(List[student].isDownLoad=="1"){
|
|
str+='<a href="/ect/upload/videos/'+List[student].url+'.'+List[student].fristFormat+'" onclick="downLoadNum('+List[student].id+');">下载</a>';
|
|
}else{
|
|
str+='<a>不予下载</a>';
|
|
}
|
|
str+='</li>'
|
|
+'</ul>';
|
|
|
|
}
|
|
$("#videosdiv").html("");
|
|
$("#videosdiv").append(str);
|
|
if(id==10){
|
|
$("#names").text("技术视频");
|
|
}
|
|
if(id==20){
|
|
$("#names").text("安全视频");
|
|
}
|
|
if(id==30){
|
|
$("#names").text("质量视频");
|
|
}
|
|
if(id==40){
|
|
$("#names").text("技能视频");
|
|
}
|
|
|
|
}
|
|
},
|
|
error:function(){
|
|
alert("失败");
|
|
}
|
|
});
|
|
}
|
|
|
|
function paluVido(id){ //播放
|
|
window.open("../UIDeuVideo/playVideo.jsp?id="+id);
|
|
}
|
|
|
|
function download(id){//下载
|
|
}
|
|
|
|
function allvideo(id){
|
|
window.location.href="../UIDeuVideo/AllVideo.jsp?id="+id;
|
|
}
|
|
function downLoadNum(id){//下载次数
|
|
$.ajax({
|
|
url:"../../dataservice?serviceobj=UIvio&action=downLoadNum&id="+id,
|
|
data:{"id":id},
|
|
type:"post",
|
|
dataType:"json",
|
|
success:function(result){
|
|
},
|
|
error:function(result){
|
|
alert("执行失败");
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function getAll5Video(id){
|
|
$.ajax({
|
|
url:"../../dataservice?serviceobj=UIvio&action=getAllVideo",
|
|
data:{"id":id},
|
|
type: "post",
|
|
dataType: "json",
|
|
success:function(jsonDate){
|
|
var obj = JSON.stringify(jsonDate);
|
|
obj = JSON.parse(obj);
|
|
for(var key in obj) { //第一层循环取到各个list
|
|
var List = obj[key];
|
|
var str ="";
|
|
for(var student in List) { //第二层循环取list中的对象
|
|
str+='<ul style="width: auto;">'
|
|
+'<li style="width: auto;">'
|
|
+'<img src="/ect/upload/videos/image/'+List[student].url+'.jpg" onclick="paluVido('+List[student].id+');" width="250" height="150"/>'
|
|
+'<p>名称:'+List[student].name+'</p>'
|
|
+'<p>上传时间:'+List[student].startTime+'</p>'
|
|
+'<p>视频类型:'+List[student].type+'</p>'
|
|
+'<p>下载次数:'+List[student].dowloadMum+'</p>'
|
|
if(List[student].isDownLoad=="1"){
|
|
str+='<a href="/ect/upload/videos/'+List[student].url+'.'+List[student].fristFormat+'" onclick="downLoadNum('+List[student].id+');">下载</a>';
|
|
}else{
|
|
str+='<a>不予下载</a>';
|
|
}
|
|
str+='</li>'
|
|
+'</ul>';
|
|
}
|
|
/*if(id!=0){
|
|
str+='<div style="float: right;">'
|
|
+'<a onclick="allvideo('+id*10+')">更多>></a>'
|
|
+'</div>';
|
|
}*/
|
|
if("0"==id){ //最新视频
|
|
$("#newVideo").html("");
|
|
$("#newVideo").append(str);
|
|
}
|
|
if("1"==id){ //技术视频
|
|
$("#technologyVideo").html("");
|
|
$("#technologyVideo").append(str);
|
|
}
|
|
if("2"==id){//安全视频
|
|
$("#safetyVideo").html("");
|
|
$("#safetyVideo").append(str);
|
|
}
|
|
if("3"==id){//质量视频
|
|
$("#qualityVideo").html("");
|
|
$("#qualityVideo").append(str);
|
|
}
|
|
|
|
}
|
|
},
|
|
error:function(){
|
|
alert("失败");
|
|
}
|
|
});
|
|
}
|