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

231 lines
11 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" /}
<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> Personal Homepage </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">Hunan</div>
<div class="pbj">Introduce yourself briefly<a href="javascript:;"><img src="__PUBLIC__/web/images/images/b1.png"></a></div>
</div>
<div class="w1200 pelist">
<div class="pecon">
<form id="user-form">
<div class="peinfo">Information</div>
<div class="peput">
<i>Gender</i>
<input value="Male" name="sex" type="radio" <?php if ($customer['sex'] == 'Male'): ?>checked="checked"<?php endif; ?>/><label class="sex">Male</label>
<input value="Female" name="sex" type="radio" <?php if ($customer['sex'] == 'Female'): ?>checked="checked"<?php endif; ?>/><label class="sex">Female</label>
</div>
<div class="peput">
<i>E-mail Address</i>
<span class="bding">Binding(<?php echo $customer['email']; ?>)</span>
<div class="pearea">
<div class="cha">
<input type="text" value="" class="binds" placeholder="Please enter your Email" 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">Cancel</a>
<a href="javascript:;" class="cfirm2" id="submit-email">Submit</a>
</div>
</div>
<div class="peput">
<i>Change Password</i>
<input type="password" class="infos" placeholder="New password" id="password"/><br>
<input type="password" class="infos1" placeholder="Confirm password" id="repassword"/><br>
<a href="javascript:;" class="cfirm1" id="reset-pwd">Cancel</a>
<a href="javascript:;" class="cfirm2" id="submit-pwd">Submit</a>
</div>
<div class="peput">
<i>Birth Date</i>
<input type="date" name="birthday" value="<?php echo $customer['birthday']; ?>" class="infos" placeholder="Select Date"/>
</div>
<div class="peput">
<i>Industry</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>Job</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">Submit</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);
}
}
});
});
$("img#reset-tx").click(function(event) {
var that = $(this);
$.ajax({
type: 'POST',
url: '<?php echo url('/index/user/resettx'); ?>',
data: {'picture': that.attr('src')},
dataType: 'json',
success: function(data) {
if (data.code) {
that.attr('src', data.data.picture);
} 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('Please enter a valid E-mail address');
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('Please enter user password at least 6 characters');
passwordObj.focus();
return false;
}
var repasswordObj = document.getElementById('repassword');
if (isNull(repasswordObj.value) || repasswordObj.value.length < 6) {
alert('Please enter confirmed password at least 6 characters');
repasswordObj.focus();
return false;
}
if (repasswordObj.value !== passwordObj.value) {
repasswordObj.focus();
alert('User password should be consistent with the confirmed password');
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>