瀏覽代碼

增加忘记密码功能,调整访客注册

金隅分支
zhangli 3 年之前
父節點
當前提交
9e562f7bc4
共有 7 個檔案被更改,包括 604 行新增51 行删除
  1. +1
    -0
      .gitignore
  2. +2
    -17
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/VisitorInfoController.cs
  3. +41
    -11
      Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs
  4. +6
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj
  5. +23
    -22
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/PageSix.cshtml
  6. +277
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/PageSixForgetPwd.cshtml
  7. +254
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/VisitorInfoAdd.cshtml

+ 1
- 0
.gitignore 查看文件

@@ -80,3 +80,4 @@ Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js
/Learun.Framework.Ultimate V7/Learun.Application.Mobile/www.7z
/Learun.Framework.Ultimate V7/Learun.Application.WebApi/bin.7z
/Learun.Framework.Ultimate V7/LearunApp-2.2.0/.hbuilderx/launch.json
/Learun.Framework.Ultimate V7/Learun.Application.Web/Properties/PublishProfiles

+ 2
- 17
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/VisitorInfoController.cs 查看文件

@@ -104,22 +104,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
#endregion

#region 提交数据
/// <summary>
/// 验证图片验证码
/// </summary>
/// <param name="verifycode">验证码</param>
/// <returns></returns>
[HttpPost]
[AjaxOnly]
public ActionResult CheckVerifycode(string verifycode)
{
verifycode = Md5Helper.Encrypt(verifycode.ToLower(), 16);
if (Session["session_verifycode"].IsEmpty() || verifycode != Session["session_verifycode"].ToString())
{
return Fail("验证码错误");
}
return Success("");
}

/// <summary>
/// 删除实体数据
@@ -157,7 +142,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers
verifycode = Md5Helper.Encrypt(verifycode.ToLower(), 16);
if (Session["session_verifycode"].IsEmpty() || verifycode != Session["session_verifycode"].ToString())
{
return Fail("验证码错误");
return Fail("图片验证码错误");
}
//验证手机验证码
var type = (SmsType)Enum.Parse(typeof(SmsType), "0");


+ 41
- 11
Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs 查看文件

@@ -454,6 +454,15 @@ namespace Learun.Application.Web.Controllers
{
return View();
}
public ActionResult PageSixForgetPwd()
{
return View();
}
public ActionResult VisitorInfoAdd()
{
return View();
}
#endregion

#region 获取数据
@@ -486,6 +495,24 @@ namespace Learun.Application.Web.Controllers
#endregion

#region 提交数据

/// <summary>
/// 验证图片验证码
/// </summary>
/// <param name="verifycode">验证码</param>
/// <returns></returns>
[HttpPost]
[AjaxOnly]
public ActionResult CheckVerifycode(string verifycode)
{
verifycode = Md5Helper.Encrypt(verifycode.ToLower(), 16);
if (Session["session_verifycode"].IsEmpty() || verifycode != Session["session_verifycode"].ToString())
{
return Fail("验证码错误");
}
return Success("");
}

