webpackJsonp([56],{

/***/ "/xI2":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ }),

/***/ "BXO0":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/babel-runtime/core-js/json/stringify.js
var stringify = __webpack_require__("mvHQ");
var stringify_default = /*#__PURE__*/__webpack_require__.n(stringify);

// EXTERNAL MODULE: ./src/api/index.js + 5 modules
var api = __webpack_require__("gyMJ");

// EXTERNAL MODULE: ./src/utils/resetMessage.js
var resetMessage = __webpack_require__("46Yo");

// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/views/getFinger.vue

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//




var Ip;
var getFinger_select = 0; //第几枚指纹
var contectStatus; //判断设备是否连接，0表示已连接
var fingerStatus; //判断手指是否按下，0表示未按下
var index; //手指序号
var strBmp; //bmp图像
var strFTP; //模板 一般存于数据库
var strFTR1; //特征1
var strFTR2; //特征1
var strFTR3; //特征3
var fingerData = void 0;

var WS_RET_ERR_OK = "0"; //操作成功
var WS_RET_ERR_PARAM = "-1"; //参数错误
var WS_RET_ERR_MEMORY = "-2"; //内存分配失败，没有分配到足够的内存
var WS_RET_ERR_FUN = "-3"; //功能未实现
var WS_RET_ERR_DEVICE = "-4"; //设备不存在
var WS_RET_ERR_INIT = "-5"; //设备未初始化
var WS_RET_ERR_UNKOWN = "-6"; //非法错误号
var WS_RET_ERR_EXTRACT = "-7"; //提取特征失败或合成模板失败
var WS_RET_ERR_ELSE = "-9"; //其它错误

var WS_FM_Init = "FM_Init";
//{"reqcode":"FM_Init"}
//{"repcode":"FM_Init","result":"xx"}
var WS_FM_Deinit = "FM_Deinit";
//{"reqcode":"FM_Deinit"}
//{"repcode":"FM_Deinit","result":"xx"}
var WS_FM_GetDevVerison = "FM_GetDevVerison";
//{"reqcode":"FM_GetDevVerison"}
//{"reqcode":"FM_GetDevVerison","result":"xx":"version":"string"}
var WS_FM_GetSdkVerison = "FM_GetSdkVerison";
//{"reqcode":"FM_GetSdkVerison"}
//{"reqcode":"FM_GetSdkVerison","result":"xx":"version":"string"}
var WS_FM_DetectFinger = "FM_DetectFinger";
//{"reqcode":"FM_DetectFinger"}
//{"reqcode":"FM_DetectFinger","result":"xx"}
var WS_FM_Extract = "FM_Extract";
//{"reqcode":"FM_Extract","index":"(1~6)"}
//{"reqcode":"FM_Extract","result":"xx","feature":"base64"}
var WS_FM_Enroll = "FM_Enroll";

var WS_FPM_FeatureMatch = "FM_DetectFinger";
//{"reqcode":"FM_Enroll"}
//{"reqcode":"FM_Extract","result":"xx","feature":"base64"}


//--------------------------------------------------------------//
// 清空显示页面
//--------------------------------------------------------------//


function ClearPage_OnClick() {}
// document.getElementById('mb').value = "";;
//       document.getElementById("output").textContent ="";

//--------------------------------------------------------------//
// FPM_Init
//--------------------------------------------------------------//
function FM_Init_OnClick() {
  ClearPage_OnClick();
  var obj = {
    "reqcode": WS_FM_Init
  };
  var str = stringify_default()(obj);
  plguin_send(str);
}
//--------------------------------------------------------------//
// FM_Deinit
//--------------------------------------------------------------//
function FM_Deinit_OnClick() {
  ClearPage_OnClick();
  var obj = {
    "reqcode": WS_FM_Deinit
  };
  var str = stringify_default()(obj);
  plguin_send(str);
}
//--------------------------------------------------------------//
// FM_GetSdkVerison
//--------------------------------------------------------------//
function FM_GetSdkVerison_OnClick() {
  ClearPage_OnClick();
  var obj = {
    "reqcode": WS_FM_GetSdkVerison
  };
  var str = stringify_default()(obj);
  plguin_send(str);
}
//--------------------------------------------------------------//
// FM_GetDevVerison
//--------------------------------------------------------------//
function FM_GetDevVerison_OnClick() {
  ClearPage_OnClick();
  var obj = {
    "reqcode": WS_FM_GetDevVerison
  };
  var str = stringify_default()(obj);
  plguin_send(str);
}

