fullstack.web/www/swa/u/index.html
2023-01-05 17:39:59 +08:00

421 lines
13 KiB
HTML
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.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>U 盾维护工具</title>
<style>
:root {
--mainColor: salmon;
}
html, body {
margin: 0;
width: 100%;
height: 100%;
}
.title {
color: var(--mainColor);
}
.container {
margin: 2rem auto;
border: var(--mainColor) solid 2px;
border-radius: 10px;
width: 80%;
height: 80%;
text-align: left;
}
.group {
padding: 1rem;
margin: 1rem;
}
.form input {
display: block;
margin: 0.5rem 0;
}
</style>
<link rel="stylesheet" type="text/css" href="tabs.css">
<link rel="stylesheet" type="text/css" href="layx.min.css">
</head>
<body>
<div style="width: 100%; text-align: center;">
<h2 class="title">信雅达 UKey 发行工具</h2>
</div>
<div class="container">
<div class="group" style="width: 100%; ">
<select id="ukeys" style="height: 1.5rem; width: 308px">
</select>
<button id="btn_refresh" style="margin-right: 1rem">&emsp;&emsp;</button>
</div>
<div class="group" style="width: 100%;">
<input id="pwd1" style="width: 300px;height: 1.06rem" type="password" maxlength="8" placeholder="口令8 个数字">
<button id="login" style="margin-right: 1rem">&emsp;&emsp;</button>
<button id="login_def" style="margin-right: 1rem">默认口令</button>
</div>
<div class="group" style="height: 10rem">
<ul class="tabs">
<li>
<a href="#" name="tab_public">UKey 发行</a>
</li>
<li>
<a href="#" name="tab_file">文件操作</a>
</li>
<li>
<a href="#" name="tab_pin">PIN 管理</a>
</li>
<li>
<a href="#" name="tab_active">驱动程序</a>
</li>
</ul>
<div class="tabs-content">
<div class="tab tab_public">
<div class="form">
<input id="manufactor" style="width: 300px; height: 1.06rem" type="text" value=""
placeholder="厂家标记">
<input id="system" style="width: 300px; height: 1.06rem" type="text" value="" placeholder="系统信息">
<input id="customer" style="width: 300px; height: 1.06rem" type="text" value="" placeholder="客户信息">
</div>
<div style="margin: 1rem 0 ">
<button id="btn_nameplate_clear" style="margin-right: 1rem">清空</button>
<button id="btn_nameplate_tmp_save" style="margin-right: 1rem">临存</button>
<button id="btn_nameplate_tmp_load" style="margin-right: 1rem">临取</button>
<button id="btn_nameplate_read" style="margin-right: 1rem">返显</button>
</div>
<button id="btn_nameplate_release" style="margin-right: 1rem">&emsp;&emsp;</button>
</div>
<div class="tab tab_file">
<input id="path" style="width: 300px; height: 1.06rem" type="text" value="\root\mana"
placeholder="文件目录">
<button id="btn_list_path" style="margin-right: 1rem">&emsp;&emsp;</button>
<textarea id="ta_files" style="display: block; margin: 1rem 0; width: 375px; height: 100px;"
readonly></textarea>
<input id="filepath" style="width: 260px; height: 1.06rem" type="text" value="\root\mana\name"
placeholder="文件">
<button id="btn_read" style="margin-right: 0.5rem"></button>
<button id="btn_write" style="margin-right: 0.5rem"></button>
<button id="btn_delete" style="margin-right: 0.5rem"></button>
<textarea id="ta_txt" style="display: block; margin: 1rem 0; width: 375px; height: 100px;"
></textarea>
</div>
<div class="tab tab_pin">
<div class="group" style="width: 100%; ">
<input id="pwd2" style="width: 300px;height: 1.06rem" type="password" maxlength="8"
placeholder="口令8 个数字">
<button id="login2" style="margin-right: 1rem">&emsp;&emsp;</button>
<button id="login_def2" style="margin-right: 1rem">默认口令</button>
</div>
<div class="form group">
<input id="old_pwd" style="width: 360px;height: 1.06rem" type="password" maxlength="8"
placeholder="旧口令8 个数字">
<input id="new_pwd1" style="width: 360px;height: 1.06rem" type="password" maxlength="8"
placeholder="新口令8 个数字">
<input id="new_pwd2" style="width: 360px;height: 1.06rem" type="password" maxlength="8"
placeholder="重复新口令8 个数字">
<button id="update1" style="margin-right: 1rem">修改操作员 PIN</button>
<button id="update2" style="margin-right: 1rem">修改管理员 PIN</button>
<button id="reset" style="margin-right: 1rem">解锁操作员 PIN</button>
</div>
</div>
<div class="tab tab_active" style="padding-top: 1rem">
<ul>
<li>
<h4 style="color: var(--mainColor);"><span>【2023年01月01日】</span> V1.0.1 <a href="./Setup_V1.0.1.exe" style="text-decoration:none; font-size: 0.5rem; font-weight: normal; cursor: pointer">(点击下载)</a> </h4>
<p>渔翁 UKey</p>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- UKey 支持, 共 3 个 js-->
<!-- jquery -->
<script type="text/javascript" src="./jquery.min.js"></script>
<script type="text/javascript" src="./fiseckey.js"></script>
<script type="text/javascript" src="./ukey.js"></script>
<!-- 演示程序 -->
<script type="text/javascript" src="./tabs.js"></script>
<script type="application/javascript" src="layx.min.js"></script>
<script type="application/javascript" src="tools.js"></script>
<script type="application/javascript">
$(function () {
function refresh() {
var list = window.UKey.enumDevByArray()
if (list) {
var ll = list.split("|");
var options = ""
for (var i = 0; i < ll.length; i++) {
var value = ll[i].split(",")[0]
options += "<option value =\"" + value + "\">" + ll[i] + "</option>"
}
$("#ukeys").html(options);
}
}
refresh();
$("#btn_refresh").click(function () {
refresh()
success("刷新成功")
})
$("#btn_list_path").click(function () {
var path = $("#path").val();
try {
var ret = window.UKey.enumDir(path)
var out = ""
for (var i = 0; i < ret.folders.length; i++) {
out += "文件夹:\t" + ret.folders[i] + "\r\n"
}
for (var i = 0; i < ret.files.length; i++) {
out += "文件:\t" + ret.files[i] + "\r\n"
}
$("#ta_files").text(out)
success("枚举成功")
} catch (e) {
alert("枚举失败:" + e.message)
}
})
$("#login2").click(function () {
var pwd2 = $("#pwd2").val();
check(pwd2, /\d{8}/, "口令输入错误")
var ukey = $("#ukeys").val();
try {
window.UKey.admin(ukey, pwd2)
success("登录成功")
} catch (e) {
alert("登录失败:" + e.message)
}
})
$("#login2_def").click(function () {
$("#pwd2").val("12345678");
$("#login2").click()
})
$("#login").click(function () {
var pwd1 = $("#pwd1").val();
check(pwd1, /\d{8}/, "口令输入错误")
var ukey = $("#ukeys").val();
try {
window.UKey.login(ukey, pwd1)
success("登录成功")
} catch (e) {
alert("登录失败:" + e.message)
}
})
$("#login_def").click(function () {
$("#pwd1").val("12345678");
$("#login").click()
})
$("#btn_nameplate_clear").click(function () {
$("#manufactor").val("");
$("#system").val("");
$("#customer").val("");
})
$("#btn_read").click(function () {
try {
var filepath = $("#filepath").val()
var idx = filepath.lastIndexOf("\\")
var folder = filepath.substr(0, idx)
var file = filepath.substr(idx + 1)
var txt = window.UKey.readFile(folder, file);
txt = JSON.stringify(txt, null, 4)
$("#ta_txt").val( txt )
success("读取成功")
} catch (e) {
alert("读取失败:" + e.message)
}
})
$("#btn_write").click(function () {
// alert("暂不开放")
try {
var filepath = $("#filepath").val()
var idx = filepath.lastIndexOf("\\")
var folder = filepath.substr(0, idx)
var file = filepath.substr(idx + 1)
var txt = $("#ta_txt").val();
window.UKey.writeFile(folder, file, txt);
success("写入成功")
} catch (e) {
alert("写入失败:" + e.message)
}
})
$("#btn_delete").click(function () {
// alert("暂不开放")
try {
var filepath = $("#filepath").val()
var idx = filepath.lastIndexOf("\\")
var folder = filepath.substr(0, idx)
var file = filepath.substr(idx + 1)
window.UKey.deleteFile(folder, file);
success("删除成功")
} catch (e) {
alert("删除失败:" + e.message)
}
})
$("#btn_nameplate_tmp_load").click(function () {
var def = {
manufactor: "sunyard",
system: "hsm",
customer: "ICBC"
}
$("#manufactor").val(def.manufactor);
$("#system").val(def.system);
$("#customer").val(def.customer);
})
$("#btn_nameplate_read").click(function () {
try {
var txt = window.UKey.catRelease();
var def = Object.assign({
manufactor: "",
system: "",
customer: ""
}, txt)
$("#manufactor").val(def.manufactor);
$("#system").val(def.system);
$("#customer").val(def.customer);
success("返显成功")
} catch (e) {
alert("返显失败:" + e.message)
}
})
$("#btn_nameplate_tmp_load").click(function () {
var json = localStorage.getItem("tmp")
var def = {
manufactor: "sunyard",
system: "hsm",
customer: "ICBC"
}
try {
def = JSON.parse(json)
} catch (e) {
}
$("#manufactor").val(def.manufactor);
$("#system").val(def.system);
$("#customer").val(def.customer);
})
$("#btn_nameplate_tmp_save").click(function () {
var def = {
manufactor: $("#manufactor").val(),
system: $("#system").val(),
customer: $("#customer").val()
}
localStorage.setItem("tmp", JSON.stringify(def))
})
$("#btn_nameplate_release").click(function () {
var def = {
manufactor: $("#manufactor").val(),
system: $("#system").val(),
customer: $("#customer").val()
}
check(def.manufactor, /\w+/, "厂家标记填写错误")
check(def.system, /\w+/, "系统信息填写错误")
check(def.customer, /\w+/, "客户信息填写错误")
try {
window.UKey.release(def)
success("发行成功")
} catch (e) {
alert("发行失败:" + e.message)
}
})
$("#reset").click(function () {
alert("暂不开放")
})
$("#update1").click(function () {
alert("暂不开放")
})
$("#update2").click(function () {
alert("暂不开放")
})
})
</script>
</body>
</html>