From 9b6f2b9a80fbcaae09af4693a6cd76f4a760f962 Mon Sep 17 00:00:00 2001
From: admin:huo123456@qq <496960745@qq.com>
Date: 星期一, 21 一月 2019 10:02:40 +0800
Subject: [PATCH] 图片和视频上传修改内容

---
 gx_tieta/WebRoot/mobil/iframe/homeinfo1.html |   87 +++++++++++++++++++++++++++++--------------
 1 files changed, 59 insertions(+), 28 deletions(-)

diff --git a/gx_tieta/WebRoot/mobil/iframe/homeinfo1.html b/gx_tieta/WebRoot/mobil/iframe/homeinfo1.html
index 630c67d..822cc7e 100644
--- a/gx_tieta/WebRoot/mobil/iframe/homeinfo1.html
+++ b/gx_tieta/WebRoot/mobil/iframe/homeinfo1.html
@@ -84,7 +84,7 @@
                         <div class="layui-form layui-form-pane layui-form-default mrt5 mrl8 mrr8 mrb10" action="" lay-filter="">
                             <div class="layui-row">
                                 <div class="layui-col-12">
-                                    <button class="layui-btn layui-btn-normal layui-btn-sm" id="videoSelect">瑙嗛閫夋嫨</button>
+                                    <button class="layui-btn layui-btn-normal layui-btn-sm" id="videoSelect">瑙嗛閫夋嫨鎴栨媿鎽�</button>
                                 	<span style="color: #FF0000;">璇蜂笂浼犳湁鍏虫満鎴跨殑瑙嗛</span>
                                 </div>
                                 <div class="layui-col-12 mrt5">
@@ -109,7 +109,7 @@
                                     </div>
                                 </div>
                                 <div class="layui-col-12 t-align-right mrt5">
-                                    <span style="color: #FF0000;" class="mrr4">璇蜂笂浼犲井淇℃媿鎽勭殑瑙嗛</span><button class="layui-btn layui-btn-normal layui-btn-sm" id="uploadVideo">瑙嗛涓婁紶</button>
+                                    <button class="layui-btn layui-btn-normal layui-btn-sm" id="uploadVideo">瑙嗛涓婁紶</button>
                                 </div>
                             </div>
                         </div>
@@ -119,8 +119,8 @@
                     <div class="rel-full">
                         <div class="layui-form layui-form-pane layui-form-default mrt5 mrl8 mrr8 mrb10" action="" lay-filter="">
                             <div class="layui-col-12">
-                                <button class="layui-btn layui-btn-normal layui-btn-sm" id="imgsSelect">鍥剧墖閫夋嫨</button>
-                            	<span style="color: #FF0000;">璇蜂笂浼犳湁鍏虫満鎴跨殑鍥剧墖</span>
+                                <button class="layui-btn layui-btn-normal layui-btn-sm" id="imgsSelect">鍥剧墖閫夋嫨鎴栨媿鐓�</button>
+                            	<span style="color: #FF0000;">璇蜂笂浼犵數璇濆崱銆佹満鎴垮悕绉般�佺數姹犲瀷鍙枫�佽礋杞界數娴併�乥ts璁惧鎺ョ嚎銆佺數娴佹帴绾裤�佹暣浣撳畨瑁呮晥鏋滃浘绛夊浘鐗�</span>
                             </div>
                             <div class="layui-col-12">
                                 <div class="layui-upload">
@@ -129,7 +129,6 @@
                                             <thead>
                                                 <tr>
                                                     <th>鍥剧墖棰勮</th>
-                                                    <th>鏂囦欢鍚�</th>
                                                     <th>澶у皬</th>
                                                     <th lay-data="{fixed: 'right', sort: true, minWidth: 100, align: 'center'}">鎿嶄綔</th>
                                                 </tr>
@@ -297,7 +296,7 @@
 					data: "json="+temp,
 					dataType: 'json',
 					success:function(data) {
-						console.info(data);
+						//console.info(data);
 						data = JSON.parse(data.result);
 						if(data.code==1){
 							layer.msg("鐢宠楠屾敹鎴愬姛!3绉掑悗鍏抽棴闈㈡澘");
@@ -317,17 +316,29 @@
             	setTimeout(function() {
             		var lng = $('#lng').val();		// 缁忓害
 			        var lat = $('#lat').val();		// 绾害
-			        console.log(lng+'***'+lat);
+			        //console.log(lng+'***'+lat);
 	            	var point = new BMap.Point(lng, lat);
 	            	delMkByLabel('鏂版満鎴�');
 	            	var mk = new BMap.Marker(point);
 		       		var label = new BMap.Label("鏂版満鎴�",{offset:new BMap.Size(20,-10)});
 		       		label.setStyle({display: 'none', padding: '4px 2px'});
-		       		mk.disableDragging();		// 璁剧疆涓嶅彲鎷栧姩
+		       		mk.enableDragging();		// 璁剧疆鍙嫋鍔�
 		       		map.addOverlay(mk);			// 灏嗚鐩栫墿娣诲姞鍒板湴鍥句腑
 		       		mk.setLabel(label);			// 缁欒鐩栫墿娣诲姞label鎻愮ず
 					map.panTo(point);		// 灏嗗湴鍥剧Щ鍔ㄥ埌娣诲姞鐨勭偣浣嶇疆
-					map.setZoom(20);			// 璁剧疆鍦板浘鐨勭缉鏀剧瓑绾�
+					map.setZoom(20);			// 璁剧疆鍦板浘鐨勭缉鏀剧瓑绾�
+					
+					// 缁檓k鐐规坊鍔犵Щ鍔ㄤ簨浠�
+					mk.addEventListener('dragend', function(e) {
+						//console.log(e.point);
+						var lat = e.point.lat;
+						var lng = e.point.lng;
+						
+						// 鏍规嵁鎷栧姩鐨勪綅缃洿鏂扮粡绾害
+						$('#lng').val(lng);
+						$('#lat').val(lat);
+						
+					});
             	}, 500);
             });
             
