fullstack.web/swa/ic/index.html

410 lines
13 KiB
HTML
Raw Normal View History

2022-12-22 06:57:51 +00:00
<!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;
}
2023-01-04 02:30:35 +00:00
.line span {
display: inline-block;
width: 150px;
font-size: 0.8rem;
color: var(--mainColor);
}
2022-12-22 06:57:51 +00:00
</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>
2023-01-04 02:30:35 +00:00
<a href="#" name="tab_file">内部信息维护</a>
2022-12-22 06:57:51 +00:00
</li>
<li>
2023-01-04 02:30:35 +00:00
<a href="#" name="tab_active">Active 程序</a>
2022-12-22 06:57:51 +00:00
</li>
</ul>
<div class="tabs-content">
<div class="tab tab_public">
2023-01-04 02:30:35 +00:00
<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)">
2022-12-22 06:57:51 +00:00
</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>
2023-01-04 02:30:35 +00:00
2022-12-22 06:57:51 +00:00
</div>
<div class="tab tab_file">
2023-01-04 02:30:35 +00:00
<div style="float: right; width: 500px">
<h4 style="color: var(--mainColor)">帮助</h4>
<p>本页所有值都是 HEX</p>
</div>
<div style="height: 1rem"></div>
2022-12-22 06:57:51 +00:00
2023-01-04 02:30:35 +00:00
<div class="line">
<span>IC卡属主 (20h+1)</span>
2023-01-05 09:39:59 +00:00
<input id="path1" style="width: 300px; height: 1.06rem" type="text" value="" maxlength="2"
placeholder="31/32/33">
2023-01-04 02:30:35 +00:00
</div>
<div class="line">
2023-01-11 07:32:36 +00:00
<span>主密钥校验值 (30h+4)</span>
2023-01-05 09:39:59 +00:00
<input id="path2" style="width: 300px; height: 1.06rem" type="text" maxlength="32" value=""
2023-01-11 07:32:36 +00:00
placeholder="主密钥校验值">
2023-01-04 02:30:35 +00:00
</div>
2022-12-22 06:57:51 +00:00
2023-01-04 02:30:35 +00:00
<div class="line">
2023-01-11 07:32:36 +00:00
<span>主密钥密文 (40h+16)</span>
2023-01-05 09:39:59 +00:00
<input id="path3" style="width: 300px; height: 1.06rem" type="text" value=""
2023-01-11 07:32:36 +00:00
placeholder="主密钥密文">
2023-01-04 02:30:35 +00:00
</div>
2022-12-22 06:57:51 +00:00
2023-01-04 02:30:35 +00:00
<div class="line">
2023-01-11 07:32:36 +00:00
<span>保护密钥校验值 (50h+4)</span>
2023-01-05 09:39:59 +00:00
<input id="path4" style="width: 300px; height: 1.06rem" type="text" value=""
2023-01-11 07:32:36 +00:00
placeholder="保护密钥校验值">
2023-01-04 02:30:35 +00:00
</div>
2022-12-22 06:57:51 +00:00
2023-01-04 02:30:35 +00:00
<div class="line">
2023-01-11 07:32:36 +00:00
<span>保护密钥分量(60h+16)</span>
<input id="path5" style="width: 300px; height: 1.06rem" type="text" value=""
placeholder="保护密钥分量">
2023-01-04 02:30:35 +00:00
</div>
2022-12-22 06:57:51 +00:00
2023-01-11 07:32:36 +00:00
<div style="margin-top: 1rem">
<button id="btn_read">读取所有</button>
<button id="btn_write">写入所有</button>
<button id="btn_clear">清空</button>
</div>
2022-12-22 06:57:51 +00:00
</div>
2023-01-04 02:30:35 +00:00
<div class="tab tab_active" style="padding-top: 1rem">
2022-12-22 06:57:51 +00:00
2023-01-04 02:30:35 +00:00
<ul>
2024-03-07 03:32:45 +00:00
<li>
<h4 style="color: var(--mainColor);">V1.0 <a href="./active-ic.zip" style="font-size: 0.5rem; font-weight: normal; cursor: pointer">(点击下载)</a> </h4>
<p>【2023年12月15日】</p>
<p>端口改为 2222</p>
</li>
2023-01-04 02:30:35 +00:00
<li>
2023-01-05 09:39:59 +00:00
<h4 style="color: var(--mainColor);">V1.0 <a href="./active_ic_setup.exe" style="font-size: 0.5rem; font-weight: normal; cursor: pointer">(点击下载)</a> </h4>
2023-01-04 02:30:35 +00:00
<p>【2022年12月22日】</p>
<p>第一个发行版本</p>
</li>
</ul>
2022-12-22 06:57:51 +00:00
</div>
</div>
</div>
</div>
<!-- UKey 支持, 共 3 个 js-->
<!-- jquery -->
<script type="text/javascript" src="./jquery.min.js"></script>
2023-01-05 09:39:59 +00:00
<script type="text/javascript" src="./active.ic.min.js"></script>
2022-12-22 06:57:51 +00:00
<!-- 演示程序 -->
<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 () {
2023-01-05 09:39:59 +00:00
var ic = new ActiveIC();
ic.connect()
2022-12-22 06:57:51 +00:00
$("#btn_nameplate_clear").click(function () {
$("#manufactor").val("");
$("#system").val("");
$("#customer").val("");
})
$("#btn_nameplate_tmp_load").click(function () {
var def = {
2023-01-05 09:39:59 +00:00
manufactor: "SUNYARD@",
system: "PAYVER50",
customer: "ICBCZJ"
2022-12-22 06:57:51 +00:00
}
$("#manufactor").val(def.manufactor);
$("#system").val(def.system);
$("#customer").val(def.customer);
})
$("#btn_nameplate_read").click(function () {
try {
2023-01-05 09:39:59 +00:00
ic.readText(0, 32)
.then(function (def){
def = hexToString( def.data )
$("#manufactor").val(def.substr(0, 8));
$("#system").val(def.substr(8, 8));
$("#customer").val(def.substr(16, 16));
success("返显成功")
})
.catch(function (e) {
alert("返显失败:" + e.msg)
})
2022-12-22 06:57:51 +00:00
} catch (e) {
2023-01-05 09:39:59 +00:00
alert("返显失败:" + e.msg)
2022-12-22 06:57:51 +00:00
}
})
$("#btn_nameplate_tmp_load").click(function () {
var json = localStorage.getItem("tmp")
var def = {
2023-01-05 09:39:59 +00:00
manufactor: "SUNYARD@",
system: "PAYVER50",
customer: "ICBCZJ"
2022-12-22 06:57:51 +00:00
}
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()
}
2023-01-05 09:39:59 +00:00
check(def.manufactor, /[\w|@]{8}/, "厂家标记填写错误")
check(def.system, /\w{8}/, "系统信息填写错误")
check(def.customer, /[\w|\|\|\-]{7,16}/, "客户信息填写错误")
2022-12-22 06:57:51 +00:00
try {
2023-01-05 09:39:59 +00:00
def.customer += " "
def.customer = def.customer.substr(0, 16)
var info = def.manufactor + def.system + def.customer
ic.writeText(0, info).then(function () {
success("发行成功")
}).catch(function (e) {
alert("发行失败:" + e.msg)
});
2022-12-22 06:57:51 +00:00
} catch (e) {
2023-01-05 09:39:59 +00:00
console.log( e )
2022-12-22 06:57:51 +00:00
}
})
2023-01-05 09:39:59 +00:00
$("#btn_clear").click(function () {
$("#path1").val("");
$("#path2").val("");
2022-12-22 06:57:51 +00:00
})
2023-01-05 09:39:59 +00:00
$("#btn_read").click(function () {
ic.readText(0x20, 1)
.then(function (def){
$("#path1").val(def.data);
2023-01-11 07:32:36 +00:00
return ic.readText(0x30, 4)
2023-01-05 09:39:59 +00:00
})
.then(function (def){
$("#path2").val(def.data);
2023-01-11 07:32:36 +00:00
return ic.readText(0x40, 16);
// success("读取成功")
})
.then(function (def){
$("#path3").val(def.data);
return ic.readText(0x50, 4);
// success("读取成功")
})
.then(function (def){
$("#path4").val(def.data);
return ic.readText(0x60, 16);
// success("读取成功")
})
.then(function (def){
$("#path5").val(def.data);
2023-01-05 09:39:59 +00:00
success("读取成功")
})
.catch(function (e) {
alert("读取失败:" + e.msg)
})
2022-12-22 06:57:51 +00:00
})
2023-01-11 07:32:36 +00:00
2023-01-05 09:39:59 +00:00
$("#btn_write").click(function () {
var path1 = $("#path1").val();
if ( path1 != "31"
&& path1 != "32"
&& path1 != "33") {
alert("IC卡属主填写错误")
return
}
var path2 = $("#path2").val();
2023-08-09 05:57:49 +00:00
check(path2, /^([A-Fa-f0-9][A-Fa-f0-9]){4}$/g, "特征字串2填充错误")
var path3 = $("#path3").val();
check(path3, /^([A-Fa-f0-9][A-Fa-f0-9]){16}$/g, "特征字串3填充错误")
var path4 = $("#path4").val();
check(path4, /^([A-Fa-f0-9][A-Fa-f0-9]){4}$/g, "特征字串4填充错误")
var path5 = $("#path5").val();
check(path5, /^([A-Fa-f0-9][A-Fa-f0-9]){16}$/g, "特征字串5填充错误")
2023-01-05 09:39:59 +00:00
ic.writeHex(0x20, path1)
.then(function (def){
return ic.writeHex(0x30, path2)
})
2023-08-09 05:57:49 +00:00
.then(function (def){
return ic.writeHex(0x40, path3)
})
.then(function (def){
return ic.writeHex(0x50, path4)
})
.then(function (def){
return ic.writeHex(0x60, path5)
})
2023-01-05 09:39:59 +00:00
.then(function (def){
success("写入成功")
})
.catch(function (e) {
alert("写入失败:" + e.msg)
})
2022-12-22 06:57:51 +00:00
})
})
</script>
</body>
</html>