Files
juipnet/Host/Views.Mobile/User/Regist.cshtml

101 lines
4.0 KiB
Plaintext
Raw Normal View History

2020-10-07 20:25:03 +08:00
@using Home.Models
@using Microsoft.Extensions.Configuration
@using Hncore.Infrastructure.Extension
@inject IConfiguration m_Configuration
@model UserHomeModel
@{
Layout = "_Layout";
var BaseUrl = m_Configuration["Service_BaseUrl"];
var WxAppId = m_Configuration["WxApps:AppID"];
}
<div class="loginArea">
<div class="loginTop">
<p> <img src="~/m/img/logoBlue.png"></p>
<p class="logoTit">用户注册</p>
<p><span class="xinyonghu">新用户免费赠送3次测试机会</span></p>
</div>
<div class="loginCenter">
<p><img src="~/m/img/phone.png"><input type="text" name="" id="username" value="" placeholder="手机号" /></p>
<p><img src="~/m/img/password.png"><input type="password" name="" id="password" value="" placeholder="密码" /></p>
<p class="yzm"><img src="~/m/img/yanzhengma.png"><input type="text" name="" id="yanzhengma" value="" placeholder="验证码" /><button type="button" class="btnBlue" onclick="getCode(this)">获取验证码</button></p>
<p><img src="~/m/img/phone.png"><input type="text" name="" id="wxhao" value="" placeholder="微信号" /></p>
<p><img src="~/m/img/phone.png"><input type="text" name="" id="wxhao" value="" placeholder="QQ号" /></p>
</div>
2020-12-13 12:53:37 +08:00
<p class="xieyi"><input type="checkbox" name="" id="xieyi" value="" />我同意<span><a href="/LineList/xieyi" target="_blank">《聚IP JUIP.COM用户注册协议》</a></span></p>
2020-10-07 20:25:03 +08:00
<p><button type="button" class="btnLogin" onclick="reg()">注册</button></p>
2020-11-30 13:56:19 +08:00
<p class="tixing">*手机号不是IP账号请登录后开通IP账号*</p>
2020-10-07 20:25:03 +08:00
<p class="bianjie">已有账号?<a href="#">立即登录</a></p>
</div>
<script>
var redirect = "@ViewBag.redirect" || "/user/index";
var time = 60;
function getCode(_self) {
var name = $("#username").val()
if(name == '') { alert('手机号不能为空'); return; }
if (!timing(_self)) return;
var url = '/user/SendPhoneCode?key=User_Code&phone=' + name;
$.ajax({
type: 'GET',
url: url,
success: function (res) {
alert(res.Message)
}
});
}
function timing(_self) {
if (time != 60) return false
var timerHandler = setInterval(function () {
time--;
if (time <= 1) {
clearInterval(timerHandler);
time = 60;
$(_self).text("获取验证码")
} else {
$(_self).text(time + "s");
}
}, 1000)
return true;
}
function reg() {
2020-12-13 12:53:37 +08:00
if(!$("input[type='checkbox']").is(':checked')){
alert('请认真阅读用户注册协议后勾选 我同意 方可注册!');
return;
}
2020-10-07 20:25:03 +08:00
var name = $("#username").val()
var pwd = $("#password").val()
var code = $("#yanzhengma").val()
if (name == '') { alert('手机号不能为空'); return; }
if (code == '') { alert('验证码不能为空'); return; }
var wx = $("#wxhao").val()
var qq = $("#qqhao").val()
var data = { Phone: name, Pwd: pwd, Code: code, Wx: wx, QQ: qq };
$.ajax({
type: 'POST',
url: '/user/Regist',
contentType: "application/json",
data: JSON.stringify(data),
success: function (res) {
console.log(res);
if (res.Code == 10000) {
loginSuccess(res.Data.User)
} else {
alert(res.Message)
}
}
});
}
function loginSuccess(user) {
if (!isWeiXin()) {
window.location.href = redirect;
return;
}
if (!user.OpenId) {
window.location.href = "@(BaseUrl)User/MP_GetUserInfo?appid=@WxAppId&callbakUrl="+redirect+"&state="+user.Id;
}
}
</script>