@@ -351,7 +362,6 @@
             
 
             var footerMenu = new FooterMenu($('#pageFooter'));  // 瀹炰緥鍖栧簳閮ㄥ鑸爮
-            
             // 涓婁紶瑙嗛妯″潡
             var videoInfoTbl = $('#videoInfoTbl');
             // 娓叉煋骞跺垵濮嬪寲涓婁紶鎸夐挳
@@ -368,11 +378,12 @@
                         VideoOrImage: 'video'
                     })
                 }
+                ,exts: 'mp4|MOV|avi|rmvb'
                 ,accept: 'video' //瑙嗛
                 ,choose: function(obj) {
                 	
                 	var files = this.files = obj.pushFile();
-                	console.log(obj.pushFile());
+                	//console.log(obj.pushFile());
                 	videoInfoTbl.text('');
                 	// 閬嶅巻
                 	Object.keys(files).forEach(function(key) {
@@ -397,7 +408,7 @@
                 	});
                 }
                 ,progress: function(e , percent) {
-                	console.log(percent);
+                	//console.log(percent);
 					element.progress('uploadProgress',percent  + '%');
 				}
                 ,done: function(res, index, upload) {
@@ -413,15 +424,10 @@
 			var uploadImgsLoad;
 			var uploadImgs = upload.render({
     			elem: '#imgsSelect'
-    			,url: 'MyFileAction!uploadStationFile'
+    			,url: 'MyFileAction!uploadStationFile_mobile'
     			,accept: 'image'
 			    ,multiple: true
-			    ,data: {
-                    json:JSON.stringify( {
-                        StationId: homeInfo.homeId,
-                        VideoOrImage: 'image'
-                    })
-                }
+			    ,data:{} 
 			    ,auto: false
 			    ,bindAction: '#uploadImgs'
 			    ,choose: function(obj){
@@ -431,13 +437,17 @@
       				obj.preview(function(index, file, result){
       					var tr = $(['<tr id="upload-'+ index +'">'
       					  ,'<td><img src="'+result+'">'
-				          ,'<td>'+ file.name +'</td>'
 				          ,'<td>'+ (file.size/1014).toFixed(1) +'kb</td>'
 				          ,'<td>'
 				            ,'<button class="layui-btn layui-btn-xs imgs-reload layui-hide">閲嶄紶</button>'
 				            ,'<button class="layui-btn layui-btn-xs layui-btn-danger imgs-delete">鍒犻櫎</button>'
 				          ,'</td>'
 				        ,'</tr>'].join(''));
+				        
+				        // 瀹氫箟鏂囦欢鍚嶇О
+				        var fileName = 'image&&'+index+'.jpg';
+				        
+				        obj.resetFile(index, file, fileName);  //閲嶅懡鍚嶆枃浠跺悕
 				        
 				        //鍗曚釜閲嶄紶
 				        tr.find('.imgs-reload').on('click', function(){
@@ -454,15 +464,36 @@
 				        imgsInfo.append(tr);
       				});
 			    }
-			    ,before:function() {
-			    	uploadImgsLoad = layer.load(1);
-			    }
-			    ,done:function(res) {
-			    	var rs = JSON.parse(res.result);
-			    	if(rs.code == 1) {
-			    		layer.msg('涓婁紶鎴愬姛锛�');
+			    ,before:function(obj) {
+			    	var isShowLoad = false;
+			    	// 閬嶅巻瀵硅薄鏌ョ湅鏄惁瀛樺湪鏂囦欢
+			    	Object.keys(this.files).forEach(function(key) {
+			    		isShowLoad = true;
+			    	});
+			    	if(isShowLoad) {
+			    		uploadImgsLoad = layer.load(1);
 			    	}else {
-			    		layer.msg('涓婁紶澶辫触锛�');
+			    		layer.msg('娌℃湁鍙笂浼犵殑鍐呭');
+			    	}
+			    	// 璁剧疆鎻愪氦鐨勫弬鏁�
+			    	this.data.json = JSON.stringify({
+	                        StationId: homeInfo.homeId
+	                        ,VideoOrImage: 'image'
+	                        ,binfmation: {
+	                        	StationId: homeInfo.homeId
+	                        	,StationName: $('#homeName').val()
+	                        	,latitude: $('#lat').val()	// 绾害
+	                        	,longitude: $('#lng').val()	// 缁忓害
+	                        	,Address: $('#addr').val()				// 鍦板潃
+	                        }
+	                    })
+			    }
+			    ,allDone: function(obj) {
+			    	console.log(obj);
+			    	if(obj.aborted == 0) {
+			    		layer.msg('涓婁紶瀹屾垚锛�');
+			    	}else {
+			    		layer.msg('瀛樺湪'+obj.aborted+'涓笂浼犲け璐�,璇烽噸鏂颁笂浼狅紒');
 			    	}
 			    	layer.close(uploadImgsLoad);
 			    }

--
Gitblit v1.9.1