Files
juipnet/Host/Views.Mobile/Product/Test.cshtml

129 lines
4.6 KiB
Plaintext
Raw Normal View History

2020-10-07 20:25:03 +08:00
@using Hncore.Pass.Vpn.Response.Product
@using Hncore.Infrastructure.Extension
@using Microsoft.Extensions.Configuration
@using Hncore.Infrastructure.Common
@model PackageInfoResponse
@inject IConfiguration m_Configuration
@inject Hncore.Pass.Vpn.Service.ProductAccountService m_AccountService
@{
ViewData["Title"] = "购买产品";
var t = this.Context.Request.GetInt("t");
var baseUrl = m_Configuration["BaseInfoUrl"];
Func<string, string> P = (path) => $"{baseUrl}{path}";
var randomPwd = ValidateCodeHelper.MakeNumCode(3).ToLower();
var randomAccount = ValidateCodeHelper.MakeCharCode(2).ToLower() + ValidateCodeHelper.MakeNumCode(4).ToLower();
while (m_AccountService.Exist(m => m.Account == randomAccount))
{
randomAccount = ValidateCodeHelper.MakeCharCode(2).ToLower() + ValidateCodeHelper.MakeNumCode(4).ToLower();
}
}
<vc:redirecct-login></vc:redirecct-login>
2020-12-28 14:49:43 +08:00
<script type="text/javascript">
$(function () {
let realverify = {
cookie:document.cookie,
}
$.ajax({
type: 'POST',
async:false,
url: 'http://php-api.juip.com/api/Realname/index',
dataType: "json",
contentType: "application/json",
data: JSON.stringify(realverify),
beforeSend: function(xhr) {
xhr.withCredentials = true;
},
crossDomain: true,
success: function (res) {
if (res.Code == -10000) {
alert('接主管部门要求,会员需要实名认证方可使用该产品,点击确定前往 用户主页、个人信息 实名认证。');
window.location.href="/User/IndexInfo";
}
}
});
2021-01-04 17:40:23 +08:00
});
2020-12-28 14:49:43 +08:00
</script>
2020-10-07 20:25:03 +08:00
<div class="cpTop">
<p class="choose">当前已选产品:</p>
<div class="kArea">
<div class="cpKuang">
<div class="item">
<p><img src="@P(Model.Product.Image)"></p>
<p>@Model.Product.Name</p>
</div>
<div class="item">
<p class="kaci">@Model.Package.Name</p>
<p class="grayText">@(Model.Package.DayPrice)元/天</p>
<p class="grayText">@Model.Package.Profile</p>
</div>
<div class="item">
¥ <span class="price">@Model.Package.Price</span>
</div>
</div>
</div>
<div class="chongxin">
<div class="item redText">
*请确认好所需产品,买错产品换货将产生费用
</div>
<div class="item">
<a asp-action="index" asp-controller="product"><button type="button" class="btnBlue">返回重新选择</button></a>
</div>
</div>
</div>
<div class="biaodan">
2020-11-30 13:56:19 +08:00
IP账号前缀<input type="text" name="" id="account" value="@randomAccount" />
2020-10-07 20:25:03 +08:00
</div>
<div class="biaodan">
2020-11-30 13:56:19 +08:00
IP账号密码<input type="text" name="" id="pwd" value="@randomPwd" />
2020-10-07 20:25:03 +08:00
</div>
<p class="grayText text-center shengyu">剩余试用次数:<span>@(Model.RestTimes)</span></p>
<p class="text-center redText tip"></p>
<p class="text-center">
@if (Model.RestTimes > 0 && Model.Package.Status == 1)
{
<button type="button" class="btnBlue large" onclick="create()">领取试用</button>
}
@if (Model.Package.Status == 0)
{
<span style="color:red;">
该产品暂不能测试
</span>
}
</p>
@section Scripts{
<script>
function create() {
var data = {
ProductId:@(Model.Product.Id),
PackageId: @(Model.Package.Id),
Account: $('#account').val(),
Pwd: $('#pwd').val()
};
if (data.Account == '' || data.Pwd == '') {
$(".tip").text("账户和密码不能为空");
return;
}
$.ajax({
type: 'POST',
url: '/api/course/v1/productaccount/CreateTestAccount',
contentType: "application/json",
data: JSON.stringify(data),
success: function (res) {
console.log(res);
if (res.Code == 10000) {
alert("领取成功")
window.location.href = "/user/myaccounts";
} else {
$(".tip").text(res.Message);
}
},
dataType: "json"
});
}
</script>
}