/// <summary>
/// 安全退出
/// </summary>
@@ -1077,7 +1104,6 @@ namespace Learun.Application.Web.Controllers
{
//写入redis
_redis.Write($"checkcode_{type}_{mobile}", randomNum, TimeSpan.FromMinutes(5));
//WebHelper.WriteSession($"checkcode_{type}_{mobile}", randomNum);
actionResult = Success("发送成功,请注意查收");
}
else
@@ -1096,37 +1122,41 @@ namespace Learun.Application.Web.Controllers
/// <summary>
/// 找回密码
/// </summary>
/// <param name="phone">手机号</param>
/// <param name="phonecode">短信验证码</param>
/// <param name="newPassword">新密码</param>
/// <param name="smsType">短信类型 0 注册,2 忘记密码</param>
/// <returns></returns>
[HttpPost]
[AjaxOnly]
public async Task<ActionResult> FindPassword(string mobile, string checkcode, string newPassword, string smsType)
public async Task<ActionResult> FindPassword(string phone, string phonecode, string newPassword,string smsType)
{
if (string.IsNullOrEmpty(mobile))
if (string.IsNullOrEmpty(phone))
{
return Fail("手机号码不能为空!");
}
if (!Regex.IsMatch(mobile, @"^1[3-9]\d{9}$"))
if (!Regex.IsMatch(phone, @"^1[3-9]\d{9}$"))
{
return Fail("请输入正确的手机号!");
}
if (string.IsNullOrEmpty(checkcode))
if (string.IsNullOrEmpty(phonecode))
{
return Fail("验证码不能为空!");
return Fail("短信验证码不能为空!");
}

var type = (SmsType)Enum.Parse(typeof(SmsType), smsType);
var smscode = _redis.Read<string>($"checkcode_{type}_{mobile}");
var smscode = _redis.Read<string>($"checkcode_{type}_{phone}");
if (!string.IsNullOrEmpty(smscode))
{
if (smscode != checkcode)
if (smscode != phonecode)
{
return Fail("验证码不正确,请核对!");
return Fail("短信验证码不正确,请核对!");
}
else
{
//获取用户密码
UserEntity userEntity = userBll.GetEntityByMobile(mobile);
UserEntity userEntity = userBll.GetEntityByMobile(phone);
if (userEntity == null)
{
return Fail("用户不存在!");
@@ -1139,7 +1169,7 @@ namespace Learun.Application.Web.Controllers
userBll.SaveEntity(userEntity.F_UserId, userEntity);

//删除验证码
_redis.Remove($"checkcode_{type}_{mobile}");
_redis.Remove($"checkcode_{type}_{phone}");
}
}
else


+ 6
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj 查看文件

@@ -7175,7 +7175,7 @@
<Content Include="Areas\LR_OAModule\Views\Notice\FormLostArticleView.cshtml" />
<Content Include="Areas\PersonnelManagement\Views\Emp_Payroll\StatisticIndex.cshtml" />
<Content Include="Areas\PersonnelManagement\Views\VisitorInfo\FormAdd.cshtml" />
<Content Include="Areas\PersonnelManagement\Views\VisitorInfo\FormAdd2.cshtml" />
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<Content Include="Views\Login\Default-beifen.cshtml" />
<None Include="Properties\PublishProfiles\FolderProfile1.pubxml" />
@@ -7253,6 +7253,11 @@
<Content Include="Views\SSOSystem\DragModelThree.cshtml" />
<Content Include="Views\SSOSystem\DragNoWxLogin.cshtml" />
<Content Include="Views\Shared\_SimpleForm.cshtml" />
<Content Include="Views\Login\PageSixForgetPwd.cshtml" />
<Content Include="Views\Login\VisitorInfoAdd.cshtml" />
<None Include="Properties\PublishProfiles\FolderProfile2.pubxml" />
<None Include="Properties\PublishProfiles\FolderProfile3.pubxml" />
<None Include="Properties\PublishProfiles\learunadms6.1.pubxml" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />


+ 23
- 22
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/PageSix.cshtml 查看文件

@@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@*金隅登录页面*@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
@@ -52,6 +52,7 @@
</div>
<div class="loginBtn">
<input type="button" id="lr_login_btn" class="btn btn-white btn-outline btn-lg btn-rounded progress-login" value="登 录" style="cursor:pointer" />
<a href="/Login/PageSixForgetPwd" style="color: blue; font-size: 12px;">忘记密码?</a>
</div>
</form>
</div>
@@ -71,7 +72,7 @@
}
@if (ViewBag.VisitorSwitch)
{
<a href="#" onclick="javascript:location.href = '/PersonnelManagement/VisitorInfo/FormAdd'"><img src="~/Content/images/Login/login8-3.png" alt="" /><span class="bbh_span1">访客注册</span></a>
<a href="#" onclick="javascript:location.href = '/Login/VisitorInfoAdd'"><img src="~/Content/images/Login/login8-3.png" alt="" /><span class="bbh_span1">访客注册</span></a>
}
@if (ViewBag.SSOSystemSwitch)
{
@@ -101,9 +102,9 @@
<div>
<span class="loginEdition">
版本号 : @if (ViewBag.Version)
{
@ViewBag.VersionNum
}
{
@ViewBag.VersionNum
}
</span>&nbsp; &nbsp; &nbsp; 在线用户人数 : @ViewBag.OnlineUserNum 人
</div>
<div>北京金隅科技学校 &nbsp; &nbsp; &nbsp; 智慧校园 版权所有</div>
@@ -147,24 +148,24 @@
@Html.AppendJsFile("/Views/Login/PageSix/Index.js")
@Html.AppendJsFile("/Views/Login/ACLogon.js")
@*<script>
//点击版本号,显示版本号历史进程
$('.loginEdition').click(function () {
var html = '<div class="process"><div class="proTitle">历史进程</div><div class="pro_sec1">';
$.each(@(new HtmlString(ViewBag.VersionList)), function (i, item) {
var index = i % 2 == 0 ? 1 : 2;
html += '<div class="proBox proBox'+index+'">' + item.Content + '<div class="edition">' + item.VersionNum + '</div><div class="time">' + item.UpdateTime.slice(0,item.UpdateTime.indexOf("T"))+'</div></div>' ;
});
html += '</div></div>';
//点击版本号,显示版本号历史进程
$('.loginEdition').click(function () {
var html = '<div class="process"><div class="proTitle">历史进程</div><div class="pro_sec1">';
$.each(@(new HtmlString(ViewBag.VersionList)), function (i, item) {
var index = i % 2 == 0 ? 1 : 2;
html += '<div class="proBox proBox'+index+'">' + item.Content + '<div class="edition">' + item.VersionNum + '</div><div class="time">' + item.UpdateTime.slice(0,item.UpdateTime.indexOf("T"))+'</div></div>' ;
});
html += '</div></div>';

layer.open({
type: 1,
closeBtn: 2,
title: "版本号",
area: ['888px', '60%'],
content: html
})
});
</script>*@
layer.open({
type: 1,
closeBtn: 2,
title: "版本号",
area: ['888px', '60%'],
content: html
})
});
</script>*@
</body>

</html>

+ 277
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/PageSixForgetPwd.cshtml 查看文件

@@ -0,0 +1,277 @@

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@*金隅忘记密码页面*@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="format-detection" content="telephone=no" />
<link rel="shortcut icon" href="images/dzlogo.ico" />
<title>数字化智慧校园</title>
<meta name="keywords" content="忘记密码页面" />
<meta name="description" content="忘记密码页面" />
<link href="~/Content/css/LoginModel/common.css" rel="stylesheet" />
<link href="~/Content/css/LoginModel/loginPublic.css" rel="stylesheet" />
<link href="~/Content/css/LoginModel/login8.css" rel="stylesheet" />

<!--自适应-->
<script src="~/Content/js/jquery.min.js"></script>
<style>
.variCode #btn {
padding: 6px 4px;
margin-top: 12px;
background: #0094DE;
}

.variCode input {
padding: 0;
color: #fff;
}
</style>
<script type="text/javascript">


</script>
<!--自适应-->

</head>

<body>
<div class="loginBox">
<div class="logo_box">
<img src="~/Content/images/Login/logo8.png" alt="" />
</div>
<div class="login_box commonClear">
<div class="loginCon">
<div class="loginT">
<div><span></span> 欢迎登录</div>
<div>智慧校园管理平台</div>
</div>
<div class="loginTabBox">
<div class="loginTabCon">
<form id="pwdForm" role="form" action="/a/login" method="post" novalidate="novalidate">
<div class="loginInput">
<input type="text" placeholder="手机号" id="phone" name="phone" class="form-control required" required="required" />
<img src="~/Content/images/Login/login8-6.png" alt="" />
</div>
<div class="loginInput loginInputCode">
<input type="code" placeholder="请输入验证码" id="verifycode" name="code" class="form-control" required="required" />
<div class="variCode"><img id="lr_verifycode_img" src="~/Login/VerifyCode" alt="点击切换验证码" title="点击切换验证码" /></div>
<img src="~/Content/images/Login/login8-8.png" alt="" />
</div>
<div class="loginInput">
<input type="code" placeholder="短信验证码" id="phonecode" name="phonecode" class="form-control" required="required" />
<div class="variCode">
<input type="button" id="btn" value="获取验证码" onclick="GetPhoneCode(this)" />
</div>
<img src="~/Content/images/Login/login8-7.png" alt="" />
</div>
<div class="loginInput">
<input type="password" placeholder="请输入新密码" id="newPassword" name="newPassword" class="form-control required" required="required" />
<img src="~/Content/images/Login/login8-7.png" alt="" />
</div>
<div class="loginInput">
<input type="password" placeholder="请再次输入密码" id="newPasswordAgain" name="newPasswordAgain" class="form-control required" required="required" />
<img src="~/Content/images/Login/login8-7.png" alt="" />
</div>
<div class="loginBtn">
<input type="submit" class="btn btn-white btn-outline btn-lg btn-rounded progress-login" value="提交" style="cursor:pointer" id="bthsubmit" />
</div>
</form>
</div>
<div class="loginTabCon">
<div id="qrCode"></div>
<div class="qrCodeTxt">智慧校园移动端</div>
</div>
</div>

</div>
<div class="tips">
<img src="~/Content/images/LoginPage/tips5.png" alt="" /> <span>建议使用360或谷歌浏览器</span>
</div>
</div>
</div>
<div class="loginFooter">
<div>版本号 : V3.0.1 &nbsp; &nbsp; &nbsp; 在线用户人数 : 0 人 </div>
<div>北京金隅科技学校 &nbsp; &nbsp; &nbsp; 数字化智慧校园 版权所有</div>
<!--京ICP备13045367号-->
</div>
<script src="~/Content/js/qrcode.min.js"></script>
<script src="~/Content/layui/layui.all.js"></script>
<script src="~/Content/vue/vue.js"></script>
<script>
var qrCodeBox = $('.qrCodeBox');
var loginForm = $('#loginForm');
var qrcode = new QRCode(document.getElementById("qrCode"), {
width: 200,
height: 200
});
makeCode('@ViewBag.QRCodeUrl');
$('.loginTab li').click(function() {
var flag = $(this).hasClass('active');
if (!flag) {
var ind = $(this).index();
$(this).addClass('active').siblings().removeClass('active');
$('.loginTabCon').css('display', 'none').eq(ind).fadeIn();
} else {
return;
}
});

function makeCode(urls) {
qrcode.makeCode(urls);
}
//提交
$("#bthsubmit").on('click', function () {
if (!$('#phone').val()) {
alert('手机号不能为空!');
}
if (!$('#phonecode').val()) {
alert('短信验证码不能为空!');
}
var newPassword = $('#newPassword').val();
var newPasswordAgain = $('#newPasswordAgain').val();
if (!$('#newPassword').val()) {
alert('请输入新密码!');
}
if (newPassword != newPasswordAgain) {
alert('两次密码输入不一致!');
return;
}
$.ajax({
url: "/Login/FindPassword",
data: { phone: $('#phone').val(), phonecode: $('#phonecode').val(), newPassword: newPassword, smsType:2},
type: "POST",
dataType: "json",
async: true,
cache: false,
success: function (data) {
console.log(data);
alert("修改成功");
location.href = "/home/index";
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
},
beforeSend: function () {
},
complete: function () {
}
});
});

//layui.use(['form', 'laydate', 'upload'], function () {
// var form = layui.form;
// //按钮点击
// form.on('submit(*)', function (data) {
// console.log('提交!');
// return;
// $.ajax({
// url: "/PersonnelManagement/VisitorInfo/SaveForm?keyValue=",
// data: { strEntity: JSON.stringify(data.field), verifycode: $.trim($verifycode.val()), phonecode: $('#phonecode').val() },
// type: "POST",
// dataType: "json",
// async: true,
// cache: false,
// success: function (data) {
// console.log(data);
// layer.msg("注册成功");
// alert("注册成功");
// //location.reload();
// location.href = "/home/index";
// },
// error: function (XMLHttpRequest, textStatus, errorThrown) {
// },
// beforeSend: function () {
// },
// complete: function () {
// }
// });
// return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。

// });

//});


// 点击切换验证码
$("#lr_verifycode_img").click(function () {
$("#verifycode").val('');
$("#lr_verifycode_img").attr("src", "/Login/VerifyCode?time=" + Math.random());
});
//图片验证码
$("#verifycode").blur(function () {
//失去焦点时判断验证码是否正确
$.ajax({
url: "/Login/CheckVerifycode",
//headers: { __RequestVerificationToken: $.lrToken },
data: { verifycode: $('#verifycode').val() },
type: "post",
dataType: "json",
success: function (res) {
console.log(res);
if (res.code != 200) {
alert(res.info);
}
}
});
});


//获取手机验证码
function GetPhoneCode(obj) {
var phone = $('#phone').val();
//图片验证码
var verifycode = $('#verifycode').val();
if (!verifycode) {
alert("请输入图片验证码!");
return;
}
if (!phone) {
alert("请输入手机号!");
return;
} else {
var reg = /^((\(\d{2,3}\))|(\d{3}\-))?1\d{10}$/;
if (!reg.test(phone)) {
alert("手机号格式不正确!");
return;
}}
$.ajax({
url: "/Login/GetCheckCode",
data: { mobile: phone, smsType: 2 },
type: "post",
dataType: "json",
success: function (res) {
console.log(res);
alert(res.info);
if (res.code == 200) {
settime(obj);
}
}
});
};
var countdown = 30;
function settime(obj) {
console.log(obj)
if (countdown == 0) {
obj.removeAttribute("disabled");
obj.value = "获取验证码";
countdown = 30;
return;
} else {
obj.setAttribute("disabled", true);
obj.value = "重新发送(" + countdown + ")";
countdown--;
}
setTimeout(function () {
settime(obj);
},
1000);
}


</script>
</body>

</html>

+ 254
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/VisitorInfoAdd.cshtml 查看文件

@@ -0,0 +1,254 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<link rel="shortcut icon" href="">
<title>数字化校园-访客注册</title>
<meta name="keywords" content="数字化校园-教师注册">
<meta name="description" content="数字化校园-教师注册">
<link href="~/Content/css/font-awesome.css" rel="stylesheet" />
<link href="~/Content/css/common.css" rel="stylesheet" />
<link href="~/Content/layui/css/layui.css" rel="stylesheet" media="all" />
<link href="~/Content/css/fromAdd.css" rel="stylesheet" />


<link href="~/Content/laydate/theme/laydate.css" rel="stylesheet" />
<link href="~/Content/layui/css/modules/layer/default/layer.css" rel="stylesheet" />
<link href="~/Content/layui/css/code.css" rel="stylesheet" />
@*<link href="./files/css/font-awesome.css" rel="stylesheet">
<link href="./files/css/common.css" rel="stylesheet">
<link href="./files/css/layui.css" rel="stylesheet" media="all">
<link href="./files/css/fromAdd.css" rel="stylesheet">
<link id="layuicss-laydate" rel="stylesheet" href="./files/css/laydate.css" media="all">
<link id="layuicss-layer" rel="stylesheet" href="./files/css/layer.css" media="all">
<link id="layuicss-skincodecss" rel="stylesheet" href="./files/css/code.css" media="all">*@
<style>
.variCode #btn {
padding: 6px 4px;
margin-top: 12px;
background: #0094DE;
}

