10 Star 0 Fork 0

Gospel/xvstore

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
account.php 10.16 KB
一键复制 编辑 原始数据 按行查看 历史
黄丽青 提交于 2016-09-09 11:14 . update personalCenter page
<!--<div class="breadcrumbs">
<div class="container">
<ol class="breadcrumb breadcrumb1 animated wow slideInLeft animated" data-wow-delay=".05s" style="visibility: visible; animation-delay: 0.5s; animation-name: slideInLeft;">
<li><a href="index.php?page=single"><span class="glyphicon glyphicon-home" aria-hidden="true"></span>主页</a></li>
<li class="active" id="biaozhi">登录</li>
</ol>
</div>
</div>-->
<div class="account">
<div class="container" id="denglu">
<div class="logincenter">
<h2>用户登录</h2>
<form action="#" method="post">
<ul>
<li>
<p>账号:</p>
<input type="text" id="usTel">
</li>
<li>
<p>密码:</p>
<input type="password" id="usPwd">
</li>
<li>
<p>验证码:</p>
<span id="idcode"></span>
</li>
<li>
<input type="button" value="登录" id="submit" style="background:#29a9e3;color: #FFF;font-size: 0.9em;padding: 0.4em 1em;transition: 0.5s all;-webkit-transition: 0.5s all;-moz-transition: 0.5s all;-o-transition: 0.5s all;display: inline-block;text-transform: uppercase;border:none;outline:none;">
</li>
<li>
<div class="loginbottom">
<p>
<a class="forgot" id="forget" href="#">忘记密码</a>
<a class="acount-btn" href="index.php?page=register">新用户注册</a>
</p>
<p>通过创建我们的商店帐户,您将能够通过结帐过程更快地移动,存储多个送货地址,
查看和跟踪您的帐户和更多的订单。</p>
</div>
</li>
</ul>
</form>
</div>
<!--<h2>登录</h2>-->
</div>
<div class="container" id="wangji" style="display:none">
<div class="logincenter">
<h2>忘记密码</h2>
<form action="#" method="post">
<ul>
<li>
<p>手机号:</p>
<input type="text" id="usTel">
</li>
<li>
<p>密码:</p>
<input type="password" id="usPwd">
</li>
<li>
<p>重复密码:</p>
<input type="password" id="rePwd">
</li>
<li>
<p>验证码:</p>
<input type="text" id="testCode">
</li>
<li>
<input type="button" value="修改密码" id="edit">
<input type="button" value="发送验证码" id="test">
<div class="clearfix"> </div>
</li>
<li>
<div class="loginbottom">
<p>
<a class="forgot" id="showlogin" href="#">去登陆</a>
<a class="acount-btn" href="index.php?page=register">新用户注册</a>
</p>
<p>通过创建我们的商店帐户,您将能够通过结帐过程更快地移动,存储多个送货地址,
查看和跟踪您的帐户和更多的订单。</p>
</div>
</li>
</ul>
</form>
</div>
<!--<div class="account_grid">
<div class="col-md-6 login-right">
<form action="#" method="post">
<span>手机号</span>
<input type="text" id="usTel">
<span>密码</span>
<input type="password" id="usPwd">
<span>重复密码</span>
<input type="password" id="rePwd">
<span>验证码</span>
<input type="text" id="testCode">
<div class="word-in">
<input type="button" value="修改密码" id="submit" style="background:#403b37;color: #FFF;font-size: 0.9em;padding: 0.4em 1em;transition: 0.5s all;-webkit-transition: 0.5s all;-moz-transition: 0.5s all;-o-transition: 0.5s all;display: inline-block;text-transform: uppercase;border:none;outline:none;">
<input type="button" value="获取验证码" id="test" style="background:#403b37;color: #FFF;font-size: 0.9em;padding: 0.4em 1em;transition: 0.5s all;-webkit-transition: 0.5s all;-moz-transition: 0.5s all;-o-transition: 0.5s all;display: inline-block;text-transform: uppercase;border:none;outline:none;">
</div>
</form>
<div class="register-but" style="margin-left:0;margin-top:-18px;">
</div>
</div>
<div class="col-md-6 login-left">
<h4>新的用户</h4>
<p>通过创建我们的商店帐户,您将能够通过结帐过程更快地移动,存储多个送货地址,查看和跟踪您的帐户和更多的订单。</p>
<a class="acount-btn" href="index.php?page=register">创建用户</a>
</div>
<div class="clearfix"> </div>
</div>-->
</div>
</div>
<script src="js/idcode.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$(document).ready(function(){
$.idcode.setCode();
});
function vertify() {
// 验证函数
function judgeStrLegality( str ){
console.log(str);
var containSpecial = RegExp(/[(\ )(\~)(\!)(\@)(\#)(\$)(\%)(\^)(\&)(\*)(\()(\))(\-)(\_)(\+)(\=)(\[)(\])(\{)(\})(\|)(\\)(\;)(\:)(\,)(\.)(\/)(\<)(\>)(\?)]+/);
return ( containSpecial.test( s ) );
};
// 验证登录信息合法性
// 验证过程
if ( !judgeStrLegality( $('#usTel').val() ) ) {
_alertWarning("账号中请不要包含特殊字符","alert-warning",2500);
return false;
} else if ( !judgeStrLegality( $('#usPwd').val() ) ){
_alertWarning("密码中请不要包含特殊字符","alert-warning",2500);
return false;
}
return true;
};
// 登录函数
function account() {
debugger;
var requestData = {
usTel: $('#usTel').val(),
usPwd: $('#usPwd').val()
};
if(requestData.usTel==""){_alertWarning("请输入账号!","alert-warning",2500); return;}
if(requestData.usPwd==""){_alertWarning("请输入密码!","alert-warning",2500); return;}
if ( vertify() ) {
var requestData = {
usTel: $('#usTel').val(),
usPwd: $('#usPwd').val()
};
} else {
_alertWarning("用户名/密码错误","alert-warning",2500);return;
}
var usYzm=$("#ehong-code-input").val();
if(usYzm==""){_alertWarning("请输入验证码","alert-warning",2500);return;}
else {
var realyzm=$("#ehong-code").text();
if(usYzm.toLowerCase()!=realyzm.toLowerCase())
{_alertWarning("验证码错误,请重新输入!","alert-warning",2500);return;}
}
ajax({
url: ajaxDomain + "client/user/login.do",
type: "GET",
data: requestData,
success:function( responseData ) {
if ( responseData.code === 1 ) {
// 登录成功后,储存登录信息到localStorage
localStorage.usTel = responseData.usTel;
localStorage.usPwd = responseData.usPwd;
localStorage.userid = responseData.id;
localStorage.userType = responseData.typeId;
localStorage.authCode = responseData.authCode;
localStorage.loginStatus = true;
_alertWarning("登录成功","alert-warning",2500);
window.location.href = "index.php?page=personalCenter";
} else {
_alertWarning("用户名/密码错误","alert-warning",2500);
return;
};
}
});
};
// 修改密码
function editPassword() {
ajax({
url: ajaxDomain + "admin/user/forget.do",
type: "get",
data: {
usTel: $('#usTel').val(),
usPwd: $('#usPwd').val(),
rePwd: $('#rePwd').val(),
telCode: $('#testCode').val(),
key: localStorage.message
},
// 处理AJAX响应内容
success: function( responseData ) {
if ( responseData.code === 1 ) {
// 储存用户名和密码
localStorage.usTel = responseData.usTel;
localStorage.usPwd = responseData.usPwd;
// 注册成功后,重定向至登录界面
_alertWarning("修改成功","alert-warning",2500);
window.location.href = "http://store.xiaovdingzhi.com/index.php?page=account";
} else {
_alertWarning( responseData.message ,"alert-warning",2500);
};
}
});
}
// 获取验证码
function getTestCode() {
ajax({
url: ajaxDomain + "admin/telCode/getTelCode.do",
type: "GET",
data: { usTel: $("#usTel").val() },
success: function ( responseData ) {
// 60秒之后才能再次发送手机验证码
if ( responseData.code===1 ) {
localStorage.message = responseData.message;
_alertWarning("验证码发送成功","alert-warning",2500);
} else {
_alertWarning("验证码发送失败","alert-warning",2500);
};
var times = 60;
var id = setInterval(function (){
times -= 1;
console.log(times);
if ( parseInt(times) <= 60 && parseInt(times)> 0 ) {
$("#test").attr("disabled","disabled");
$("#test").attr("style","background-color:#ededed;color:#999;")
$("#test").attr("value",times + "秒后再发送")
} else {
$("#test").attr("disabled",false);
$("#test").attr("style","background-color:#49f;color:#fff;")
$("#test").attr("value","发送验证码")
clearInterval(id);
};
},1000);
}
});
}
//
$('#forget').click(function () {
$('#denglu').hide();
$('#wangji').show();
//attr("style","display:none;")
});
$('#showlogin').click(function () {
$('#wangji').hide();
$('#denglu').show(); //attr("style","display:none;")
});
// 第一步:获取localStorage,自动填充表单
// if ( !!localStorage.usTel && !!localStorage.usPwd ) {
// $("#usTel").text( localStorage.usTel );
// $("#usPwd").text( localStorage.usPwd );
// }
// 第二步:验证登录信息合法后,则发送AJAX请求
$('#submit').click(function(){
account();
});
// 修改密码
$("#test").click( function () {
getTestCode();
});
$("#edit").click(function () {
editPassword();
})
});
</script>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/gospel0/xvstore.git
[email protected]:gospel0/xvstore.git
gospel0
xvstore
xvstore
master

搜索帮助