123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
-
- @{
- Layout = null;
- }
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>中联区卫产品登记</title>
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <link href="~/Content/Scripts/plugins/mui/css/mui.css" rel="stylesheet" />
- <script src="~/Content/Scripts/jquery.min.js"></script>
- <script src="~/Content/Scripts/plugins/mui/js/mui.js"></script>
- <script src="~/Content/Scripts/jquery.min.js"></script>
- <script src="~/Content/Scripts/babel.min.js"></script>
- <script src="~/Content/Scripts/polyfill.min.js"></script>
- </head>
- <body>
- <style>
- .mui-toast-container {
- bottom: 50% !important;
- }
- .mui-bar-nav {
- background-color: #00aaff;
- }
- .mui-btn-success{
- color: #fff;
- border: 1px solid #00aaff;
- background-color: #00aaff;
- }
- </style>
- <header class="mui-bar mui-bar-nav ">
- <h1 class="mui-title" style="color:white">用户注册</h1>
- </header>
- <!-- 主页面内容容器 -->
- <div class="mui-content ">
- <!-- 主界面具体展示内容 -->
- <h5 class="mui-content-padded"><span class="mui-icon iconfont icon-p9zhonglei" style="color: #8F8F94; margin-right: 7px"></span>用户信息</h5>
- <ul class="mui-table-view mui-table-view-chevron" id="tab"></ul>
- <ul class="mui-table-view ">
- <li class="mui-table-view-cell">
- <a>机构<span class="mui-pull-right" id="InstitutionsName" style="color:#8f8f94"></span></a>
- </li>
- </ul>
- <form class="mui-input-group" style="margin-top:10px">
- <div class="mui-input-row">
- <label>姓名</label>
- <input id="name" type="text" class="mui-input-clear" placeholder="请输入姓名">
- </div>
- <div class="mui-input-row">
- <label>科室</label>
- <input id="Department" type="text" class="mui-input-clear" placeholder="请输入科室">
- </div>
- <div class="mui-input-row">
- <label>手机号码</label>
- <input id="telephone" type="text" class="mui-input-clear" placeholder="请输入手机号码">
- </div>
- <div class="mui-input-row">
- <label>密码</label>
- <input id="password" type="password" class="mui-input-clear" placeholder="请输入密码">
- </div>
- <div class="mui-input-row">
- <label>确认密码</label>
- <input id="SurePassword" type="password" class="mui-input-clear" placeholder="请输入确认密码">
- </div>
- <div class="mui-input-row">
- <input id="Code" type="password" style="width:60%" class="mui-input" placeholder="请输入验证码">
- <button id="GetCode" type="button" class="mui-btn mui-btn-success" style="margin-top:5px;margin-right:5px;width:110px">获取验证码</button>
- </div>
- </form>
- <button type="button" style="margin-top: 10px;" class="mui-btn mui-btn-success mui-btn-block btn_2" onclick="UserRegist()">注册</button>
- </div>
- <script type="text/babel">
- var PersonResource_id = "@ViewBag.PersonResource_id";
- var InstitutionsSorId = "@ViewBag.InstitutionsSorId";
- var InstitutionsID;
- $(document).ready(function () {
- mui.init();
- findUser();
- });
- function findUser() {
- if (!PersonResource_id || !InstitutionsSorId) {
- mui.alert("找不到资源信息,请重新扫描二维码,或者联系管理员!", "提示", "确定", function () { window.location.href = "/MobileAccount/MobileProblemLogin" }, 'div');
- return;
- }
- UserCheck();
- }
- ///获取站点信息
- function GetInstitutions() {
- $.post("/MobileAccount/GetInstitutions", { "InstitutionsSorID": InstitutionsSorId }, function (data) {
- if (!data||data.length==0) {
- mui.alert("找不到机构信息,请联系管理员!", "提示", "确定", function () { window.location.href = "/MobileAccount/MobileProblemLogin" }, 'div');
- return;
- } else {
- InstitutionsID = data[0].ID;
- $("#InstitutionsName").html(data[0].名称);
- }
- })
- }
- ///用户校验
- function UserCheck() {
- $.post("/MobileAccount/UserCheck", { "PersonResource_id": PersonResource_id }, function (data) {
- if (data.code == 200) {
- if (data.msg == "2") {
- window.location.href = "/MobileAccount/MobileProblemLogin" ;
- }
- else if (data.msg == "0") {
- GetInstitutions();
- } else if (data.msg == "1" ) {
- GetInstitutions();
- GetExistInfo();
- }
- } else {
- mui.toast(data.msg, { duration: 'long', type: 'div' });
- }
- })
- }
- ///获取用户已存在信息
- function GetExistInfo() {
- $.post("/MobileAccount/GetExistInfo", { "PersonResource_id": PersonResource_id }, function (data) {
- $("#name").val(data[0].姓名);
- $("#Department").val(data[0].部门名);
- $("#telephone").val(data[0].联系电话);
- });
- }
- ///获取验证码
- document.getElementById('GetCode').addEventListener('tap', function () {
- // if (!/^(13[0-9]|15[012356789]|17[0-9]|18[0-9]|14[57])[0-9]{8}|(170[059])[0-9]{6}$/i
- if (!/^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/.test($('#telephone').val())) {
- mui.toast('请输入正确的手机号码', { duration: 'long', type: 'div' });
- $('#telephone').val('');
- $('#telephone').focus();
- return;
- }
- var obj = $('#GetCode');
- // 重新发送倒计时
- var validCode = true;
- var time = 60;
- if (validCode) {
- validCode = false;
- var t = setInterval(function () {
- time--;
- $(obj).html('重新获取(' + time + 's)');
- $('#GetCode').attr('disabled', 'disabled');
- if (time == 0) {
- clearInterval(t);
- $(obj).html("重新获取");
- validCode = true;
- sms_flag = true;
- $('#GetCode').removeAttr('disabled');
- }
- }, 1000);
- }
- var tele = $('#telephone').val();
- $.post("/MobileAccount/GetSMSCode", { "tele": tele }, function (data) {
- if (data.code == "200") {
- mui.toast('短信发送成功', { duration: 'long', type: 'div' });
- } else {
- mui.toast('短信发送失败', { duration: 'long', type: 'div' });
- }
- }).error(function (xhr, type, errorThrown) {
- mui.toast('系统错误', { duration: 'long', type: 'div' });
- })
- });
- ///用户注册按钮
- function UserRegist() {
- var name = $("#name").val();
- var Department = $("#Department").val();
- var telephone = $("#telephone").val();
- var password = $("#password").val();
- var SurePassword = $("#SurePassword").val();
- var SMSCode = $("#Code").val();
- ///校验
- if (name == "" || name == null || Department == "" || Department == null || telephone == "" || telephone == null || password == "" || password == null || SMSCode == "" || SMSCode == null) {
- mui.toast('请填写完整信息', { duration: 'long', type: 'div' });
- return (false);
- }
- if (password != SurePassword) {
- mui.toast('两次密码不相等', { duration: 'long', type: 'div' });
- $('#password').focus();
- return (false);
- }
- var t = mui.showLoading("注册中...");
- $.post("/MobileAccount/UserRegist",
- { "name": name, "Department": Department, "telephone": telephone, "password": password, "SiteID": InstitutionsID, "UserGetId": PersonResource_id, "SMSCode": SMSCode }, function (data) {
- mui.hideLoading(t);
- if (data.msg == "3") {
- mui.alert("注册成功!", "提示", "确定", function () { window.location.href = "/MobileAccount/MobileProblemLogin?Tele=" + telephone; }, 'div');
- } else if (data.msg == "2") {
- mui.alert("验证码错误!", "提示", "确定", function () {
- $("#Code").val('');
- $("#Code").focus();
- return;
- }, 'div');
- } else if (data.msg == "1") {
- mui.toast('注册发生异常', { duration: 'long', type: 'div' });
- } else if (data.msg == "0") {
- mui.toast('验证码过期', { duration: 'long', type: 'div' });
- $("#Code").val('');
- $("#Code").focus();
- } else if (data.msg == "4") {
- mui.alert("账户已存在!", "提示", "确定", function () { window.location.href = "/MobileAccount/MobileProblemLogin?Tele=" + telephone; }, 'div');
- }
- else {
- mui.alert("注册失败!请查看日志", "提示", "确定", function () { }, 'div');
- }
- })
- }
- </script>
- </body>
- </html>
|