< extend name = "Public/bases" / >
< block name = "css" >
< link href = "__CSS__/unlr.css" rel = "stylesheet" >
< script src = "__JS__/lwx.js" > < / script >
< style >
.username_record_list {position:absolute;top:100%;left:0;right:0;z-index:100;background:#FFF;width:100%;border:1px solid #cdcdcd;border-radius:3px;padding:0.6rem 0;}
.username_record_list li {padding:0.6rem 0.9rem 0.6rem 5.5%;position:relative;}
.username_record_list li .name {display:inline-block;width:80%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}
.username_record_list li .delete_btn {float:right;background:url(__IMG__/trade1/icon_normal_shan.png) center center no-repeat;background-size:100% 100%;width:2rem;height:2rem;}
#mobile:focus~.username_record_list {display:block;}
.login-form .input-group .txt {border:none;padding:.4rem 1% .4rem 0;}
.login-form .input-group .txt::-webkit-input-placeholder {
color: #999;
}
.login-form .input-group .txt:-moz-placeholder {
color: #999;
}
.login-form .input-group .txt::-moz-placeholder {
color: #999;
}
.login-form .input-group .txt:-ms-input-placeholder {
color: #999;
}
< / style >
< / block >
< block name = "body" >
< body class = "unlr" >
< header class = "header login-header" >
< div class = "" >
< if condition = "I('get.back') neq ''" >
< a href = "javascript:;history.go('{:I('get.back')}')" class = "hbtn back" > < i class = "iconfont icon-drop-left" > < / i > < / a >
< else / >
< a href = "{:U('user')}" class = "hbtn back" > < i class = "iconfont icon-drop-left" > < / i > < / a >
< / if >
< h1 class = "caption" > 用户登录< / h1 >
< / div >
< / header >
< div class = "occupy" > < / div >
< section class = "trunker" >
< section class = "container" >
< div class = "banner login-banner" >
< div class = "wrap" >
< div class = "imgbox" >
< img src = "__IMG__/head_men.png" >
< / div >
< / div >
< / div >
< div class = "t-form login-form" >
< form class = "login-box" id = "login_form" autocomplete = "off" data-url = "{$url}" >
< div class = "form-group clearfix" >
< div class = "input-group clearfix" id = "url_list" >
< span class = "input-fix input-prefix" > < i class = "iconfont icon-mobile" > < / i > < / span >
<!-- <span class="input - fix input - suffix jsdel" style="right:8.5%;"><i class="iconfont icon - error3"></i></span>
-->
< span class = "input-fix input-suffix jsdrop" > < i class = "iconfont icon-drop-down" > < / i > < / span >
< input type = "text" name = "" id = "mobile" autocomplete = "off" class = "txt jsinput" placeholder = "请输入账号/手机号" >
< / div >
< div class = "input-group clearfix" >
< span class = "input-fix input-prefix" > < i class = "iconfont icon-lock" > < / i > < / span >
< input type = "password" name = "" id = "password" autocomplete = "off" class = "txt jsinput" placeholder = "请输入密码" >
< / div >
< / div >
< p class = "agree" > <!-- 注册账号表示您同意<a href="">最终用户协议</a> --> < / p >
< div class = "btn-group" >
< input type = "button" class = "submit" value = "登录" >
< / div >
< div class = "link-group clearfix" >
<?php if (empty(I('get.pid'))) {?>
< a href = "{:U('User/step1')}" class = "register-btn" > 账号注册 < font class = "line" > |< / font > < / a > < a href = "{:U('User/step')}" class = "register-btn" > 手机注册< / a >
<?php } else {?>
< a href = "<?='mobile.php?s=/User/step1/pid/'.I('get.pid').'/gid/'.I('get.gid').'.html'?>" class = "register-btn" > 账号注册 < font class = "line" > |< / font > < / a >
< a href = "<?='mobile.php?s=/User/step/pid/'.I('get.pid').'/gid/'.I('get.gid').'.html'?>" class = "register-btn" > 手机注册< / a >
<?php }?>
< a href = "{:U('User/forget')}" class = "forget-btn" style = "color: #333" > 忘记密码< / a >
< / div >
< / form >
< / div >
< / section >
< / section >
< div class = "pop pop-window" >
< div class = "pop-box pop-sign" >
< div class = "pop-wrap" > < / div >
< / div >
< / div >
< div class = "popmsg pop-dialog" > < / div >
< script src = "__JS__/pop.lwx.min.js" > < / script >
< script >
$(document).keyup(function(event){
if(event.keyCode == 13){
$('.submit').click();
}
});
function delete_url(e,str,i) {
var arr = str.split(',');
var index = arr.indexOf(i);
if(index>-1)
arr.splice(index,1);
lwx.setItem('username',arr.join(','));
$(e).closest('li').remove();
if($('#url_list #username_record_list li').length< 1 ) {
$('#url_list #username_record_list').remove();
}
}
function input_name(e,i) {
$('#mobile').val(i);
$(e).closest('#username_record_list').hide();
}
var username = lwx.getItem('username');
if(username) {
var uname = username.split(',');
var html = '< ul class = "username_record_list" id = "username_record_list" style = "display:none;" > ';
for(var i=0,len=uname.length;i< len ; i + + ) {
html += '< li > < span class = "name" onclick = "input_name(this,''+uname[i]+'')" > '+uname[i]+'< / span > < a class = "delete_btn" onclick = "delete_url(this,''+username+'',''+uname[i]+'')" href = "javascript:;" > < / a > < / li > ';
}
html += '< / ul > ';
$('#url_list').append(html);
}
$('#mobile').focus(function() {
if($('#url_list #username_record_list').length>0) {
//$('#url_list #username_record_list').show();
}
return false;
});
$('.jsdrop').on('click',function() {
var url = $('#url_list #username_record_list');
if(url.is(':visible')) {
url.hide();$(this).find('i').removeClass('icon-drop-up').addClass('icon-drop-down');
} else {
url.show();$(this).find('i').removeClass('icon-drop-down').addClass('icon-drop-up');
}
return false;
});
$('body').click(function(event) {
var e = event || window.event;
var target = $(e.target);
if(target.closest('#url_list').length< 1 & & target . attr ( ' id ' ) ! = ' url_list ' ) {
$('#url_list #username_record_list').hide();
}
});
var pmsg = $('.popmsg').pop();
$('.submit').click(function(event) {
var mobile = $.trim($('#mobile').val());
var password = $.trim($('#password').val());
var promoteId = parseInt("{:I('get.pid')}") ? parseInt("{:I('get.pid')}") : 0;
var gameId = parseInt("{:I('get.gid')}") ? parseInt("{:I('get.gid')}") : 0;
if (mobile) {
if (password) {
$.ajax({
type:'POST',
url:'{:U("login")}',
data:{'phone':mobile,'password':password,'promote_id':promoteId,'game_id':gameId},
dataType:"Json",
success:function(data){
if(data.status == 1 || data.status == 2){
var username = lwx.getItem('username');
if(username) {
var arr = username.split(',');
if(arr.length>=5) {arr = arr.splice(0,5);}
for(var i=0,len=arr.length;i< len ; i + + ) {
if((!arr[i] & & typeof(arr[i]) != 0) || arr[i] == mobile) {arr.splice(i,1);}
}
arr.unshift(mobile);
mobile = arr.join(',');
}
lwx.setItem('username',mobile);
pmsg.msg(data.msg);
var url = $.trim($('#login_form').attr('data-url'));
setTimeout(function(){
if (data.status == 2) {
window.location.href = 'http://' + "{:C('APPLY_DOWN_DOMAIN')}" + "/index.php?s=/Home/Home/promitionofregestion/gid/" + gameId + "/pid/" + promoteId + "/status/" + "1" + ".html";
} else {
if (url) {
window.location.href = url;
} else {
window.location.href = "{:U('index')}";
}
}
},1500);
}else{
pmsg.msg(data.msg);
return false;
}
}
});
} else{
pmsg.msg('请输入密码');event.preventDefault();
}
} else {
pmsg.msg('请输入手机号码');event.preventDefault();
}
});
$(".jsdel").click(function(){
var input = $(this).siblings('.jsinput');
input.val('').focus();
if($.trim(input.val())) {
$(this).show();
} else {
$(this).hide();
}
return false;
})
< / script >
< / body >
< / block >