first commit
This commit is contained in:
77
WebRoot/jsp/user/fileinputHeadPortrait.jsp
Normal file
77
WebRoot/jsp/user/fileinputHeadPortrait.jsp
Normal file
@ -0,0 +1,77 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<script type="text/javascript">
|
||||
|
||||
//初始化fileinput控件(第一次初始化)
|
||||
function initFileInput(ctrlName, uploadUrl) {
|
||||
var control = $('#' + ctrlName);
|
||||
control.fileinput({
|
||||
language: 'zh', //设置语言
|
||||
uploadUrl: uploadUrl, //上传的地址
|
||||
uploadAsync:true,
|
||||
allowedFileExtensions : ['jpg', 'png','gif'],//接收的文件后缀
|
||||
showUpload: false, //是否显示上传按钮
|
||||
showRemove: false,
|
||||
showCaption: false,//是否显示标题
|
||||
showClose:false,//右上角关闭按钮
|
||||
browseClass: "btn btn-primary", //按钮样式
|
||||
maxFileCount: 1, //表示允许同时上传的最大文件个数
|
||||
enctype: 'multipart/form-data',
|
||||
validateInitialCount:true,
|
||||
maxFileSize:2000, //图片最大为2M
|
||||
dropZoneEnabled: false,
|
||||
autoReplace:true,//是否自动替换当前图片
|
||||
previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
|
||||
uploadExtraData:function (previewId, index) { //传参
|
||||
var data = {
|
||||
/* "masterId": '${masterId}', //此处自定义传参
|
||||
"tbName": '${tbName}',
|
||||
"nameSpace": 'HeadPortrait' */
|
||||
};
|
||||
return data;
|
||||
},
|
||||
layoutTemplates:{
|
||||
//图片缩略图上的删除,上传按钮
|
||||
actionDelete:'',
|
||||
actionUpload:''
|
||||
},
|
||||
});
|
||||
control.on("filebatchselected", function (event, data, previewId, index) {
|
||||
$(this).fileinput("upload");
|
||||
});
|
||||
//导入文件上传完成之后的事件
|
||||
control.on("fileuploaded", function (event, data, previewId, index) {
|
||||
if(data.response.suc) {
|
||||
closeModal('fileinputHeadPortraitModal');
|
||||
closeModal('subPasswordModal');
|
||||
goToMainPage();
|
||||
}
|
||||
});
|
||||
}
|
||||
$(function() {
|
||||
initFileInput("filelist",ext.contextPath+ "/user/inputHeadPortrait.do");
|
||||
})
|
||||
</script>
|
||||
<div class="modal fade" id="fileinputHeadPortraitModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">上传头像</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- 新增界面formid强制为subForm -->
|
||||
<form class="form-horizontal" id="fileInputModalForm" style="padding:10px">
|
||||
<div class="form-group" >
|
||||
<input type="file" name="filelist" id="filelist" multiple class="file-loading" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content -->
|
||||
</div>
|
||||
<!-- /.modal-dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user