/** * web-upload 工具类 * * 约定: * 上传按钮的id = 图片隐藏域id + 'BtnId' * 图片预览框的id = 图片隐藏域id + 'PreId' * * @author fengshuonan */ (function() { var $WebUpload = function(pictureId) { this.pictureId = pictureId; this.uploadBtnId = pictureId + "BtnId"; this.uploadPreId = pictureId + "PreId"; this.uploadUrl = Feng.ctxPath + '/mgr/upload'; this.fileSizeLimit = 100 * 1024 * 1024; this.picWidth = 800; this.picHeight = 800; this.uploadBarId = null; }; $WebUpload.prototype = { /** * 初始化webUploader */ init : function() { var uploader = this.create(); this.bindEvent(uploader); return uploader; }, /** * 创建webuploader对象 */ create : function() { var webUploader = WebUploader.create({ auto : true, pick : { id : '#' + this.uploadBtnId, multiple : false,// 只上传一个 }, accept : { title : 'Images', extensions : 'gif,jpg,jpeg,bmp,png', mimeTypes : 'image/gif,image/jpg,image/jpeg,image/bmp,image/png' }, swf : Feng.ctxPath + '/static/js/plugins/webuploader/Uploader.swf', disableGlobalDnd : true, duplicate : true, server : this.uploadUrl, fileSingleSizeLimit : this.fileSizeLimit }); return webUploader; }, /** * 绑定事件 */ bindEvent : function(bindedObj) { var me = this; bindedObj.on('fileQueued', function(file) { var $li = $('