.variCode input {
padding: 0;
color: #fff;
}
</style>
</head>
<body>

<div class="header">
<div class="fromSec">
<a href="">数字化智慧校园</a> <span class="headerLine">|</span> <span>访客注册</span>
</div>
</div>
<div class="warpper" id="app">
<!-- / index_sec5 -->
<div class="chickForm_sec">
<div class="fromSec">
<div class="chickT">注册</div>
<form class="layui-form" action="">
<!-- / chickForm_sec1 -->
<div class="chickForm_sec1">
<div class="chickInput">
<span class="chickInputLable"><span>*</span> 姓名</span>
<input type="text" id="EmpNo" name="EmpNo" lay-verify="required" placeholder="请输入姓名" class="layui-input">
</div>
<div class="chickInput">
<span class="chickInputLable"><span>*</span> 电话</span>
<input id="EmpName" type="text" name="EmpName" lay-verify="required" placeholder="请输入电话" class="layui-input">
</div>
</div>
<div class="chickInput yz">
<p>
<span class="chickInputLable"><span>*</span> 图形验证</span>
<input id="verifycode" type="text" name="verifycode" lay-verify="required" placeholder="请输入内容" class="layui-input">
</p>

<div class="variCode">
<img id="lr_verifycode_img" src="~/Login/VerifyCode" alt="点击切换验证码" title="点击切换验证码" />
</div>
</div>
<div class="chickInput yz">
<p>
<span class="chickInputLable"><span>*</span> 短信验证</span>
<input id="phonecode" type="text" name="phonecode" lay-verify="required" placeholder="请输入内容" class="layui-input">
</p>
<div class="variCode">
<input type="button" id="btn" value="获取验证码" onclick="GetPhoneCode(this)" />
</div>
</div>
<div class="chickInput">
<span class="chickInputLable"><span>*</span> 申请理由</span>
<input id="VReasons" type="text" name="VReasons" lay-verify="required" placeholder="请输入原因" class="layui-input">
</div>
<div class="chickInput">
<span class="chickInputLable"><span>*</span> 来访目的</span>
<input id="VObjective" type="text" name="VObjective" lay-verify="required" placeholder="请输入原因" class="layui-input">
</div>

