103 lines
3.7 KiB
Plaintext
103 lines
3.7 KiB
Plaintext
@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>
|
||
<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">
|
||
PPTP账号前缀:<input type="text" name="" id="account" value="@randomAccount" />
|
||
</div>
|
||
<div class="biaodan">
|
||
PPTP账号密码:<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;
|
||
}
|
||
$.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>
|
||
} |