Selaa lähdekoodia

🐛身份证解密

shaogen1995 2 vuotta sitten
vanhempi
commit
1e389a45aa

+ 6 - 5
后台管理/src/pages/A1Order/A1Look/index.tsx

@@ -2,6 +2,7 @@ import React, { useMemo } from "react";
 import styles from "./index.module.scss";
 import { Modal } from "antd";
 import { A1TableType } from "@/types";
+import passDecodeFu from "../passDecode";
 
 type Props = {
   data: A1TableType;
@@ -52,14 +53,14 @@ function A1Look({ data, closeModelFu }: Props) {
       <div className="A1MBox">
         <div className="A1MBoxL">所在单位:</div>
         <div className="A1MBoxR">
-          <p>{data.organ}</p>
+          <p>{data.unitName}</p>
         </div>
       </div>
 
       <div className="A1MBox">
         <div className="A1MBoxL">所在处室:</div>
         <div className="A1MBoxR">
-          <p>xxxxxxxxxxxx</p>
+          <p>{data.division}</p>
         </div>
       </div>
 
@@ -69,7 +70,7 @@ function A1Look({ data, closeModelFu }: Props) {
           {infoArr.map((v: any, i: number) => (
             <div className="infoP" key={i}>
               <p>{v.name}</p>
-              <p>{v.zheng}</p>
+              <p>{passDecodeFu(v.zheng)}</p>
             </div>
           ))}
         </div>
@@ -78,14 +79,14 @@ function A1Look({ data, closeModelFu }: Props) {
       <div className="A1MBox">
         <div className="A1MBoxL">预约日期:</div>
         <div className="A1MBoxR">
-          <p>{data.bookDay + " " + data.bootTimeScope}</p>
+          <p>{data.bookDay}</p>
         </div>
       </div>
 
       <div className="A1MBox">
         <div className="A1MBoxL">所在时段:</div>
         <div className="A1MBoxR">
-          <p>xxxxxxxxxxxxxxxx</p>
+          <p>{data.bootTimeScope}</p>
         </div>
       </div>
       <br />

+ 7 - 7
后台管理/src/pages/A1Order/A1SetOrder/index.tsx

@@ -28,13 +28,13 @@ const tabArr = [
 ];
 
 const dateArr = [
-  { id: 1, name: "周一", type: "pcs0" },
-  { id: 2, name: "周二", type: "pcs1" },
-  { id: 3, name: "周三", type: "pcs2" },
-  { id: 4, name: "周四", type: "pcs3" },
-  { id: 5, name: "周五", type: "pcs4" },
-  { id: 6, name: "周六", type: "pcs5" },
-  { id: 0, name: "周日", type: "pcs6" },
+  { id: 1, name: "周一", type: "pcs1" },
+  { id: 2, name: "周二", type: "pcs2" },
+  { id: 3, name: "周三", type: "pcs3" },
+  { id: 4, name: "周四", type: "pcs4" },
+  { id: 5, name: "周五", type: "pcs5" },
+  { id: 6, name: "周六", type: "pcs6" },
+  { id: 0, name: "周日", type: "pcs0" },
 ] as {
   id: number;
   name: string;

+ 6 - 4
后台管理/src/pages/A1Order/index.tsx

@@ -20,6 +20,7 @@ import ExportJsonExcel from "js-export-excel";
 import dayjs from "dayjs";
 import A1Look from "./A1Look";
 import A1SetOrder from "./A1SetOrder";
+import passDecodeFu from "./passDecode";
 
 const { RangePicker } = DatePicker;
 
@@ -179,7 +180,8 @@ function A1Order() {
       },
       {
         title: "所在单位",
-        render: (item: A1TableType) => (item.organ ? item.organ : "(空)"),
+        render: (item: A1TableType) =>
+          item.unitName ? item.unitName : "(空)",
       },
       {
         title: "所在处室",
@@ -258,7 +260,7 @@ function A1Order() {
               ...v,
               name: arr1[0] || "暂无",
               phone: arr1[1] || "暂无",
-              IDCard: arr1[2] || "暂无",
+              IDCard: passDecodeFu(arr1[2]) || "暂无",
             });
           });
         } else {
@@ -266,7 +268,7 @@ function A1Order() {
             ...v,
             name: resField(v.contact)[0],
             phone: resField(v.contact)[1],
-            IDCard: resField(v.contact)[2],
+            IDCard: passDecodeFu(resField(v.contact)[2]),
           });
         }
       });
@@ -280,7 +282,7 @@ function A1Order() {
             sheetFilter: [
               "createTime",
               "exhibitionName",
-              "organ",
+              "unitName",
               "division",
               "name",
               "phone",

+ 18 - 0
后台管理/src/pages/A1Order/passDecode.ts

@@ -0,0 +1,18 @@
+import { Base64 } from "js-base64";
+
+const passDecodeFu = (val: string, flag?: boolean) => {
+  // flag:加密是否使用了 Base64
+
+  const NUM = 2;
+  // 去掉前8位
+  const str1 = val.substring(8);
+  // 去掉后8位
+  const str2 = str1.substring(0, str1.length - 8);
+  // 最后2个字符串放到前面,在去掉后8位
+  const front = str2.slice(-NUM);
+  const end = str2.substring(0, str2.length - 8 - NUM);
+
+  return flag ? Base64.decode(front + end) : front + end;
+};
+
+export default passDecodeFu;

+ 1 - 1
后台管理/src/types/api/A1Order.d.ts

@@ -8,7 +8,7 @@ export type A1TableType = {
   description: string;
   exhibitionName: string;
   id: number;
-  organ: string;
+  unitName: string;
   updateTime: string;
   division:string
 };