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

486 lines
14 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">
<title>个人中心</title>
{include file="include/head-product" /}
</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>
<div class="swt-Container">
<div class="people">
<div class="people_title">
<ul>
<a href="__ORICOROOT__/index/customer/personal.html"><li class="people_blue">账号管理</li></a>
<a href="__ORICOROOT__/index/customer/my_collection.html"><li>我的收藏</li></a>
</ul>
</div>
<div class="content01">
<?php if (!empty($customer_info)): ?>
<?php
$head_img = $customer_info['picture'] != '' ? $customer_info['picture'] : '__PUBLIC__/web/images/customer/logo_small_03.png';
?>
<div class="people_logo">
<div class="left"><img style="border-radius: 50%;" src="<?php echo $head_img; ?>"></div>
<div class="right">
<div>用户:<?php echo $customer_info['firstname']; ?></div>
<!--<div class="">修改个人信息</div>-->
</div>
</div>
<?php endif; ?>
<div class="people_AC">
<div class="title"><span class="text-l">帐号安全</span></div>
<?php if (!empty($customer_info)): ?>
<ul>
<li>
<div class="u_before">
<div class="left">密码</div>
<div class="right text-r cursor_p">修改密码</div>
</div>
<div class="u_after b_bottom" style="display: none;">
<?php if ($customer_info['have_pwd']): ?>
<div class="m-bottom"><label>旧密码</label><input id="old_pwd" onfocus="hide_err('old_pwd')" class="form-control input_class" type="password"><div id="err_oldpwd" class="Obtain font-red"></div></div>
<?php endif; ?>
<div class="m-bottom"><label>新密码</label><input onfocus="hide_err('new_pwd')" onblur="check_format('password')" id="password" class="form-control input_class" type="password"><div id="err_pwd" class="Obtain font-red"></div></div>
<div class="m-bottom"><label>确认密码</label><input onfocus="hide_err('re_pwd')" onblur="check_format('re_password')" id="re_password" class="form-control input_class" type="password"><div id="err_repwd" class="Obtain font-red"></div></div>
<div class="u_button"><a class="u_button_blue" onclick="update_pwd()">确认</a><a class="u_button_gray">取消</a><a href="__ORICOROOT__/forgetpwd"><span class="forget_button f_blue">忘记密码</span></a></div>
</div>
</li>
<li>
<div class="u_before">
<div class="left">邮箱</div>
<?php if ($customer_info['email'] == ''): ?>
<div class="center"><strong>未绑定邮箱</strong><br>绑定后可通过邮箱登录</div>
<div class="right text-r cursor_p">绑定邮箱</div>
<?php else: ?>
<div class="center"><strong><?php echo $customer_info['email']; ?></strong><br>可通过邮箱登录</div>
<div class="right text-r cursor_p">修改邮箱</div>
<?php endif; ?>
</div>
<div class="u_after b_bottom b_top p-top" style="display: none;">
<div class="m-bottom"><label>邮箱</label><input onfocus="hide_err('email')" id="email" class="form-control input_class" type="text"><div id="err_email" class="Obtain font-red"></div></div>
<div class="u_button"><a onclick="bind_email()" class="u_button_blue">确认</a><a class="u_button_gray">取消</a></div>
</div>
</li>
<li>
<div class="u_before">
<div class="left">手机号码</div>
<div class="center"><strong><?php echo $customer_info['telephone']; ?></strong><br>已验证,可通过手机找回密码</div>
<div id="update_tel" class="right text-r cursor_p">修改手机号</div>
</div>
<div class="u_after b_top p-top" style="display: none;">
<div class="m-bottom"><label>旧手机号</label><input onfocus="hide_err('old_tel')" onblur="check_format('old_tel')" id="old_tel" class="form-control input_class" type="text"><div id="err_oldtel" class="Obtain font-red"></div></div>
<div class="m-bottom"><label>新手机号</label><input onfocus="hide_err('new_tel')" onblur="check_format('new_tel')" id="new_tel" class="form-control input_class" type="text"><div id="err_newtel" class="Obtain font-red"></div></div>
<div class="m-bottom"><label>验证码</label><input class="form-control input_class" type="text" id="captcha3"><div class="Obtain f_blue get_new_captcha cursor_p" onclick="get_captcha('captcha3')">获取验证码</div></div>
<div class="u_button"><a onclick="update_tel()" class="u_button_blue">确认</a><a class="u_button_gray">取消</a></div>
</div>
</li>
</ul>
</div>
<?php endif; ?>
</div>
</div>
</div>
<script type="application/javascript">
/*修改*/
$(document).ready(function(){
$(".u_before .right").click(function(){
$(this).parents(".u_before").hide();
$(this).parents(".u_before").next().show();
})
$(".u_after .u_button_gray").click(function(){
$(this).parents(".u_after").hide();
$(this).parents(".u_after").prev().show();
// hide_err('old_pwd');
// hide_err('new_pwd');
// hide_err('re_pwd');
// hide_err('email');
// hide_err('old_tel');
// hide_err('new_tel');
})
})
/*批量管理*/
$(document).ready(function(){
$(".u_admin01 .Batch").click(function(){
$(".u_admin01").hide();
$(".u_admin02").show();
$(".u_product .check_B").html('<div class="check_B position-a"><input id="" type="checkbox" class="check_box"><label></label></div>');
});
$(".u_admin02 .cancel").click(function(){
$(".u_admin02").hide();
$(".u_admin01").show();
$(".u_product .check_B").html('');
});
})
/*全选*/
$(document).ready(function(){
$(".u_admin02 input[name='check']").click(function(){
if($(this).is(":checked")){
$(".u_product input[type='checkbox']").prop("checked",true);
}else{
$(".u_product input[type='checkbox']").prop("checked",false);
}
})
});
</script>
<!-- bottom s -->
{include file="include/bottom2023" /}
<!-- bottom e -->
</body>
</html>
<script type="text/javascript">
function check_format(id)
{
if (id == 'password')
{
var re_password = $("#re_password").val();
if (re_password != '')
{
check_format('re_password');
}
var password = $("#password").val();
var arg = /^(?![a-zA-z]+$)(?!\d+$)(?![!@#$%^&*-.]+$)[a-zA-Z\d!@#$%^&*-.]{8,20}$/;
if (!arg.test(password))
{
var html = '密码必须包含8-20个字符,且至少包含两种类型字符';
show_err('new_pwd', html);
return false;
}
else
{
hide_err('new_pwd');
return true;
}
}
else if (id == 're_password')
{
var password = $("#password").val();
var re_password = $("#re_password").val();
if (password != re_password)
{
var html = '两次密码不一致';
show_err('re_pwd', html);
return false;
}
else
{
hide_err('re_pwd');
return true;
}
}
else if (id == 'new_tel')
{
var new_tel = $("#new_tel").val();
var arg = /^1[3456789]\d{9}$/;
if (!arg.test(new_tel))
{
var html = '请检查手机号格式';
show_err('new_tel', html);
return false;
}
else
{
hide_err('new_tel');
return true;
}
}
else if (id == 'old_tel')
{
var old_tel = $("#old_tel").val();
var arg = /^1[3456789]\d{9}$/;
if (!arg.test(old_tel))
{
var html = '请检查手机号格式';
show_err('old_tel', html);
return false;
}
else
{
hide_err('old_tel');
return true;
}
}
else 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 = '请检查邮箱格式';
show_err('email', html);
return false;
}
else
{
hide_err('email');
return true;
}
}
}
function update_pwd()
{
var old_pwd = $("#old_pwd").val();
var password = $("#password").val();
var data = {
old_password: old_pwd,
password: password,
};
if (!check_format('password') || !check_format('re_password'))
{
return;
}
$.ajax({
url: '/index/customer/update_pwd',
type: 'post',
dataType: 'json',
data: data,
success: function (res) {
if (res.code == 200)
{
alert(res.msg);
location.reload();
}
else if (res.code == -2)
{
var html = res.msg;
show_err('old_pwd');
}
else
{
alert(res.msg);
}
}
});
}
function bind_email()
{
var email = $("#email").val();
var data = {
email: email
};
if (!check_format('email'))
{
return;
}
$.ajax({
url: '/index/customer/bind_email',
type: 'post',
dataType: 'json',
data: data,
success: function (res) {
if (res.code == 200)
{
alert(res.msg);
location.reload();
}
else if (res.code < 0)
{
var html = res.msg;
show_err('email', html);
}
}
});
}
function update_tel()
{
var old_tel = $("#old_tel").val();
var new_tel = $("#new_tel").val();
var captcha = $("#captcha3").val();
var data = {
old_telephone: old_tel,
new_telephone: new_tel,
captcha: captcha
};
if (!check_format('new_tel') || !check_format('old_tel'))
{
return;
}
$.ajax({
url: '/index/customer/update_tel',
type: 'post',
dataType: 'json',
data: data,
success: function (res) {
if (res.code == 200)
{
alert(res.msg);
location.reload();
}
else if (res.code == -2)
{
var html = res.msg;
show_err('old_tel', html);
}
else
{
alert(res.msg);
}
}
});
}
var sendsms_flag = 1;
function get_captcha(id)
{
if (id == 'captcha1')
{
var telephone = '<?php echo $customer_info['telephone']; ?>';
}
else if (id == 'captcha3')
{
var telephone = $("#new_tel").val();
if (!check_format('new_tel'))
{
return;
}
}
if (sendsms_flag == 0)
{
return;
}
var data = {
telephone: telephone
};
$.ajax({
url: '/index/customer/sendsms',
type: 'post',
dataType: 'json',
data: data,
success: function(data) {
if (data.code) {
//设置button效果开始计时
curCount = 60;
$(".get_new_captcha").attr("disabled", "true");
$(".get_new_captcha").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;
$(".get_new_captcha").removeAttr("disabled"); //启用按钮
$(".get_new_captcha").html("获取短信验证码");
} else {
curCount--;
$(".get_new_captcha").html("重新获取" + curCount + "秒");
}
}
</script>
<script type="text/javascript">
function hide_err(id)
{
if (id == 'old_pwd')
{
$('#err_oldpwd').html('');
$('#old_pwd').css('border', '1px solid #dedfe0');
}
else if (id == 'new_pwd')
{
$('#err_pwd').html('');
$('#password').css('border', '1px solid #dedfe0');
}
else if (id == 're_pwd')
{
$('#err_repwd').html('');
$('#re_password').css('border', '1px solid #dedfe0');
}
else if (id == 'email')
{
$('#err_email').html('');
$('#email').css('border', '1px solid #dedfe0');
}
else if (id == 'old_tel')
{
$('#err_oldtel').html('');
$('#old_tel').css('border', '1px solid #dedfe0');
}
else if (id == 'new_tel')
{
$('#err_newtel').html('');
$('#new_tel').css('border', '1px solid #dedfe0');
}
}
function show_err(id, html)
{
if (id == 'old_pwd')
{
$('#err_oldpwd').html(html);
$('#old_pwd').css('border', '1px solid red');
}
else if (id == 'new_pwd')
{
$('#err_pwd').html(html);
$('#password').css('border', '1px solid red');
}
else if (id == 're_pwd')
{
$('#err_repwd').html(html);
$('#re_password').css('border', '1px solid red');
}
else if (id == 'email')
{
$('#err_email').html(html);
$('#email').css('border', '1px solid red');
}
else if (id == 'old_tel')
{
$('#err_oldtel').html(html);
$('#old_tel').css('border', '1px solid red');
}
else if (id == 'new_tel')
{
$('#err_newtel').html(html);
$('#new_tel').css('border', '1px solid red');
}
}
</script>