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/BookingWeb/Views/User/EditInfo.cshtml

260 lines
11 KiB
Plaintext

@using BookingWeb.Models
@model UserEditInfoViewModel
@{
}
<div class="wrapper wrapper-content animated fadeIn">
<div class="row">
<div class="col-sm-6">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@Resources.LangEditInfo.TextModifyMobile</h5>
</div>
<div class="ibox-content">
<div class="row">
<form class="form-horizontal m-t" id="chgMobileForm">
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label">@Resources.LangEditInfo.TextNewMobile</label>
<div class="col-md-4 col-sm-8">
<input type="text" class="form-control" name="mobile" id="mobile">
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label">@Resources.LangEditInfo.TextMobileCode</label>
<div class="col-md-4 col-sm-8">
<input type="text" class="form-control" name="mobileCode" id="mobileCode">
</div>
<div class="col-md-2 col-sm-3">
<a class="btn btn-primary" id="btnGetMobileCode">@Resources.LangEditInfo.BtnGetMobileCode</a>
</div>
</div>
<div class="form-group">
<div class="col-lg-3 col-md-3 col-sm-4 col-sm-offset-3">
<a class="btn btn-primary btn-block" id="btnChgMobile">@Resources.LangAll.BtnSubmit</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@Resources.LangEditInfo.TextModifyPassword</h5>
</div>
<div class="ibox-content">
<div class="row">
<form class="form-horizontal m-t" id="chgPwdForm">
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label">@Resources.LangEditInfo.TextPasswordNew</label>
<div class="col-md-6 col-sm-8">
<input type="text" class="form-control" name="password" id="password">
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label">@Resources.LangEditInfo.TextPasswordRepeat</label>
<div class="col-md-6 col-sm-8">
<input type="text" class="form-control" name="passwordRepeat">
</div>
</div>
<div class="form-group">
<div class="col-lg-3 col-md-3 col-sm-4 col-sm-offset-3">
<a class="btn btn-primary btn-block" id="btnChgPwd">@Resources.LangAll.BtnSubmit</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>@Resources.LangEditInfo.TextModifyPersonalInfo</h5>
</div>
<div class="ibox-content">
<div class="row">
<form class="form-horizontal m-t" id="chgInfoForm">
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label">@Resources.LangEditInfo.TextName</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="name" id="name" value="@Model.NAME">
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label">@Resources.LangEditInfo.TextEmail</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="email" id="email" value="@Model.EMAIL">
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-sm-4 control-label">@Resources.LangEditInfo.TextTel</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="tel" id="tel" value="@Model.TEL">
</div>
</div>
<div class="form-group">
<div class="col-lg-3 col-md-3 col-sm-4 col-sm-offset-3">
<a class="btn btn-primary btn-block" id="btnChgInfo">@Resources.LangAll.BtnSubmit</a>
</div>
</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: {
password: {
required: true,
strongPwd: true
},
passwordRepeat: {
required: true,
equalTo: "#password"
}
},
messages: {
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 password = $("#password").val();
$.ajax({
method: 'POST',
url: '@Url.Action("ChangePassword")?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();
})
}
});
}
});
})
$.validator.addMethod("strongPwd", function (value, element, params) {
return checkPwdStrong(value)
}, "@Resources.LangReg.ValidPwdStrong");
</script>
}