📖 File Reader
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>注册</title>
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<style></style>
<link rel="stylesheet" href="__PUBLIC__/share/css/style.css">
<script src="__PUBLIC__/share/js/jquery-1.10.2.js"></script>
<script src="__PUBLIC__/share/js/fliexible.js"></script>
<link href="__PUBLIC__/layui-v2.9.14/layui/css/layui.css" rel="stylesheet">
<script src="__PUBLIC__/layui-v2.9.14/layui/layui.js"></script>
<style>
.download{
height: 50px;
align-items: center;
font-size: 14px;
color: blue;
display: flex;
width: 100%;
justify-content: center;
text-align: center;
}
.bgimg{
position: fixed ;
top: 0px;
height: 100%;
width: 100%;
z-index: 999;
}
</style>
</head>
<body class="bg1">
<div class="bg">
{if $browser == 'weixin'}
<img class="bgimg" src="__PUBLIC__/admin/img/fenxiang.png" alt="">
{/if}
<div class="logo">
<img src="{$logo}">
</div>
<form action="" method="post" id="form">
<!-- <div class="int1">-->
<!-- <input type="text" name="user_name" placeholder="请输入账户名" required autocomplete="off">-->
<!-- </div>-->
<div class="int1">
<input type="text" name="mobile" placeholder="请输入手机号" required id="phone1" autocomplete="off">
</div>
<div class="int1">
<input type="text" name="code" required placeholder="请输入验证码">
<input id="btnSendCode1" type="button" class="btn btn-default" value="获取验证码" onClick="sendMessage1()" style="color:#FFFFFF;"/>
</div>
<div class="int1">
<input type="password" name="password" placeholder="请设置密码" required>
</div>
<div class="int1">
<input type="password" name="password2" placeholder="请确认密码" required>
</div>
<div class="int1">
<input type="text" placeholder="请输入邀请码" disabled value="{$invite_code}">
<input type="hidden" name="invite_code" value="{$invite_code}">
</div>
<div class="int2">
<input type="button" onclick="binding()" value="立即注册" style="color:#FFFFFF;">
</div>
</form>
<a class="download" href="{$register_url}">下载地址</a>
</div>
<!--验证-->
<script>
var phoneReg = /(^1\d{10}$)/;//手机号正则
var count = 60; //间隔函数,1秒执行
var InterValObj1; //timer变量,控制时间
var curCount1;//当前剩余秒数
/*第一*/
function sendMessage1() {
curCount1 = count;
var phone = $.trim($('#phone1').val());
if (!phoneReg.test(phone)) {
parent.layer.msg('请输入有效的手机号码', {shift: 2});
return false;
}
//设置button效果,开始计时
$("#btnSendCode1").attr("disabled", "true");
$("#btnSendCode1").val(+curCount1 + "秒再获取");
$("#btnSendCode1").css({cursor: 'not-allowed'});
InterValObj1 = window.setInterval(SetRemainTime1, 1000); //启动计时器,1秒执行一次
//向后台发送处理数据
$.ajax({
type: "POST",
url: "/api/Other/note_send",
data: {'phone': phone}, //组装参数
dataType: "json",
success: function (res) {
parent.layer.msg(res.msg, {shift: 2});
if (res.code == 400){
return false;
}
}
});
}
function SetRemainTime1() {
if (curCount1 == 0) {
window.clearInterval(InterValObj1);//停止计时器
$("#btnSendCode1").removeAttr("disabled");//启用按钮
$("#btnSendCode1").css({cursor: 'pointer'});
$("#btnSendCode1").val("重新发送");
} else {
curCount1--;
$("#btnSendCode1").val(+curCount1 + "秒再获取");
}
}
/*提交*/
function binding() {
var register_url = "{$register_url}";
var formData =new FormData($('#form')[0])
$.ajax({
type:'post',
url:'/api/Login/register',
data:formData,
cache: false,
contentType: false,
processData: false,
dataType: "json",
success: function(res) {
console.log(res);
if (res.code == 200){
layer.msg(res.msg,{
icon:1,
time:1800,
end:function () {
window.location.href=register_url;
}
})
}else{
parent.layer.msg(res.msg, {shift: 2});
}
}
});
}
</script>
</body>
</html>