Files
orico-official-website-old/app/index/view/customer/register.phtml
2024-10-29 14:04:59 +08:00

254 lines
8.1 KiB
PHTML
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
{include file="include/head-product" /}
<script type="text/javascript">
var navID = "1";
</script>
</head>
<body class="bg-gray">
<!-- 注册 -->
<div class="login" style="margin-top:186px;">
<div class="swt-Container">
<div class="login_content_register">
<div class="text-c" style="margin-bottom: 2vw"><a href="__ORICOROOT__"><img src="/uploads/default/logo-black.png"></a></div>
<div class="title text-c">
<!-- <span class="accounts blue cursor_p">手机注册</span> -->
<!--<ul>
<li class="accounts blue cursor_p">手机注册</li>
<li class="short_letter cursor_p">邮箱注册</li>
</ul>-->
</div>
<div class="content content_01">
<li class="margin-b-7"><input type="text" value="" onclick="handle_focus('telephone')" onblur="check_format('telephone')" id="telephone" placeholder="请输入手机号码"></li>
<li class="margin-b-7"><input type="text" value="" id="captcha1" placeholder="请输入验证码">
<button class="Obtain cursor_pcursor_p" onclick="get_captcha('captcha1')">获取验证码</button>
</li>
<div id="err_tel"></div>
</div>
<div class="content content_02" style="display: none;">
<li class="margin-b-7"><input type="text" value="" id="email" placeholder="请输入邮箱"></li>
<li class="margin-b-7"><input type="text" value="" id="captcha2" placeholder="请输入验证码">
<div class="Obtain cursor_p" onclick="get_captcha('captcha2')">获取验证码</div>
</li>
</div>
<div class="tjdl">
<button class="tjbtn" onclick="register()">注册</button>
</div>
<div class="Register text-r">
<a href="login.html" class="f_blue">立即登录</a>
</div>
</div>
</div>
</div>
<div class="text-c login_bottom">2015 ORICO Technologies Co.,Ltd 版权所有(<a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=44030702002297" >粤ICP备15025109号-3</a>
<p> <a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=44030702002297" ><img src=""/>粤公网安备 44030702002297号 <img src="__PUBLIC__/web/images/orico_co_icon.png" style="vertical-align: middle;"></a></p>
</div>
<!-- 注册 e -->
<!-- bottom s -->
<!-- bottom e -->
</body>
</html>
<script type="text/javascript">
$(document).ready(function(){
$(".accounts").click(function(){
$(this).siblings().removeClass("blue");
$(this).addClass("blue");
$(".content_02").hide();
$(".content_01").show();
})
$(".short_letter").click(function(){
$(this).siblings().removeClass("blue");
$(this).addClass("blue");
$(".content_01").hide();
$(".content_02").show();
})
})
function isNull(data) {
return (data == "" || data == undefined || data == null) ? true : false;
}
function trim(str) {
return str.replace(/(^\s*)|(\s*$)/g, '');
}
function validEmail(email) {
//对电子邮件的验证
var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
return reg.test(email);
}
</script>
<script type="text/javascript">
function handle_focus(id)
{
if (id == 'telephone')
{
$('#telephone').css('border', '1px solid #dedfe0');
$('#err_tel').html('');
}
}
function check_format(id)
{
if (id == 'telephone')
{
var telephone = $("#telephone").val();
var arg = /^1[3456789]\d{9}$/;
if (!arg.test(telephone))
{
var html = '<span style="color: red">请检查手机号格式</span>';
$('#err_tel').html(html);
$('#telephone').css('border', '1px solid red');
return false;
}
else
{
$('#telephone').css('border', '1px solid #dedfe0');
$('#err_tel').html('');
return true;
}
}
}
function register()
{
var telephone = $("#telephone").val();
var email = $("#email").val();
var flag = 0; // 标记手机还是邮箱注册
if (telephone)
{
var captcha = $("#captcha1").val();
data = {
telephone: telephone,
captcha: captcha
};
flag = 1;
}
else if (email)
{
var captcha = $("#captcha2").val();
data = {
email: email,
captcha: captcha
};
flag = 2;
alert('邮箱注册暂不可用');
return;
}
if (!check_format('telephone'))
{
return;
}
$.ajax({
url: '/index/customer/new_register',
type: 'post',
dataType: 'json',
data: data,
success: function(res) {
if (res.code == 200)
{
location.href = '/index/customer/personal';
}
if (res.code < 0)
{
if (flag == 1)
{
var html = '<span style="color: red">' + res.msg + '</span>';
$('#err_tel').html(html);
}
else if (flag == 2)
{
var html = '<span style="color: red">' + res.msg + '</span>';
$('#err_tel').html(html);
}
}
}
});
};
var sendsms_flag = 1;
function get_captcha(type)
{
if (type == 'captcha1')
{
var url = '/index/customer/sendsms';
var telephone = $("#telephone").val();
var data = {
register: 1,
telephone: telephone
};
if (sendsms_flag == 0)
{
return;
}
if (!check_format('telephone'))
{
return;
}
}
else if (type == 'captcha2')
{
alert('邮箱注册暂不可用');
return;
}
$.ajax({
url: url,
type: 'post',
dataType: 'json',
data: data,
success: function(data) {
if (data.code > 0) {
//设置button效果开始计时
curCount = 60;
$(".Obtain").attr("disabled", "true");
$(".Obtain").html("重新获取" + curCount + "秒");
InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器1秒执行一次
sendsms_flag = 0;
setTimeout(function() {
sendsms_flag = 1;
}, 60000);
} else {
alert(data.msg);
}
}
});
}
function SetRemainTime() {
if (curCount < 1) {
window.clearInterval(InterValObj); //停止计时器
InterValObj = null;
$(".Obtain").removeAttr("disabled"); //启用按钮
$(".Obtain").html("获取短信验证码");
} else {
curCount--;
$(".Obtain").html("重新获取" + curCount + "秒");
}
}
$(document).keyup(function(e) {
var code = e.keyCode;
if (code == 13)
{
register();
}
});
</script>