智慧保安打卡签到系统
liuyg
2021-11-19 510cdf91c11696f97aefd175df2abab5ae0d3053
src/views/home/forms.vue
@@ -1,5 +1,5 @@
<template>
  <basic-container>
  <basic-container class="formsss">
    <avue-form
      ref="form"
      v-model="obj"
@@ -31,7 +31,11 @@
<script>
import CertCtl from "./sfzJS";
import { mapGetters } from "vuex";
export default {
  computed: {
    ...mapGetters(["userInfo", "cardInfor", "haveCardid", "useZhiWen"]),
  },
  mounted() {
    // console.log(CertCtl);
    try {
@@ -58,13 +62,13 @@
    return {
      cardShebei: "",
      intTime: "", //自动获取身份证;
      isHaveCardid: false,
      obj: {},
      option: {
        // mockBtn: true,
        // submitText: "完成",
        // printBtn: true,
        submitBtn: false,
        disabled: true,
        column: [
          {
            label: "姓名",
@@ -126,7 +130,7 @@
    setIntervals: function () {
      let that = this;
      this.intTime = setInterval(function () {
        if (!that.isHaveCardid) {
        if (!that.haveCardid) {
          //定时读卡
          let result = CertCtl.readCert();
          if (result == "") {
@@ -136,7 +140,7 @@
            //resultFlag为0代表读卡成功
            if (resultObj.resultFlag == "0") {
              //回显相关数据
              console.log(resultObj, 123);
              // console.log(resultObj, 123);
              const data = resultObj.resultContent;
              //赋值数据
              that.obj = {
@@ -175,12 +179,14 @@
                id: data.certNumber,
                qfjg: data.certOrg,
              };
              that.isHaveCardid = true;
              that.$store.commit("setCardInfor", that.obj);
              that.$store.commit("setCardidState", true);
            } else if (resultObj.resultFlag == "-1") {
              if (resultObj.errorMsg == "端口打开失败") {
                console.log("读卡器未连接");
              } else {
                console.log(resultObj.errorMsg);
                // console.log(resultObj.errorMsg);
                //无卡片提醒
              }
            } else if (resultObj.resultFlag == "-2") {
              console.log(resultObj.errorMsg);
@@ -190,16 +196,30 @@
      }, 1000);
    },
    emptytChange() {
      this.isHaveCardid = false;
      this.$message.success("清空方法回调");
      this.$store.commit("setCardidState", false);
      let zhiwen = {
        featuredatas: "",
        imgBMP: "",
        url: "",
        isoks: false,
        clear: true,
      };
      this.useZhiWen("setZhiwenData", zhiwen);
      this.$message.success("清空身份证数据");
    },
    // useZhiWen: function (fn, vals) {
    //   //读取指纹实例
    //   let val = vals || "";
    //   var winzhiwen = document.getElementById("zhiwen").contentWindow;
    //   return winzhiwen[fn](val);
    // },
  },
};
</script>
<style lang="scss" scoped>
.zhiwenMain {
  width: 222px;
  height: 196px;
  width: 255px;
  height: 205px;
  // border: 1px solid rgba($color: #d3d3d3, $alpha: 1);
}
.imgss {