//--------------------------------------------------------------//
// FPM_FeatureExtract
//--------------------------------------------------------------//
function FM_Extract_OnClick() {
  // ClearPage_OnClick();
  var obj = {
    "reqcode": WS_FM_Extract,
    "index": getFinger_select + 1 + ""
  };
  var str = stringify_default()(obj);
  plguin_send(str);
}
//--------------------------------------------------------------//
// FM_Enroll
//--------------------------------------------------------------//
function FM_Enroll_OnClick() {
  var obj = {
    "reqcode": WS_FM_Enroll
  };
  var str = stringify_default()(obj);
  plguin_send(str);
}
//--------------------------------------------------------------//
// FPM_FeatureMatch
//--------------------------------------------------------------//
function FM_DetectFinger_OnClick() {
  var obj = {
    "reqcode": WS_FM_DetectFinger
  };
  var str = stringify_default()(obj);
  plguin_send(str);
}

function errAlert(iret) {
  if (iret === WS_RET_ERR_OK) {
    resetMessage["a" /* message */].success("操作成功");
  } else if (iret === WS_RET_ERR_PARAM) {
    resetMessage["a" /* message */].success("参数错误");
  } else if (iret === WS_RET_ERR_MEMORY) {
    resetMessage["a" /* message */].success("内存分配失败，没有分配到足够的内存");
  } else if (iret === WS_RET_ERR_FUN) {
    resetMessage["a" /* message */].success("功能未实现");
  } else if (iret === WS_RET_ERR_DEVICE) {
    resetMessage["a" /* message */].success("设备不存在");
  } else if (iret === WS_RET_ERR_EXTRACT) {
    resetMessage["a" /* message */].success("提取特征失败或合成模板失败");
  } else if (iret === WS_RET_ERR_INIT) {
    resetMessage["a" /* message */].success("设备未初始化");
  } else if (iret === WS_RET_ERR_UNKOWN) {
    resetMessage["a" /* message */].success("非法错误号");
  } else if (iret === WS_RET_ERR_ELSE) {
    resetMessage["a" /* message */].success("其它错误");
  }
}

var mb = null;
//显示信息
var log = function log(s) {
  if (document.readyState !== "complete") {
    log.buffer.push(s);
  } else {
    // document.getElementById("output").textContent += (s + "\n");
    // document.getElementById("outputdiv").scrollTop = document.getElementById("outputdiv").scrollHeight;
  }
};
log.buffer = [];
//显示连接状态
function setConnected(status) {
  // document.getElementById("socketstatus").innerHTML = status;
}
var ws = null;

