73 lines
2.7 KiB
Plaintext
73 lines
2.7 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="rLogin_Name" value="" placeholder="会员手机号" /></p>
|
||
<p><img src="~/m/img/password.png"><input type="password" name="" id="rLogin_Pwd" value="" placeholder="密码" /></p>
|
||
|
||
</div>
|
||
<p>@*<span><input type="checkbox" name="" id="" value="" />自动登录</span>*@<span class="pull-right"><a asp-action="FindPwd" asp-controller="User">忘记密码?</a></span></p>
|
||
<p class="denglu"><button type="button" class="btnLogin" onclick="login()">登录</button></p>
|
||
<p class="tixing">*手机号不是IP账号,请登录后开通IP账号*</p>
|
||
<p class="bianjie">还没有账号?<a asp-action="Regist" asp-controller="User">立即注册</a></p>
|
||
</div>
|
||
|
||
<script>
|
||
var redirect = "@ViewBag.redirect" || "/user/index";
|
||
function isWeiXin() {
|
||
var ua = window.navigator.userAgent.toLowerCase();
|
||
if (ua.match(/micromessenger/i) == 'micromessenger') {
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|
||
function login() {
|
||
var name = $("#rLogin_Name").val()
|
||
var pwd = $("#rLogin_Pwd").val()
|
||
var data = { Logincode: name, Password: pwd, Code: 1 };
|
||
$.ajax({
|
||
type: 'POST',
|
||
url: '/user/login',
|
||
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;
|
||
}
|
||
window.location.href = "@(BaseUrl)User/MP_GetUserInfo?appid=@WxAppId&callbakUrl=" + redirect + "&state=" + user.Id;
|
||
//if (!user.OpenId) {
|
||
|
||
//} else {
|
||
// window.location.href = "/User/Index";
|
||
//}
|
||
}
|
||
</script> |