简单,首先复制默认login.html的form部分,再把登录js地址改成,例如下面
<form class="login-form" id="myform" action="" method="post"> <h3 class="form-title font-green">会员登录</h3> <div class="form-group"> <label class="control-label visible-ie8 visible-ie9">会员名称</label> <input class="form-control form-control-solid placeholder-no-fix" type="text" autocomplete="off" placeholder="Username" name="data[username]" /> </div> <div class="form-group"> <label class="control-label visible-ie8 visible-ie9">登录密码</label> <input class="form-control form-control-solid placeholder-no-fix" type="password" autocomplete="off" placeholder="Password" name="data[password]" /> </div> <div class="form-group"> <div class="col-sm-6" style="padding-left:0;padding-right:0"> <input class="form-control form-control-solid placeholder-no-fix" type="text" autocomplete="off" placeholder="验证码" name="code" /> </div> <div class="col-sm-6"> <img align="absmiddle" style="cursor:pointer;" onclick="this.src='{dr_member_url('api/captcha', array('width' => 120, 'height' => 40))}&'+Math.random();" src="{dr_member_url('api/captcha', array('width' => 120, 'height' => 40))}" /> </div> </div> <div class="form-actions"> <button type="button" onclick="dr_submit()" class="btn green uppercase">登录</button> </div> <div class="login-options" style="margin-bottom: 10px"> <ul class="social-icons"> {list action=cache name=oauth} <li> <a class="social-icon-color facebook" style="border-radius:0!important;background-position:0 0!important;background: url({THEME_PATH}oauth/{$t.id}.png) no-repeat" href="javascript:;" onclick="window.location.href='{dr_member_url('api/oauth')}&id={$t.id}'"> </a> </li> {/list} </ul> </div> </form> <script type="text/javascript"> function dr_submit() { var post = $("#myform").serialize(); $.ajax({type: "POST",dataType:"json", url: "{dr_member_url('login/index')}", data: post, success: function(data) { if (data.status) { dr_tips('登录成功,即将为您跳转....', 3, 1); setTimeout('window.location.href="'+data.backurl+'"', 2000); var sync_url = data.syncurl; // 发送同步登录信息 for(var i in sync_url){ $.ajax({ type: "GET", async: false, url:sync_url[i], dataType: "jsonp", success: function(json){ }, error: function(){ } }); } } else { dr_tips(data.code); } }, error: function(HttpRequest, ajaxOptions, thrownError) { alert(HttpRequest.responseText); } }); } </script>
以上代码可以放到任意一个页面上
文档最后更新时间:2017-04-05 03:41:47