//连接
function plguin_connect() {
  if (ws != null) {
    console.log("现已连接");
    return;
  }
  var url = Ip;
  if ('WebSocket' in window) {
    ws = new WebSocket(url);
    console.log(ws);
  } else if ('MozWebSocket' in window) {
    ws = new MozWebSocket(url);
  } else {
    log("unsupported WebSocket");
    return;
  }
  ws.onopen = function () {
    log("open");
    setConnected("已连接");
    //设置发信息送类型为：ArrayBuffer
    ws.binaryType = "arraybuffer";
  };
  ws.onmessage = function (e) {
    log("[recv]:" + e.data.toString());
    var s = e.data.toString();
    var obj = JSON.parse(s);

    //检测设备
    if (obj.repcode == WS_FM_Init) {
      console.log(obj);
      contectStatus = obj.result;
    }
    //关闭设备
    else if (obj.repcode == WS_FM_Deinit) {
        // console.log(222)
        errAlert(obj.result);
      }
      //插件版本
      else if (obj.repcode == WS_FM_GetDevVerison) {
          //
          var info = "Ver:" + obj.version;
          resetMessage["a" /* message */].success(info);
        }
        //设备版本
        else if (obj.repcode == WS_FM_GetSdkVerison) {
            //
            resetMessage["a" /* message */].success(obj.version);
          }

          //提取手指特征
          else if (obj.repcode == WS_FM_Extract) {
              if (obj.result == WS_RET_ERR_OK) {
                if (0 == getFinger_select) {
                  console.log(obj);
                  // alert("指纹采集成功，请松开手指后在按下")
                  resetMessage["a" /* message */].success("指纹采集成功，请松开手指后在按下");
                  // this.DetectFinger()
                }
                if (1 == getFinger_select) {
                  console.log(obj);
                  console.log("第二次数据");
                  // alert("指纹采集成功，请松开手指后在按下")
                  resetMessage["a" /* message */].success("指纹采集成功，请松开手指后在按下");
                }
                if (2 == getFinger_select) {
                  console.log(obj);
                  fingerData = obj;
                  console.log("第三次数据");
                  // alert("指纹采集成功")
                  resetMessage["a" /* message */].success("指纹采集成功");
                }
                getFinger_select++;
              } else errAlert(obj.result);
            } else if (obj.repcode == WS_FM_Enroll) {
              strFTP = obj.template;
              errAlert(obj.result);
              if (obj.result == WS_RET_ERR_OK) {
                console.log(obj);
              }
            } else if (obj.repcode == WS_FPM_FeatureMatch) {
              console.log(obj);
              fingerStatus = obj.result;
              console.log(fingerStatus);
              // errAlert(obj.result);
            } else {
              log("Unkown");
            }
  };
  ws.onclose = function (e) {
    log("closed");
    ws = null;
  };
  ws.onerror = function (e) {
    log("error");
    ws = null;
  };
}

//断开连接
function plguin_close() {
  if (ws != null) {
    ws.close();
    ws = null;
    setConnected("已断开");
  }
}

function plguin_send(s) {
  log("[send]:" + s);
  if (ws != null) {
    ws.send(s);
  } else {
    log("[send]: ws null");
  }
}

function getLocalIp(cb) {
  if (window.navigator.userAgent.indexOf("MSIE") == -1 && window.navigator.userAgent.indexOf("Edge") == -1 && window.navigator.userAgent.indexOf("Trident") == -1) {
    var conn = new RTCPeerConnection({
      iceServers: []
    });
    var noop = function noop() {};
    conn.onicecandidate = function (ice) {
      if (ice.candidate) {
        //使用正则获取ip
        var arr = ice.candidate.candidate.split(' ');
        var ip_addr = null;
        for (var i in arr) {
          if (arr[i].indexOf('.local') != -1) {
            ip_addr = arr[i];
          }
        }
        cb(ip_addr);
        conn.onicecandidate = noop;
      }
    };
    conn.createDataChannel('dataChannel');
    conn.createOffer(conn.setLocalDescription.bind(conn), noop);
  } else {
    try {
      var locator = new ActiveXObject("WbemScripting.SWbemLocator");
      var service = locator.ConnectServer("."); //连接本机服务器
      var properties = service.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration where IPEnabled=TRUE");
      //查询使用SQL标准
      var e = new Enumerator(properties);
      for (; !e.atEnd(); e.moveNext()) {
        var p = e.item();
        var desc = "Caption:" + p.Caption + " "; //网卡描述,也可以使用Description
        var ip = "IP:" + p.IPAddress(0) + " "; //IP地址为数组类型,子网俺码及默认网关亦同
        var mac = "MAC:" + p.MACAddress + " "; //网卡物理地址

        var ipSplit = ip.split(':');
        ip = ipSplit[1] ? ipSplit[1] : ipSplit[0];
        cb(ip);
      }
    } catch (e) {
      //IE获取失败可提示用户，设置相关信任
    }
  }
}

