表单提交前,判断webuploader是否上传

function busUpLoadImg(postUrl,id) {
    .......//省略部分不用修改
  uploader.on('uploadSuccess', function(file) {
        $('#' + file.id).addClass('upload-state-done');
        //验证是否上传上传
        oSuccess = true;
    });
//回调函数验证是否上传
    var oSuccess = false;
    return function(){
        return oSuccess;
    }
}
<input type="text" />
<input type="submit" onclick="subMit()" />
function subMit(){
    fn1 = busUpLoadImg("postUrl",1);
    fn2 = busUpLoadImg("postUrl",2);

  if(!(fn1() && fn2())){
       layer.msg("请上传图片",{time:1500});
       return false;
  }      
}    

 

posted @ 2017-07-02 16:29  Jade_g  阅读(2646)  评论(0编辑  收藏  举报