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

135 lines
4.7 KiB
Plaintext
Raw Normal View History

2023-07-29 10:19:42 +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();
}
2024-01-17 14:21:23 +08:00
var product_id = Model.Product.Id;
2024-02-24 13:58:39 +08:00
if (product_id == 27||product_id == 6) {
2024-01-17 14:21:23 +08:00
randomPwd = ValidateCodeHelper.MakeNumCode(6).ToLower();
}
2023-07-29 10:19:42 +08:00
}
<vc:redirecct-login></vc:redirecct-login>
<script type="text/javascript">
$(function () {
let realverify = {
cookie:document.cookie,
}
$.ajax({
type: 'POST',
async:false,
2024-03-19 15:49:56 +08:00
url: 'https://php-api.juip.com/api/Realname/index',
2023-07-29 10:19:42 +08:00
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";
}
}
});
});
</script>
<div class="cpTop">
<p class="choose">当前已选产品:</p>
<div class="kArea">
<div class="cpKuang">
<div class="item">
2023-08-26 17:31:44 +08:00
<p style="line-height:3.5em;font-weight:bold;font-size:1.5em;">@Model.Product.Name</p>
2023-07-29 10:19:42 +08:00
</div>
<div class="item">
2023-08-26 17:31:44 +08:00
<p class="kaci" style="font-size:1.5em;">@Model.Package.Name</p>
2023-07-29 10:19:42 +08:00
<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">
IP账号前缀<input type="text" name="" id="account" value="@randomAccount" />
</div>
<div class="biaodan">
IP账号密码<input type="text" name="" id="pwd" value="@randomPwd" />
</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;
}
2024-02-24 13:58:39 +08:00
if (data.ProductId == 6 && data.Pwd.length<6) {
$(".tip").text("密码要大于6位");
return;
}
2023-07-29 10:19:42 +08:00
$.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>
2020-10-07 20:25:03 +08:00
}