Files
g.hnyhua.cn/Mtxfw.VipSite/mobile/editpwd.html

475 lines
18 KiB
HTML
Raw Normal View History

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title>修改登录密码</title>
<link rel="stylesheet" type="text/css" href="/css/api.css" />
<link rel="stylesheet" type="text/css" href="/css/content.css" />
<script type="text/javascript" src="/scripts/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="/scripts/jquery.cookie.min.js"></script>
<!--<script type="text/javascript" src="/scripts/iscroll.js"></script>-->
<script type="text/javascript" src="/script/main.js?t=0"></script>
<script type="text/javascript" src="/layer/layer.js"></script>
<script type="text/javascript" src="/Scripts/long.js"></script>
<script type="text/javascript" src="/script/moment.js"></script>
<script type="text/javascript" src="/script/area.js?t=0"></script>
<script type="text/javascript" src="/script/api.js"></script>
<style type="text/css">
html, body {
overflow: hidden;
}
#wrapper {
flex: 1;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
.pullDown {
position: absolute;
top: -1.25rem;
left: 0;
width: 100%;
z-index: 100;
text-align: center;
display: none;
}
.pullUp {
position: absolute;
bottom: -1.25rem;
left: 0;
width: 100%;
z-index: 100;
text-align: center;
display: none;
}
.pullDown.loading, .pullUp.loading, .pullDown.refresh, .pullUp.refresh {
display: block;
}
.dbtnbox {
margin: 0 auto;
width: 100%;
text-align: center;
padding: 0;
box-sizing: border-box;
}
.dbtnbox input[type='button'] {
height: 3.5em;
line-height: 3.5em;
border-radius: 0;
}
.uploadpic_btn {
position: absolute;
width: 5em;
height: 5em;
right: 0;
top: 0;
opacity: 0;
filter: alpha(opacity=0);
}
</style>
<script type="text/javascript">
var userId = null;
var LoginId = null;
var CartId = null;
var opentimes = null;
var sInterval0 = null;
var t = 0, t0 = 0;
var etype = 0;
var address = null;
var myScroll = null;
var pullDown = 1; // 下拉刷新避免多次执行
var pullUp = 1; // 上拉加载避免多次执行
var downHeight = 0;
var upHeight = 0;
var isload = true;//设置是否终止滚动加载
var curScrollHeight = 0;//当前滚动位置
var curCount = 1;//计数器,防止滚动时重复执行加载下一页
var ifeditpwd = 0;
$(document).ready(function () {
userId = getlocalStorage("userId");
LoginId = getlocalStorage("LoginId");
CartId = getlocalStorage("CartId");
var etypedata = getlocalStorage("etype");
if (etypedata != null) {
etype = etypedata
}
var at = $.getUrlParam("t");
if (at != null) {
t = at;
}
$($(".tab a")[t0]).addClass("on").siblings().removeClass("on");
$(".tab a").on("click", function () {
var num = $(this).index();
$(this).addClass("on").siblings().removeClass("on");
t0 = num;
getdata();
$("#wrapper").animate({ scrollTop: 0 }, 500);
});
getdata();
});
function getdata() {
if (t0 == 1) {
$("#oldpwd_box").addClass("uhide");
$("#phone_box").removeClass("uhide");
$("#yzm_box").removeClass("uhide");
} else {
$("#oldpwd_box").removeClass("uhide");
$("#phone_box").addClass("uhide");
$("#yzm_box").addClass("uhide");
}
if (etype == 0) {
var title = "修改登录密码";
if (t == 1) {
title = "修改安全密码";
}
$(document).attr("title", title);
$("title").html(title);
$("header h1").html(title);
var userinfo = getlocalStorage("userinfo");
var userdata = JSON.parse(userinfo);
if (userdata.Phone != "") {
$("#txtphone").val(userdata.Phone);
if (t0 == 1) {
$("#phone_title").html("您的手机号");
$("#phonesms_title").html("手机验证码");
} else {
$("#oldpwd_title").html("您的旧密码");
}
} else {
$("#txtphone").val(userdata.Email);
if (t0 == 1) {
$("#phone_title").html("您的电子邮箱");
$("#phonesms_title").html("邮箱验证码");
} else {
$("#oldpwd_title").html("您的旧密码");
}
}
$("#regtype_0").html("旧密码修改");
$("#regtype_1").html("验证码修改");
$("#getcode").val("获取验证码");
$("#xmm_title").html("新密码");
$("#qyxmm_title").html("确认新密码");
$("#savebtn").val("提交");
} else {
var title = "Modify login password";
if (t == 1) {
title = "Modify security password";
}
$(document).attr("title", title);
$("title").html(title);
$("header h1").html(title);
var userinfo = getlocalStorage("userinfo");
var userdata = JSON.parse(userinfo);
if (userdata.Phone != "") {
$("#txtphone").val(userdata.Phone);
if (t0 == 1) {
$("#phone_title").html("Your mobile number");
$("#phonesms_title").html("Mobile verification code");
} else {
$("#oldpwd_title").html("Old password");
}
} else {
$("#txtphone").val(userdata.Email);
if (t0 == 1) {
$("#phone_title").html("Your e-mail");
$("#phonesms_title").html("Email verification code");
} else {
$("#oldpwd_title").html("Old password");
}
}
$("#regtype_0").html("With old password");
$("#regtype_1").html("With verification code");
$("#getcode").val("Get code");
$("#xmm_title").html("New password");
$("#qyxmm_title").html("Confirm new password");
$("#savebtn").val("Submit");
}
}
function onsave() {
var oldpwd = "";
var code = "";
if (t0 == 1) {
code = fTrim($('#txtcode').val());
} else {
oldpwd = fTrim($('#txtoldpwd').val());
}
var newpwd = fTrim($('#newpwd').val());
var newconfpwd = fTrim($('#newconfpwd').val());
var ifb = true;
if (ifb) {
if (t0 == 1) {
if (code == "") {
tishi3(etype == 0 ? "验证码不能为空!" : "The verification code cannot be empty!");
$("#txtcode").focus();
ifb = false;
}
} else {
if (oldpwd == "") {
tishi3(etype == 0 ? "旧密码不能为空!" : "Old password cannot be empty!");
$("#txtoldpwd").focus();
ifb = false;
}
}
}
if (ifb) {
if (newpwd == "") {
tishi3(etype == 0 ? "新密码不能为空!" : "The new password cannot be empty!");
$("#newpwd").focus();
ifb = false;
}
}
var patrn = /^(?=.{6,16}$)[0-9a-zA-Z_]+$/;
if (ifb) {
if (!patrn.exec(newpwd)) {
tishi3(etype == 0 ? "密码由6-16位数字、字母、下划线组成" : "The password consists of 6-16 digits, letters and underscores!");
$("#newpwd").focus();
ifb = false;
}
}
if (ifb) {
if (newconfpwd == "") {
tishi3(etype == 0 ? "新确认密码不能为空!" : "The new confirmation password cannot be empty!");
$("#newconfpwd").focus();
ifb = false;
}
}
if (ifb) {
if (newconfpwd != newpwd) {
tishi3(etype == 0 ? "两次输入新密码不一致!" : "The two new passwords are inconsistent!");
$("#newconfpwd").focus();
ifb = false;
}
}
if (ifb) {
if ($("#savebtn").val() != (etype == 0 ? "提交" : "Submit")) {
ifb = false;
}
}
if (ifb) {
$("#savebtn").attr("disabled");
$("#savebtn").val(etype == 0 ? "请稍候..." :"please wait a moment...");
try {
var datas = {
action: "editpwd",
userId: userId,
LoginId: LoginId,
etype: etype,
oldpwd: oldpwd,
code: code,
newpwd: newpwd
};
if (t == 1) {
datas = {
action: "editpwd2",
userId: userId,
LoginId: LoginId,
etype: etype,
oldpwd: oldpwd,
code: code,
newpwd: newpwd
};
}
$.ajax({
type: 'POST',
url: "/apiajax.ashx?ifweb=1",
data: datas,
dataType: "json",
error: function (xhr) {
tishi3((etype == 0 ? "发生错误:" :"An error occurred:") + JSON.stringify(xhr));
},
success: function (data) {
$("#savebtn").removeAttr("disabled");
$("#savebtn").val(etype == 0 ? "提交" : "Submit");
if (data) {
if (data.status == 1) {
tishi3(data.msg);
setlocalStorage("myaddress_add_refresh", 1);
var closeInterval = setInterval(function () {
if (ifeditpwd == 1) {
onlink("/mobile/");
} else {
closeWin();
clearInterval(closeInterval);
}
}, 600);
} if (data.status == 0) {
tishi3(data.msg);
}
} else {
tishi3(etype == 0 ? "网络异常,请稍后重试" :"Network exception, please try again later");
}
}
});
} catch (err) {
tishi3(err);
}
}
}
function oncode() {
var o = $("#getcode");
$("#getcode").val(etype == 0 ? "发送中..." : "Sending...");
$.getJSON("/apiajax.ashx?t=00",
{ action: "sendphonecode1", userId: userId, LoginId: LoginId, etype: etype },
function (data) {
if (data.status == 1) {
time(o);
} else {
tishi3(data.msg);
$("#getcode").val(etype == 0 ? "获取验证码" : "Get code");
}
});
}
var wait = 120;
function time(o) {
if (wait == 0) {
o.css("color", "#00C1F9");
o.val(etype == 0 ? "获取验证码" : "Get code");
o.attr("disabled", false);
wait = 120;
} else {
o.css("color", "#gray");
o.val((etype == 0 ? "重新发送" : "Resend") + "(" + wait + ")");
o.attr("disabled", true);
wait = wait - 1;
setTimeout(function () {
time(o)
}, 1000)
}
}
</script>
</head>
<body class="wrap">
<header><div class="ub">
<div class="nav-btn" id="nav-left" style=" margin:0; padding:0; padding-top:0.2em; min-width:3em" onclick="closeWin()">
<img src="../image/faifei.png" style="margin-left:0; margin-top:0em; height:1.2em;width:1.2em;" />
</div>
<h1 class="ub-f1">
修改登录密码
</h1>
<div class="nav-btn blue" id="nav-right" style=" margin:0; padding:0; min-width:3em;">
</div>
</div></header>
<section class="ub-f1" id="wrapper">
<div id="wrapper_content">
<div style="background-color: #02323E;">
<div class="tab flex-around">
<a class="on">旧密码修改</a><a>验证码修改</a>
</div>
</div>
<div class="clear"></div>
<div id="content" class="ub-f1" style="padding: 0.8em;">
<div class="ub ub-ver tixin-item" style="">
<div class="ub ub-ac" style="" id="oldpwd_box">
<div class="ub font_box" style="padding:0.8em 0em;width:6em;" id="oldpwd_title">
您的旧密码
</div>
<div class="ub ub-f1 uinput11">
<input id="txtoldpwd" type="password" value="" style="width:" />
</div>
</div>
<div class="ub ub-ac uhide" style="margin-top: .4em;" id="phone_box">
<div class="ub font_box" id="phone_title" style="padding:0.8em 0em;width:6em;">
您的手机号
</div>
<div class=" ub-f1 uinput11">
<input id="txtphone" type="text" disabled value="" style=" border:0;" />
</div>
</div>
<div class="ub ub-ac uhide" style="margin-top: .4em;" id="yzm_box">
<div class="ub font_box" id="phonesms_title" style="padding:0.8em 0em;width:6em;">
手机验证码
</div>
<div class="ub ub-f1 uinput11" style=" background-color: #f1f1f1; border: solid 1px #dfdfdf; border-radius: .4em;box-sizing:border-box;">
<div class="ub-f1">
<input id="txtcode" type="text" style=" border-radius: 0;border:0;background:none;" />
</div>
<div class="ub" style="width: 6.5em; border-radius: 0 0.4em 0.4em 0; ">
<input id="getcode" type="button" style="width:100%;margin:0;height:100%;border:0;background:none;color:#00B050;" value="获取验证码" onclick="oncode()" />
</div>
</div>
</div>
<div class="ub ub-ac" style="margin-top: .4em;">
<div class="ub font_box" id="xmm_title" style="padding:0.8em 0em;width:6em;">
新密码
</div>
<div class=" ub-f1 uinput11">
<input id="newpwd" type="password" />
</div>
</div>
<div class="ub ub-ac" style="margin-top: .4em;">
<div class="ub font_box" id="qyxmm_title" style="padding:0.8em 0em;width:6em;">
确认新密码
</div>
<div class=" ub-f1 uinput11">
<input id="newconfpwd" type="password" />
</div>
</div>
</div>
</div>
</div>
</section>
<footer style="background-color:#fff; border:0;">
<div class="dbtnbox">
<input id="savebtn" type="button" class="mybtn" onclick="onsave()" value="提交">
</div>
</footer>
<div class="ajaxLoader ub ub-ac uhide" onclick="reload()">
<div class="ub ub-ac ub-ver"><img src="image/load.gif" /><br>正在加载...</div>
</div>
</body>
</html>