Files
juipnet/Host/Views/Product/Test.cshtml
“wanyongkang” b342c64fdb 麒麟动态
2024-01-17 14:21:23 +08:00

154 lines
5.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@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();
}
var product_id = Model.Product.Id;
if (product_id == 27) {
randomPwd = ValidateCodeHelper.MakeNumCode(6).ToLower();
}
}
<script type="text/javascript">
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/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">
<p class="sname" style="font-size:1.5em;">@Model.Package.Name</p>
<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;">
<a href='http://www.juip.com/User/Index' class="item tip"></a>
</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;
}
$.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>
}