-----jsp-----
-----js-----
//提交汇款通知
var sa = $("#submitApply");
sa.click(function(e) {
if (sa.prop("disabled"))
return;
e.preventDefault();
e.stopPropagation();
form$.trigger("validate");
});
var cpInput = $("input[name='certificatePic']");
//已选上传凭证删除
$("#certificatePicLi").on("click", ".cf-img-del", function(e) {
e.preventDefault();
e.stopPropagation();
var p = $(this).parent();
uploader.removeFile(p.attr("id"));
p.remove();
});
var form$ = $("#infoForm");
form$.validator({
stopOnError: false,
timely: false,
messages:{
checked:"请选择{0}"
},
invalid:function() {
if ($("input[name='paymentBank']").hasClass("n-invalid"))
$("#paymentBankSelContainer").addClass("n-invalid");
else
$("#paymentBankSelContainer").removeClass("n-invalid");
if (uploader.files.length <= 0) {//最后进行图片验证
form$.validator('showMsg', '#certificatePicErrorTip', {
type: "error",
msg: "请选择上传凭证"
});
} else {
form$.validator('hideMsg', '#certificatePicErrorTip');
}
},
valid:function(form) {
$("#paymentBankSelContainer").removeClass("n-invalid");
if (uploader.files.length <= 0) {
form$.validator('showMsg', '#certificatePicErrorTip', {
type: "error",
msg: "请选择上传凭证"
});
return;
} else {
form$.validator('hideMsg', '#certificatePicErrorTip');
}
if (sa.prop("disabled"))
return;
sa.prop("disabled", true).addClass("cf-disabled");
$("#certificatePicLi").find(".cf-img-del").remove();
uploader.start();//验证通过后开始上传凭证
}
});
var uploader = new plupload.Uploader({
runtimes : 'html5,flash,silverlight,html4',
browse_button : 'pickfiles',
container: document.getElementById('container'),
url : ctxResource + "/plupload/Upload.jsp",
flash_swf_url : ctxResource + '/plupload/Moxie.swf',
silverlight_xap_url : ctxResource + '/plupload/Moxie.xap',
multipart_params:{'customer':'<%=customerId%>'},
filters : {
max_file_num : 3,
max_file_size : '10mb',
mime_types: [
{title : "Image files", extensions : "jpg,jpeg,png,gif"}
]
},
init: {
PostInit: function() {
document.getElementById('certificatePicLi').innerHTML = '';
},
BeforeUpload: function(up, file) {
up.settings.multipart_params.id = file.id;
},
FilesAdded: function(up, files) {
plupload.each(files, function(file) {
document.getElementById('certificatePicLi').innerHTML += '
' + file.name + '删除
';