325 lines
10 KiB
PHTML
Executable File
325 lines
10 KiB
PHTML
Executable File
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
{include file="include/head" /}
|
||
<script type="text/javascript">
|
||
var navID = "1";
|
||
</script>
|
||
</head>
|
||
<body>
|
||
<!--top-->
|
||
<header class="header-PC header-Product">
|
||
<div id="header" class="theme-black">
|
||
{include file="include/top" /}
|
||
{include file="include/top-header" /}
|
||
</div>
|
||
</header>
|
||
<!--top End-->
|
||
|
||
<!-- 登录 -->
|
||
<div class="login login_bg login_height">
|
||
<div class="swt-Container">
|
||
<div class="login_content">
|
||
<div class="title">
|
||
<ul>
|
||
<li class="accounts blue"><span class="cursor_p">密码登录</span></li>
|
||
<li class="short_letter"><span class="cursor_p">短信登录</span></li>
|
||
</ul>
|
||
</div>
|
||
<div class="content content_01">
|
||
<li class="margin-b-5"><input type="text" id="username" onfocus="handle_focus('username')" onblur="check_format('username')" placeholder="请输入手机号/邮箱"></li>
|
||
<li class="margin-b-5"><input type="password" onblur="check_format('username')" onfocus="handle_focus('username')" id="password" placeholder="请输入密码"></li>
|
||
<div id="err_t1" class="err"></div>
|
||
<div class="tjdl">
|
||
<a class="tjbtn" id="submit-btn" onclick="login('login_by_username')">登录</a>
|
||
</div>
|
||
</div>
|
||
<div class="content content_02" style="display: none;">
|
||
<li class="margin-b-5"><input type="text" onfocus="handle_focus('telephone')" onblur="check_format('telephone')" id="telephone" placeholder="请输入手机号"></li>
|
||
<li class="margin-b-5"><input type="password" value="" id="captcha1" placeholder="请输入验证码">
|
||
<div class="Obtain cursor_p" onclick="get_captcha('captcha1')">获取验证码</div>
|
||
</li>
|
||
<div id="err_t2" class="err"></div>
|
||
<div class="tjdl">
|
||
<a class="tjbtn" id="submit-btn" onclick="login('login_by_captcha')">登录</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="Register">
|
||
<a href="__ORICOROOT__<?php echo url('/register'); ?>" class="left">立即注册</a>
|
||
<a href="__ORICOROOT__<?php echo url('/forgetpwd'); ?>" class="right">忘记密码?</a>
|
||
</div>
|
||
<div class="short">
|
||
<div class="Quick"><span>其它登录方式</span></div>
|
||
<a onclick='toLogin()'><img src="__PUBLIC__/web/images/customer/QQ.png" height="33"></a>
|
||
<a onclick='toLoginwx()'><img src="__PUBLIC__/web/images/customer/weixin.png" height="33"></a>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
<!-- 登录 -->
|
||
<!-- QQ快捷登录-->
|
||
<script
|
||
type="text/javascript" charset="utf-8"
|
||
src="http://connect.qq.com/qc_jssdk.js"
|
||
data-appid="101544135"
|
||
data-redirecturi="http://www.oricogroup.com/index/customer/save">
|
||
</script>
|
||
|
||
<script>
|
||
$(document).ready(function(){
|
||
$(".accounts").click(function(){
|
||
$(this).siblings().removeClass("blue");
|
||
$(this).addClass("blue");
|
||
$(".content_02").hide();
|
||
$(".content_01").show();
|
||
flag = 1;
|
||
})
|
||
$(".short_letter").click(function(){
|
||
$(this).siblings().removeClass("blue");
|
||
$(this).addClass("blue");
|
||
$(".content_01").hide();
|
||
$(".content_02").show();
|
||
flag = 2;
|
||
})
|
||
})
|
||
function toLogin()
|
||
{
|
||
//以下为按钮点击事件的逻辑。注意这里要重新打开窗口
|
||
//否则后面跳转到QQ登录,授权页面时会直接缩小当前浏览器的窗口,而不是打开新窗口
|
||
var A=window.open("https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=101544135&redirect_uri=http://www.orico.com.cn/index/customer/save&scope=get_user_info",'_blank');
|
||
// var A=window.open("/index/qqlogin/index.html", "location=1");
|
||
}
|
||
function toLoginwx()
|
||
{
|
||
//以下为按钮点击事件的逻辑。注意这里要重新打开窗口
|
||
//否则后面跳转到QQ登录,授权页面时会直接缩小当前浏览器的窗口,而不是打开新窗口
|
||
var A=window.open("https://open.weixin.qq.com/connect/qrconnect?appid=wx979d391fdfb583d1&redirect_uri=http%3a%2f%2fwww.orico.com.cn%2findex%2fcustomer%2fwx_save&response_type=code&scope=snsapi_login&state=wx#wechat_redirect");
|
||
// var A=window.open("/index/qqlogin/index.html", "location=1");
|
||
}
|
||
</script>
|
||
|
||
|
||
<!-- bottom s -->
|
||
{include file="include/bottom" /}
|
||
<!-- bottom e -->
|
||
</body>
|
||
</html>
|
||
|
||
<script type="text/javascript">
|
||
function handle_focus(id)
|
||
{
|
||
if (id == 'username')
|
||
{
|
||
$('#err_t1').html('');
|
||
$('#username').css('border', '1px solid #dedfe0');
|
||
}
|
||
else if (id == 'telephone')
|
||
{
|
||
$('#err_t2').html('');
|
||
$('#telephone').css('border', '1px solid #dedfe0');
|
||
}
|
||
}
|
||
|
||
function check_format(id)
|
||
{
|
||
if (id == 'username')
|
||
{
|
||
var username = $("#username").val();
|
||
var arg1 = /^1[3456789]\d{9}$/;
|
||
var arg2 = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/;
|
||
if (username == '')
|
||
{
|
||
return false;
|
||
}
|
||
|
||
if (!arg1.test(username) && !arg2.test(username))
|
||
{
|
||
var html = '<span style="color: red">请检查账号格式</span>';
|
||
$('#err_t1').html(html);
|
||
$('#username').css('border', '1px solid red');
|
||
return false;
|
||
}
|
||
else
|
||
{
|
||
$('#err_t1').html('');
|
||
$('#username').css('border', '1px solid #dedfe0');
|
||
return true;
|
||
}
|
||
}
|
||
else if (id == 'telephone')
|
||
{
|
||
var telephone = $("#telephone").val();
|
||
var arg = /^1[3456789]\d{9}$/;
|
||
if (telephone == '')
|
||
{
|
||
return false;
|
||
}
|
||
|
||
if (!arg.test(telephone))
|
||
{
|
||
var html = '<span style="color: red">请检查手机号格式</span>';
|
||
$('#err_t2').html(html);
|
||
$('#telephone').css('border', '1px solid red');
|
||
return false;
|
||
}
|
||
else
|
||
{
|
||
$('#err_t2').html('');
|
||
$('#telephone').css('border', '1px solid #dedfe0');
|
||
return true;
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
var flag = 1;
|
||
function login(id)
|
||
{
|
||
if (id == 'login_by_username')
|
||
{
|
||
var username = $("#username").val();
|
||
var password = $("#password").val();
|
||
var data = {
|
||
username: username,
|
||
password: password
|
||
};
|
||
|
||
if (!check_format('username'))
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
else if (id == 'login_by_captcha')
|
||
{
|
||
var telephone = $("#telephone").val();
|
||
var captcha = $("#captcha1").val();
|
||
var data = {
|
||
telephone: telephone,
|
||
captcha: captcha
|
||
};
|
||
|
||
if (!check_format('telephone'))
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
|
||
$.ajax({
|
||
url: '/index/customer/new_login',
|
||
type: 'post',
|
||
dataType: 'json',
|
||
data: data,
|
||
success: function (res) {
|
||
if (res.code == 200)
|
||
{
|
||
var redirect_uri = '<?php echo $url; ?>';
|
||
if (redirect_uri != '')
|
||
{
|
||
location.href = redirect_uri;
|
||
}
|
||
else
|
||
{
|
||
location.href = '/index/customer/personal';
|
||
}
|
||
}
|
||
else if (res.code < 0)
|
||
{
|
||
if (flag == 1)
|
||
{
|
||
var html = '<span style="color: red">' + res.msg + '</span>';
|
||
$('#err_t1').html(html);
|
||
}
|
||
else if (flag == 2)
|
||
{
|
||
var html = '<span style="color: red">' + res.msg + '</span>';
|
||
$('#err_t2').html(html);
|
||
}
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
var sendsms_flag = 1;
|
||
function get_captcha(type)
|
||
{
|
||
if (type == 'captcha1')
|
||
{
|
||
var url = '/index/customer/sendsms';
|
||
var telephone = $("#telephone").val();
|
||
var data = {
|
||
login:1,
|
||
telephone: telephone
|
||
};
|
||
|
||
if (sendsms_flag == 0)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (!check_format('telephone'))
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
else if (type == 'captcha2')
|
||
{
|
||
|
||
}
|
||
|
||
$.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)
|
||
{
|
||
if (flag == 1)
|
||
{
|
||
id = 'login_by_username';
|
||
}
|
||
else if (flag == 2)
|
||
{
|
||
id = 'login_by_captcha';
|
||
}
|
||
login(id);
|
||
}
|
||
|
||
});
|
||
</script>
|