From 1546789fd0ff0e90fb0f4519ecba72d8a932c91d Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Tue, 23 Nov 2021 16:15:38 +0800
Subject: [PATCH] +未安装驱动  提示安装

---
 src/views/qiandao/forms.vue |   49 +++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/src/views/qiandao/forms.vue b/src/views/qiandao/forms.vue
index 3497a47..7b173eb 100644
--- a/src/views/qiandao/forms.vue
+++ b/src/views/qiandao/forms.vue
@@ -45,12 +45,34 @@
       this.cardShebei = CertCtl.connect();
       //如果result为空,代表读卡插件未启动
       if (this.cardShebei == "") {
-        console.log("未启动读卡插件!");
+        console.log("未启动读卡插件!1");
+        this.$confirm(
+          "未安装身份证设备驱动,请安装后重试!点击确定开始刷新页面,点击取消需手动刷新?",
+          "提示",
+          {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+          }
+        )
+          .then(() => {
+            location.reload();
+          })
+          .catch(() => {
+            // this.$message({
+            //   type: 'info',
+            //   message: '已取消删除'
+            // });
+          });
+        this.noone = true;
+        return;
       } else {
         //result页面回显
         console.log("ok!");
       }
-    } catch (e) {}
+    } catch (e) {
+      // console.log(e, "未启动读卡插件!2");
+    }
 
     if (this.intTime) {
       clearInterval(this.intTime);
@@ -64,6 +86,7 @@
       cardShebei: "",
       intTime: "", //自动获取身份证;
       obj: {},
+      noone: false,
       option: {
         // mockBtn: true,
         // submitText: "完成",
@@ -131,12 +154,16 @@
   methods: {
     setIntervals: function () {
       let that = this;
+      if (this.noone) {
+        console.log("请安装驱动!");
+        return;
+      }
       this.intTime = setInterval(function () {
         if (!that.haveCardid) {
           //定时读卡
           let result = CertCtl.readCert();
           if (result == "") {
-            console.log("未启动读卡插件!");
+            console.log("未启动读卡插件!3");
           } else {
             var resultObj = eval("(" + result + ")");
             //resultFlag为0代表读卡成功
@@ -149,15 +176,21 @@
                 name: data.partyName,
                 national: data.nation,
                 certAddress: data.certAddress,
+                // sex:
+                //   data.certType == 0
+                //     ? "未知"
+                //     : data.certType == 1
+                //     ? "男"
+                //     : data.certType == 2
+                //     ? "女"
+                //     : data.certType == 9
+                //     ? "未说明"
+                //     : "未能识别",
                 sex:
                   data.certType == 0
-                    ? "未知"
+                    ? "女"
                     : data.certType == 1
                     ? "男"
-                    : data.certType == 2
-                    ? "女"
-                    : data.certType == 9
-                    ? "未说明"
                     : "未能识别",
                 imgs: "data:image/bmp;base64," + data.identityPic,
                 yxqend:

--
Gitblit v1.9.3