Commit ffb23df5 authored by westzmg's avatar westzmg

增加身份证识别的直传

parent 60cf5026
...@@ -250,3 +250,46 @@ options { ...@@ -250,3 +250,46 @@ options {
@result {uri, type, fileName, base64} @result {uri, type, fileName, base64}
``` ```
# 识别身份证正面照的信息
### await discernIdCardFront(options)
```
options {
imageId --身份证正面照图片ID
}
@result {
real_name, --姓名
id_no, --身份证号码
birth, --生日
address, --地址
ethnicity, --民族
sex --性别
}
```
# 识别身份证背面照的信息
### await discernIdCardBack(options)
```
options {
imageId --身份证正面照图片ID
}
@result {
issued_by, --发证机关
valid_to, --有效期开始
valid_from --有效期截止
}
```
# 捕捉身份证信息后直接上传并获取验证结果
### await takeIdCardAndDiscern(options)
```
options {
front: true, --是否正面
}
@result {
data: {
... --上传图片的返回结果
discernInfo --对应的身份证正反面识别的结果
},
}
```
...@@ -404,6 +404,45 @@ export const scanBusinessLicense = async (opt) => { ...@@ -404,6 +404,45 @@ export const scanBusinessLicense = async (opt) => {
}) })
}; };
/*
* @name discernIdCardFront 识别身份证正面照的信息
* options {
* imageId --身份证正面照图片ID
* }
*/
export const discernIdCardFront = async (opt) => {
return new Promise(async (resolve) => {
invoke.define('discernIdCardFrontCompleted', async (result) => {resolve(result)});
await invoke.bind("discernIdCardFront")(opt)
})
};
/*
* @name discernIdCardBack 识别身份证背面照的信息
* options {
* imageId --身份证背面照图片ID
* }
*/
export const discernIdCardBack = async (opt) => {
return new Promise(async (resolve) => {
invoke.define('discernIdCardBackCompleted', async (result) => {resolve(result)});
await invoke.bind("discernIdCardBack")(opt)
})
};
/*
* @name takeIdCardAndDiscern 捕捉身份证信息后直接上传并获取验证结果
* options {
* front: true, --是否正面
* }
*/
export const takeIdCardAndDiscern = async (opt) => {
return new Promise(async (resolve) => {
invoke.define('takeIdCardAndDiscernCompleted', async (result) => {resolve(result)});
await invoke.bind("takeIdCardAndDiscern")(opt)
})
};
export const EVENTS_TYPE = { export const EVENTS_TYPE = {
keyboardWillShow: 'keyboardWillShow', // 键盘即将出现 keyboardWillShow: 'keyboardWillShow', // 键盘即将出现
keyboardDidShow: 'keyboardDidShow', // 键盘已经出现 keyboardDidShow: 'keyboardDidShow', // 键盘已经出现
...@@ -443,6 +482,9 @@ export default { ...@@ -443,6 +482,9 @@ export default {
takeIdCard, takeIdCard,
scanCarNo, scanCarNo,
scanBusinessLicense, scanBusinessLicense,
discernIdCardFront,
discernIdCardBack,
takeIdCardAndDiscern,
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -1698,6 +1698,207 @@ export var scanBusinessLicense = /*#__PURE__*/function () { ...@@ -1698,6 +1698,207 @@ export var scanBusinessLicense = /*#__PURE__*/function () {
return _ref70.apply(this, arguments); return _ref70.apply(this, arguments);
}; };
}(); }();
/*
* @name discernIdCardFront 识别身份证正面照的信息
* options {
* imageId --身份证正面照图片ID
* }
*/
export var discernIdCardFront = /*#__PURE__*/function () {
var _ref73 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(opt) {
return _regeneratorRuntime.wrap(function _callee75$(_context75) {
while (1) {
switch (_context75.prev = _context75.next) {
case 0:
return _context75.abrupt("return", new Promise( /*#__PURE__*/function () {
var _ref74 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74(resolve) {
return _regeneratorRuntime.wrap(function _callee74$(_context74) {
while (1) {
switch (_context74.prev = _context74.next) {
case 0:
invoke.define('discernIdCardFrontCompleted', /*#__PURE__*/function () {
var _ref75 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(result) {
return _regeneratorRuntime.wrap(function _callee73$(_context73) {
while (1) {
switch (_context73.prev = _context73.next) {
case 0:
resolve(result);
case 1:
case "end":
return _context73.stop();
}
}
}, _callee73);
}));
return function (_x73) {
return _ref75.apply(this, arguments);
};
}());
_context74.next = 3;
return invoke.bind("discernIdCardFront")(opt);
case 3:
case "end":
return _context74.stop();
}
}
}, _callee74);
}));
return function (_x72) {
return _ref74.apply(this, arguments);
};
}()));
case 1:
case "end":
return _context75.stop();
}
}
}, _callee75);
}));
return function discernIdCardFront(_x71) {
return _ref73.apply(this, arguments);
};
}();
/*
* @name discernIdCardBack 识别身份证背面照的信息
* options {
* imageId --身份证背面照图片ID
* }
*/
export var discernIdCardBack = /*#__PURE__*/function () {
var _ref76 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee78(opt) {
return _regeneratorRuntime.wrap(function _callee78$(_context78) {
while (1) {
switch (_context78.prev = _context78.next) {
case 0:
return _context78.abrupt("return", new Promise( /*#__PURE__*/function () {
var _ref77 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77(resolve) {
return _regeneratorRuntime.wrap(function _callee77$(_context77) {
while (1) {
switch (_context77.prev = _context77.next) {
case 0:
invoke.define('discernIdCardBackCompleted', /*#__PURE__*/function () {
var _ref78 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(result) {
return _regeneratorRuntime.wrap(function _callee76$(_context76) {
while (1) {
switch (_context76.prev = _context76.next) {
case 0:
resolve(result);
case 1:
case "end":
return _context76.stop();
}
}
}, _callee76);
}));
return function (_x76) {
return _ref78.apply(this, arguments);
};
}());
_context77.next = 3;
return invoke.bind("discernIdCardBack")(opt);
case 3:
case "end":
return _context77.stop();
}
}
}, _callee77);
}));
return function (_x75) {
return _ref77.apply(this, arguments);
};
}()));
case 1:
case "end":
return _context78.stop();
}
}
}, _callee78);
}));
return function discernIdCardBack(_x74) {
return _ref76.apply(this, arguments);
};
}();
/*
* @name takeIdCardAndDiscern 捕捉身份证信息后直接上传并获取验证结果
* options {
* front: true, --是否正面
* }
*/
export var takeIdCardAndDiscern = /*#__PURE__*/function () {
var _ref79 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee81(opt) {
return _regeneratorRuntime.wrap(function _callee81$(_context81) {
while (1) {
switch (_context81.prev = _context81.next) {
case 0:
return _context81.abrupt("return", new Promise( /*#__PURE__*/function () {
var _ref80 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee80(resolve) {
return _regeneratorRuntime.wrap(function _callee80$(_context80) {
while (1) {
switch (_context80.prev = _context80.next) {
case 0:
invoke.define('takeIdCardAndDiscernCompleted', /*#__PURE__*/function () {
var _ref81 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee79(result) {
return _regeneratorRuntime.wrap(function _callee79$(_context79) {
while (1) {
switch (_context79.prev = _context79.next) {
case 0:
resolve(result);
case 1:
case "end":
return _context79.stop();
}
}
}, _callee79);
}));
return function (_x79) {
return _ref81.apply(this, arguments);
};
}());
_context80.next = 3;
return invoke.bind("takeIdCardAndDiscern")(opt);
case 3:
case "end":
return _context80.stop();
}
}
}, _callee80);
}));
return function (_x78) {
return _ref80.apply(this, arguments);
};
}()));
case 1:
case "end":
return _context81.stop();
}
}
}, _callee81);
}));
return function takeIdCardAndDiscern(_x77) {
return _ref79.apply(this, arguments);
};
}();
export var EVENTS_TYPE = { export var EVENTS_TYPE = {
keyboardWillShow: 'keyboardWillShow', keyboardWillShow: 'keyboardWillShow',
// 键盘即将出现 // 键盘即将出现
...@@ -1738,5 +1939,8 @@ export default { ...@@ -1738,5 +1939,8 @@ export default {
liveDetect: liveDetect, liveDetect: liveDetect,
takeIdCard: takeIdCard, takeIdCard: takeIdCard,
scanCarNo: scanCarNo, scanCarNo: scanCarNo,
scanBusinessLicense: scanBusinessLicense scanBusinessLicense: scanBusinessLicense,
discernIdCardFront: discernIdCardFront,
discernIdCardBack: discernIdCardBack,
takeIdCardAndDiscern: takeIdCardAndDiscern
}; };
\ No newline at end of file
...@@ -98,6 +98,42 @@ export default class extends React.Component { ...@@ -98,6 +98,42 @@ export default class extends React.Component {
}} }}
>识别营业执照</Button> >识别营业执照</Button>
<Button
style={{marginBottom: 20}}
onClick={async ()=>{
try {
const result = await _Bridge.takeIdCardAndDiscern({
front: true
});
await _Bridge.alertDialog({
title: "识别结果",
description: result
});
} catch (e) {
await _Bridge.alertDialog({title: "发生错误", e})
}
}}
>捕捉身份证正面并识别</Button>
<Button
style={{marginBottom: 20}}
onClick={async ()=>{
try {
const result = await _Bridge.takeIdCardAndDiscern({
front: false
});
await _Bridge.alertDialog({
title: "识别结果",
description: result
});
} catch (e) {
await _Bridge.alertDialog({title: "发生错误", e})
}
}}
>捕捉身份证背面并识别</Button>
</div> </div>
</div> </div>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment