smartClient isomorphic 登录(一)

/**
 *---------------------------------------------------------------------
 *  Function     : 登录功能
 *	Version	     : 1.0
 *  Date         : 2012-4-9
 *  Descriptions : 登录
 *---------------------------------------------------------------------	 
 */

isc.SearchForm.create({
	ID:'loginForm',
	width:200,
	numCols:2,
	autoFocus:true,
	requiredTitlePrefix:'<font color="red">*</font><b>',
	fields:[
	   {name:'account',title:'账号',length:80,height:25},
	   {name:'password',title:'密码',length:80,type:'password',height:25},	
	   {name:'checkCode',title:'验证码',length:4,icons:[{src:'../check/checkCode.do',click:function(){
		   loginForm.getField("checkCode").setValueIcons("../check/checkCode.do");
	   },height:25}],iconWidth:55,height:25}
	]
});
isc.Dialog.create({
	ID:'loginDlog',
	title:'登录',
	width:200,
	autoSize:true,
	showCloseButton:false,
	canDragReposition:false,
	items:[
	    loginForm
	],
	buttons:[
	   isc.Button.create({title:'登录'})
	],
	buttonClick:function(btn,index){
		var data=loginForm.getValues();
		RPCManager.sendRequest({ 
	    	 evalResult:true,
	    	 //data:data,
	    	 //paramsOnly:true,
	    	 params:data,
	    	 //data:{'account':credentials.username,'password':credentials.password},
	    	 actionURL: "user/login.do",
	    	 callback:function(data){
	    		 if(data.status==isc.RPCResponse.STATUS_SUCCESS){
	    			var data=data.data;
	 	    		if(data.success){
	 	    			window.location.href="index.jsp";
	 	    		}else{
	 	    			if(data.msg!=null){
	 	    				isc.say(data.msg);
	 	    			}
	 	    		}
	    		 }else{
	    			 isc.say('无法检索账户信息',window.location='login.jsp');
	    		 }
	     }});
	}
});

isc.Page.setEvent("load", "loginDlog.show()");

/*isc.LoginDialog.create({
	title:'登录系统',
 	loginButtonTitle:'登录',
 	usernameItemTitle:'账号',
 	passwordItemTitle:'密码',
 	numCols:2,
 	loginFunc:function (credentials, dialogCallback) {
	     if (credentials == null) return; // dismissed
	     var data={'account':credentials.username,'password':credentials.password};
	     
	     RPCManager.sendRequest({ 
	    	 evalResult:true,
	    	 //data:data,
	    	 //paramsOnly:true,
	    	 params:{'account':credentials.username,'password':credentials.password},
	    	 //data:{'account':credentials.username,'password':credentials.password},
	    	 actionURL: "user/login.do",
	    	 callback:function(data){
	    		 if(data.status==isc.RPCResponse.STATUS_SUCCESS){
	    			var data=data.data;
	 	    		if(data.success){
	 	    			window.location.href="index.jsp";
	 	    		}else{
	 	    			if(data.msg!=null){
	 	    				isc.say(data.msg);
	 	    			}
	 	    		}
	    		 }else{
	    			 isc.say('无法检索账户信息',window.location='login.jsp');
	    		 }
	     }});
    }
 });*/
 

你可能感兴趣的:(smartClient,isomorphic)