$("-sharpadd_link").click(function(){
var link_html = "<div class=\"linkAll_inn\">" +
"<div class=\"activity_theme\">" +
"<div class=\"activity_theme_text \"><span class=\"xing\">*</span></div>" +
"<input type=\"text\" placeholder=\"\" class=\"activity_theme_input w391 position17\" id=\"speaker\">" +
"</div>" +
"<div class=\"activity_theme \">" +
"<div class=\"activity_theme_text\"><span class=\"xing\">*</span></div>" +
"<textarea placeholder=\"\" class=\"activity_theme_area position-17\" id=\"speakerDesc\"></textarea>" +
"</div>" +
"<div class=\"activity_theme\">" +
"<div class=\"activity_theme_text \"><span class=\"xing\">*</span></div>" +
"<input type=\"text\" placeholder=\"\" class=\"activity_theme_input w391 position34\" id=\"source\">" +
"</div>" +
"<div class=\"activity_theme\">" +
"<div class=\"activity_theme_text\"><span class=\"xing\">*</span></div>" +
"<input type=\"text\" placeholder=\"\" id=\"demo-2\" class=\"activity_theme_input w191\" id=\"startDate\" value=\"\">" +
"</div>" +
"<div class=\"activity_theme\">" +
"<div class=\"activity_theme_text\"><span class=\"xing\">*</span></div>" +
"<input type=\"text\" placeholder=\"\" id=\"demo-4\" class=\"activity_theme_input w191\" id=\"endDate\">" +
"</div>" +
"<div class=\"activity_theme\">" +
"<div class=\"activity_theme_text\"><span class=\"xing\"></span></div>" +
"<button class=\"fil_mp4 layui-btn videos\"><i class=\"layui-icon\"></i></button>" +
"</div>" +
"<div class=\"activity_theme\">" +
"<div class=\"activity_theme_text\"><span class=\"xing\"></span></div>" +
"<div class=\"layui-upload\">" +
"<button type=\"button\" class=\"layui-btn layui-btn-normal fil_mp4\" id=\"testList\"></button>" +
"<div class=\"layui-upload-list\">" +
"<table class=\"layui-table\">" +
"<thead>" +
"<tr><th></th>" +
"<th></th>" +
"<th></th>" +
"<th></th>" +
"</tr></thead>" +
"<tbody id=\"demoList\"></tbody>" +
"</table>" +
"</div>" +
"<button type=\"button\" class=\"layui-btn\" id=\"testListAction\" style=\"background:-sharp1a95f0;color:-sharpfff;\"></button>" +
"</div>" +
"</div>" +
"<div class=\"hr_add\"></div>" +
"</div>";
$(".linkAll").append(link_html);
});
//
layui.use("upload", function(){
var $ = layui.jquery;
var upload = layui.upload;
//
upload.render({
elem: ".videos" //
,url: "/upload/" //
,accept: "video"
,done: function(res){
//
}
,error: function(){
//
}
});
upload.render({
elem: ".texts" //
,url: "/upload/" //
,done: function(res){
//
}
,error: function(){
//
}
});
var demoListView = $("-sharpdemoList");
var uploadListIns = upload.render({
elem: "-sharptestList"
,url: "${linkPrefix}/onlineClass/video" //
,accept: "file"
,multiple: true
,auto: false
,bindAction: "-sharptestListAction"
,choose: function(obj){
var files = obj.pushFile(); //
//
obj.preview(function(index, file, result){
var tr = $(["<tr id="upload-"+ index +"">"
,"<td>"+ file.name +"</td>"
,"<td>"+ (file.size/1014).toFixed(1) +"kb</td>"
,"<td></td>"
,"<td>"
,"<button class="layui-btn layui-btn-mini demo-reload layui-hide"></button>"
,"<button class="layui-btn layui-btn-mini layui-btn-danger demo-delete"></button>"
,"</td>"
,"</tr>"].join(""));
//
tr.find(".demo-reload").on("click", function(){
obj.upload(index, file);
});
//
tr.find(".demo-delete").on("click", function(){
delete files[index]; //
tr.remove();
});
demoListView.append(tr);
});
}
,done: function(res, index, upload){
if(res.code == 0){ //
var tr = demoListView.find("tr-sharpupload-"+ index)
,tds = tr.children();
tds.eq(2).html("<span style="color: -sharp5FB878;"></span>");
tds.eq(3).html(""); //
delete files[index]; //
return;
}
this.error(index, upload);
}
,error: function(index, upload){
var tr = demoListView.find("tr-sharpupload-"+ index)
,tds = tr.children();
tds.eq(2).html("<span style="color: -sharpFF5722;"></span>");
tds.eq(3).find(".demo-reload").removeClass("layui-hide"); //
}
});
});