Files
juipnet/Host/Views/Product/Test.cshtml
wanyongkang d318014316 初始提交
2020-10-07 20:25:03 +08:00

128 lines
4.7 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();
}
}
<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">@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>PPTP账号名称</p>
<p>PPTP账号密码</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 class="item tip">
</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>
}