para-bridge-demo
Version:
a bridge api for js-ios/andriod rest
65 lines • 1.62 kB
Markdown
``` tsx
import { scanIdentityCard } from '../../../plugins/util/scan-identity-card';
interface IScanIdentityCardResult {
status: '0' | '1' | '2' | '3'; // 0:识别成功 1:识别失败 2:授权失败 3:取消
// 识别结果描述
message: string;
// 身份证信息
cardInfo: {
// 身份证信息
idCardJson: string;
// 身份证图片
idCardImgBase64: string;
// 正面头像图片
portraitImgBase64: string;
};
}
// 身份证扫描正面
private openScanIdCardSdk = () => {
scanIdentityCard().then(result => {
this.setState({
value: JSON.stringify(result),
});
}).catch(err => {
alert(JSON.stringify(err));
});
}
// 身份证扫描反面
private openScanIdCardSdkInverse = () => {
scanIdentityCard({
isPositive: 'false',
}).then(result => {
this.setState({
value: JSON.stringify(result),
});
}).catch(err => {
alert(JSON.stringify(err));
});
}
// 身份证扫描正面
private openScanIdCardSdkFromAlbum = () => {
scanIdentityCard({
isPositive: 'true',
isNeedAlbum: 'true',
}).then(result => {
this.setState({
value: JSON.stringify(result),
});
}).catch(err => {
alert(JSON.stringify(err));
});
}
// 身份证扫描正面
private openScanIdCardSdkFromAlbumInverse = () => {
scanIdentityCard({
isPositive: 'false',
isNeedAlbum: 'true',
}).then(result => {
this.setState({
value: JSON.stringify(result),
});
}).catch(err => {
alert(JSON.stringify(err));
});
}
```