每日优鲜登陆布局login.html

登陆login布局

<!DOCTYPE html>
  <html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <title>title</title>
      <link rel="stylesheet" type="text/css" href="../css/api.css"/>
      <style>
          body{

          }

        header{
          width: 100%;
          height:50px;
          background-color: rgb(218, 1, 107);
          position:relative;
        }

        header .left{
          position: absolute;
          width:22px;
          height:100%;
          left:8px;
          top:0;
          background: url('../image/back.png');
          background-position: center;
          background-repeat: no-repeat;
          background-size: 11px 20px;
        }
        header .center{
          width:100%;
          height:100%;
          line-height: 50px;
          text-align: center;
          color:#fff;
          font-size: 18px;
        }
        header .right{
          position: absolute;
          top:0;
          right: 18px;
          height: 100px;
          line-height: 50px;
          color: #fff;
          font-size: 20px;
        }
        .row{
          width:auto;
          box-sizing: border-box;
          height:70px;
          margin:0 32px;
          padding-top: 40px;
          padding-left: 8px;
          border-bottom: 1.5px solid #888;
        }
        .input{
          width: 100%;
          border: none;
          outline: none;
          font-size: 16px;
        }
        .btn{
          width:auto;
          height: 50px;
          background:  rgb(218, 1, 107);
          margin: 32px 32px;
          color:#fff;
          font-size: 25px;
          text-align: center;
          line-height: 50px;
          /*边间弧度*/
          border-radius: 10px;
        }
        .highlight{
          /*高量实现透明度*/
          opacity:  0.7;
        }
        .wxbtn{
          width:auto;
          height:45px;
          box-sizing: border-box;
          background: url('../image/share_friend.png');
          background-position:18px center;
          background-repeat: no-repeat;
          background-size: 25px 18px;
          margin:0px 90px;
          line-height: 50px;
          color:#888;
          font-size: 20px;
          border-top: 1px solid #aaa;
          border-bottom: 1px solid #aaa;
          border-left: 1px solid rgb(255, 225, 225);
          border-right: 1px solid rgb(255, 225, 225);
          border-radius: 8px;
          padding-left: 45px;

        }
      </style>
  </head>
  <body>
    <header id="header">
      <div class="left" tapmode οnclick="api.closeWin()"></div>
      <div class="center">会员登录</div>
      <div class="right" tapmode οnclick="toRegister()">注册</div>
    </header>

    <!--  注册界面    -->
    <div class="row">
      <input type="text" class="input" id="username" placeholder="用户名(不多于6位)" maxlength="6">
    </div>
    <div class="row">
      <input type="password" class="input" id="password" placeholder="密码" maxlength="16">
    </div>
    <div class="btn" tapmode="highlight" οnclick="toLogin()">登录</div>
    <div class="wxbtn" tapmode="highlight" >使用微信登录</div>
  </body>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript">
      apiready = function(){
        api.addEventListener({
            name: 'account'
        }, function(ret, err){
            if( ret ){
              updateAccount(ret.value.username)
                // alert( JSON.stringify( ret ) );
            }else{
                 alert( JSON.stringify( err ) );
            }
        });
      };
      function updateAccount(un){
        /*获取输入框*/
        var usrInput = $api.byId('username');
      //  alert(usrInput);
        /*更改*/
        usrInput.value = un;
      }
      /*登录实现*/
      var usrValue,passValue;
      function toLogin(){
        usrValue = $api.byId('username').value;
        passValue = $api.byId('password').value;
        if(!usrValue||!passValue){
          alert("请输入账号和密码!");
        }else{
          api.ajax({
              url: 'https://d.apicloud.com/mcm/api/user/login',
              method: 'post',
              "headers": {
                  "X-APICloud-AppId": "A6944685896647",
                  "X-APICloud-AppKey": "2854C996-B52C-9991-ED1D-0A8B8F4F7BA5"
              },
              data: {
                  values: {
                      "username": usrValue,
                      "password":passValue
                  }
              }
          },function(ret, err){
              if (ret) {
                alert(" 登录成功");
                  //alert( JSON.stringify( ret ) );
                  /*设置登陆的标记*/
                  $api.setStorage('logSuccess', usrValue);
                   /*返回主界面*/
                  api.closeWin();
              } else {
                  alert( JSON.stringify( err ) );
              }
          });

        }
      }
      /*注册界面*/
      function toRegister() {
        api.openWin({
            name: 'register',
            url: './register.html',
            pageParam: {
                name: 'test'
            }
        });


      }
  </script>
  </html>

转载于:https://my.oschina.net/u/3584445/blog/1162468

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值