223 lines
11 KiB
PHTML
Executable File
223 lines
11 KiB
PHTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
{include file="include/head" /}
|
|
<script type="text/javascript">
|
|
var navID = "0";
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<!--top-->
|
|
{include file="include/top-product" /}
|
|
<!--top End-->
|
|
|
|
<div class="people">
|
|
<div class="petit"><span>个人主页</span></div>
|
|
<div><img src="__PUBLIC__/web/images/images/tximg.jpg"></div>
|
|
<div class="peotx">
|
|
<p class="ptx1">
|
|
关注
|
|
<span>0</span>
|
|
</p>
|
|
<img src="<?php echo $customer['picture'] ? $customer['picture'] : '/uploads/user/ns0.jpg'; ?>" id="reset-tx">
|
|
<p class="ptx2">
|
|
分享
|
|
<span>0</span>
|
|
</p>
|
|
<div class="pname"><?php echo $customer['firstname']; ?></div>
|
|
<div class="psf" id="sd">湖南</div>
|
|
<!-- <div class="pbj">一句话描述自己吧!<a href="javascript:;"><img src="__PUBLIC__/web/images/images/b1.png"></a></div>-->
|
|
</div>
|
|
<div class="swt-Container-1200 pelist">
|
|
<div class="pecon">
|
|
<form id="user-form">
|
|
<div class="peinfo">基本信息</div>
|
|
<div class="peput">
|
|
<i>性别</i>
|
|
<input value="男" name="sex" type="radio" <?php if ($customer['sex'] == '男'): ?>checked="checked"<?php endif; ?>/><label class="sex">男</label>
|
|
<input value="女" name="sex" type="radio" <?php if ($customer['sex'] == '女'): ?>checked="checked"<?php endif; ?>/><label class="sex">女</label>
|
|
</div>
|
|
<div class="peput">
|
|
<i>手机号码</i>
|
|
<span class="phnum"><?php echo $customer['telephone']; ?></span>
|
|
</div>
|
|
<div class="peput">
|
|
<i>邮箱号</i>
|
|
<span class="bding">绑定(<?php echo $customer['email']; ?>)</span>
|
|
<div class="pearea">
|
|
<div class="cha">
|
|
<input type="text" value="" class="binds" placeholder="请输入邮箱号" id="email"/><br>
|
|
<a href="javascript:;" class="chas"><img src="__PUBLIC__/web/images/images/cha11.png"></a>
|
|
</div>
|
|
<a href="javascript:;" class="cfirm1" id="reset-email">取消</a>
|
|
<a href="javascript:;" class="cfirm2" id="submit-email">确认</a>
|
|
</div>
|
|
</div>
|
|
<div class="peput">
|
|
<i>修改密码</i>
|
|
<input type="password" class="infos" placeholder="请输入修改密码" id="password"/><br>
|
|
<input type="password" class="infos1" placeholder="请再次确认密码" id="repassword"/><br>
|
|
<a href="javascript:;" class="cfirm1" id="reset-pwd">取消</a>
|
|
<a href="javascript:;" class="cfirm2" id="submit-pwd">确认</a>
|
|
</div>
|
|
<div class="peput">
|
|
<i>QQ</i>
|
|
<input type="text" name="qq" value="<?php echo $customer['qq']; ?>" class="infos" placeholder="请输入QQ号码"/>
|
|
</div>
|
|
<div class="peput">
|
|
<i>生日</i>
|
|
<input type="date" name="birthday" value="<?php echo $customer['birthday']; ?>" class="infos" placeholder="选择日期"/>
|
|
</div>
|
|
<div class="peput">
|
|
<i>行业</i>
|
|
<select name="hangye">
|
|
<?php foreach ($hangye as $hy): ?>
|
|
<option value="<?php echo $hy; ?>" <?php if ($hy == $customer['hangye']): ?>selected="selected"<?php endif; ?>><?php echo $hy; ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<div class="peput">
|
|
<i>职业</i>
|
|
<select name="zhiye">
|
|
<?php foreach ($zhiye as $zy): ?>
|
|
<option value="<?php echo $zy; ?>" <?php if ($zy == $customer['zhiye']): ?>selected="selected"<?php endif; ?>><?php echo $zy; ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<a href="javascript:;" class="save" id="submit-user">保存</a>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
$(".bding").click(function() {
|
|
$(".pearea").slideDown();
|
|
});
|
|
$(".chas").click(function() {
|
|
$(".pearea").hide();
|
|
});
|
|
$("#user-form .sex").click(function() {
|
|
$("#user-form input[name='sex']").removeAttr('checked');
|
|
$(this).prev().prop('checked', 'true');
|
|
});
|
|
$("a#submit-user").click(function(event) {
|
|
event.preventDefault();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: '<?php echo url('/index/user/update'); ?>',
|
|
data: $("form#user-form").serialize(),
|
|
dataType: 'json',
|
|
success: function(data) {
|
|
if (data.code) {
|
|
window.location.reload();
|
|
} else {
|
|
alert(data.msg);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
$("a#reset-email").click(function(event) {
|
|
event.preventDefault();
|
|
var emailObj = document.getElementById('email');
|
|
emailObj.value = '';
|
|
emailObj.focus();
|
|
});
|
|
$("a#reset-pwd").click(function(event) {
|
|
event.preventDefault();
|
|
var passwordObj = document.getElementById('password');
|
|
var repasswordObj = document.getElementById('repassword');
|
|
passwordObj.value = '';
|
|
repasswordObj.value = '';
|
|
passwordObj.focus();
|
|
});
|
|
$("a#submit-email").click(function(event) {
|
|
event.preventDefault();
|
|
var emailObj = document.getElementById('email');
|
|
if (isNull(emailObj.value) && !validEmail(emailObj.value)) {
|
|
alert('邮箱格式不正确');
|
|
emailObj.focus();
|
|
return false;
|
|
}
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: '<?php echo url('/index/user/resetemail'); ?>',
|
|
data: {email: emailObj.value},
|
|
dataType: 'json',
|
|
success: function(data) {
|
|
if (data.code) {
|
|
alert(data.msg);
|
|
window.location.reload();
|
|
} else {
|
|
alert(data.msg);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
$("a#submit-pwd").click(function(event) {
|
|
event.preventDefault();
|
|
var passwordObj = document.getElementById('password');
|
|
if (isNull(passwordObj.value) || passwordObj.value.length < 6) {
|
|
alert('用户密码不能少于6个字符');
|
|
passwordObj.focus();
|
|
return false;
|
|
}
|
|
var repasswordObj = document.getElementById('repassword');
|
|
if (isNull(repasswordObj.value) || repasswordObj.value.length < 6) {
|
|
alert('确认密码不能少于6个字符');
|
|
repasswordObj.focus();
|
|
return false;
|
|
}
|
|
if (repasswordObj.value !== passwordObj.value) {
|
|
repasswordObj.focus();
|
|
alert('用户密码和确认密码不相同');
|
|
return false;
|
|
}
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: '<?php echo url('/index/user/resetpwd'); ?>',
|
|
data: {password: passwordObj.value, repassword: repasswordObj.value},
|
|
dataType: 'json',
|
|
success: function(data) {
|
|
if (data.code) {
|
|
alert(data.msg);
|
|
} else {
|
|
alert(data.msg);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
//var timer = window.setInterval("showDate()", 1000);
|
|
function showDate() {
|
|
var obj;
|
|
var dat;
|
|
obj = new Date();
|
|
dat = obj.getFullYear() + "-";
|
|
dat += obj.getMonth() + 1 + "-";
|
|
dat += obj.getDay() + 24 + " ";
|
|
dat += obj.getHours() + ":";
|
|
dat += obj.getMinutes() + ":";
|
|
dat += obj.getSeconds();
|
|
document.getElementById("sd").innerHTML = dat;
|
|
}
|
|
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>
|
|
|
|
<!-- bottom s -->
|
|
{include file="include/bottom" /}
|
|
<!-- bottom e -->
|
|
</body>
|
|
</html>
|