github.com/jincm/wesharechain@v0.0.0-20210122032815-1537409ce26a/app/html/win_register.html (about)

     1  <!DOCTYPE html>
     2  <html>
     3  <head>
     4      <meta charset="utf-8">
     5      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
     6      <title></title>
     7      <link rel="stylesheet" type="text/css" href="../css/api.css"/>
     8      <link rel="stylesheet" type="text/css" href="../css/common.css"/>
     9      <style>
    10          body {
    11              display: -webkit-box;
    12              -webkit-box-orient: vertical;
    13          }
    14          .login-header-btn{
    15              display: block;
    16              background-size: 30px;
    17              padding: 20px;
    18          }
    19          .content {
    20              -webkit-box-flex: 1;
    21          }
    22  
    23          .detail-header {
    24              border-bottom: 1px solid #CDCDCD;
    25              background-color: #DD3237;
    26          }
    27  
    28          .back {
    29              background-size: 40px !important;
    30              background-image: url("../image/weather_back@2x.png");
    31              background-position: right !important;
    32          }
    33  
    34          .detail-header a {
    35              padding: 25px;
    36          }
    37  
    38          .title {
    39              color: #FFFFFF;
    40              text-align: center;
    41              line-height: 50px;
    42              font-size: 18px;
    43          }
    44  
    45          i {
    46              display: block;
    47              width: 30px;
    48              height: 30px;
    49              background-size: 30px;
    50              background-repeat: no-repeat no-repeat;
    51              background-position: center;
    52          }
    53  
    54          .user {
    55              background-image: url("../image/login_username_icon@2x.png");
    56          }
    57          .verify {
    58              background-image: url("../image/login_username_icon@2x.png");
    59          }
    60  
    61          .password {
    62              background-image: url("../image/login_password_icon@2x.png");
    63          }
    64  
    65          .input-wrap {
    66              padding: 10px 0;
    67              display: -webkit-box;
    68              border-bottom: 1px solid #d4d4d4;
    69          }
    70  
    71          .form {
    72              background-color: rgba(255, 255, 255, 0.8);
    73              margin: 20px;
    74              border-radius: 8px;
    75              padding: 0 10px;
    76              line-height: 30px;
    77          }
    78  
    79          .input-wrap input {
    80              display: block;
    81              -webkit-box-flex: 1;
    82              background-color: rgba(255, 255, 255, 0);
    83              outline: none;
    84              height: 32px;
    85          }
    86  
    87          .find-pwd {
    88              text-align: right;
    89              margin: 40px;
    90          }
    91  
    92          .btn {
    93              display: block;
    94              color: #000000;
    95              margin: 0 40px;
    96              text-align: center;
    97              border-radius: 8px;
    98              height: 40px;
    99              line-height: 40px;
   100              border: 1px solid #CECECE;
   101          }
   102  
   103          input {
   104              padding-left: 10px;
   105              font-size: 18px;
   106          }
   107      </style>
   108  </head>
   109  <body>
   110  <header>
   111      <div class="header detail-header">
   112          <div class="back login-header-btn" tapmode="" onclick="closeWin()"></div>
   113  
   114          <div class="title" id="title">注册</div>
   115          <div class="login-header-btn"></div>
   116      </div>
   117  </header>
   118  <div class="content">
   119      <div class="form">
   120          <div class="input-wrap">
   121              <i class="user"></i>
   122              <input type="text" placeholder="邮箱账号或手机号" id="username" value="">
   123          </div>
   124          <div class="input-wrap">
   125              <i class="verify"></i>
   126              <input type="text" placeholder="验证码" id="identify_code" value="">
   127              <div class="btn" id="identify_code" tapmode="" onclick="get_identify_code()">获取验证码</div>
   128          </div>        
   129          <div class="input-wrap">
   130              <i class="password"></i>
   131              <input type="password" placeholder="密码" id="password" value="">
   132          </div>
   133      </div>
   134      <div class="btn" id="login" tapmode="" onclick="register()">注册</div>
   135  </div>
   136  <script src="../script/zepto.min.js"></script>
   137  <script type="text/javascript" src="../script/api.js"></script>
   138  <script type="text/javascript" src="../script/app.js"></script>
   139  <script>
   140      apiready = function () {
   141          $api.fixIos7Bar($(".header"));
   142      };
   143      function closeWin() {
   144          api.closeWin({
   145  
   146          })
   147      }
   148      
   149      function get_identify_code() {
   150      	api.showProgress();
   151      	var username = $("#username").val();
   152      	http_path = '/u/register?account=' + username;
   153      	
   154      	myajax(http_path,"GET","",function(ret,err){
   155          	//coding...
   156          	api.hideProgress();
   157          	if (ret) {
   158  		        var urlJson = JSON.stringify(ret);
   159  		        console.log(urlJson);
   160  		        if(!!ret.body.identify_code){
   161  		        	api.alert({msg: ret.body.identify_code});
   162  		        } else {
   163  		        	api.alert({msg: "Get identify code error"});
   164  		        }
   165  		    }else {
   166  		        api.alert({
   167  		            msg:('错误码:'+err.code+';错误信息:'+err.msg+'网络状态码:'+err.statusCode)
   168  		        });
   169  		    }
   170          });
   171      }
   172      
   173      function register() {
   174          api.showProgress();
   175     
   176          var username = $("#username").val();
   177          var identify_code = $("#identify_code").val();
   178          var password = $("#password").val();
   179  		http_path = '/u/register';    	
   180      	mybody = {"account": username, "identify_code": identify_code, "passwd": password}
   181  
   182      	myajax(http_path,"POST",mybody,function(ret,err){
   183          	//coding...
   184          	api.hideProgress();
   185          	if (ret) {
   186  		        var urlJson = JSON.stringify(ret);
   187  		        //api.alert({msg: urlJson});
   188  		        //api.alert({msg: urlJson.body
   189  		        //console.log(urlJson);
   190  		        console.log(JSON.stringify(ret.body))
   191                  console.log("user_id " + ret.body.user_id);
   192                  console.log("token is " + ret.body.token);
   193                  $api.setStorage("user_id", ret.body.user_id);
   194                  $api.setStorage("token", ret.body.token);		        
   195  
   196  		        api.alert({
   197                      title: '注册成功',
   198                      msg: ret.body.user_id,
   199                      buttons: ['确定']
   200                  }, function (ret, err) {
   201                      if (ret.buttonIndex == 1) {
   202                          api.closeWin();
   203                      }
   204                  });
   205  		    }else {
   206  		        api.alert({
   207  		            msg:('错误码:'+err.code+';错误信息:'+err.msg+'网络状态码:'+err.statusCode)
   208  		        });
   209  		    }
   210          });
   211      }
   212  </script>
   213  </body>
   214  </html>