97 lines
3.8 KiB
Plaintext
97 lines
3.8 KiB
Plaintext
@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>
|
||
<p class="xieyi"><input type="checkbox" name="" id="" value="" />我同意<span>《聚IP JUIP.COM用户注册协议》</span></p>
|
||
<p><button type="button" class="btnLogin" onclick="reg()">注册</button></p>
|
||
<p class="tixing">*手机号不是PPTP账号,请登录后开通PPTP账号*</p>
|
||
<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() {
|
||
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> |