Explorar o código

git-svn-id: https://192.168.57.71/svn/jsgkj@1755 931142cf-59ea-a443-aa0e-51397b428577

ld_xuhx %!s(int64=8) %!d(string=hai) anos
pai
achega
f642de562b

+ 49 - 34
gkjsjy/trunk/WebContent/static/biz/js/gkjygl/gkjyr/xkzxx/xkzxxdetail.js

@@ -299,45 +299,56 @@ xkzxx.detail.fzguanbipop=function(){
 xkzxx.detail.saveFile1 = function(){
 //	$("#flag").val("1");
 //	 var i=$("#flag").val();
-	    $('#addform').form('submit', {
-	        url : $.app + '/xkzxx/saveFz',
-	        success : function(data, status) {
-	            var file = $('#zmpic');
-	            file.after(file.clone().val(""));
-	            file.remove();
-	            if (data) {
-	            	data = data.replace("<audio controls=\"controls\" style=\"display: none;\"></audio>","");
-	                data = $.parseJSON(data);
-	            }
-	            if (data.success) {
-	            	$("#fzzm").attr("style","display:none;");
-	                var accContect = data.attrs.acc.name;
-	                var accid = data.attrs.acc.id;
-	                $('#zmpicid').val(accid);
-	                var str = "";
-	                str = "<span id='fzmc1'>" 
-	                      + "<a class='main_title' href='"+$.app+"/accessory/downloadXkz?id="+ accid +"'> " + accContect +"</a>"+"</span>";
-	                str+="<a class='main_title' onclick=\"xkzxx.detail.delFj('"+ accid +"','1');\" class='btn btn-default btn-xs'><i class='glyphicon glyphicon-trash'></i>删除</a>"
-	                $("#fjxq1").empty();
-	                $("#fjxq1").append(str);
-	                $("#fzzm1").text(accContect);
-	                //给附件id文本框赋值
-	                $("#delid1").val(accid);
-	                accContect = "";
-	                $("#zmpic").val("");
-	                $("#fzzm").hide();
-	            }
-	            else {
-	                $.messager.showError(data.message);
-	            }
-	        }
-	    });
+	var picFormat = $('#zmpic').val();
+	picFormat = picFormat.substring(picFormat.lastIndexOf(".")+1,picFormat.length);
+	if(picFormat == "png" || picFormat == "jpg" || picFormat == "jpeg"){
+		 $('#addform').form('submit', {
+		        url : $.app + '/xkzxx/saveFz',
+		        success : function(data, status) {
+		            var file = $('#zmpic');
+		            file.after(file.clone().val(""));
+		            file.remove();
+		            if (data) {
+		            	data = data.replace("<audio controls=\"controls\" style=\"display: none;\"></audio>","");
+		                data = $.parseJSON(data);
+		            }
+		            if (data.success) {
+		            	$("#fzzm").attr("style","display:none;");
+		                var accContect = data.attrs.acc.name;
+		                var accid = data.attrs.acc.id;
+		                $('#zmpicid').val(accid);
+		                var str = "";
+		                str = "<span id='fzmc1'>" 
+		                      + "<a class='main_title' href='"+$.app+"/accessory/downloadXkz?id="+ accid +"'> " + accContect +"</a>"+"</span>";
+		                str+="<a class='main_title' onclick=\"xkzxx.detail.delFj('"+ accid +"','1');\" class='btn btn-default btn-xs'><i class='glyphicon glyphicon-trash'></i>删除</a>"
+		                $("#fjxq1").empty();
+		                $("#fjxq1").append(str);
+		                $("#fzzm1").text(accContect);
+		                //给附件id文本框赋值
+		                $("#delid1").val(accid);
+		                accContect = "";
+		                $("#zmpic").val("");
+		                $("#fzzm").hide();
+		            }
+		            else {
+		                $.messager.showError(data.message);
+		            }
+		        }
+		    });
+	}else{
+		ts("请上传格式为'png'或者'jpg'或者'jpeg'格式的图片",$('#zmpic'));
+	}
+	
+	   
 }
 
 xkzxx.detail.saveFile2 = function(){
 //	$("#flag").val("2");
 //	 var i=$("#flag").val();
-	    $('#addform').form('submit', {
+	var picFormat = $('#fmpic').val();
+	picFormat = picFormat.substring(picFormat.lastIndexOf(".")+1,picFormat.length);
+	if(picFormat == "png" || picFormat == "jpg" || picFormat == "jpeg"){
+		$('#addform').form('submit', {
 	        url : $.app + '/xkzxx/saveFz',
 	        success : function(data, status) {
 	            var file = $('#fmpic');
@@ -372,6 +383,10 @@ xkzxx.detail.saveFile2 = function(){
 	            }
 	        }
 	    });
+	}else{
+		ts("请上传格式为'png'或者'jpg'或者'jpeg'格式的图片",$('#fmpic'));
+	}
+	    
 }
 
 xkzxx.detail.delFj = function(data,flag){