<div class="chickInput">
<span class="chickInputLable"><span>*</span> 备注</span>
<input id="VRemarks" type="text" name="VRemarks" lay-verify="required" placeholder="请输入内容" class="layui-input">
</div>
<!-- / chickForm_sec1 -->
<div class="chickBtn" lay-submit="" lay-filter="*">提交</div>
</form>
</div>
</div>
</div>
<img id="fromBg" src="~/Content/images/from1.png" />
<div class="footer"> Copyright © 2019 数字化智慧校园 版权所有</div>
<script src="~/Content/js/jquery.min.js"></script>
<script src="~/Content/layui/layui.all.js"></script>
<script src="~/Content/vue/vue.js"></script>
@*<script src="./files/js/jquery.min.js"></script>
<script src="./files/js/layui.all.js"></script>
<script src="./files/js/vue.js"></script>*@
<script>
var today = formatDateTimesM();

layui.use(['form', 'laydate', 'upload'], function () {
var form = layui.form;
//登录按钮点击
form.on('submit(*)', function (data) {
$.ajax({
url: "/EducationalAdministration/EmpInfoEnternal/SaveForm?keyValue=",
data: { strEntity: JSON.stringify(data.field), verifycode: $('#verifycode').val(), phonecode: $('#phonecode').val() },
type: "POST",
dataType: "json",
async: true,
cache: false,
success: function (data) {
console.log(data);
alert("注册成功");
//location.reload();
location.href = "/home/index";
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
},
beforeSend: function () {
},
complete: function () {
}
});
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。

});
});
$(window).load(function() {
//$('.chickInputBoxs input').attr('lay-verify', 'required');


//renderForm()

});


