Pārlūkot izejas kodu

品牌多图修改

2510966293@qq.com 5 gadi atpakaļ
vecāks
revīzija
9a94c7d048

+ 5 - 5
src/main/java/com/yc/education/controller/admin/AdminsBackController.java

@@ -246,7 +246,7 @@ public class AdminsBackController extends BaseController {
 					//
 					String path = request.getSession().getServletContext().getRealPath("/");
 					String contextPath = request.getSession().getServletContext().getContextPath();
-					File localFile = new File(path + "ajaxexcel\\" + fileName);
+					File localFile = new File(path + "ajaxexcel/" + fileName);
 					try {
 						file.transferTo(localFile);
 						// 将图片名称和相对路径存到数据库中
@@ -277,7 +277,7 @@ public class AdminsBackController extends BaseController {
 		System.out.println(url);
 
 		// 上传服务器时把下面注释去除
-        url = url.substring(11, url.length());
+//        url = url.substring(11, url.length());
 		int num = rootPath.split("\\\\").length;
 		System.out.println(num);
 		if ("zip".equals(type)) {
@@ -310,7 +310,7 @@ public class AdminsBackController extends BaseController {
 		System.out.println(url);
 
 		// 上传服务器时把下面注释去除
-        url = url.substring(11, url.length());
+//        url = url.substring(11, url.length());
 		int num = rootPath.split("\\\\").length;
 		System.out.println(num);
 		if ("zip".equals(type)) {
@@ -368,8 +368,8 @@ public class AdminsBackController extends BaseController {
 					//
 					String path = request.getSession().getServletContext().getRealPath("/");
 					String contextPath = request.getSession().getServletContext().getContextPath();
-					File localFile = new File(path+"ajaxupload\\"+fileName);
-					System.err.println(path+"ajaxupload\\"+fileName);
+					File localFile = new File(path+"ajaxupload/"+fileName);
+					System.err.println(path+"ajaxupload/"+fileName);
 					try {
 						file.transferTo(localFile);
 						// 将图片名称和相对路径存到数据库中

+ 217 - 179
src/main/webapp/WEB-INF/jsp/admin/brandAdd.jsp

@@ -44,7 +44,58 @@
     <script type="text/javascript"
             src="${pageContext.request.contextPath}/static/admin/icheck/jquery.icheck.min.js"></script>
     <script src="${pageContext.request.contextPath}/static/admin/manage/js/WdatePicker.js"></script>
-
+    <style>
+        .selfprozslidim dd {
+            border: 1px solid #ccc;
+            display: inline-block;
+            height: 68px;
+            margin: 0 0 10px 10px ;
+            position: relative;
+            width: 68px;
+        }
+        .selfprozslidim dd img {
+            display: block;
+            height: 68px;
+            width: 68px;
+        }
+        .selfprozslidim dd i {
+            background: #999;
+            border: 1px solid #ccc;
+            cursor: pointer;
+            display: none;
+            height: 13px;
+            position: absolute;
+            right: 3px;
+            top: 3px;
+            width: 13px;
+        }
+        #albummore a{cursor:pointer;}
+        .selfprozslidim dd:hover i {
+            display: block;
+        }
+        .selfprozslidim dd i:hover {
+            background-color: #3388ff;
+        }
+        .delwarp {
+            display:none;
+
+            padding: 5px 7px;
+            position: absolute;
+            right: 0;
+            top: 0;
+            z-index: 2;
+        }
+        .delete {
+            background: rgba(0, 0, 0, 0) url("${pageContext.request.contextPath}/static/images/del.png") no-repeat scroll 0 0 / 15px 19px;
+            display: block;
+            height: 19px;
+            text-indent: -9999px;
+            width: 15px;
+        }
+        .selfprozslidim dd.del:hover .delwarp {
+            display: block;
+        }
+    </style>
     <script type="text/javascript">
         $(function () {
             $("#sub").click(function () {
@@ -64,44 +115,22 @@
                     layer.msg("资讯名称不能为空~");
                     return false;
                 }*/
-                var files = document.querySelector('input[name="envPhoto"]').files;
-                if(files.length>3){
-                    layer.msg("环境图片 最多上传三张图片");
-                    return false;
-                }
-                var files1 = document.querySelector('input[name="authPhoto"]').files;
-                if(files1.length>3){
-                    layer.msg("授权图片 最多上传三张图片");
-                    return false;
-                }
-                var files2 = document.querySelector('input[name="honorPhoto"]').files;
-                if(files2.length>3){
-                    layer.msg("荣誉图片 最多上传三张图片");
-                    return false;
-                }
+                // var files = document.querySelector('input[name="envPhoto"]').files;
+                // if(files.length>3){
+                //     layer.msg("环境图片 最多上传三张图片");
+                //     return false;
+                // }
+                // var files1 = document.querySelector('input[name="authPhoto"]').files;
+                // if(files1.length>3){
+                //     layer.msg("授权图片 最多上传三张图片");
+                //     return false;
+                // }
+                // var files2 = document.querySelector('input[name="honorPhoto"]').files;
+                // if(files2.length>3){
+                //     layer.msg("荣誉图片 最多上传三张图片");
+                //     return false;
+                // }
                 /*环境图*/
-                var str = "";
-                $("input[name='eachImg']").each(function(){
-                    str += $(this).val()+",";
-                });
-                var substr = str.substring(0,str.length-1)
-                $("#uploadEnvPhoto").val(substr)
-
-                /*授权图*/
-                var authStr = "";
-                $("input[name='eachAuthImg']").each(function(){
-                    authStr += $(this).val()+",";
-                });
-                var subAuthStr = authStr.substring(0,authStr.length-1)
-                $("#uploadAuthPhoto").val(subAuthStr)
-
-                /*荣誉图*/
-                var honorStr = "";
-                $("input[name = 'eachHonorImg']").each(function () {
-                    honorStr += $(this).val()+",";
-                });
-                var subHonorStr = honorStr.substring(0,honorStr.length-1)
-                $("#uploadHonorPhoto").val(subHonorStr)
 
 
 
@@ -131,7 +160,7 @@
         </div>
 
         <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-1"><span class="c-red">*</span>品牌log:</label>
+            <label class="form-label col-xs-4 col-sm-1"><span class="c-red">*</span>品牌logo:</label>
             <div class="formControls col-xs-8 col-sm-9">
                 <input type="file" class="input-text" id="caseimage"  name="filename" multiple="file"/>
                 <img src="" alt="" id="showImg" style="width:100px;height: 100px;" hidden="hidden">
@@ -140,38 +169,38 @@
         </div>
 
         <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-1"><span class="c-red"></span>环境图:</label>
+            <label class="form-label col-xs-4 col-sm-1">环境图:</br><span class="c-red">*不超过三张</span></label>
             <div class="formControls col-xs-8 col-sm-9">
-                <input type="file"  multiple="multiple" id="envPhoto"  class="input-text" name="envPhoto"/>
-                <div><label style="color:red" >最多选择三张图片</label></div>
-                <div id="envImg">
-
+                <div style="width:100%;height:auto;border:1px solid #DDDDDD;padding:8px 5px 0 0;" class="selfprozslidim">
+                    <dl>
+                        <input type="file" style="display: none;" name="fileToUpload_ev" class="selfbasetlimgedup" id="fileToUpload_ev">
+                        <dd id="albummore_ev"><a onclick="$('#fileToUpload_ev').click();"><img src="${pageContext.request.contextPath}/static/images/addmore.jpg" alt="" id="img"></a></dd>
+                    </dl>
                 </div>
-                 <input type="text" id="uploadEnvPhoto"  name="imgEnv" value="" hidden="hidden"/>
             </div>
         </div>
 
         <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-1"><span class="c-red"></span>授权图:</label>
+            <label class="form-label col-xs-4 col-sm-1">授权图:</br><span class="c-red">*不超过三张</span></label>
             <div class="formControls col-xs-8 col-sm-9">
-                <input type="file"  multiple="multiple" id="authPhoto"  class="input-text" name="authPhoto"/>
-                <div><label style="color:red" >最多选择三张图片</label></div>
-                <div id="authImg">
-
+                <div style="width:100%;height:auto;border:1px solid #DDDDDD;padding:8px 5px 0 0;" class="selfprozslidim">
+                    <dl>
+                        <input type="file" style="display: none;" name="fileToUpload_auth" class="selfbasetlimgedup" id="fileToUpload_auth">
+                        <dd id="albummore_auth"><a onclick="$('#fileToUpload_auth').click();"><img src="${pageContext.request.contextPath}/static/images/addmore.jpg" alt="" id="img"></a></dd>
+                    </dl>
                 </div>
-                <input type="text" id="uploadAuthPhoto"  name="imgAuth" value="" hidden="hidden"/>
             </div>
         </div>
 
         <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-1"><span class="c-red"></span>荣誉图:</label>
+            <label class="form-label col-xs-4 col-sm-1">广告图:</br><span class="c-red">*不超过三张</span></label>
             <div class="formControls col-xs-8 col-sm-9">
-                <input type="file"  multiple="multiple" id="honorPhoto"  class="input-text" name="honorPhoto"/>
-                <div><label style="color:red" >最多选择三张图片</label></div>
-                <div id="honorImg">
-
+                <div style="width:100%;height:auto;border:1px solid #DDDDDD;padding:8px 5px 0 0;" class="selfprozslidim">
+                    <dl>
+                        <input type="file" style="display: none;" name="fileToUpload" class="selfbasetlimgedup" id="fileToUpload">
+                        <dd id="albummore"><a onclick="$('#fileToUpload').click();"><img src="${pageContext.request.contextPath}/static/images/addmore.jpg" alt="" id="img"></a></dd>
+                    </dl>
                 </div>
-                <input type="text" id="uploadHonorPhoto"  name="imgHonor" value="" hidden="hidden"/>
             </div>
         </div>
 
@@ -240,131 +269,10 @@
 <script src="<%=base%>/static/ue/ueditor.config.js" type="text/javascript"></script>
 <script src="<%=base%>/static/ue/ueditor.all.js" type="text/javascript"></script>
 <script type="text/javascript" src="<%=base%>/static/ue/lang/zh-cn/zh-cn.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/ajaxfileupload.js"></script>
 
 <script type="text/javascript">
 
-    /*                       环境图片          */
-    // 移除图片
-    function delalbum(obj) {
-        $(obj).parents(".del").remove();
-    }
-
-    $('#envPhoto').change(function(){
-
-        var formData = new FormData();
-        var files = document.querySelector('input[name="envPhoto"]').files;
-        if(files.length>0){
-            for (var i=0; i<files.length; i++) {
-                formData.append("envPhoto",files[i]);
-            }
-
-        }
-        $.ajax({
-            url : '/nvrnetwork/admin/uploadBrandImg',
-            data: formData,
-            type: 'POST',
-            cache: false,
-            async : false,
-            dataType: "json",
-            processData: false,
-            contentType: false,
-            success : function(response) {
-                if(response.is){
-                    if(response.data.length > 0){
-                        for(var i=0;i<response.data.length;i++){
-
-                            var faceImg = response.data[i];
-                            $("#envImg").before('<dd class="del" style="float: left"> <img src="'+faceImg+'" alt="'+faceImg+'"  style="width:100px;height: 100px;"> <input type="hidden" name="eachImg" value="' + faceImg + '"/> <div class="delwarp"><button class="delete" onclick="delalbum(this)">删除</button></div></dd>')
-                        }
-
-                    }
-
-                }
-            }
-        })
-    });
-
-    /*                       授权图片          */
-    // 移除图片
-    function delalbumAuth(obj) {
-        $(obj).parents(".delAuth").remove();
-    }
-
-    $('#authPhoto').change(function(){
-
-        var formData = new FormData();
-        var files = document.querySelector('input[name="authPhoto"]').files;
-        if(files.length>0){
-            for (var i=0; i<files.length; i++) {
-                formData.append("authPhoto",files[i]);
-            }
-
-        }
-        $.ajax({
-            url : '/nvrnetwork/admin/uploadBrandAuthImg',
-            data: formData,
-            type: 'POST',
-            cache: false,
-            async : false,
-            dataType: "json",
-            processData: false,
-            contentType: false,
-            success : function(response) {
-                if(response.is){
-                    if(response.data.length > 0){
-                        for(var i=0;i<response.data.length;i++){
-
-                            var faceImg1 = response.data[i];
-                            $("#authImg").before('<dd class="delAuth" style="float: left"> <img src="'+faceImg1+'" alt="'+faceImg1+'"  style="width:100px;height: 100px;"> <input type="hidden" name="eachAuthImg" value="' + faceImg1 + '"/> <div class="delwarp1"><button class="delete1" onclick="delalbumAuth(this)">删除</button></div></dd>')
-                        }
-
-                    }
-
-                }
-            }
-        })
-    });
-    /*                       荣誉图片          */
-    // 移除图片
-    function delalbumHonor(obj) {
-        $(obj).parents(".delHonor").remove();
-    }
-
-    $('#honorPhoto').change(function(){
-
-        var formData = new FormData();
-        var files = document.querySelector('input[name="honorPhoto"]').files;
-        if(files.length>0){
-            for (var i=0; i<files.length; i++) {
-                formData.append("honorPhoto",files[i]);
-            }
-
-        }
-        $.ajax({
-            url : '/nvrnetwork/admin/uploadBrandHonorImg',
-            data: formData,
-            type: 'POST',
-            cache: false,
-            async : false,
-            dataType: "json",
-            processData: false,
-            contentType: false,
-            success : function(response) {
-                if(response.is){
-                    if(response.data.length > 0){
-                        for(var i=0;i<response.data.length;i++){
-
-                            var faceImg2 = response.data[i];
-                            $("#honorImg").before('<dd class="delHonor" style="float: left"> <img src="'+faceImg2+'" alt="'+faceImg2+'"  style="width:100px;height: 100px;"> <input type="hidden" name="eachHonorImg" value="' + faceImg2 + '"/> <div class="delwarp2"><button class="delete2" onclick="delalbumHonor(this)">删除</button></div></dd>')
-                        }
-
-                    }
-
-                }
-            }
-        })
-    });
-
 
     /* 回显图片*/
     $(function () {
@@ -466,6 +374,136 @@
     }
 </script>
 
+<%-- 多图上传 --%>
+<script type="text/javascript">
+    $(function(){
+        $("#fileToUpload").change(function(){
+            var f = document.getElementById('fileToUpload').files[0];
+            $.ajaxFileUpload({
+                fileElementId : 'fileToUpload',
+                url : 'uploadImages.html',
+                dataType : 'text',
+                data : {},
+                async : true,
+                error : function(data) {
+                    alert("网络异常,请重试");
+                },
+                success : function(message) {
+                    $("#albummore").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="imgHonor" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
+                    chens();
+
+                }
+            });
+        });
+    });
+    function chens(){
+        $("#fileToUpload").change(function(){
+            var f = document.getElementById('fileToUpload').files[0];
+            $.ajaxFileUpload({
+                fileElementId : 'fileToUpload',
+                url : 'uploadImages.html',
+                dataType : 'text',
+                data : {},
+                async : true,
+                error : function(data) {
+                    alert("网络异常,请重试");
+                },
+                success : function(message) {
+                    $("#albummore").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="imgHonor" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
+                    chens();
+                }
+            });
+        });
+    }
+
+    /* 授权 */
+    $(function(){
+        $("#fileToUpload_auth").change(function(){
+            var f = document.getElementById('fileToUpload_auth').files[0];
+            $.ajaxFileUpload({
+                fileElementId : 'fileToUpload_auth',
+                url : 'uploadImages.html',
+                dataType : 'text',
+                data : {},
+                async : true,
+                error : function(data) {
+                    alert("网络异常,请重试");
+                },
+                success : function(message) {
+                    $("#albummore_auth").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="imgAuth" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
+                    chens_auth();
+
+                }
+            });
+        });
+    });
+    function chens_auth(){
+        $("#fileToUpload_auth").change(function(){
+            var f = document.getElementById('fileToUpload_auth').files[0];
+            $.ajaxFileUpload({
+                fileElementId : 'fileToUpload_auth',
+                url : 'uploadImages.html',
+                dataType : 'text',
+                data : {},
+                async : true,
+                error : function(data) {
+                    alert("网络异常,请重试");
+                },
+                success : function(message) {
+                    $("#albummore_auth").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="imgAuth" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
+                    chens_auth();
+                }
+            });
+        });
+    }
+
+
+    /* 环境 */
+    $(function(){
+        $("#fileToUpload_ev").change(function(){
+            var f = document.getElementById('fileToUpload_ev').files[0];
+            $.ajaxFileUpload({
+                fileElementId : 'fileToUpload_ev',
+                url : 'uploadImages.html',
+                dataType : 'text',
+                data : {},
+                async : true,
+                error : function(data) {
+                    alert("网络异常,请重试");
+                },
+                success : function(message) {
+                    $("#albummore_ev").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="imgEnv" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
+                    chens_ev();
+
+                }
+            });
+        });
+    });
+    function chens_ev(){
+        $("#fileToUpload_ev").change(function(){
+            var f = document.getElementById('fileToUpload_ev').files[0];
+            $.ajaxFileUpload({
+                fileElementId : 'fileToUpload_ev',
+                url : 'uploadImages.html',
+                dataType : 'text',
+                data : {},
+                async : true,
+                error : function(data) {
+                    alert("网络异常,请重试");
+                },
+                success : function(message) {
+                    $("#albummore_ev").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="imgEnv" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
+                    chens_ev();
+                }
+            });
+        });
+    }
+
+    function delalbum(obj){
+        $(obj).parents(".del").remove();
+    }
+
+</script>
 
 <!--请在下方写此页面业务相关的脚本-->
 <script type="text/javascript">

+ 1 - 1
src/main/webapp/WEB-INF/jsp/admin/brandList.jsp

@@ -56,7 +56,7 @@
                 <th width="60" ><input  id="checked_all"   type="checkbox"  >全选</th>
                 <th width="40">ID</th>
                 <th width="70">名称</th>
-                <th width="70">log</th>
+                <th width="70">logo</th>
                 <th width="90">提供服务</th>
                 <th width="60">人数</th>
                 <th width="60">门店数量</th>

+ 226 - 205
src/main/webapp/WEB-INF/jsp/admin/brandUpdate.jsp

@@ -44,7 +44,58 @@
     <script type="text/javascript"
             src="${pageContext.request.contextPath}/static/admin/icheck/jquery.icheck.min.js"></script>
     <script src="${pageContext.request.contextPath}/static/admin/manage/js/WdatePicker.js"></script>
-
+    <style>
+        .selfprozslidim dd {
+            border: 1px solid #ccc;
+            display: inline-block;
+            height: 68px;
+            margin: 0 0 10px 10px ;
+            position: relative;
+            width: 68px;
+        }
+        .selfprozslidim dd img {
+            display: block;
+            height: 68px;
+            width: 68px;
+        }
+        .selfprozslidim dd i {
+            background: #999;
+            border: 1px solid #ccc;
+            cursor: pointer;
+            display: none;
+            height: 13px;
+            position: absolute;
+            right: 3px;
+            top: 3px;
+            width: 13px;
+        }
+        #albummore a{cursor:pointer;}
+        .selfprozslidim dd:hover i {
+            display: block;
+        }
+        .selfprozslidim dd i:hover {
+            background-color: #3388ff;
+        }
+        .delwarp {
+            display:none;
+
+            padding: 5px 7px;
+            position: absolute;
+            right: 0;
+            top: 0;
+            z-index: 2;
+        }
+        .delete {
+            background: rgba(0, 0, 0, 0) url("${pageContext.request.contextPath}/static/images/del.png") no-repeat scroll 0 0 / 15px 19px;
+            display: block;
+            height: 19px;
+            text-indent: -9999px;
+            width: 15px;
+        }
+        .selfprozslidim dd.del:hover .delwarp {
+            display: block;
+        }
+    </style>
     <script type="text/javascript">
         $(function () {
             $("#sub").click(function () {
@@ -64,45 +115,21 @@
                     layer.msg("资讯名称不能为空~");
                     return false;
                 }*/
-                var files = document.querySelector('input[name="envPhoto"]').files;
-                if(files.length>3){
-                    layer.msg("环境图片 最多上传三张图片");
-                    return false;
-                }
-                var files1 = document.querySelector('input[name="authPhoto"]').files;
-                if(files1.length>3){
-                    layer.msg("授权图片 最多上传三张图片");
-                    return false;
-                }
-                var files2 = document.querySelector('input[name="honorPhoto"]').files;
-                if(files2.length>3){
-                    layer.msg("荣誉图片 最多上传三张图片");
-                    return false;
-                }
-                /*环境图*/
-                var str = "";
-                $("input[name='eachImg']").each(function(){
-                    str += $(this).val()+",";
-                });
-                var substr = str.substring(0,str.length-1)
-                $("#uploadEnvPhoto").val(substr)
-
-                /*授权图*/
-                var authStr = "";
-                $("input[name='eachAuthImg']").each(function(){
-                    authStr += $(this).val()+",";
-                });
-                var subAuthStr = authStr.substring(0,authStr.length-1)
-                $("#uploadAuthPhoto").val(subAuthStr)
-
-                /*荣誉图*/
-                var honorStr = "";
-                $("input[name = 'eachHonorImg']").each(function () {
-                    honorStr += $(this).val()+",";
-                });
-                var subHonorStr = honorStr.substring(0,honorStr.length-1)
-                $("#uploadHonorPhoto").val(subHonorStr)
-
+                // var files = document.querySelector('input[name="envPhoto"]').files;
+                // if(files.length>3){
+                //     layer.msg("环境图片 最多上传三张图片");
+                //     return false;
+                // }
+                // var files1 = document.querySelector('input[name="authPhoto"]').files;
+                // if(files1.length>3){
+                //     layer.msg("授权图片 最多上传三张图片");
+                //     return false;
+                // }
+                // var files2 = document.querySelector('input[name="honorPhoto"]').files;
+                // if(files2.length>3){
+                //     layer.msg("荣誉图片 最多上传三张图片");
+                //     return false;
+                // }
 
 
 
@@ -132,7 +159,7 @@
         </div>
 
         <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-1"><span class="c-red">*</span>品牌log:</label>
+            <label class="form-label col-xs-4 col-sm-1"><span class="c-red">*</span>品牌logo:</label>
             <div class="formControls col-xs-8 col-sm-9">
                 <input type="file" class="input-text" id="caseimage"  name="filename" multiple="file" />
                 <img src="${brand.imgLog}" alt="" id="showImg" style="width:100px;height: 100px;">
@@ -140,70 +167,53 @@
             </div>
         </div>
 
+
         <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-1"><span class="c-red"></span>环境图:</label>
+            <label class="form-label col-xs-4 col-sm-1">环境图:</br><span class="c-red">*不超过三张</span></label>
             <div class="formControls col-xs-8 col-sm-9">
-                <input type="file"  multiple="multiple" id="envPhoto"  class="input-text" name="envPhoto"/>
-                <div><label style="color:red" >最多选择三张图片</label></div>
-                <div id="envImg">
-                    <c:if test="${envList != null}">
-                        <c:forEach items="${envList}" var="list" >
-                            <dd class="del" style="float: left"><img src="${list}" alt=""  style="width:100px;height: 100px;">
-                                <input type="hidden" name="eachImg" value="${list}"/>
-                                <div class="delwarp">
-                                    <button class="delete" onclick="delalbum(this)">删除</button>
-                                </div>
-                            </dd>
+                <div style="width:100%;height:auto;border:1px solid #DDDDDD;padding:8px 5px 0 0;" class="selfprozslidim">
+                    <dl>
+                        <input type="file" style="display: none;" name="fileToUpload_ev" class="selfbasetlimgedup" id="fileToUpload_ev">
+                        <c:forEach items="${envList }" var="pics">
+                            <dd class="del"><img src="${pics}" width="68" height="68" /><input type="hidden" name="imgEnv" value="${pics }"/><div class="delwarp"><a class="delete"  onclick="delalbum(this)"></a></div></dd>
                         </c:forEach>
-                    </c:if>
+                        <dd id="albummore_ev"><a onclick="$('#fileToUpload_ev').click();"><img src="${pageContext.request.contextPath}/static/images/addmore.jpg" alt="" id="img"></a></dd>
+                    </dl>
                 </div>
-                 <input type="text" id="uploadEnvPhoto"  name="imgEnv" value="" hidden="hidden"/>
             </div>
         </div>
 
-
         <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-1"><span class="c-red"></span>授权图:</label>
+            <label class="form-label col-xs-4 col-sm-1">授权图:</br><span class="c-red">*不超过三张</span></label>
             <div class="formControls col-xs-8 col-sm-9">
-                <input type="file"  multiple="multiple" id="authPhoto"  class="input-text" name="authPhoto"/>
-                <div><label style="color:red" >最多选择三张图片</label></div>
-                <div id="authImg">
-                    <c:if test="${authList != null}">
-                        <c:forEach items="${authList}" var="list" >
-                            <dd class="delAuth" style="float: left"><img src="${list}" alt=""  style="width:100px;height: 100px;">
-                                <input type="hidden" name="eachAuthImg" value="${list}"/>
-                                <div class="delwarp1">
-                                    <button class="delete1" onclick="delalbumAuth(this)">删除</button>
-                                </div>
-                            </dd>
+                <div style="width:100%;height:auto;border:1px solid #DDDDDD;padding:8px 5px 0 0;" class="selfprozslidim">
+                    <dl>
+                        <input type="file" style="display: none;" name="fileToUpload_auth" class="selfbasetlimgedup" id="fileToUpload_auth">
+                        <c:forEach items="${authList }" var="pics">
+                            <dd class="del"><img src="${pics}" width="68" height="68" /><input type="hidden" name="imgAuth" value="${pics }"/><div class="delwarp"><a class="delete"  onclick="delalbum(this)"></a></div></dd>
                         </c:forEach>
-                    </c:if>
+                        <dd id="albummore_auth"><a onclick="$('#fileToUpload_auth').click();"><img src="${pageContext.request.contextPath}/static/images/addmore.jpg" alt="" id="img"></a></dd>
+                    </dl>
                 </div>
-                <input type="text" id="uploadAuthPhoto"  name="imgAuth" value="" hidden="hidden"/>
             </div>
         </div>
 
         <div class="row cl">
-            <label class="form-label col-xs-4 col-sm-1"><span class="c-red"></span>荣誉图:</label>
+            <label class="form-label col-xs-4 col-sm-1">广告图:</br><span class="c-red">*不超过三张</span></label>
             <div class="formControls col-xs-8 col-sm-9">
-                <input type="file"  multiple="multiple" id="honorPhoto"  class="input-text" name="honorPhoto"/>
-                <div><label style="color:red" >最多选择三张图片</label></div>
-                <div id="honorImg">
-                    <c:if test="${honorList != null}">
-                        <c:forEach items="${honorList}" var="list" >
-                            <dd class="delHonor" style="float: left"><img src="${list}" alt=""  style="width:100px;height: 100px;">
-                                <input type="hidden" name="eachHonorImg" value="${list}"/>
-                                <div class="delwarp2">
-                                    <button class="delete2" onclick="delalbumHonor(this)">删除</button>
-                                </div>
-                            </dd>
+                <div style="width:100%;height:auto;border:1px solid #DDDDDD;padding:8px 5px 0 0;" class="selfprozslidim">
+                    <dl>
+                        <input type="file" style="display: none;" name="fileToUpload" class="selfbasetlimgedup" id="fileToUpload">
+                        <c:forEach items="${honorList }" var="pics">
+                            <dd class="del"><img src="${pics}" width="68" height="68" /><input type="hidden" name="activityimage" value="${pics }"/><div class="delwarp"><a class="delete"  onclick="delalbum(this)"></a></div></dd>
                         </c:forEach>
-                    </c:if>
+                        <dd id="albummore"><a onclick="$('#fileToUpload').click();"><img src="${pageContext.request.contextPath}/static/images/addmore.jpg" alt="" id="img"></a></dd>
+                    </dl>
                 </div>
-                <input type="text" id="uploadHonorPhoto"  name="imgHonor" value="" hidden="hidden"/>
             </div>
         </div>
 
+
         <div class="row cl">
             <label class="form-label col-xs-4 col-sm-1"><span class="c-red">*</span>提供服务:</label>
             <div class="formControls col-xs-8 col-sm-9">
@@ -269,130 +279,10 @@
 <script src="<%=base%>/static/ue/ueditor.config.js" type="text/javascript"></script>
 <script src="<%=base%>/static/ue/ueditor.all.js" type="text/javascript"></script>
 <script type="text/javascript" src="<%=base%>/static/ue/lang/zh-cn/zh-cn.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/ajaxfileupload.js"></script>
 
 <script type="text/javascript">
 
-    /*                       环境图片          */
-    // 移除图片
-    function delalbum(obj) {
-        $(obj).parents(".del").remove();
-    }
-
-    $('#envPhoto').change(function(){
-
-        var formData = new FormData();
-        var files = document.querySelector('input[name="envPhoto"]').files;
-        if(files.length>0){
-            for (var i=0; i<files.length; i++) {
-                formData.append("envPhoto",files[i]);
-            }
-
-        }
-        $.ajax({
-            url : '/nvrnetwork/admin/uploadBrandImg',
-            data: formData,
-            type: 'POST',
-            cache: false,
-            async : false,
-            dataType: "json",
-            processData: false,
-            contentType: false,
-            success : function(response) {
-                if(response.is){
-                    if(response.data.length > 0){
-                        for(var i=0;i<response.data.length;i++){
-
-                            var faceImg = response.data[i];
-                            $("#envImg").before('<dd class="del" style="float: left"> <img src="'+faceImg+'" alt="'+faceImg+'"  style="width:100px;height: 100px;"> <input type="hidden" name="eachImg" value="' + faceImg + '"/> <div class="delwarp"><button class="delete" onclick="delalbum(this)">删除</button></div></dd>')
-                        }
-
-                    }
-
-                }
-            }
-        })
-    });
-
-    /*                       授权图片          */
-    // 移除图片
-    function delalbumAuth(obj) {
-        $(obj).parents(".delAuth").remove();
-    }
-
-    $('#authPhoto').change(function(){
-
-        var formData = new FormData();
-        var files = document.querySelector('input[name="authPhoto"]').files;
-        if(files.length>0){
-            for (var i=0; i<files.length; i++) {
-                formData.append("authPhoto",files[i]);
-            }
-
-        }
-        $.ajax({
-            url : '/nvrnetwork/admin/uploadBrandAuthImg',
-            data: formData,
-            type: 'POST',
-            cache: false,
-            async : false,
-            dataType: "json",
-            processData: false,
-            contentType: false,
-            success : function(response) {
-                if(response.is){
-                    if(response.data.length > 0){
-                        for(var i=0;i<response.data.length;i++){
-
-                            var faceImg1 = response.data[i];
-                            $("#authImg").before('<dd class="delAuth" style="float: left"> <img src="'+faceImg1+'" alt="'+faceImg1+'"  style="width:100px;height: 100px;"> <input type="hidden" name="eachAuthImg" value="' + faceImg1 + '"/> <div class="delwarp1"><button class="delete1" onclick="delalbumAuth(this)">删除</button></div></dd>')
-                        }
-
-                    }
-
-                }
-            }
-        })
-    });
-    /*                       荣誉图片          */
-    // 移除图片
-    function delalbumHonor(obj) {
-        $(obj).parents(".delHonor").remove();
-    }
-
-    $('#honorPhoto').change(function(){
-
-        var formData = new FormData();
-        var files = document.querySelector('input[name="honorPhoto"]').files;
-        if(files.length>0){
-            for (var i=0; i<files.length; i++) {
-                formData.append("honorPhoto",files[i]);
-            }
-
-        }
-        $.ajax({
-            url : '/nvrnetwork/admin/uploadBrandHonorImg',
-            data: formData,
-            type: 'POST',
-            cache: false,
-            async : false,
-            dataType: "json",
-            processData: false,
-            contentType: false,
-            success : function(response) {
-                if(response.is){
-                    if(response.data.length > 0){
-                        for(var i=0;i<response.data.length;i++){
-
-                            var faceImg2 = response.data[i];
-                            $("#honorImg").before('<dd class="delHonor" style="float: left"> <img src="'+faceImg2+'" alt="'+faceImg2+'"  style="width:100px;height: 100px;"> <input type="hidden" name="eachHonorImg" value="' + faceImg2 + '"/> <div class="delwarp2"><button class="delete2" onclick="delalbumHonor(this)">删除</button></div></dd>')
-                        }
-
-                    }
-
-                }
-            }
-        })
-    });
 
 
     /* 回显图片*/
@@ -495,6 +385,137 @@
     }
 </script>
 
+<%-- 多图上传 --%>
+<script type="text/javascript">
+    $(function(){
+        $("#fileToUpload").change(function(){
+            var f = document.getElementById('fileToUpload').files[0];
+            $.ajaxFileUpload({
+                fileElementId : 'fileToUpload',
+                url : 'uploadImages.html',
+                dataType : 'text',
+                data : {},
+                async : true,
+                error : function(data) {
+                    alert("网络异常,请重试");
+                },
+                success : function(message) {
+                    $("#albummore").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="imgHonor" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
+                    chens();
+
+                }
+            });
+        });
+    });
+    function chens(){
+        $("#fileToUpload").change(function(){
+            var f = document.getElementById('fileToUpload').files[0];
+            $.ajaxFileUpload({
+                fileElementId : 'fileToUpload',
+                url : 'uploadImages.html',
+                dataType : 'text',
+                data : {},
+                async : true,
+                error : function(data) {
+                    alert("网络异常,请重试");
+                },
+                success : function(message) {
+                    $("#albummore").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="imgHonor" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
+                    chens();
+                }
+            });
+        });
+    }
+
+    /* 授权 */
+    $(function(){
+        $("#fileToUpload_auth").change(function(){
+            var f = document.getElementById('fileToUpload_auth').files[0];
+            $.ajaxFileUpload({
+                fileElementId : 'fileToUpload_auth',
+                url : 'uploadImages.html',
+                dataType : 'text',
+                data : {},
+                async : true,
+                error : function(data) {
+                    alert("网络异常,请重试");
+                },
+                success : function(message) {
+                    $("#albummore_auth").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="imgAuth" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
+                    chens_auth();
+
+                }
+            });
+        });
+    });
+    function chens_auth(){
+        $("#fileToUpload_auth").change(function(){
+            var f = document.getElementById('fileToUpload_auth').files[0];
+            $.ajaxFileUpload({
+                fileElementId : 'fileToUpload_auth',
+                url : 'uploadImages.html',
+                dataType : 'text',
+                data : {},
+                async : true,
+                error : function(data) {
+                    alert("网络异常,请重试");
+                },
+                success : function(message) {
+                    $("#albummore_auth").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="imgAuth" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
+                    chens_auth();
+                }
+            });
+        });
+    }
+
+
+    /* 环境 */
+    $(function(){
+        $("#fileToUpload_ev").change(function(){
+            var f = document.getElementById('fileToUpload_ev').files[0];
+            $.ajaxFileUpload({
+                fileElementId : 'fileToUpload_ev',
+                url : 'uploadImages.html',
+                dataType : 'text',
+                data : {},
+                async : true,
+                error : function(data) {
+                    alert("网络异常,请重试");
+                },
+                success : function(message) {
+                    $("#albummore_ev").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="imgEnv" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
+                    chens_ev();
+
+                }
+            });
+        });
+    });
+    function chens_ev(){
+        $("#fileToUpload_ev").change(function(){
+            var f = document.getElementById('fileToUpload_ev').files[0];
+            $.ajaxFileUpload({
+                fileElementId : 'fileToUpload_ev',
+                url : 'uploadImages.html',
+                dataType : 'text',
+                data : {},
+                async : true,
+                error : function(data) {
+                    alert("网络异常,请重试");
+                },
+                success : function(message) {
+                    $("#albummore_ev").before('<dd class="del"><img src="'+message+'" width="68" height="68" /><input type="hidden" name="imgEnv" value="'+message+'"/><div class="delwarp"><a class="delete" onclick="delalbum(this)">删除</a></div></dd>');
+                    chens_ev();
+                }
+            });
+        });
+    }
+
+    function delalbum(obj){
+        $(obj).parents(".del").remove();
+    }
+
+</script>
+
 
 <!--请在下方写此页面业务相关的脚本-->
 <script type="text/javascript">

+ 1 - 1
src/main/webapp/WEB-INF/jsp/admin/carSedanImg.jsp

@@ -57,7 +57,7 @@
                 <div class="formControls col-xs-8 col-sm-9">
 
                     <label class="text">说明:
-                        图片导入使用压缩文件格式(ZIP或RAR),确保图片名和Excel导入时填写的名称一致
+                        图片导入使用压缩文件格式(ZIP或RAR),确保图片名和品牌名称一致,图片格式要求jpg格式
                         <br/> 打包方式:将需要上传的图片全部选中,在选中图片上方点击鼠标右键,在右击弹出列表中点击“添加到XXX.zip”选项,最后选中刚生成的压缩包上传就好了。
                         <br/> <br/>注意:* 多次上传相同文件名图片会导致数据覆盖!建议上传接近于正方形的图片效果最佳,建议尺寸300x300!
                     </label>