簡單,首先復(fù)制默認(rèn)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="驗(yàn)證碼" 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('登錄成功,即將為您跳轉(zhuǎn)....', 3, 1); setTimeout('window.location.href="'+data.backurl+'"', 2000); var sync_url = data.syncurl; // 發(fā)送同步登錄信息 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