| 
					
				 | 
			
			
				@ -8,9 +8,26 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        actionUrl:"${contextRoot}/app/addApp", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        init: function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            this.toDisable(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            this.bindEvents(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            this.initForm(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        toDisable: function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            debugger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ($("#flag").val()=='disabled') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("#btnEditor").show(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("#btnSave").hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("input[name='name']").attr("disabled", "disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("input[name='code']").attr("disabled", "disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("input[name='icon']").attr("disabled", "disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $($(".btnGrayDo")[0]).attr("disabled","disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("input[name='appUrl']").attr("disabled", "disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("input[name='developer']").attr("disabled", "disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("input[name='appKey']").attr("disabled", "disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("input[name='appSecret']").attr("disabled", "disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("input[name='status']").attr("disabled", "disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        initForm: function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            var me = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           var data; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -35,17 +52,16 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                liger.get("status").selectValue("1");//默认有效 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            var iconVal=$("#name_icon").attr("src"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(iconVal!=''){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("#form1").closest("div").find("span").html("重新上传<i></i>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $("#div_info_form").ligerAutoForm({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                data:data, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                validate:{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    name:"required", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    appUrl:"required", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    developer:"required", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    code:"required", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    icon: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        required:true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    appKey:"required", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    appSecret: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        required:true 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -54,10 +70,23 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            var iconVal=$("#name_icon").val(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(iconVal!=''){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("#form1").closest("div").find("span").html("重新上传<i></i>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        bindEvents: function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            var me = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $(".m-form-bottom").on("click","#btnSave",function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("#btnSave").css("pointer-events","none"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                $("#name_icon").removeClass("required"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if($("#name_icon").val()=="") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    $("#name_icon").addClass("required"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(!$("#div_info_form").ligerAutoForm("validate")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(!$("#div_info_form").ligerAutoForm("validate")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -75,13 +104,28 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            $.ligerDialog.error(data.message); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $("#btnSave").css("pointer-events",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    error :function(data){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $.ligerDialog.error("Status:"+data.status +"(" +data.statusText+")"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $("#btnSave").css("pointer-events",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $(".m-form-bottom").on("click","#btnEditor",function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $("#btnEditor").hide(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $("#btnSave").show(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $("input[name='name']").removeAttr("disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $("input[name='code']").removeAttr("disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $("input[name='icon']").removeAttr("disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $($(".btnGrayDo")[0]).removeAttr("disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $("input[name='appUrl']").removeAttr("disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $("input[name='developer']").removeAttr("disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $("input[name='appKey']").removeAttr("disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $("input[name='appSecret']").removeAttr("disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $("input[name='status']").removeAttr("disabled"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        $("#flag").val(""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $(".m-form-bottom").on("click","#btnCancel",function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                parent.app.dialog.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -96,10 +140,13 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                var obj=$(this).closest("div").find("input[type=file]") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                obj.change(function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    inputVal.val(obj.val()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                obj.click(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            $(".btnGrayDo").bind("click",function(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ($("#flag").val()=='disabled') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                var id = $(this).attr("data-id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                var formId = '#form'+id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                var formObj=$(formId);//要提交的表单 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -107,15 +154,15 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                var upObj=formObj.closest("input").find(".btnGrayUp");//浏览的按钮 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                var formsay=formObj.find(".say"+id);//提示文字 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(formObj.closest("div").find("input[type=text]").val().length!=0){//判断是否选择了文件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    formsay.attr("class","say true").html("上传中"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    formsay.html("上传中"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    formObj.ajaxForm({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        dataType: 'json', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        success:  function processJson(data){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            if(data.successFlg){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                formsay.attr("class","say true").html("上传成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                formObj.find("input[type=text]").attr("data-id","/upload/"+data.message)//设置已上传的文件的ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                formObj.find("input[type=text]").val("/upload/"+data.message)//设置已上传的文件的ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                $("#img_icon").attr("src","/upload/"+data.message)//设置已上传的文件的ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                formsay.html("上传成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                formObj.find("input[type=text]").attr("data-id","${contextRoot}/upload/"+data.message)//设置已上传的文件的ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                formObj.find("input[type=text]").val("${contextRoot}/upload/"+data.message)//设置已上传的文件的ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                $("#img_icon").attr("src","${contextRoot}/upload/"+data.message)//设置已上传的文件的ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                formObj.closest("div").find("span").html("重新上传<i></i>"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                $.ligerDialog.error("上传格式有问题"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -125,7 +172,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            //console.log(eval('('+data.data+')')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        error: function processJson(data){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            formsay.attr("class","say false").html("上传失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            formsay.html("上传失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    formObj.submit(); 
			 |