Commit 15b6b737 by lixiaofeng

提交

1 parent aced5637
Showing with 15 additions and 11 deletions
...@@ -9,20 +9,24 @@ $(function(){ ...@@ -9,20 +9,24 @@ $(function(){
fileSize : 1024 * 1024 * 10 // 上传文件的大尿 10M fileSize : 1024 * 1024 * 10 // 上传文件的大尿 10M
}; };
/*点击图片的文本框*/ /*点击图片的文本框*/
var upArr=[]
$(".file").change(function(){ $(".file").change(function(){
var idFile = $(this).attr("id"); var idFile = $(this).attr("id");
var file = document.getElementById(idFile); var file = document.getElementById(idFile);
var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元紿 var imgContainer = $(this).parents(".z_photo"); //存放图片的父亲元紿
var fileList = file.files; //获取的图片文仿 var fileList = file.files; //获取的图片文仿
upArr.push(fileList)
console.log(upArr)
console.log(fileList)
var input = $(this).parent();//文本框的父亲元素 var input = $(this).parent();//文本框的父亲元素
var imgArr = []; var imgArr = [];
//遍历得到的图片文仿 //遍历得到的图片文仿
var numUp = imgContainer.find(".up-section").length; var numUp = imgContainer.find(".up-section").length;
var totalNum = numUp + fileList.length; //总的数量 var totalNum = numUp + fileList.length; //总的数量
if(fileList.length > 5 || totalNum > 5 ){ // if(fileList.length > 5 || totalNum > 5 ){
alert("上传图片数目不可以超迿5个,请重新选择"); //一次选择上传超过5张 或者是已经上传和这次上传的到的总数也不可以超过5张 // alert("上传图片数目不可以超迿5个,请重新选择"); //一次选择上传超过5张 或者是已经上传和这次上传的到的总数也不可以超过5张
} // }
else if(numUp < 5){ // else if(numUp < 5){
fileList = validateUp(fileList); fileList = validateUp(fileList);
for(var i = 0;i<fileList.length;i++){ for(var i = 0;i<fileList.length;i++){
var imgUrl = window.URL.createObjectURL(fileList[i]); var imgUrl = window.URL.createObjectURL(fileList[i]);
...@@ -51,15 +55,15 @@ $(function(){ ...@@ -51,15 +55,15 @@ $(function(){
$input2.appendTo($section); $input2.appendTo($section);
} }
} // }
setTimeout(function(){ setTimeout(function(){
$(".up-section").removeClass("loading"); $(".up-section").removeClass("loading");
$(".up-img").removeClass("up-opcity"); $(".up-img").removeClass("up-opcity");
},450); },450);
numUp = imgContainer.find(".up-section").length; numUp = imgContainer.find(".up-section").length;
if(numUp >= 5){ // if(numUp >= 5){
$(this).parent().hide(); // $(this).parent().hide();
} // }
}); });
...@@ -72,9 +76,9 @@ $(function(){ ...@@ -72,9 +76,9 @@ $(function(){
$(".wsdel-ok").click(function(){ $(".wsdel-ok").click(function(){
$(".works-mask").hide(); $(".works-mask").hide();
var numUp = delParent.siblings().length; var numUp = delParent.siblings().length;
if(numUp < 6){ // if(numUp < 6){
delParent.parent().find(".z_file").show(); // delParent.parent().find(".z_file").show();
} // }
delParent.remove(); delParent.remove();
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!