reg.html 5.13 KB
<!DOCTYPE html >
<html>
<head>
<meta name="Generator" content="TPshop1.2" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>登录-{$tpshop_config['shop_info_store_title']}</title>
<meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}" />
<meta name="description" content="{$tpshop_config['shop_info_store_desc']}" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/public.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/flow.css"/> 
<link rel="stylesheet" type="text/css" href="__STATIC__/css/login.css"/> 
<script type="text/javascript" src="__STATIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/global.js"></script>
<script src="__PUBLIC__/js/mobile_common.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer.js" ></script>
</head>
<body>
  <header id="header" class='header'>
    <div class="h-left"><a href="javascript:history.back(-1)" class="sb-back"></a></div>
	<div class="h-mid">会员登录     </div>
 </header>
  <div class="denglu">
		<form action="" method="post">        	
            <div class="Login">
				<dl>
	                <dt>用户名:</dt>
			    	<dd><input type="text" name="username" id="username" placeholder="请输入手机号" value="" /></dd>
				</dl>
                <dl style=" margin-top:15px;">
                <dt>密码:</dt>
					<dd><input type="password" name="password" id="password" placeholder="密码"/></dd>
	            </dl>

				<div class="field submit-btn">
					<input type="button" class="btn_big1" onClick="checkSubmit()"  value="登 录" />
					<input type="hidden" name="referurl" id="referurl" value="{$referurl}">
				</div>
            <div class="ng-foot">
              <div class="ng-cookie-area" >
                <label class="bf1 login_ffri">
					<input type="checkbox" name="remember" value="1" checked=""> &nbsp;自动登录 
				</label>
              </div>
              <div class="ng-link-area" >
                <span style=" margin-right:5px; border-right:1px solid #eeeeee">
                  <a href="{:U('User/reg',array('stoid'=>$Think.request.stoid))}" >免费注册</a>
                </span>
                 <span class="user_line"></span>
                   <span >
                  <a href="{:U('User/forget_pwd',array('stoid'=>$Think.request.stoid))}" >忘记密码?</a>
                </span>
              </div>
              <div class="third-area ">
                <div class="third-area-a">第三方登录</div>
				  <tpshop sql="select * from __PREFIX__plugin where type='login' AND status = 1" item="v" key="k">
					  <if condition="$v['code'] eq 'qq' AND is_qq() neq 1"><a class="ta-qq" href="{:U('LoginApi/login',array('oauth'=>'qq'))}" target="_blank" title="QQ"></a></if>
					  <if condition="$v['code'] eq 'weixin' AND is_weixin() neq 1"><a class="ta-weixin" href="{:U('LoginApi/login',array('oauth'=>'weixin'))}" target="_blank" title="weixin"></a></if>
					  <if condition="$v['code'] eq 'alipay' AND is_alipay() neq 1"><a class="ta-alipay" href="{:U('LoginApi/login',array('oauth'=>'alipay'))}" target="_blank" title="alipay"></a></if>
				  </tpshop>
              </div>
            </div>			
          </div>
            <input type="hidden" id="hidstoid" value="{$Think.request.stoid}">
		</form>
	</div>
<!--新增  考虑是否删除   20170322-->

<script type="text/javascript">
    function verify(){
        $('#verify_code_img').attr('src','/index.php?m=Mobile&c=User&a=verify&r='+Math.random());
    }

function checkSubmit()
{
	var username = $.trim($('#username').val());
	var password = $.trim($('#password').val());
	var stoid=$.trim($('#hidstoid').val());
	var referurl = $('#referurl').val();
    if(username == ''){
        alert("用户名不能为空");
		return false;
	}
	if(!checkMobile(username) && !checkEmail(username)){
        alert("账号格式不匹配");
		return false;
	}
	if(password == ''){
        alert("密码不能为空");
		return false;
	}

$('#login-form').submit();
	$.ajax({
		type : 'post',
		url : '/index.php?m=Mobile&c=User&a=do_login&stoid='+stoid+'&t='+Math.random(),
		data : {username:username,password:password,stoid:stoid,referurl:referurl},
		dataType : 'json',
		success : function(res){
			if(res.status == 1){
				top.location.href = res.url;
			}else{
				showErrorMsg(res.msg);
         verify();
			}
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			showErrorMsg('网络失败,请刷新页面后重试');
		}
	})
}


    function checkMobile(tel) {
        var reg = /(^1[3|4|5|7|8][0-9]{9}$)/;
        if (reg.test(tel)) {
            return true;
        }else{
            return false;
        };
    }
    
    function checkEmail(str){
        var reg = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
        if(reg.test(str)){
            return true;
        }else{
            return false;
        }
    }
    
    function showErrorMsg(msg){
    	//$('.msg-err').show();
    	//$('.J-errorMsg').html(msg);
    	layer.open({content:msg,time:2});
    }

</script>	
</body>
</html>