<!DOCTYPE html>
<!--[if IE 8]>
  <html lang="en" class="ie8 no-js">
  <![endif]-->
<!--[if IE 9]>
    <html lang="en" class="ie9 no-js">
    <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->

<head>
<base href="#springUrl('/assets/adminlte/')" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
	name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet"
	href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet"
	href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet"
	href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet"
	href="plugins/daterangepicker/daterangepicker-bs3.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet"
	href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!--validate css-->
<link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
<!--fileinput css-->
<link rel="stylesheet"
	href="plugins/ztree/css/metroStyle/metroStyle.css" type="text/css" />
<link rel="stylesheet"
	href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<link rel="stylesheet"
	href="plugins/daterangepicker/daterangepicker-bs3.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
          <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
<style type="text/css"></style>

<style>
.datepicker.dropdown-menu {
	z-index: 100000 !important
}
</style>
</head>
<!-- END HEAD -->

<body class="hold-transition skin-blue sidebar-mini">

	<div id="hiddenDiv" style="display:none">$!{newsMedia.content}</div>

	<div class="wrapper">
		<div id="treeSelect"></div>
		<div class="content-wrapper" style="margin-left: 0;">
			<section class="content-header">
				<h1>
					图库管理 <small>编辑图</small>
				</h1>
				<ol class="breadcrumb">
					<li><a href="#"> <i class="fa fa-dashboard"></i>首页
					</a></li>
					<li><a class="active">图库管理</a></li>
				</ol>
			</section>
			<!-- Main content -->
			<section class="content">
				<div class="row">
					<div class="col-xs-11">
						<div class="box box-primary">
							<form role="form" id="imageTextForm" enctype="multipart/form-data">
								<div class="box-body">
                                <div class="form-group form-md-line-input" id="bannerNewImgTitle"> 
                                    <label style="width:100%;" for="brandname">图片</label>
                                </div> 
                                <input name="id" id="id" value="$!{image.wxUrl}" style="display:none"/>
                                <div class="form-group form-md-line-input" id="bannerNewImg"> 
                                    <div class="fileinput fileinput-new" data-provides="fileinput">
                                        <div style="float:left;margin-right:15px;">
                                        	<div class="fileinput-preview thumbnail" data-trigger="fileinput"
	                                             style="width: 200px; height: 150px;">
	                                              #if($image.wxUrl) 
	                                             <img id='img_1' src='$!{image.wxUrl}'>
	                                             #end 
	                                        </div> 
	                                        <div>
	                                                <span class="btn btn-default btn-file"> 
														<span class="fileinput-new">
														选择图片 </span>
														<span class="fileinput-exists">
														更换 </span>
														<input type="file" name="file" id="file" class="file-loading">
	                                                </span> 
	                                            <a href="javascript:;" class="btn btn-danger fileinput-exists"  
	                                               data-dismiss="fileinput">移除 </a> 
	                                        </div>
                                        </div>
                                    </div>
                                </div>

									<input type="text" style="display: none" name="_csrf" value="${_csrf.token}"/>
									<input  type="text" style="display: none" name="_csrf_header" value="${_csrf.headerName}"/>

                            </div>
								<div class="box-footer">
									<input class="btn btn-primary" id="save" value="保存"
										type="submit"> <a href="#springUrl('/a/imageMedia/imageMediaList')"
										class="btn btn-default">取消</a>
								</div>
							</form>
						</div>
					</div>
				</div>
			</section>
		</div>
		<div class="control-sidebar-bg"></div>
	</div>
	<!-- ./wrapper -->
	<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
	<!-- Bootstrap 3.3.5 -->
	<script src="bootstrap/js/bootstrap.min.js"></script>
	<!-- SlimScroll -->
	<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
	<!-- FastClick -->
	<script src="plugins/fastclick/fastclick.min.js"></script>
	<!--fileinput js-->
	<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
	<!-- AdminLTE App -->
	<script src="dist/js/app.min.js"></script>
	<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js"
		type="text/javascript"></script>
	<script src="plugins/security/sha256.js" type="text/javascript"></script>
	<script src="plugins/ztree/js/jquery.ztree.all.min.js"
		type="text/javascript"></script>
	<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
	<script src="js/jquery.form.min.js"></script>
	<!-- Uedit Start -->
	<script type="text/javascript" charset="utf-8"
		src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8"
		src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
	<!-- Uedit End -->
	<script type="text/javascript" charset="utf-8"
		src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
	<script src="common/js/cfapp.js"></script>
	<script src="plugins/datepicker/bootstrap-datepicker.js"></script>
	<script src="plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
	<!-- END PAGE LEVEL PLUGINS -->
	<script>
	 $().ready(function () {
	        Cfapp.init();   
	        $("#imageTextForm").validate({
	            rules: {
	            	
	            },
	            messages: {
	             
	            }, 
	            submitHandler: function(form) {
	            	  if($("#bannerNewImg .fileinput").find("img").length==0){
	            		  var HTML="<label id='content-error' class='error' for='content'>请选择图片</label>";
	                 		$("#bannerNewImg").append(HTML); 
	                 		return 
	            	  } 
	            	  var options = {
	          				url : "#springUrl('/a/imageMedia/addImageForm')",
	          				type : "POST", 
	          				dataType: "json",  
	          				contentType : "application/x-www-form-urlencoded; charset=utf-8",
	          				success : function(data) {  
	          					if(data.errorNo == 0){
	          						Cfapp.alert({
	                	                  message: "上传成功",
	                	                  btnoktext: "确定",
	                	                  success: function () {
	                	                 location.href="#springUrl('/a/imageMedia/imageMediaList')";
	                	                  } 
	                	              }); 
	          					}else if(data.errorNo == 3){
	          						 Cfapp.alert({
	          	           	    		  message: "文件过大(最大为1M)",
	          	                             btntext: "确定", 
	          	        	                  success: function () {
	          	        	                  }
	          	        	         });
	          					}else if(data.errorNo == 4){
	         						 Cfapp.alert({
	         	           	    		  message: "仅支持jpg、png文件",
	         	                             btntext: "确定",  
	         	        	                  success: function () {
	         	        	                  } 
	         	        	         });
	         					}else{ 
	         						 Cfapp.alert({
	         	           	    		  message: "上传失败",
	         	                             btntext: "确定",  
	         	        	                  success: function () {
	         	        	                  } 
	         	        	         });
	         					}
	          				} 
	          			};
	          	 
	                 $("#imageTextForm").ajaxSubmit(options);  
	            } 
	          });
	        
	        
	        
	         
	       		

	    });
	    
	</script>
</body>
<!-- END BODY -->
</html>