springMvc+webUploader圖片從後臺取出,回顯後,新增圖片刪除功能
阿新 • • 發佈:2019-02-01
$list.on("click", "#iIcon", function() {
picNum -= 1;
var Id = $(this).parent().attr("id");
if(Id.indexOf("KUEMS_")<0){
uploader.removeFile(uploader.getFile(Id, true));
}
$(this).parent().parent().remove();
$("#photos").attr("value", getAllFilePath());
alert($("#photos").val());
var li = $("#fileList li").length - 1;
if (li >= 3) {
$("#filePicker").css("display", "none");
}
if (li < 3) {
$("#upload").css("display", "none");
$("#filePicker").css("display", "block");
}
});
CheckLength();
function CheckLength() {
var sumLength;
var li = $(".thumbsInfo ul li").length;
var iLenght3 = $('#fileList input:hidden').length;
sumLength = li + iLenght3;
$("#changeText").html("(" + (sumLength) + "/5)");
if (sumLength < 5) {
$("#fileList").css("display", "block");
}
}
}
function getAllFilePath() {
var path = "";
var input = $('#fileList .upload-state-done input:hidden');
if (input.length > 0) {
for (var i = 0; i < input.length; i++) {
path = path + input[i].value + ",";
}
}
return path;
}
picNum -= 1;
var Id = $(this).parent().attr("id");
if(Id.indexOf("KUEMS_")<0){
uploader.removeFile(uploader.getFile(Id, true));
}
$(this).parent().parent().remove();
$("#photos").attr("value", getAllFilePath());
alert($("#photos").val());
var li = $("#fileList li").length - 1;
if (li >= 3) {
$("#filePicker").css("display", "none");
}
if (li < 3) {
$("#upload").css("display", "none");
$("#filePicker").css("display", "block");
}
});
CheckLength();
function CheckLength() {
var sumLength;
var li = $(".thumbsInfo ul li").length;
var iLenght3 = $('#fileList input:hidden').length;
sumLength = li + iLenght3;
$("#changeText").html("(" + (sumLength) + "/5)");
if (sumLength < 5) {
$("#fileList").css("display", "block");
}
}
}
function getAllFilePath() {
var path = "";
var input = $('#fileList .upload-state-done input:hidden');
if (input.length > 0) {
for (var i = 0; i < input.length; i++) {
path = path + input[i].value + ",";
}
}
return path;
}