完成签约之后直接添加人员,录入下发凭证
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

290 lines
14 KiB

  1. <!DOCTYPE html>
  2. <head>
  3. <link type="text/css" rel="stylesheet" href="jquery.toast.css">
  4. <style type="text/css">
  5. *, *:before, *:after {
  6. box-sizing: border-box;
  7. margin: 0;
  8. padding: 0;
  9. }
  10. .log-text {
  11. font-size: 14px;
  12. padding: 10px 0 0 10px;
  13. color: #666;
  14. text-align: center;
  15. margin-bottom: 30px;
  16. }
  17. .fprint-container {
  18. width: 300px;
  19. height: 252px;
  20. margin: 0 auto;
  21. position: relative;
  22. }
  23. .demo__fprint {
  24. width: 300px;
  25. height: 260px;
  26. overflow: visible;
  27. display: block;
  28. }
  29. .demo__fprint_bg {
  30. position: absolute;
  31. top: 0;
  32. left: 0;
  33. width: 297px;
  34. height: 260px;
  35. z-index: -1;
  36. background: url(./fprintBackground.svg) no-repeat;
  37. background-position: 78px -260px;
  38. background-size: auto;
  39. /* background-position: -100px 0; */
  40. /* background-size: cover; */
  41. }
  42. .demo__fprint_bg img{position: absolute;width: 147px;top: 50%;
  43. left: 75px;
  44. opacity: .9;
  45. transform: translateY(-50%);}
  46. .demo__fprint_bg.leave {
  47. opacity: 0.5;
  48. }
  49. .demo__fprint_bg.down {
  50. opacity: 1;
  51. }
  52. .demo__fprint-path {
  53. stroke-width: 2.5px;
  54. stroke-linecap: round;
  55. fill: none;
  56. stroke: white;
  57. visibility: hidden;
  58. transition: opacity 0.5s ease;
  59. will-change: stroke-dashoffset, stroke-dasharray;
  60. -webkit-transform: translateZ(0);
  61. transform: translateZ(0);
  62. }
  63. .demo__fprint-path--pinkish {
  64. stroke: #a94a8c;
  65. }
  66. .demo__fprint-path--purplish {
  67. stroke: #8742cc;
  68. }
  69. .demo__fprint-path#demo__elastic-path {
  70. will-change: opacity;
  71. opacity: 1;
  72. }
  73. .demo__hidden-path {
  74. display: none;
  75. }
  76. .demo__ending-path {
  77. fill: none;
  78. stroke-width: 2.5px;
  79. stroke-dasharray: 60 1000;
  80. stroke-dashoffset: 61;
  81. stroke-linecap: round;
  82. will-change: stroke-dashoffset, stroke-dasharray, opacity;
  83. -webkit-transform: translateZ(0);
  84. transform: translateZ(0);
  85. transition: stroke-dashoffset 1s ease, stroke-dasharray 0.5s linear, opacity 0.75s ease;
  86. }
  87. .demo__ending-path--pinkish {
  88. stroke: #a94a8c;
  89. }
  90. .demo__ending-path--purplish {
  91. stroke: #8742cc;
  92. }
  93. .buttons {
  94. width: 500px;
  95. display: flex;
  96. margin: auto;
  97. align-items: center;
  98. justify-content: center;
  99. }
  100. #enroll-btn {
  101. width: 140px;
  102. }
  103. </style>
  104. </head>
  105. <body>
  106. <div class="fprint-container">
  107. <div class="demo__fprint_bg leave"><img src="./fprintBackground.svg" alt=""></div>
  108. <svg class="demo__fprint" viewBox="0 0 180 320">
  109. <defs>
  110. <linearGradient id="linear" x1="0%" y1="0%" x2="100%" y2="0%">
  111. <stop offset="0%" stop-color="#8742cc"></stop>
  112. <stop offset="100%" stop-color="#a94a8c"></stop>
  113. </linearGradient>
  114. </defs>
  115. <path class="demo__fprint-path demo__fprint-path--removes-backwards demo__fprint-path--pinkish" d="M46.1,214.3c0,0-4.7-15.6,4.1-33.3" style="stroke-dasharray: 34.235, 36.235; stroke-dashoffset: 35.235px; visibility: visible;"></path>
  116. <path class="demo__fprint-path demo__fprint-path--removes-backwards demo__fprint-path--purplish" d="M53.5,176.8c0,0,18.2-30.3,57.5-13.7" style="stroke-dasharray: 64.5064, 66.5064; stroke-dashoffset: 65.5064px; visibility: visible;"></path>
  117. <path class="demo__fprint-path demo__fprint-path--removes-forwards demo__fprint-path--pinkish" d="M115.8,166.5c0,0,19.1,8.7,19.6,38.4" style="stroke-dasharray: 45.1842, 47.1842; stroke-dashoffset: 46.1842px; visibility: visible;"></path>
  118. <path class="demo__fprint-path demo__fprint-path--removes-backwards demo__fprint-path--pinkish" d="M47.3,221c0,0,3.1-2.1,4.1-4.6s-5.7-20.2,7-36.7c8.5-11,22.2-19,37.9-15.3" style="stroke-dasharray: 88.0272, 90.0272; stroke-dashoffset: 89.0272px; visibility: visible;"></path>
  119. <path class="demo__fprint-path demo__fprint-path--removes-forwards demo__fprint-path--pinkish" d="M102.2,165.4c10.2,2.7,19.5,10.4,23.5,20.2c6.2,15.2,4.9,27.1,4.1,39.4" style="stroke-dasharray: 72.1106, 74.1106; stroke-dashoffset: 73.1106px; visibility: visible;"></path>
  120. <path class="demo__fprint-path demo__fprint-path--removes-backwards demo__fprint-path--purplish" d="M51.1,226.5c3.3-2.7,5.1-6.3,5.7-10.5c0.5-4-0.3-7.7-0.3-11.7" style="stroke-dasharray: 23.9625, 25.9625; stroke-dashoffset: 24.9625px; visibility: visible;"></path>
  121. <path class="demo__fprint-path demo__fprint-path--removes-backwards demo__fprint-path--purplish" d="M56.3,197.9c3.1-16.8,17.6-29.9,35.1-28.8c17.7,1.1,30.9,14.9,32.8,32.2" style="stroke-dasharray: 99.6723, 101.672; stroke-dashoffset: 100.672px; visibility: visible;"></path>
  122. <path class="demo__fprint-path demo__fprint-path--removes-forwards demo__fprint-path--purplish" d="M124.2,207.9c0.5,9.3,0.5,18.7-2.1,27.7" style="stroke-dasharray: 27.9142, 29.9142; stroke-dashoffset: 28.9142px; visibility: visible;"></path>
  123. <path class="demo__fprint-path demo__fprint-path--removes-backwards demo__fprint-path--pinkish" d="M54.2,231.1c2.1-2.6,4.6-5.1,6.3-8c4.2-6.8,0.9-14.8,1.5-22.3c0.5-7.1,3.4-16.3,10.4-19.7" style="stroke-dasharray: 56.1771, 58.1771; stroke-dashoffset: 57.1771px; visibility: visible;"></path>
  124. <path class="demo__fprint-path demo__fprint-path--removes-backwards demo__fprint-path--purplish" d="M77.9,178.2c9.3-5.1,22.9-4.7,30.5,3.3" style="stroke-dasharray: 32.824, 34.824; stroke-dashoffset: 33.824px; visibility: visible;"></path>
  125. <path class="demo__fprint-path demo__fprint-path--removes-forwards demo__fprint-path--purplish" d="M113,186.5c0,0,13.6,18.9,1,54.8" style="stroke-dasharray: 56.5353, 58.5353; stroke-dashoffset: 57.5353px; visibility: visible;"></path>
  126. <path class="demo__fprint-path demo__fprint-path--removes-backwards demo__fprint-path--pinkish" d="M57.3,235.2c0,0,5.7-3.8,9-12.3" style="stroke-dasharray: 15.4365, 17.4365; stroke-dashoffset: 16.4365px; visibility: visible;"></path>
  127. <path class="demo__fprint-path demo__fprint-path--removes-forwards demo__fprint-path--pinkish" d="M111.7,231.5c0,0-4.1,11.5-5.7,13.6" style="stroke-dasharray: 14.7687, 16.7687; stroke-dashoffset: 15.7687px; visibility: visible;"></path>
  128. <path class="demo__fprint-path demo__fprint-path--removes-backwards demo__fprint-path--purplish" d="M61.8,239.4c9.3-8.4,12.7-19.7,11.8-31.9c-0.9-12.7,3.8-20.6,18.5-21.2" style="stroke-dasharray: 67.9598, 69.9598; stroke-dashoffset: 68.9598px; visibility: visible;"></path>
  129. <path class="demo__fprint-path demo__fprint-path--removes-forwards demo__fprint-path--pinkish" d="M97.3,188.1c8.4,2.7,11,13,11.3,20.8c0.4,11.8-2.5,23.7-7.9,34.1c-0.1,0.1-0.1,0.2-0.2,0.3
  130. c-0.4,0.8-0.8,1.5-1.2,2.3c-0.5,0.8-1,1.7-1.5,2.5" style="stroke-dasharray: 66.4444, 68.4444; stroke-dashoffset: 67.4444px; visibility: visible;"></path>
  131. <path class="demo__fprint-path demo__fprint-path--removes-backwards demo__fprint-path--purplish" d="M66.2,242.5c0,0,15.3-11.1,13.6-34.9" style="stroke-dasharray: 38.917, 40.917; stroke-dashoffset: 39.917px; visibility: visible;"></path>
  132. <path class="demo__fprint-path demo__fprint-path--removes-backwards demo__fprint-path--pinkish" d="M78.7,202.5c1.5-4.6,3.8-9.4,8.9-10.6c13.5-3.2,15.7,13.3,14.6,22.1" style="stroke-dasharray: 46.1932, 48.1932; stroke-dashoffset: 47.1932px; visibility: visible;"></path>
  133. <path class="demo__fprint-path demo__fprint-path--removes-forwards demo__fprint-path--pinkish" d="M102.2,219.7c0,0-1.7,15.6-10.5,28.4" style="stroke-dasharray: 30.5375, 32.5375; stroke-dashoffset: 31.5375px; visibility: visible;"></path>
  134. <path class="demo__fprint-path demo__fprint-path--removes-backwards demo__fprint-path--pinkish" d="M72,244.9c0,0,8.8-9.9,9.9-15.7" style="stroke-dasharray: 18.7134, 20.7134; stroke-dashoffset: 19.7134px; visibility: visible;"></path>
  135. <path class="demo__fprint-path demo__fprint-path--removes-forwards demo__fprint-path--pinkish" d="M84.5,223c0.3-2.6,0.5-5.2,0.7-7.8c0.1-2.1,0.2-4.6-0.1-6.8c-0.3-2.2-1.1-4.3-0.9-6.5c0.5-4.4,7.2-6.9,10.1-3.1
  136. c1.7,2.2,1.7,5.3,1.9,7.9c0.4,3.8,0.3,7.6,0,11.4c-1,10.8-5.4,21-11.5,29.9" style="stroke-dasharray: 86.4028, 88.4028; stroke-dashoffset: 87.4028px; visibility: visible;"></path>
  137. <path class="demo__fprint-path demo__fprint-path--removes-forwards demo__fprint-path--purplish" d="M90,201.2c0,0,4.6,28.1-11.4,45.2" style="stroke-dasharray: 48.0853, 50.0853; stroke-dashoffset: 49.0853px; visibility: visible;"></path>
  138. <path class="demo__fprint-path demo__fprint-path--pinkish" id="demo__elastic-path" d="M67.3,219C65,188.1,78,180.1,92.7,180.3c18.3,2,23.7,18.3,20,46.7" style="stroke-dasharray: 111.304, 113.304; stroke-dashoffset: 112.304px; visibility: visible;"></path>
  139. <!-- <line id="demo__straight-path" x1="0" y1="151.3" x2="180" y2="151.3"></line>
  140. <path class="demo__hidden-path" id="demo__arc-to-top" d="M0,148.4c62.3-13.5,122.3-13.5,180,0"></path>
  141. <path class="demo__hidden-path" id="demo__curve" d="M0,140.2c13.1-10.5,34.7-17,48.5-4.1c5.5,5.2,7.6,12.1,9.2,19.2c2.4,10.5,4.3,21,7.2,31.4c2.4,8.6,4.3,19.6,10.4,26.7c4.3,5,17.7,13.4,23.1,4.8c5.9-9.4,6.8-22.5,9.7-33c4.9-17.8,13-14.6,15.7-14.6c1.8,0,9,2.3,15.4,5.4c6.2,3,11.9,7.7,17.9,11.2c7,4.1,16.5,9.2,22.8,6.6"></path>
  142. <path class="demo__ending-path demo__ending-path--pinkish" d="M48.4,220c-5.8,4.2-6.9,11.5-7.6,18.1c-0.8,6.7-0.9,14.9-9.9,12.4c-9.1-2.5-14.7-5.4-19.9-13.4c-3.4-5.2-0.4-12.3,2.3-17.2c3.2-5.9,6.8-13,14.5-11.6c3.5,0.6,7.7,3.4,4.5,7.1"></path>
  143. <path class="demo__ending-path demo__ending-path--pinkish" d="M57.3,235.2c-14.4,9.4-10.3,19.4-17.8,21.1c-5.5,1.3-8.4-7.8-13.8-4.2c-2.6,1.7-5.7,7.7-4.6,10.9c0.7,2,4.1,2,5.8,2.4c3,0.7,8.4,3,7.6,7.2c-0.6,3-5,5.3-2.4,8.7c1.8,2.2,4.7,1.1,6.9,0.3c11.7-4.3,14.5,0.8,16.5,0.9"></path>
  144. <path class="demo__ending-path demo__ending-path--purplish" d="M79,246c-1.8,2.4-4.9,2.9-7.6,3.2c-2.7,0.3-5.8-0.8-7.7,1.6c-2.9,3.3,0.7,8.2-1.2,12c-1.5,2.8-4.5,2.4-6.9,1.3c-10.1-4.7-33.2-17.5-38.1-2.5c-1.1,3.4-1.9,7.5-1.3,11c0.6,4,5.6,7.9,7.7,2.3c0.8-2.1,3.1-8.6-1-8.9"></path>
  145. <path class="demo__ending-path demo__ending-path--pinkish" d="M91.8,248c0,0-3.9,6.4-6.2,9.2c-3.8,4.5-7.9,8.9-11.2,13.8c-1.9,2.8-4.4,6.4-3.7,10c0.9,5.2,4.7,12.5,9.7,14.7c5.2,2.2,15.9-4.7,13.1-10.8c-1.4-3-6.3-7.9-10-7.2c-1,0.2-1.8,1-2,2"></path>
  146. <path class="demo__ending-path demo__ending-path--purplish" d="M114.8,239.4c-2.7,6.1-8.3,12.8-7.8,19.8c0.3,4.6,3.8,7.4,7.8,9.1c8.9,3.8,19.7,0.4,28.6-1.3c8.8-1.7,19.7-3.2,23.7,6.7c2.8,6.8,6.1,14.7,4.4,22.2"></path>
  147. <path class="demo__ending-path demo__ending-path--pinkish" d="M129.9,224.2c-0.4,7.5-3.1,18,0.7,25c2.8,5.1,14.3,6.3,19.5,7.4c3.7,0.7,8.7,2.2,12-0.5c6.7-5.4,11.1-13.7,14.1-21.6c3.1-8-4.4-12.8-11.1-14.5c-5-1.3-19.1-0.7-21-6.7c-0.9-2.8,1.8-5.9,3.4-7.9"></path>
  148. <path class="demo__under-curve" d="M0,140.2c13.1-10.5,34.7-17,48.5-4.1c5.5,5.2,7.6,12.1,9.2,19.2c2.4,10.5,4.3,21,7.2,31.4c2.4,8.6,4.3,19.6,10.4,26.7c4.3,5,17.7,13.4,23.1,4.8c5.9-9.4,6.8-22.5,9.7-33c4.9-17.8,13-14.6,15.7-14.6c1.8,0,9,2.3,15.4,5.4c6.2,3,11.9,7.7,17.9,11.2c7,4.1,16.5,9.2,23.8,6.6l0,125.5l-181,0l0,-179.8"></path> -->
  149. </svg>
  150. </div>
  151. <div class="log-text">loading...</div>
  152. <div class="buttons">
  153. <button id="enroll-btn">GX1000采集指纹</button>
  154. </div>
  155. <audio src="./press.mp3" id="press"></audio>
  156. <audio src="./up.mp3" id="up"></audio>
  157. <script src='jquery.min.js'></script>
  158. <script src='jquery.toast.min.js'></script>
  159. <script src='index.js'></script>
  160. <script src='mafp_sdk.js'></script>
  161. <script type="text/javascript">
  162. function log(msg) {
  163. document.querySelector(".log-text").innerHTML = msg;
  164. }
  165. onload = function() {
  166. const EnrollCount = 6;
  167. const EnrollTimeout = 30 * 1000;
  168. setFprintProgress(0);
  169. log("初始化...");
  170. mafp.init({
  171. enrollCount: EnrollCount,
  172. enrollTimeout: EnrollTimeout
  173. }).then(() => {
  174. log("初始化成功.");
  175. }).catch(e => {
  176. log("初始化失败.");
  177. });
  178. var up = document.getElementById("up");
  179. var press = document.getElementById("press");
  180. $("#enroll-btn").click(() => {
  181. if (mafp.isWorking) {
  182. mafp.cancelEnroll();
  183. $("#enroll-btn").text("注册");
  184. log("注册取消");
  185. }else {
  186. log("注册准备中...");
  187. mafp.startEnroll((status) => {
  188. // console.log(status)
  189. if (status.err) {
  190. let logText = "注册出错";
  191. switch(status.err) {
  192. case ErrorReceiveDataErr:
  193. logText = "数据包传输错误";
  194. break;
  195. case ErrorEnrollTimeout:
  196. logText = "注册超时";
  197. break;
  198. case ErrorDeviceNotFound:
  199. logText = "设备未找到";
  200. break;
  201. case ErrorEmptyFail:
  202. logText = "清空数据失败";
  203. break;
  204. default:
  205. logText = "注册出错:" + status.err;
  206. }
  207. log(logText);
  208. $.toast({text: logText, position: 'top-center', icon: "error", hideAfter: 5000})
  209. $("#enroll-btn").text("注册");
  210. return;
  211. }else {
  212. if(status.state == STATE_WAIT_FINGER_DOWN) {
  213. up.pause()
  214. press.play()
  215. log("请按手指");
  216. }
  217. else if(status.state == STATE_WAIT_FINGER_LEAVE) {
  218. up.play()
  219. log("请抬起手指");
  220. }
  221. else if(status.state == STATE_EXTRACT_TEMPLATE) {
  222. log("提取特征点...");
  223. }
  224. else if(status.state == STATE_DOWNLOAD_TEMPLATE) {
  225. log("模板传输中...");
  226. }
  227. else if (status.state == STATE_FINGER_DOWN) {
  228. $(".demo__fprint_bg").addClass("down");
  229. }else if (status.state == STATE_FINGER_LEAVE) {
  230. $(".demo__fprint_bg").removeClass("down");
  231. }else if (status.state >= STATE_EXTRACT_TEMPLATE_FAIL) {
  232. let errText = "提取特征点失败";
  233. if (status.state == STATE_EXTRACT_TEMPLATE_DIRTY) {
  234. errText = "提取特征点失败, 指纹图像太乱";
  235. }else if (status.state == STATE_EXTRACT_TEMPLATE_POINTS_FEW) {
  236. errText = "提取特征点失败, 特征点太少";
  237. }else if (status.state == STATE_EXTRACT_TEMPLATE_DIRTY) {
  238. errText = "提取特征点失败, 合并失败";
  239. }
  240. $.toast({text: errText, position: 'top-center', hideAfter: 5000})
  241. }
  242. }
  243. if (status.data) {
  244. //注册完成 模板数据 二进制数据
  245. //可封装成 multipart/form-data 上传服务端
  246. console.log(status.data,'指纹数据')
  247. var templateData = new Uint8Array(status.data);
  248. localStorage.setItem('fingerprint',status.data)
  249. // console.log(status.data);
  250. log("注册完成");
  251. $("#enroll-btn").text("注册");
  252. }
  253. if (status.data || status.step == EnrollCount && (status.state == 5 || status.state == 6)) {
  254. setFprintProgress(1);
  255. }else {
  256. setFprintProgress((status.step - 1) / EnrollCount);
  257. }
  258. });
  259. $("#enroll-btn").text("取消");
  260. }
  261. })
  262. }
  263. </script>
  264. </body>