/* harmony default export */ var getFinger = ({
  data: function data() {
    return {
      ipAddress: '',
      text: '',
      loading: '',
      list: [],
      isdiable: true, //是否重新采集
      fingerStatus: fingerStatus //判断手指是否按下，0表示未按下
    };
  },
  mounted: function mounted() {},

  methods: {
    getFingerData: function getFingerData(value, callback) {
      console.log(fingerData, 'fingerData');
      callback(fingerData);
    },

    //连接
    contect: function contect() {
      plguin_connect();
    },

    //检测设备
    Init: function Init() {
      FM_Init_OnClick();
    },

    //检测手指
    DetectFinger: function DetectFinger() {
      var _this = this;

      if (contectStatus == '0') {
        FM_DetectFinger_OnClick();
        setTimeout(function () {
          _this.fingerStatus = fingerStatus;
        }, 1000);
        console.log("finger", this.fingerStatus);
      } else {
        this.Init();
        this.$message("设备未连接，请重新尝试");
      }
    },

    //提取特征
    Extract: function Extract() {
      FM_Extract_OnClick();
    },

    //合成模板
    Enroll: function Enroll() {
      FM_Enroll_OnClick();
    },

    //获取本机IP地址
    getIp: function getIp() {
      getLocalIp(function (ip) {
        console.log(ip);
      });
      var str = window.location.host.split(':');
      console.log(window.location.host, str);
      Ip = "ws://" + '127.0.0.1' + ":9618";
      // httpGet(data,'').then(res => {
      // 	let str = res.data
      // 	let targetStr = str.substring(str.indexOf('{'), str.lastIndexOf('}') + 1);
      //   Ip = "ws://" + JSON.stringify(targetStr) + ":9618"
      // // 	Ip = "ws://" + '192.168.1.111' + ":9618"
      // 	console.log(Ip)
      // })
    },

    //重新采集
    onload: function onload() {
      getFinger_select = 0;
      this.isdiable = true;
    },

    //loading
    openFullScreen: function openFullScreen() {
      this.loading = this.$loading({
        lock: true,
        text: this.text,
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
    }
  },
  created: function created() {
    var _this2 = this;

    this.getIp();
    this.text = '设备连接中';
    this.openFullScreen();
    setTimeout(function () {
      _this2.contect();
      setTimeout(function () {
        _this2.Init();
        _this2.loading.close();
      }, 500);
    }, 500);
  },

  watch: {
    //监听手指是否按下
    fingerStatus: function fingerStatus(news, olds) {
      var _this3 = this;

      console.log("watch", news);
      if (this.fingerStatus == 1 && news == 1) {
        this.Extract();
        this.fingerStatus = 2;
        if (getFinger_select == 2) {
          this.Enroll();
          setTimeout(function () {
            _this3.list.push(strFTP);
            _this3.isdiable = false;
          }, 500);
          console.log(this.list);
        }
        return;
      }
      if (news == 0) {
        this.$message("请按压手指");
        this.fingerStatus = 2;
      }
    }
  }
});
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-6f9da94a","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/views/getFinger.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{on:{"click":function($event){return _vm.DetectFinger()}}}),_vm._v(" "),_c('div',{on:{"click":function($event){return _vm.getFingerData()}}}),_vm._v(" "),_c('div',{attrs:{"id":"my-button"},on:{"click":function($event){return _vm.onload()}}})])}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var views_getFinger = (esExports);
// CONCATENATED MODULE: ./src/views/getFinger.vue
function injectStyle (ssrContext) {
  __webpack_require__("/xI2")
}
var normalizeComponent = __webpack_require__("VU/8")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = null
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  getFinger,
  views_getFinger,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var src_views_getFinger = __webpack_exports__["default"] = (Component.exports);


/***/ })

});