zoukankan      html  css  js  c++  java
  • 单点登陆的javascript类原创

     

    //--------------------------------
    //短信系统
    //--------------------------------
    ShortObj=function()
    {
     //this.url="http://192.168.0.118";//短信系统的url
     this.url="http://10.11.117.163";//短信系统的url
    }


    ShortObj.prototype.loginShort=function(operatorCode,password)
    {   
     //alert(this.url);
     var url = this.url+'/operatorlogin';
     var pars = 'operatorCode='+operatorCode+'&password='+password;
     var selfp=this;
     var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: pars, onComplete: function(originalRequest){selfp.ongetlogin(originalRequest);}}
        );
     // function(originalRequest){selfp.ongetlogin(originalRequest);}
    }
    ShortObj.prototype.ongetlogin=function(originalRequest)
    {
     
     var strscript = originalRequest.responseText;
     //alert(strscript);
     //this.location="http://192.168.0.118/frame.jsp"
     //alert(this.url);
     window.open(this.url+"/frame.jsp");
    }


    //-------------------------------------
    //修改密码、新增用户
    //-------------------------------------
    ShortObj.prototype.ModifyShort=function(operatorCode,newpassword)
    {   
     var url = this.url+'/operatorlogin';
     var pars = 'operatorCode=0000&password=0';
     var selfp=this;
     var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: pars, onComplete: function(transport){selfp.ModifyDeal(operatorCode,newpassword);}}
        );
    }
    ShortObj.prototype.ModifyDeal=function(id,newpassword)
    {
     var url = this.url+'/attemper';
     var pars = 'actionid=ModifyPasswordAction&id='+id+'&newpassword='+newpassword+'&newpassword2='+newpassword;
     var selfp=this;
     var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: pars, onComplete: selfp.onCompleteEnd}
        );
    }

    ShortObj.prototype.AddShort=function(id,code,name,password)
    {
     var url = this.url+'/operatorlogin';
     var pars = 'operatorCode=0000&password=0';
     var selfp=this;
     var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: pars, onComplete: function(a){selfp.AddDeal(id,code,name,password)}}
        );
    }
    ShortObj.prototype.AddDeal=function(id,code,name,password)
    {
     var url = this.url+'/attemper';
     var pars = 'actionid=OperatorAddAction&operatorType=1&id='+id+'&code='+code+'&name='+name+'&password='+password+'&repassword='+password+'&department=&information=&roleId=1&maxSendSum=0&byDay=0&byMonth=0';
     
     var selfp=this;
     var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: pars, onComplete: selfp.onCompleteEnd}
        );
    }

    ShortObj.prototype.onCompleteEnd=function(originalRequest)
    {
     var strscript = originalRequest.responseText;
     if(strscript.indexOf("成功")>0)
     {
      alert('成功!');
     }
     else
     {
      alert('失败!');
     }
    }
    shortObj=new ShortObj();


    ---应用举例
    shortObj.AddShort(ls_idcard,ls_idcard,ls_name,ls_pwd);

  • 相关阅读:
    用javascript实现简单的用户登录验证
    JS创建数组的三种方法
    JS中的数据类型
    原始值和引用值
    html为什么用雪碧图的优缺点
    html,将元素水平,垂直居中的四种方式
    使用display:none和visibility:hidden隐藏的区别
    jsonview注解、RequestBody 、拦截
    02.实现图形验证码
    spring注解使用
  • 原文地址:https://www.cnblogs.com/kuailewangzi1212/p/1233442.html
Copyright © 2011-2022 走看看