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

158 lines
5.8 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 Hncore.Infrastructure.Common
@model PackageInfoResponse
@inject Hncore.Pass.Vpn.Service.ProductAccountService m_AccountService
@{
ViewData["Title"] = "领取试用";
var t = this.Context.Request.GetInt("t");
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
}
<script type="text/javascript">
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/Index";
}
}
});
</script>
<style>
.tip {
color: red;
text-align: center
}
</style>
<div class="container-fluid top">
<div class="container">
<div class="row">
<div class="col-lg-3 text-center">
当前已选产品:
</div>
<div class="col-lg-6">
<div class="selectCard">
@*<div class="item">
<p class="selectPhoto"> <img src="/@Model.Product.Image"></p>
<p>@Model.Product.Name</p>
</div>*@
<div class="item">
<p style="padding-top: 40px; font-size: 25px; font-weight: bold; color: #ee7a69;">@Model.Product.Name</p>
</div>
<div class="item">
2023-08-26 17:31:44 +08:00
<p class="sname" style="font-size:1.5em;">@Model.Package.Name</p>
2023-07-29 10:19:42 +08:00
<p class="sprice">0元</p>
<p class="stime">@Model.Package.Profile</p>
</div>
<div class="item">
<p class="zongjia"><span>@Model.Package.Price</span>元</p>
</div>
</div>
<p class="tishi tishika" style="text-align:center">*请务必选好所需商品,换货会产生费用</p>
</div>
<div class="col-lg-3">
<a asp-action="index" asp-controller="product">返回重新选择》</a>
</div>
</div>
</div>
</div>
<!-- 试用 -->
<div class="container biaodan">
<div class="row">
<div class="col-lg-3 text-right shuruname">
<p>IP账号名称</p>
<p>IP账号密码</p>
</div>
<div class="col-lg-4 text-left shuru">
<p><input type="text" name="" id="account" value="@randomAccount" /></p>
<p><input type="text" name="" id="pwd" value="@randomPwd" /></p>
<div class="btnlingqu">
<div class="item cishu">
剩余试用次数<span style="color:red">@(Model.RestTimes)</span>
</div>
<div style="text-align: center;">
2024-03-19 15:49:56 +08:00
<a href='/User/Index' class="item tip"></a>
2023-07-29 10:19:42 +08:00
</div>
<div class="item tijiao lingqu">
@if (Model.RestTimes > 0 && Model.Package.Status == 1)
{
<button type="button" class="btn btn-primary" onclick="create()">领取试用</button>
}
@if (Model.Package.Status == 0)
{
<span class="tip">
该产品暂不能测试
</span>
}
</div>
</div>
</div>
@*<div class="col-lg-5 text-left">
<p class="tishi chongfu">*此用户名重复,请重新输入</p>
</div>*@
</div>
</div>
@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
}