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

272 lines
8.4 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 f-black text-c"><span class="cursor_p">Create Account</span></div>
<div class="content">
<ul>
<li class="margin-b-7">
<input type="text" onfocus="hide_err('email')" onblur="check_format('email')" id="email" placeholder="Email Address">
<div id="err_email" style="color: red"></div>
</li>
<li class="margin-b-7">
<input type="password" onfocus="hide_err('password')" onblur="check_format('password')" id="password" placeholder="Password">
<div id="err_password" style="color: red"></div>
</li>
<li class="margin-b-7 overflow-f">
<input type="text" onfocus="hide_err('captcha')" id="captcha" placeholder="Enter Captcha">
<div class="w_right text-center">
<img id="verifyimg" src="/captcha/authcode.html" class="img-responsive ">
</div>
<div id="err_captcha" style="color: red; width:100%; overflow: hidden; margin-top:1vw;"></div>
</li>
</ul>
</div>
<div class="tjdl">
<button class="tjbtn" onclick="register()">Registry</button>
</div>
<div class="Register text-r">
<a href="login.html" class="f_blue">Login</a>
</div>
</div>
</div>
</div>
<div class="text-c login_bottom">2015 ORICO Technologies Co.,Ltd copyright<a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=44030702002297" >GuangDong ICP No. 15,025,109</a></div>
<!-- 注册 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 show_err(id, html)
{
var err_id = '#err_' + id;
var input_id = '#' + id;
$(err_id).html(html);
$(input_id).css('border', '1px solid red');
}
function hide_err(id)
{
var err_id = '#err_' + id;
var input_id = '#' + id;
$(err_id).html('');
$(input_id).css('border', '1px solid #dedfe0');
}
function check_format(id)
{
if (id == 'email')
{
var email = $("#email").val();
var arg = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/;
if (!arg.test(email))
{
var html = 'Please check the E-mail';
show_err(id, html);
return false;
}
else
{
hide_err(id);
return true;
}
}
else if (id == 'password')
{
var password = $("#password").val();
var arg = /^(?![a-zA-z]+$)(?!\d+$)(?![!@#$%^&*-.]+$)[a-zA-Z\d!@#$%^&*-.]{8,20}$/;
if (!arg.test(password))
{
var html = 'The password must contain 8-20 characters and at least two types of characters.';
show_err(id, html);
return false;
}
else
{
hide_err(id);
return true;
}
}
}
function register()
{
var email = $("#email").val();
var password = $("#password").val();
var captcha = $("#captcha").val();
var data = {
email: email,
password: password,
captcha: captcha
}
if (!check_format('email') || !check_format('password'))
{
return;
}
$.ajax({
url: '/us/customer/new_register',
type: 'post',
dataType: 'json',
data: data,
success: function(res) {
if (res.code == 200)
{
location.href = '/us/customer/activation.html?email=' + email;
}
if (res.code < 0)
{
$("#verifyimg").trigger('click');
if (res.code == -4)
{
var html = 'Captcha Error';
show_err('captcha', html);
}
else if (res.code == -5)
{
var html = res.msg;
show_err('email', html);
}
else
{
alert(res.msg);
}
}
}
});
};
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("Sent Again" + curCount + "S");
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>
<script type="text/javascript">
$("#verifyimg").click(function(event) {
event.preventDefault();
$img = $("#verifyimg");
$img.attr("src", "/captcha/authcode.html?t=" + Math.random());
//$img.attr("src", $img.attr("src").substring(0, 21) + "?" + Math.random());
//jQuery(this).attr("src", "<?php echo url('/admin/authcode/verify');?>?" + Math.random());
});
</script>