//重新渲染表单
function renderForm() {
layui.use('form', function () {
var form = layui.form//高版本建议把括号去掉,有的低版本,需要加()
form.render();
});
}
function formatDateTimesM() {
var date = new Date(1960, 0, 0);
var y = date.getFullYear();
var m = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
var d = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
var h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
var min = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();

return {
y: y,
m: m,
d: d,
h: h,
min: min
}
};
</script>
<script type="text/javascript">
// 点击切换验证码
$("#lr_verifycode_img").click(function () {
$("#verifycode").val('');
$("#lr_verifycode_img").attr("src", "/Login/VerifyCode?time=" + Math.random());
});
//图片验证码
$("#verifycode").blur(function () {
//失去焦点时判断验证码是否正确
$.ajax({
url: "/Login/CheckVerifycode",
//headers: { __RequestVerificationToken: $.lrToken },
data: { verifycode: $('#verifycode').val() },
type: "post",
dataType: "json",
success: function (res) {
console.log(res);
if (res.code != 200) {
alert(res.info);
}
}
});
});

//获取手机验证码
function GetPhoneCode(obj) {
var phone = $('#phone').val();
//图片验证码
var verifycode = $('#verifycode').val();
if (!verifycode) {
alert("请输入图片验证码!");
return;
}
if (!phone) {
alert("请输入手机号!");
return;
} else {
var reg = /^((\(\d{2,3}\))|(\d{3}\-))?1\d{10}$/;
if (!reg.test(phone)) {
alert("手机号格式不正确!");
return;
}}
$.ajax({
url: "/Login/GetCheckCode",
data: { mobile: phone, smsType: 2 },
type: "post",
dataType: "json",
success: function (res) {
console.log(res);
alert(res.info);
if (res.code == 200) {
settime(obj);
}
}
});
};
var countdown = 30;
function settime(obj) {
console.log(obj)
if (countdown == 0) {
obj.removeAttribute("disabled");
obj.value = "获取验证码";
countdown = 30;
return;
} else {
obj.setAttribute("disabled", true);
obj.value = "重新发送(" + countdown + ")";
countdown--;
}
setTimeout(function () {
settime(obj);
},
1000);
}
</script>

</body>
</html>

Loading…
取消
儲存