387 lines
12 KiB
HTML
387 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">发  行</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="path1" style="width: 300px; height: 1.06rem" type="text" value="" maxlength="2"
|
||
placeholder="31/32/33">
|
||
</div>
|
||
|
||
<div class="line">
|
||
<span>主密钥校验值 (30h+4)</span>
|
||
<input id="path2" style="width: 300px; height: 1.06rem" type="text" maxlength="32" value=""
|
||
placeholder="主密钥校验值">
|
||
</div>
|
||
|
||
<div class="line">
|
||
<span>主密钥密文 (40h+16)</span>
|
||
<input id="path3" style="width: 300px; height: 1.06rem" type="text" value=""
|
||
placeholder="主密钥密文">
|
||
</div>
|
||
|
||
<div class="line">
|
||
<span>保护密钥校验值 (50h+4)</span>
|
||
<input id="path4" style="width: 300px; height: 1.06rem" type="text" value=""
|
||
placeholder="保护密钥校验值">
|
||
</div>
|
||
|
||
<div class="line">
|
||
<span>保护密钥分量(60h+16)</span>
|
||
<input id="path5" style="width: 300px; height: 1.06rem" type="text" value=""
|
||
placeholder="保护密钥分量">
|
||
</div>
|
||
|
||
|
||
<div style="margin-top: 1rem">
|
||
<button id="btn_read">读取所有</button>
|
||
<button id="btn_write">写入所有</button>
|
||
<button id="btn_clear">清空</button>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
<div class="tab tab_active" style="padding-top: 1rem">
|
||
|
||
<ul>
|
||
<li>
|
||
<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>
|
||
<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="./active.ic.min.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 () {
|
||
|
||
var ic = new ActiveIC();
|
||
ic.connect()
|
||
|
||
$("#btn_nameplate_clear").click(function () {
|
||
$("#manufactor").val("");
|
||
$("#system").val("");
|
||
$("#customer").val("");
|
||
})
|
||
|
||
$("#btn_nameplate_tmp_load").click(function () {
|
||
var def = {
|
||
manufactor: "SUNYARD@",
|
||
system: "PAYVER50",
|
||
customer: "ICBC-ZJ"
|
||
}
|
||
$("#manufactor").val(def.manufactor);
|
||
$("#system").val(def.system);
|
||
$("#customer").val(def.customer);
|
||
})
|
||
|
||
$("#btn_nameplate_read").click(function () {
|
||
|
||
try {
|
||
|
||
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)
|
||
})
|
||
|
||
} catch (e) {
|
||
alert("返显失败:" + e.msg)
|
||
}
|
||
})
|
||
|
||
|
||
$("#btn_nameplate_tmp_load").click(function () {
|
||
|
||
|
||
var json = localStorage.getItem("tmp")
|
||
var def = {
|
||
manufactor: "SUNYARD@",
|
||
system: "PAYVER50",
|
||
customer: "ICBC-ZJ"
|
||
}
|
||
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|@]{8}/, "厂家标记填写错误")
|
||
check(def.system, /\w{8}/, "系统信息填写错误")
|
||
check(def.customer, /[\w|\|\-|\-]{7,16}/, "客户信息填写错误")
|
||
|
||
try {
|
||
|
||
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)
|
||
});
|
||
} catch (e) {
|
||
console.log( e )
|
||
}
|
||
|
||
})
|
||
|
||
|
||
|
||
$("#btn_clear").click(function () {
|
||
$("#path1").val("");
|
||
$("#path2").val("");
|
||
})
|
||
|
||
$("#btn_read").click(function () {
|
||
ic.readText(0x20, 1)
|
||
.then(function (def){
|
||
$("#path1").val(def.data);
|
||
return ic.readText(0x30, 4)
|
||
})
|
||
.then(function (def){
|
||
$("#path2").val(def.data);
|
||
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);
|
||
success("读取成功")
|
||
})
|
||
.catch(function (e) {
|
||
alert("读取失败:" + e.msg)
|
||
})
|
||
})
|
||
|
||
$("#btn_write").click(function () {
|
||
var path1 = $("#path1").val();
|
||
if ( path1 != "31"
|
||
&& path1 != "32"
|
||
&& path1 != "33") {
|
||
alert("IC卡属主填写错误")
|
||
return
|
||
}
|
||
|
||
var path2 = $("#path2").val();
|
||
check(path2, /^([A-Fa-f0-9][A-Fa-f0-9]){16}$/g, "特征字串填充错误")
|
||
|
||
ic.writeHex(0x20, path1)
|
||
.then(function (def){
|
||
return ic.writeHex(0x30, path2)
|
||
})
|
||
.then(function (def){
|
||
success("写入成功")
|
||
})
|
||
.catch(function (e) {
|
||
alert("写入失败:" + e.msg)
|
||
})
|
||
})
|
||
|
||
})
|
||
</script>
|
||
</body>
|
||
</html>
|