forgetPassword_reset_frm.html 3.77 KB
<!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"/>
      <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
      <title>重置密码</title>
      <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
      <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
      <link rel="stylesheet" type="text/css" href="../../css/login/forgetPassword.css"/>
      <style>
          html,
          body{
            background-color: #F4F6F9;
          }
      </style>
  </head>
  <body>
    <div class="form-panel">
      <div class="aui-list" style="border-radius:16px;">
        <div class="aui-list-item" style="border-bottom: none;background-size: 100% 0px;">
            <div class="aui-list-item-left">
              <img src="../../image/login_icon_password.png" style="height:24px;width:24px;"/>
            </div>
            <div class="aui-list-item-center">
                <input id="newPwd" class="aui-input" type="password" placeholder="输入新密码" style="border-bottom:1px solid #F0F5FF;margin-right:15px;">
            </div>
        </div>
        <div class="aui-list-item" style="border-bottom: none;background-size: 100% 0px;">
            <div class="aui-list-item-left">
              <img src="../../image/login_icon_repassword.png" style="height:24px;width:24px;"/>
            </div>
            <div class="aui-list-item-center">
                <input id="rePwd" class="aui-input" type="password" placeholder="确认新密码" style="border-bottom:1px solid #F0F5FF;margin-right:15px;">
            </div>
        </div>
      </div>
    </div>
    <div style="margin-left:15px;margin-right:15px;margin-top:15px;">
      <span tapmode onclick="handleReset();" class="next-btn">确认</span>
    </div>
  </body>
  <script type="text/javascript" src="../../script/api.js"></script>
  <script type="text/javascript" src="../../script/common.js"></script>
  <script type="text/javascript">
      apiready = function(){
        api.parseTapmode();
        api.sendEvent({
            name: 'sendThisTitle',
            extra: {
                title: '设置新密码'
            }
        });
        console.log(api.pageParam.phone);
      };

      function handleReset() {
        var newpwd_dom = $api.byId("newPwd");
        var repwd_dom = $api.byId("rePwd");
        newpwd_dom.blur();
        repwd_dom.blur();
        var inputed_new_pwd = $api.trim($api.val($api.byId("newPwd")));
        var inputed_re_pwd = $api.trim($api.val($api.byId("rePwd")));
        if (inputed_new_pwd != inputed_re_pwd) {
          api.toast({msg: '两次密码不一致',duration: 2000,location: 'bottom'});
        }else {
          api.ajax({
              url: HOST + '/iot_api/v1/app/reset_password',
              method: 'post',
              headers: {
                'Content-Type': 'application/json;charset=utf-8'
              },
              data: {
                body: {
                  phone: api.pageParam.phone,
                  code: api.pageParam.code,
                  cid: api.pageParam.cid,
                  new_password: inputed_new_pwd
                }
              }
          }, function(ret, err) {
            console.log(JSON.stringify(ret));
            if (ret.code == 0) {
              api.toast({msg: '修改成功',duration: 2000,location: 'bottom'});
              api.sendEvent({
                  name: 'showPhone',
                  extra: {
                      phone: api.pageParam.phone,
                  }
              });
            }else {
              api.toast({msg: '修改失败',duration: 2000,location: 'bottom'});
            }
          });
        }
      }
  </script>
  </html>