123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- @model string;
- <html>
- @{
- Layout = null;
- }
- <head>
- <link rel="stylesheet" href="~/css/licensing.css" />
- <link rel="stylesheet" href="~/css/modalBox.css">
- </head>
- <body class="container-main">
- <div class="container-item">
- <h1 class="h1">
- 请输入验证码
- </h1>
- <div>
- <form class="login">
- <div class="container-form">
- <input id="input_box" type="text" name="authCode" value="" placeholder="验证码" />
- <input id="ok_button" class="submit"
- type="button"
- onclick="check(this.form)"
- value="确 定" />
- </div>
- </form>
- <div class="serial-number">SN: @Model</div>
- </div>
- </div>
- <div id="code_error" class="modal">
- <p>验证码错误,请联系厂家获取!</p>
- <a href="#" rel="modal:close">关闭</a>
- </div>
- <div id="reboot_msg" class="modal">
- <p>验证通过,请重启设备!</p>
- <a href="#" rel="modal:close">关闭</a>
- </div>
- <script src="~/js/jquery-3.4.1.min.js"></script>
- <script>
- //will set ApiName as key,ProviderConfigName as value
- var apis = new Map();
- $(document).ready(function () {
- var requestData = ["webapi", ["LicensingApp"]];
- var serviceUrl = "http://localhost:8384/u/?apitype=service&an=ShowMeApi&pn=ProcessorsDispatcher&en=Edge.Core.Processor.Dispatcher.DefaultDispatcher";
- $.ajax({
- url: serviceUrl,
- datatype: "application/json",
- type: 'post',
- contentType: "application/json;charset=utf-8;",
- data: JSON.stringify(requestData),
- beforeSend: function () {
- },
- success: function (data) {
- console.log(data);
- data.forEach(function (d) {
- if (apis.has(d.ApiName)) {
- apis.delete(d.ApiName);
- }
- apis.set(d.ApiName, d.Path);
- });
- },
- error: function (err) {
- console.log(err);
- }
- });
- });
- function saveLicense(license) {
- var path = apis.has("VerifyLicense") ? apis.get("VerifyLicense") : "";
- if (path === "") return;
- //var requestUrl = "http://localhost:8384/u/?apitype=service&an=VerifyLicense&pn=" + processorName
- // + "&en=Application.LicensingApp.App";
- var requestUrl = "http://localhost:8384" + path;
- $.ajax({
- url: requestUrl,
- datatype: "application/json",
- type: 'post',
- contentType: "application/json;charset=utf-8;",
- data: JSON.stringify(license),
- beforeSend: function () {
- },
- success: function (data) {
- if (data == true) {
- //window.location.href = '@Url.Action("SaveLicense", "Home")?license=' + license;
- $("#reboot_msg").modal({
- fadeDuration: 100
- });
- disableInputForm();
- }
- else {
- $("#code_error").modal({
- fadeDuration: 100
- });
- }
- },
- error: function (err) {
- console.log(err);
- }
- });
- }
- function check(form) {
- if (form.authCode.value != "") {
- saveLicense(form.authCode.value);
- } else {
- $("#code_error").modal({
- fadeDuration: 100
- });
- }
- }
- function disableInputForm() {
- document.getElementById("input_box").disabled = true;
- document.getElementById("ok_button").disabled = true;
- }
- </script>
- <script src="~/js/jQuery3.js"></script>
- <script src="~/js/modalBox.js"></script>
- </body>
- </html>
|