初始化
This commit is contained in:
8
TestWebAPI/Views/Home/Index.cshtml
Normal file
8
TestWebAPI/Views/Home/Index.cshtml
Normal file
@@ -0,0 +1,8 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
</div>
|
||||
6
TestWebAPI/Views/Home/Privacy.cshtml
Normal file
6
TestWebAPI/Views/Home/Privacy.cshtml
Normal file
@@ -0,0 +1,6 @@
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
||||
76
TestWebAPI/Views/Index/Index.cshtml
Normal file
76
TestWebAPI/Views/Index/Index.cshtml
Normal file
@@ -0,0 +1,76 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
<link href="~/css/bulma.css" rel="stylesheet" />
|
||||
<link href="~/css/bulma.min.css" rel="stylesheet" />
|
||||
<script src="~/js/jquery.min.js"></script>
|
||||
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
$("#btnsend").click(function()
|
||||
{
|
||||
let cmdtype=$("#txtdata").val();
|
||||
let id=$("#idcmd").val();
|
||||
let data=$("#txtdata").val();
|
||||
console.log(data)
|
||||
let aaa= {
|
||||
Cmd: "tcp_send_data_clientid",
|
||||
Parameterlist: {
|
||||
"device_clientid": id,
|
||||
"command_word":cmdtype,
|
||||
"data":data
|
||||
}
|
||||
};
|
||||
let YUI= JSON.stringify(aaa);
|
||||
$.ajax({
|
||||
url: 'http://localhost:5116/api/sockettcp/send_data_to_targetnew',
|
||||
type: 'Post',
|
||||
//contentType: 'application/x-www-form-urlencoded',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify(aaa),
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log(error);
|
||||
},
|
||||
beforeSend: function(xhr) {
|
||||
console.log('Sending request...');
|
||||
},
|
||||
complete: function(xhr, status) {
|
||||
console.log('Request completed.');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="field">
|
||||
<label class="label">设备CID:</label>
|
||||
<div class="control">
|
||||
<input id="txtid" class="input is-primary"
|
||||
type="text"
|
||||
placeholder="Primary input" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label class="label">命令字:</label>
|
||||
<div class="control">
|
||||
<input id="idcmd" class="input is-primary"
|
||||
type="text"
|
||||
placeholder="Primary input" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label">数据:</label>
|
||||
<div class="control">
|
||||
<textarea id="txtdata" class="textarea"
|
||||
placeholder="10 lines of textarea"
|
||||
rows="10"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button id="btnsend" class="button is-link">发送</button>
|
||||
@{
|
||||
}
|
||||
25
TestWebAPI/Views/Shared/Error.cshtml
Normal file
25
TestWebAPI/Views/Shared/Error.cshtml
Normal file
@@ -0,0 +1,25 @@
|
||||
@model ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
12
TestWebAPI/Views/Shared/_Layout.cshtml
Normal file
12
TestWebAPI/Views/Shared/_Layout.cshtml
Normal file
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</head>
|
||||
<body>
|
||||
@RenderBody()
|
||||
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
48
TestWebAPI/Views/Shared/_Layout.cshtml.css
Normal file
48
TestWebAPI/Views/Shared/_Layout.cshtml.css
Normal file
@@ -0,0 +1,48 @@
|
||||
/* Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
for details on configuring this project to bundle and minify static web assets. */
|
||||
|
||||
a.navbar-brand {
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0077cc;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.box-shadow {
|
||||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||
}
|
||||
|
||||
button.accept-policy {
|
||||
font-size: 1rem;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
line-height: 60px;
|
||||
}
|
||||
2
TestWebAPI/Views/Shared/_ValidationScriptsPartial.cshtml
Normal file
2
TestWebAPI/Views/Shared/_ValidationScriptsPartial.cshtml
Normal file
@@ -0,0 +1,2 @@
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||
3
TestWebAPI/Views/_ViewImports.cshtml
Normal file
3
TestWebAPI/Views/_ViewImports.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
@using TestWebAPI
|
||||
@using TestWebAPI.Models
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
3
TestWebAPI/Views/_ViewStart.cshtml
Normal file
3
TestWebAPI/Views/_ViewStart.cshtml
Normal file
@@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
||||
Reference in New Issue
Block a user