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);

  • 相关阅读:
    Cookie
    C#计算程序的运行时间
    .Net源码之Page类
    AJAX资源
    匿名方法的使用
    序列化和反序列化
    实验分析C#中三种计时器使用异同点
    (转载)突然就看懂了《大话西游》
    做人、做事,做架构师——架构师能力模型解析
    服务颗粒度的困扰(转)
  • 原文地址:https://www.cnblogs.com/kuailewangzi1212/p/1233442.html
Copyright © 2011-2022 走看看