var params={fileInput:$("#fileImage").get(0),upButton:$("#fileSubmit").get(0),url:$("#uploadForm").attr("action"),filter:function(files){var arrFiles=[];for(var i=0,file;file=files[i];i+=1){if(file.type.indexOf("image")==0){if(file.size>=5120000){mui.alert('您这张"'+file.name+'"图片大小过大','应小于5000kB',function(){})}else{arrFiles=[];arrFiles.push(file)}}else{alert('文件"'+file.name+'"不是图片。')}}return arrFiles},onSelect:function(files){var html='',i=0;$("#preview").html('<div class="upload_loading"></div>');var funAppendImage=function(){file=files[i];if(file){var reader=new FileReader();reader.onload=function(e){html='<div id="uploadList_'+i+'" class="upload_append_list"><p><strong>'+file.name+'</strong><br /><img id="uploadImage_'+i+'" src="'+e.target.result+'" class="upload_image" /></p><span id="uploadProgress_'+i+'" class="upload_progress"></span></div>';i+=1;funAppendImage()};reader.readAsDataURL(file);document.querySelector('.upload_preview').style.background='#ccc'}else{$("#preview").html(html);if(html){$("#fileSubmit").show();document.getElementById("i_want_share").className="mui-btn mui-btn-red"}else{$("#fileSubmit").hide()}}};funAppendImage()},onDelete:function(file){$("#uploadList_"+file.index).fadeOut()},onDragOver:function(){$(this).addClass("upload_drag_hover")},onDragLeave:function(){$(this).removeClass("upload_drag_hover")},onProgress:function(file,loaded,total){var eleProgress=$("#uploadProgress_"+file.index),percent=(loaded/total*100).toFixed(2)+'%';eleProgress.show().html(percent)},onSuccess:function(file,response){$("#uploadInf").append("<p>上传成功，图片地址是："+response+"</p>")},onFailure:function(file){$("#uploadInf").append("<p>图片"+file.name+"上传失败！</p>");$("#uploadImage_"+file.index).css("opacity",0.2)},onComplete:function(){$("#fileSubmit").hide();$("#fileImage").val("");$("#uploadInf").append("<p>当前图片全部上传完毕。</p>")}};ZXXFILE=$.extend(ZXXFILE,params);ZXXFILE.init();var mask=mui.createMask(function(){});mui('body').on('tap','.mui-btn-red',function(){mask.show();});