You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/BookingJieFeng/pub/Views/User/EditInfo.cshtml

251 lines
11 KiB
Plaintext

@using BookingJieFeng.Models
@model UserEditInfoViewModel
@{
}
<div class="wrapper-content J_mainContent gray-bg-right">
<div class="form-horizontal clearfix">
<div class="row editinfo-middle">
<div class="col-lg-5 col-md-5 col-sm-5 editinfo-p">
<div class="ibox float-e-margins">
<div class="ibox-title"><h5>修改手机号</h5></div>
<div class="ibox-content">
<form id="chgMobileForm">
<div class="form-group clearfix">
<label class="col-lg-3 col-md-4 control-label">原手机号</label>
<div class="col-lg-8 col-md-7">
<input type="text" class="form-control" name="mobileSrc" id="mobileSrc" value="@Model.MOBILE" readonly />
</div>
</div>
<div class="form-group clearfix">
<label class="col-lg-3 col-md-4 control-label">新手机号</label>
<div class="col-lg-8 col-md-7">
<input type="text" class="form-control" name="mobile" id="mobile" />
</div>
</div>
<div class="form-group clearfix">
<label class="col-lg-3 col-md-4 control-label" name="mobileCode" id="mobileCode">验证码</label>
<div class="col-lg-5 col-md-7">
<input type="text" class="form-control" />
</div>
<div class="col-lg-2 col-md-5 code">
<a class="btn btn-info" id="btnGetMobileCode">获取验证码</a>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-5 col-sm-offset-5 clearfix">
<a class="btn btn-info btn-block" id="btnChgMobile">确定</a>
</div>
</form>
</div>
</div>
</div>
<div class="col-lg-5 col-md-5 col-sm-5 editinfo-p top-20-768">
<div class="ibox float-e-margins">
<div class="ibox-title"><h5>修改密码</h5></div>
<div class="ibox-content">
<form id="chgPwdForm">
<div class="form-group clearfix">
<label class="col-lg-3 col-md-4 control-label">原密码</label>
<div class="col-lg-8 col-md-7">
<input type="password" class="form-control" name="passwordSrc" id="passwordSrc" />
</div>
</div>
<div class="form-group clearfix">
<label class="col-lg-3 col-md-4 control-label">新密码</label>
<div class="col-lg-8 col-md-7">
<input type="password" class="form-control" name="password" id="password" />
</div>
</div>
<div class="form-group clearfix">
<label class="col-lg-3 col-md-4 control-label">确认密码</label>
<div class="col-lg-8 col-md-7">
<input type="password" class="form-control" name="passwordRepeat" />
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-5 col-sm-offset-5 clearfix">
<a class="btn btn-info btn-block" id="btnChgPwd">确定</a>
</div>
</form>
</div>
</div>
</div>
<div class="col-lg-5 col-md-5 col-sm-5 editinfo-p top-20 clearfix">
<div class="ibox float-e-margins">
<div class="ibox-title"><h5>修改个人信息</h5></div>
<div class="ibox-content">
<form id="chgInfoForm">
<div class="form-group clearfix">
<label class="col-lg-3 col-md-4 control-label">姓名</label>
<div class="col-lg-8 col-md-7">
<input type="text" class="form-control" name="name" id="name" value="@Model.NAME" />
</div>
</div>
<div class="form-group clearfix">
<label class="col-lg-3 col-md-4 control-label">邮箱</label>
<div class="col-lg-8 col-md-7">
<input type="text" class="form-control" name="email" id="email" value="@Model.EMAIL" />
</div>
</div>
<div class="form-group clearfix">
<label class="col-lg-3 col-md-4 control-label">固话</label>
<div class="col-lg-8 col-md-7">
<input type="text" class="form-control" name="tel" id="tel" value="@Model.TEL" />
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-5 col-sm-offset-5 clearfix">
<a class="btn btn-info btn-block" id="btnChgInfo">确定</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
@section styles
{
<link type="text/css" rel="stylesheet" href="~/Content/css/editInfo.css" />
}
@section scripts
{
<script src="~/Content/hplus/js/plugins/validate/jquery.validate.min.js"></script>
<script src="~/Content/js/jquery.form.js"></script>
<script src="~/Content/js/validatorConfig.js"></script>
<script src="~/Content/js/common.js"></script>
<script>
$(function () {
//修改手机号form
$("#chgMobileForm").validate({
rules: {
mobile: "required",
mobileCode: "required"
},
messages: {
mobile: errIcon + "@Resources.LangEditInfo.ValidInputMobile",
mobileCode: errIcon + "@Resources.LangEditInfo.ValidInputMobileCode"
}
});
//修改密码form
$("#chgPwdForm").validate({
rules: {
passwordSrc:'required',
password: {
required: true,
strongPwd: true
},
passwordRepeat: {
required: true,
equalTo: "#password"
}
},
messages: {
passwordSrc:'请输入原始密码',
password:{
required: errIcon + "@Resources.LangEditInfo.ValidInputPwdNew"
},
passwordRepeat: {
required: errIcon + "@Resources.LangEditInfo.ValidInputPwdRepeat",
equalTo: errIcon + "@Resources.LangEditInfo.ValidInputPwdRepeat"
}
}
});
//修改信息form
$("#chgInfoForm").validate({
rules: {
name: "required",
email:"required"
},
messages: {
name: errIcon + "@Resources.LangEditInfo.ValidInputName",
email: errIcon + "@Resources.LangEditInfo.ValidInputEmail"
}
});
//获取验证码
$("#btnGetMobileCode").click(function () {
var mobile = $("#mobile").val();
if (mobile.length != 11) {
layer.alert("@Resources.LangEditInfo.ValidInputMobile");
return;
}
num = 120;
$.ajax({
method: 'POST',
url: '@Url.Action("GetMobileCode", "common")?mobile=' + mobile,
success: function (data) {
layer.alert(data.Message)
}
});
});
//修改手机
$("#btnChgMobile").click(function () {
if ($("#chgMobileForm").valid()) {
var mobile = $("#mobile").val();
var mobileCode = $("#mobileCode").val();
$.ajax({
method: 'POST',
url: '@Url.Action("ChangeMobile")?newMobile=' + mobile + "&mobileCode=" + mobileCode,
success: function (data) {
var idx = layer.alert(data.Message, function () {
if (data.Success) {
$("#chgMobileForm input").val("");
}
layer.close(idx);
})
}
});
}
});
//修改密码
$("#btnChgPwd").click(function () {
if ($("#chgPwdForm").valid()) {
var passwordSrc = $("#passwordSrc").val();
var password = $("#password").val();
$.ajax({
method: 'POST',
url: '@Url.Action("ChangePassword")?srcPwd=' + passwordSrc + '&newPwd=' + password,
success: function (data) {
var idx= layer.alert(data.Message, function () {
if (data.Success) {
$("#chgPwdForm input").val("");
}
layer.close(idx);
})
}
});
}
});
//修改个人信息
$("#btnChgInfo").click(function () {
if ($("#chgInfoForm").valid()) {
var name = $("#name").val();
var email = $("#email").val();
var tel = $("#tel").val();
$.ajax({
method: 'POST',
url: '@Url.Action("SaveInfo")?name=' + name + '&email=' + email + '&tel=' + tel,
success: function (data) {
layer.alert(data.Message, function () {
location.reload();
})
}
});
}
});
})
</script>
}