fullstack.web/swa/ic/index.html
2023-01-04 10:30:35 +08:00

411 lines
12 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>IC 卡维护工具</title>
<style>
:root {
--mainColor: #0062cc;
}
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;
}
.line span {
display: inline-block;
width: 150px;
font-size: 0.8rem;
color: var(--mainColor);
}
</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">信雅达 IC 卡发行工具</h2>
</div>
<div class="container">
<div class="group" style="height: 10rem">
<ul class="tabs">
<li>
<a href="#" name="tab_public">IC 卡发行</a>
</li>
<li>
<a href="#" name="tab_file">内部信息维护</a>
</li>
<li>
<a href="#" name="tab_active">Active 程序</a>
</li>
</ul>
<div class="tabs-content">
<div class="tab tab_public">
<div style="float: right; width: 500px">
<h4 style="color: var(--mainColor)">帮助</h4>
<ul>
<li>
<span style="color: var(--mainColor); ">清空</span>
<p>仅清空 3 个输入框。</p>
</li>
<li>
<span style="color: var(--mainColor); ">临存</span>
<p>将 3 个输入框的内容临时保存在本地。</p>
</li>
<li>
<span style="color: var(--mainColor); ">临取</span>
<p>将临时保存在本地的信息填入 3 个输入框。</p>
</li>
<li>
<span style="color: var(--mainColor); ">返显</span>
<p>尝试读取 IC 卡内部信息。IC 卡内部信息错误时有可能显示乱码。</p>
</li>
<li>
<span style="color: var(--mainColor); ">发行</span>
<p>将发行信息写入 IC 卡。</p>
</li>
</ul>
</div>
<div class="form" style="padding-top: 2rem">
<input id="manufactor" style="width: 300px; height: 1.06rem" type="text" value="" maxlength="8"
placeholder="厂家标记(长度 8)">
<input id="system" style="width: 300px; height: 1.06rem" type="text" value="" maxlength="8" placeholder="系统信息(长度 8)">
<input id="customer" style="width: 300px; height: 1.06rem" type="text" value="" maxlength="16" placeholder="客户信息(长度 16)">
</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">
<div style="float: right; width: 500px">
<h4 style="color: var(--mainColor)">帮助</h4>
<p>本页所有值都是 HEX</p>
</div>
<div style="height: 1rem"></div>
<div class="line">
<span>IC卡属主 (20h+1)</span>
<input id="path" style="width: 300px; height: 1.06rem" type="text" value="\root\mana"
placeholder="文件目录">
</div>
<div class="line">
<span>特征字串 (30h+16)</span>
<input id="path" style="width: 300px; height: 1.06rem" type="text" value="\root\mana"
placeholder="文件目录">
</div>
<div class="line">
<span>主密钥分量 (40h+5)</span>
<input id="path" style="width: 300px; height: 1.06rem" type="text" value="\root\mana"
placeholder="文件目录">
</div>
<div class="line">
<span>LMK0 (50h+16)</span>
<input id="path" style="width: 300px; height: 1.06rem" type="text" value="\root\mana"
placeholder="文件目录">
</div>
<div class="line">
<span>LMK分量 (100h)</span>
<textarea id="ta_txt" style="display: block; margin: 1rem 0; width: 460px; height: 100px;"
readonly></textarea>
</div>
<button>读取所有</button>
<button>写入所有</button>
</div>
<div class="tab tab_active" style="padding-top: 1rem">
<ul>
<li>
<h4 style="color: var(--mainColor);">V1.0 <span style="font-size: 0.5rem; font-weight: normal; cursor: pointer">(点击下载)</span> </h4>
<p>【2022年12月22日】</p>
<p>第一个发行版本</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 () {
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);
$("#ta_txt").text(JSON.stringify(txt, null, 4))
})
$("#btn_write").click(function () {
alert("暂不开放")
})
$("#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>