Commit b2fe6d69 authored by westzmg's avatar westzmg

集成百度AI和原生对话框

parent c69c178f
...@@ -30,5 +30,7 @@ export default { ...@@ -30,5 +30,7 @@ export default {
{ path: '/launchShare', component: '../pages/launchShare' }, { path: '/launchShare', component: '../pages/launchShare' },
{ path: '/getToken', component: '../pages/getToken' }, { path: '/getToken', component: '../pages/getToken' },
{ path: '/uploadImage', component: '../pages/uploadImage' }, { path: '/uploadImage', component: '../pages/uploadImage' },
{ path: '/dialog', component: '../pages/dialog' },
{ path: '/baiduAI', component: '../pages/baiduAI' },
] ]
} }
...@@ -7,35 +7,248 @@ yarn add https://github.com/westzmg/zhu_wap_bridge.git ...@@ -7,35 +7,248 @@ yarn add https://github.com/westzmg/zhu_wap_bridge.git
##引用方式 ##引用方式
yarn add https://github.com/westzmg/zhu_wap_bridge.git yarn add https://github.com/westzmg/zhu_wap_bridge.git
# # 拍摄照片
# #### await _Bridge.takePhoto(options)
### 拍摄照片 ```
##### await _Bridge.takePhoto(options) options: {
##### options: {
quality: 0.6, // 图片质量0 to 1 quality: 0.6, // 图片质量0 to 1
includeBase64: true, // 返回值内是否包含base64 includeBase64: true, // 返回值内是否包含base64
} }
```
##### 详情参考 https://github.com/react-native-image-picker/react-native-image-picker ##### 详情参考 https://github.com/react-native-image-picker/react-native-image-picker
# 录制视频
# ### await _Bridge.recordVideo(options)
# ```
### 录制视频 options: {
##### await _Bridge.recordVideo(options) quality: 0.6, // 质量 0 to 1
##### options: {
quality: 0.6, // 图片质量0 to 1
} }
```
##### 详情参考 https://github.com/react-native-image-picker/react-native-image-picker ##### 详情参考 https://github.com/react-native-image-picker/react-native-image-picker
# # 扫描二维码
# ### await _Bridge.barCodeScan(options)
### 扫描二维码 ```
##### await _Bridge.barCodeScan(options) options: {
##### options: {
quality: 0.6, // 图片质量0 to 1
includeBase64: true, // 返回值内是否包含base64
} }
```
##### 详情参考 https://github.com/react-native-image-picker/react-native-image-picker ##### 详情参考 https://github.com/react-native-image-picker/react-native-image-picker
#打开WebView
### openWindow(options)
```
options: {
url: "http://www.baidu.com
}
```
#关闭当前的WebView
### closeWindow()
```
options: {
}
```
#获取坐标信息
### getPosition()
```
options: {
}
```
#使用重庆电子签章(未完成)
### launchCQDigitalSign(options)
```
options: {
}
```
#使用手写板签名(未完成)
### launchFingerSign(options)
```
options: {
}
```
#社交应用分享
### launchShare(options)
```
options: {
message:string,
title:string,
url:string<base64>
}
refer https://react-native-share.github.io/react-native-share/docs/share-open
```
#获取token
### getToken()
```
```
#获取当前项目信息
### getCurrProject()
```
```
#获取当前项目信息
### previewImage([])
```
@params [imageUrl]
```
#获取上传图片以及文件的token
### getUpToken(options)
```
options: {
id, --必输项,如果是项目级应用则设置project_id,否则设置user_id
app_id="common", --逻辑必输项,设置为应用的code,如果没有设置系统默认为common,
signature=true, --是否需要签名访问
rename=true, --文件是否重命名
maxSize=1024*1024*10 --文件尺寸限制,默认为10M
}
```
#上传图片
### uploadImage(options)
```
options {
token: object, --从getUpToken中获取
photo: object, --选择或拍照的结果,主要会用到fileName,type,fileName,多数情况直接拿结果直接用就行了
onProgress: func, --图片上传的进度回调
}
```
#图片直传
### uploadImageThrough(options)
```
options {
photo: object, --选择或拍照的结果,主要会用到fileName,type,fileName,多数情况直接拿结果直接用就行了
tokenMode: string, --必输项,project or user
appId: string, --所属的app代码,默认为common
signature: false, --是否需要签名上传
rename=true, --是否重命名
maxSize=1024*10000 --最大尺寸
}
```
#拍照后直接上传
### takePhotoAndUpload(options)
```
options {
quality: 0.6,
includeBase64: true,
saveToPhotos: false,
uploadOptions: {
tokenMode: string, --必输项,project or user,默认为project
appId: string, --所属的app代码,默认为common
signature: false, --是否需要签名上传
} --图片上传的options
}
```
#选择文件后上传
### choosePhotoAndUpload(options)
```
options {
includeBase64: false,
uploadOptions: {
tokenMode: string, --必输项,project or user
appId: string, --所属的app代码,默认为common
signature: false, --是否需要签名上传
} --图片上传的options
}
```
#拍照或选择文件后上传
### getPhotoAndUpload(options)
```
options {
sourceType --['album', 'camera']相册选择和摄像头的选择,可二者同时
takeOptions: {
quality: 0.6,
includeBase64: true,
saveToPhotos: false,
} --拍照的options,无特殊情况几乎不用设置
chooseOptions:{
includeBase64: true,
} --拍照的options,无特殊情况几乎不用设置
uploadOptions: {
tokenMode: string, --归类方式 project or user,默认project
appId: string, --所属的app代码,默认为common,建议输入
signature: true, --是否需要签名上传,默认为true
} --图片上传的options
}
```
#信息提示对话框
### alertDialog(options)
```
options {
title, -- 标题
description, -- 描述内容
status, --状态 normal(默认),warning,error,success
}
```
#信息确认对话框
### await confirmDialog(options)
```
options {
title, -- 标题
description, -- 描述内容
}
@result 确认true, 放弃false
```
#文本输入对话框
### await inputDialog(options)
```
options {
title, -- 标题
description, -- 描述内容
}
@result
```
#人脸活体检测
### await liveDetect(options)
```
options {
includeBase64, --
scale, -- 尺寸
cropHeight, -- 图片高度
cropWidth, -- 图片宽度
}
@result {uri, type, fileName, base64}
```
#捕捉拍摄身份证
### await takeIdCard(options)
```
options {
includeBase64, --
quality, --
}
@result {uri, type, fileName, base64}
```
#识别车牌
### await scanCarNo(options)
```
options {
includeBase64, --
}
@result {uri, type, fileName, base64}
```
#识别营业执照
### await scanBusinessLicense(options)
```
options {
includeBase64, --
}
@result {uri, type, fileName, base64}
```
...@@ -158,6 +158,25 @@ export const getToken = async () => { ...@@ -158,6 +158,25 @@ export const getToken = async () => {
}) })
}; };
/*
* 获取当前项目信息
* @name getCurrProject
* @return
*/
export const getCurrProject = async () => {
return new Promise(async (resolve) => {
// invoke.define('getToken', async () => {resolve()});
invoke.define('getCurrProjectCompleted', async (result) => {resolve(result)});
await invoke.bind("getCurrProject")()
})
};
/*
* 预览图片
* @name previewImage
* @params [imageUrl]
* @return
*/
export const previewImage = async (opt) => { export const previewImage = async (opt) => {
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
await invoke.bind("previewImage")(opt) await invoke.bind("previewImage")(opt)
...@@ -280,7 +299,110 @@ export const getPhotoAndUpload = async (opt) => { ...@@ -280,7 +299,110 @@ export const getPhotoAndUpload = async (opt) => {
}) })
}; };
/*
* @name alertDialog 信息提示对话框
* options {
* title, -- 标题
* description, -- 描述内容
* status, --状态 normal(默认),warning,error,success
* }
*/
export const alertDialog = async (opt) => {
return new Promise(async (resolve) => {
invoke.define('alertDialogCompleted', async (result) => {resolve(result)});
await invoke.bind("alertDialog")(opt)
})
};
/*
* @name confirmDialog 信息确认对话框
* options {
* title, -- 标题
* description, -- 描述内容
* }
* @result 确认true, 放弃false
*/
export const confirmDialog = async (opt) => {
return new Promise(async (resolve) => {
invoke.define('confirmDialogCompleted', async (result) => {resolve(result)});
await invoke.bind("confirmDialog")(opt)
})
};
/*
* @name inputDialog 文本输入对话框
* options {
* title, -- 标题
* description, -- 描述内容
* }
* @result
*/
export const inputDialog = async (opt) => {
return new Promise(async (resolve) => {
invoke.define('inputDialogCompleted', async (result) => {resolve(result)});
await invoke.bind("inputDialog")(opt)
})
};
/*
* @name liveDetect 人脸活体检测
* options {
* includeBase64, --
* scale, --
* cropHeight, --
* cropWidth, --
* }
* @result {uri, type, fileName, base64}
*/
export const liveDetect = async (opt) => {
return new Promise(async (resolve) => {
invoke.define('liveDetectCompleted', async (result) => {resolve(result)});
await invoke.bind("liveDetect")(opt)
})
};
/*
* @name takeIdCard 捕捉拍摄身份证
* options {
* includeBase64, --
* quality, --
* }
* @result {uri, type, fileName, base64}
*/
export const takeIdCard = async (opt) => {
return new Promise(async (resolve) => {
invoke.define('takeIdCardCompleted', async (result) => {resolve(result)});
await invoke.bind("takeIdCard")(opt)
})
};
/*
* @name scanCarNo 识别车牌
* options {
* includeBase64, -- 标题
* }
* @result
*/
export const scanCarNo = async (opt) => {
return new Promise(async (resolve) => {
invoke.define('scanCarNoCompleted', async (result) => {resolve(result)});
await invoke.bind("scanCarNo")(opt)
})
};
/*
* @name scanBusinessLicense 识别营业执照
* options {
* includeBase64, -- 标题
* }
* @result
*/
export const scanBusinessLicense = async (opt) => {
return new Promise(async (resolve) => {
invoke.define('scanBusinessLicenseCompleted', async (result) => {resolve(result)});
await invoke.bind("scanBusinessLicense")(opt)
})
};
export const EVENTS_TYPE = { export const EVENTS_TYPE = {
keyboardWillShow: 'keyboardWillShow', // 键盘即将出现 keyboardWillShow: 'keyboardWillShow', // 键盘即将出现
...@@ -303,6 +425,7 @@ export default { ...@@ -303,6 +425,7 @@ export default {
launchFingerSign, launchFingerSign,
launchShare, launchShare,
getToken, getToken,
getCurrProject,
previewImage, previewImage,
getUpToken, getUpToken,
...@@ -311,6 +434,15 @@ export default { ...@@ -311,6 +434,15 @@ export default {
takePhotoAndUpload, takePhotoAndUpload,
choosePhotoAndUpload, choosePhotoAndUpload,
getPhotoAndUpload, getPhotoAndUpload,
alertDialog,
confirmDialog,
inputDialog,
liveDetect,
takeIdCard,
scanCarNo,
scanBusinessLicense,
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -663,93 +663,96 @@ export var getToken = /*#__PURE__*/function () { ...@@ -663,93 +663,96 @@ export var getToken = /*#__PURE__*/function () {
return _ref26.apply(this, arguments); return _ref26.apply(this, arguments);
}; };
}(); }();
export var previewImage = /*#__PURE__*/function () { /*
var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(opt) { * 获取当前项目信息
return _regeneratorRuntime.wrap(function _callee30$(_context30) { * @name getCurrProject
* @return
*/
export var getCurrProject = /*#__PURE__*/function () {
var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31() {
return _regeneratorRuntime.wrap(function _callee31$(_context31) {
while (1) { while (1) {
switch (_context30.prev = _context30.next) { switch (_context31.prev = _context31.next) {
case 0: case 0:
return _context30.abrupt("return", new Promise( /*#__PURE__*/function () { return _context31.abrupt("return", new Promise( /*#__PURE__*/function () {
var _ref30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(resolve) { var _ref30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(resolve) {
return _regeneratorRuntime.wrap(function _callee29$(_context29) { return _regeneratorRuntime.wrap(function _callee30$(_context30) {
while (1) { while (1) {
switch (_context29.prev = _context29.next) { switch (_context30.prev = _context30.next) {
case 0: case 0:
_context29.next = 2; // invoke.define('getToken', async () => {resolve()});
return invoke.bind("previewImage")(opt); invoke.define('getCurrProjectCompleted', /*#__PURE__*/function () {
var _ref31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(result) {
return _regeneratorRuntime.wrap(function _callee29$(_context29) {
while (1) {
switch (_context29.prev = _context29.next) {
case 0:
resolve(result);
case 2: case 1:
case "end":
return _context29.stop();
}
}
}, _callee29);
}));
return function (_x29) {
return _ref31.apply(this, arguments);
};
}());
_context30.next = 3;
return invoke.bind("getCurrProject")();
case 3:
case "end": case "end":
return _context29.stop(); return _context30.stop();
} }
} }
}, _callee29); }, _callee30);
})); }));
return function (_x29) { return function (_x28) {
return _ref30.apply(this, arguments); return _ref30.apply(this, arguments);
}; };
}())); }()));
case 1: case 1:
case "end": case "end":
return _context30.stop(); return _context31.stop();
} }
} }
}, _callee30); }, _callee31);
})); }));
return function previewImage(_x28) { return function getCurrProject() {
return _ref29.apply(this, arguments); return _ref29.apply(this, arguments);
}; };
}(); }();
/* /*
* 获取上传图片以及文件的token * 预览图片
* options: { * @name previewImage
* id, --必输项,如果是项目级应用则设置project_id,否则设置user_id * @params [imageUrl]
* app_id="common", --逻辑必输项,设置为应用的code,如果没有设置系统默认为common, * @return
* signature=true, --是否需要签名访问
* rename=true, --文件是否重命名
* maxSize=1024*1024*10 --文件尺寸限制,默认为10M
* }
*/ */
export var getUpToken = /*#__PURE__*/function () { export var previewImage = /*#__PURE__*/function () {
var _ref31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(opt) { var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee33(opt) {
return _regeneratorRuntime.wrap(function _callee33$(_context33) { return _regeneratorRuntime.wrap(function _callee33$(_context33) {
while (1) { while (1) {
switch (_context33.prev = _context33.next) { switch (_context33.prev = _context33.next) {
case 0: case 0:
return _context33.abrupt("return", new Promise( /*#__PURE__*/function () { return _context33.abrupt("return", new Promise( /*#__PURE__*/function () {
var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(resolve) { var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee32(resolve) {
return _regeneratorRuntime.wrap(function _callee32$(_context32) { return _regeneratorRuntime.wrap(function _callee32$(_context32) {
while (1) { while (1) {
switch (_context32.prev = _context32.next) { switch (_context32.prev = _context32.next) {
case 0: case 0:
invoke.define('getUpTokenCompleted', /*#__PURE__*/function () { _context32.next = 2;
var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee31(result) { return invoke.bind("previewImage")(opt);
return _regeneratorRuntime.wrap(function _callee31$(_context31) {
while (1) {
switch (_context31.prev = _context31.next) {
case 0:
resolve(result);
case 1:
case "end":
return _context31.stop();
}
}
}, _callee31);
}));
return function (_x32) {
return _ref33.apply(this, arguments);
};
}());
_context32.next = 3;
return invoke.bind("getUpToken")(opt);
case 3: case 2:
case "end": case "end":
return _context32.stop(); return _context32.stop();
} }
...@@ -758,7 +761,7 @@ export var getUpToken = /*#__PURE__*/function () { ...@@ -758,7 +761,7 @@ export var getUpToken = /*#__PURE__*/function () {
})); }));
return function (_x31) { return function (_x31) {
return _ref32.apply(this, arguments); return _ref33.apply(this, arguments);
}; };
}())); }()));
...@@ -770,20 +773,22 @@ export var getUpToken = /*#__PURE__*/function () { ...@@ -770,20 +773,22 @@ export var getUpToken = /*#__PURE__*/function () {
}, _callee33); }, _callee33);
})); }));
return function getUpToken(_x30) { return function previewImage(_x30) {
return _ref31.apply(this, arguments); return _ref32.apply(this, arguments);
}; };
}(); }();
/* /*
* @name uploadImage 上传图片 * 获取上传图片以及文件的token
* options { * options: {
* token: object, --从getUpToken中获取 * id, --必输项,如果是项目级应用则设置project_id,否则设置user_id
* photo: object, --选择或拍照的结果,主要会用到fileName,type,fileName,多数情况直接拿结果直接用就行了 * app_id="common", --逻辑必输项,设置为应用的code,如果没有设置系统默认为common,
* onProgress: func, --图片上传的进度回调 * signature=true, --是否需要签名访问
* } * rename=true, --文件是否重命名
*/ * maxSize=1024*1024*10 --文件尺寸限制,默认为10M
* }
*/
export var uploadImage = /*#__PURE__*/function () { export var getUpToken = /*#__PURE__*/function () {
var _ref34 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(opt) { var _ref34 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee36(opt) {
return _regeneratorRuntime.wrap(function _callee36$(_context36) { return _regeneratorRuntime.wrap(function _callee36$(_context36) {
while (1) { while (1) {
...@@ -795,7 +800,7 @@ export var uploadImage = /*#__PURE__*/function () { ...@@ -795,7 +800,7 @@ export var uploadImage = /*#__PURE__*/function () {
while (1) { while (1) {
switch (_context35.prev = _context35.next) { switch (_context35.prev = _context35.next) {
case 0: case 0:
invoke.define('uploadImageCompleted', /*#__PURE__*/function () { invoke.define('getUpTokenCompleted', /*#__PURE__*/function () {
var _ref36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(result) { var _ref36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee34(result) {
return _regeneratorRuntime.wrap(function _callee34$(_context34) { return _regeneratorRuntime.wrap(function _callee34$(_context34) {
while (1) { while (1) {
...@@ -811,12 +816,12 @@ export var uploadImage = /*#__PURE__*/function () { ...@@ -811,12 +816,12 @@ export var uploadImage = /*#__PURE__*/function () {
}, _callee34); }, _callee34);
})); }));
return function (_x35) { return function (_x34) {
return _ref36.apply(this, arguments); return _ref36.apply(this, arguments);
}; };
}()); }());
_context35.next = 3; _context35.next = 3;
return invoke.bind("uploadImage")(opt); return invoke.bind("getUpToken")(opt);
case 3: case 3:
case "end": case "end":
...@@ -826,7 +831,7 @@ export var uploadImage = /*#__PURE__*/function () { ...@@ -826,7 +831,7 @@ export var uploadImage = /*#__PURE__*/function () {
}, _callee35); }, _callee35);
})); }));
return function (_x34) { return function (_x33) {
return _ref35.apply(this, arguments); return _ref35.apply(this, arguments);
}; };
}())); }()));
...@@ -839,23 +844,20 @@ export var uploadImage = /*#__PURE__*/function () { ...@@ -839,23 +844,20 @@ export var uploadImage = /*#__PURE__*/function () {
}, _callee36); }, _callee36);
})); }));
return function uploadImage(_x33) { return function getUpToken(_x32) {
return _ref34.apply(this, arguments); return _ref34.apply(this, arguments);
}; };
}(); }();
/* /*
* @name uploadImageThrough 图片直传,获取token和上传操作合并 * @name uploadImage 上传图片
* options { * options {
* token: object, --从getUpToken中获取
* photo: object, --选择或拍照的结果,主要会用到fileName,type,fileName,多数情况直接拿结果直接用就行了 * photo: object, --选择或拍照的结果,主要会用到fileName,type,fileName,多数情况直接拿结果直接用就行了
* tokenMode: string, --必输项,project or user * onProgress: func, --图片上传的进度回调
* appId: string, --所属的app代码,默认为common
* signature: false, --是否需要签名上传
* rename=true, --是否重命名
* maxSize=1024*10000 --最大尺寸
* } * }
*/ */
export var uploadImageThrough = /*#__PURE__*/function () { export var uploadImage = /*#__PURE__*/function () {
var _ref37 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(opt) { var _ref37 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee39(opt) {
return _regeneratorRuntime.wrap(function _callee39$(_context39) { return _regeneratorRuntime.wrap(function _callee39$(_context39) {
while (1) { while (1) {
...@@ -867,7 +869,7 @@ export var uploadImageThrough = /*#__PURE__*/function () { ...@@ -867,7 +869,7 @@ export var uploadImageThrough = /*#__PURE__*/function () {
while (1) { while (1) {
switch (_context38.prev = _context38.next) { switch (_context38.prev = _context38.next) {
case 0: case 0:
invoke.define('uploadImageThroughCompleted', /*#__PURE__*/function () { invoke.define('uploadImageCompleted', /*#__PURE__*/function () {
var _ref39 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(result) { var _ref39 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee37(result) {
return _regeneratorRuntime.wrap(function _callee37$(_context37) { return _regeneratorRuntime.wrap(function _callee37$(_context37) {
while (1) { while (1) {
...@@ -883,12 +885,12 @@ export var uploadImageThrough = /*#__PURE__*/function () { ...@@ -883,12 +885,12 @@ export var uploadImageThrough = /*#__PURE__*/function () {
}, _callee37); }, _callee37);
})); }));
return function (_x38) { return function (_x37) {
return _ref39.apply(this, arguments); return _ref39.apply(this, arguments);
}; };
}()); }());
_context38.next = 3; _context38.next = 3;
return invoke.bind("uploadImageThrough")(opt); return invoke.bind("uploadImage")(opt);
case 3: case 3:
case "end": case "end":
...@@ -898,7 +900,7 @@ export var uploadImageThrough = /*#__PURE__*/function () { ...@@ -898,7 +900,7 @@ export var uploadImageThrough = /*#__PURE__*/function () {
}, _callee38); }, _callee38);
})); }));
return function (_x37) { return function (_x36) {
return _ref38.apply(this, arguments); return _ref38.apply(this, arguments);
}; };
}())); }()));
...@@ -911,25 +913,23 @@ export var uploadImageThrough = /*#__PURE__*/function () { ...@@ -911,25 +913,23 @@ export var uploadImageThrough = /*#__PURE__*/function () {
}, _callee39); }, _callee39);
})); }));
return function uploadImageThrough(_x36) { return function uploadImage(_x35) {
return _ref37.apply(this, arguments); return _ref37.apply(this, arguments);
}; };
}(); }();
/* /*
* @name takePhotoAndUpload 拍照后直接上传 * @name uploadImageThrough 图片直传,获取token和上传操作合并
* options { * options {
* quality: 0.6, * photo: object, --选择或拍照的结果,主要会用到fileName,type,fileName,多数情况直接拿结果直接用就行了
* includeBase64: true, * tokenMode: string, --必输项,project or user
* saveToPhotos: false, * appId: string, --所属的app代码,默认为common
* uploadOptions: { * signature: false, --是否需要签名上传
* tokenMode: string, --必输项,project or user,默认为project * rename=true, --是否重命名
* appId: string, --所属的app代码,默认为common * maxSize=1024*10000 --最大尺寸
* signature: false, --是否需要签名上传
* } --图片上传的options
* } * }
*/ */
export var takePhotoAndUpload = /*#__PURE__*/function () { export var uploadImageThrough = /*#__PURE__*/function () {
var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(opt) { var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(opt) {
return _regeneratorRuntime.wrap(function _callee42$(_context42) { return _regeneratorRuntime.wrap(function _callee42$(_context42) {
while (1) { while (1) {
...@@ -941,7 +941,7 @@ export var takePhotoAndUpload = /*#__PURE__*/function () { ...@@ -941,7 +941,7 @@ export var takePhotoAndUpload = /*#__PURE__*/function () {
while (1) { while (1) {
switch (_context41.prev = _context41.next) { switch (_context41.prev = _context41.next) {
case 0: case 0:
invoke.define('takePhotoAndUploadCompleted', /*#__PURE__*/function () { invoke.define('uploadImageThroughCompleted', /*#__PURE__*/function () {
var _ref42 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(result) { var _ref42 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee40(result) {
return _regeneratorRuntime.wrap(function _callee40$(_context40) { return _regeneratorRuntime.wrap(function _callee40$(_context40) {
while (1) { while (1) {
...@@ -957,12 +957,12 @@ export var takePhotoAndUpload = /*#__PURE__*/function () { ...@@ -957,12 +957,12 @@ export var takePhotoAndUpload = /*#__PURE__*/function () {
}, _callee40); }, _callee40);
})); }));
return function (_x41) { return function (_x40) {
return _ref42.apply(this, arguments); return _ref42.apply(this, arguments);
}; };
}()); }());
_context41.next = 3; _context41.next = 3;
return invoke.bind("takePhotoAndUpload")(opt); return invoke.bind("uploadImageThrough")(opt);
case 3: case 3:
case "end": case "end":
...@@ -972,7 +972,7 @@ export var takePhotoAndUpload = /*#__PURE__*/function () { ...@@ -972,7 +972,7 @@ export var takePhotoAndUpload = /*#__PURE__*/function () {
}, _callee41); }, _callee41);
})); }));
return function (_x40) { return function (_x39) {
return _ref41.apply(this, arguments); return _ref41.apply(this, arguments);
}; };
}())); }()));
...@@ -985,23 +985,25 @@ export var takePhotoAndUpload = /*#__PURE__*/function () { ...@@ -985,23 +985,25 @@ export var takePhotoAndUpload = /*#__PURE__*/function () {
}, _callee42); }, _callee42);
})); }));
return function takePhotoAndUpload(_x39) { return function uploadImageThrough(_x38) {
return _ref40.apply(this, arguments); return _ref40.apply(this, arguments);
}; };
}(); }();
/* /*
* @name choosePhotoAndUpload 选择文件后上传 * @name takePhotoAndUpload 拍照后直接上传
* options { * options {
* includeBase64: false, * quality: 0.6,
* includeBase64: true,
* saveToPhotos: false,
* uploadOptions: { * uploadOptions: {
* tokenMode: string, --必输项,project or user * tokenMode: string, --必输项,project or user,默认为project
* appId: string, --所属的app代码,默认为common * appId: string, --所属的app代码,默认为common
* signature: false, --是否需要签名上传 * signature: false, --是否需要签名上传
* } --图片上传的options * } --图片上传的options
* } * }
*/ */
export var choosePhotoAndUpload = /*#__PURE__*/function () { export var takePhotoAndUpload = /*#__PURE__*/function () {
var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(opt) { var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(opt) {
return _regeneratorRuntime.wrap(function _callee45$(_context45) { return _regeneratorRuntime.wrap(function _callee45$(_context45) {
while (1) { while (1) {
...@@ -1013,7 +1015,7 @@ export var choosePhotoAndUpload = /*#__PURE__*/function () { ...@@ -1013,7 +1015,7 @@ export var choosePhotoAndUpload = /*#__PURE__*/function () {
while (1) { while (1) {
switch (_context44.prev = _context44.next) { switch (_context44.prev = _context44.next) {
case 0: case 0:
invoke.define('choosePhotoAndUploadCompleted', /*#__PURE__*/function () { invoke.define('takePhotoAndUploadCompleted', /*#__PURE__*/function () {
var _ref45 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(result) { var _ref45 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(result) {
return _regeneratorRuntime.wrap(function _callee43$(_context43) { return _regeneratorRuntime.wrap(function _callee43$(_context43) {
while (1) { while (1) {
...@@ -1029,12 +1031,12 @@ export var choosePhotoAndUpload = /*#__PURE__*/function () { ...@@ -1029,12 +1031,12 @@ export var choosePhotoAndUpload = /*#__PURE__*/function () {
}, _callee43); }, _callee43);
})); }));
return function (_x44) { return function (_x43) {
return _ref45.apply(this, arguments); return _ref45.apply(this, arguments);
}; };
}()); }());
_context44.next = 3; _context44.next = 3;
return invoke.bind("choosePhotoAndUpload")(opt); return invoke.bind("takePhotoAndUpload")(opt);
case 3: case 3:
case "end": case "end":
...@@ -1044,7 +1046,7 @@ export var choosePhotoAndUpload = /*#__PURE__*/function () { ...@@ -1044,7 +1046,7 @@ export var choosePhotoAndUpload = /*#__PURE__*/function () {
}, _callee44); }, _callee44);
})); }));
return function (_x43) { return function (_x42) {
return _ref44.apply(this, arguments); return _ref44.apply(this, arguments);
}; };
}())); }()));
...@@ -1057,31 +1059,23 @@ export var choosePhotoAndUpload = /*#__PURE__*/function () { ...@@ -1057,31 +1059,23 @@ export var choosePhotoAndUpload = /*#__PURE__*/function () {
}, _callee45); }, _callee45);
})); }));
return function choosePhotoAndUpload(_x42) { return function takePhotoAndUpload(_x41) {
return _ref43.apply(this, arguments); return _ref43.apply(this, arguments);
}; };
}(); }();
/* /*
* @name getPhotoAndUpload 拍照或选择文件后上传 * @name choosePhotoAndUpload 选择文件后上传
* options { * options {
* sourceType --['album', 'camera']相册选择和摄像头的选择,可二者同时 * includeBase64: false,
* takeOptions: {
* quality: 0.6,
* includeBase64: true,
* saveToPhotos: false,
* } --拍照的options,无特殊情况几乎不用设置
* chooseOptions:{
* includeBase64: true,
* } --拍照的options,无特殊情况几乎不用设置
* uploadOptions: { * uploadOptions: {
* tokenMode: string, --归类方式 project or user,默认project * tokenMode: string, --必输项,project or user
* appId: string, --所属的app代码,默认为common,建议输入 * appId: string, --所属的app代码,默认为common
* signature: true, --是否需要签名上传,默认为true * signature: false, --是否需要签名上传
* } --图片上传的options * } --图片上传的options
* } * }
*/ */
export var getPhotoAndUpload = /*#__PURE__*/function () { export var choosePhotoAndUpload = /*#__PURE__*/function () {
var _ref46 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(opt) { var _ref46 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(opt) {
return _regeneratorRuntime.wrap(function _callee48$(_context48) { return _regeneratorRuntime.wrap(function _callee48$(_context48) {
while (1) { while (1) {
...@@ -1093,7 +1087,7 @@ export var getPhotoAndUpload = /*#__PURE__*/function () { ...@@ -1093,7 +1087,7 @@ export var getPhotoAndUpload = /*#__PURE__*/function () {
while (1) { while (1) {
switch (_context47.prev = _context47.next) { switch (_context47.prev = _context47.next) {
case 0: case 0:
invoke.define('getPhotoAndUploadCompleted', /*#__PURE__*/function () { invoke.define('choosePhotoAndUploadCompleted', /*#__PURE__*/function () {
var _ref48 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(result) { var _ref48 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(result) {
return _regeneratorRuntime.wrap(function _callee46$(_context46) { return _regeneratorRuntime.wrap(function _callee46$(_context46) {
while (1) { while (1) {
...@@ -1109,12 +1103,12 @@ export var getPhotoAndUpload = /*#__PURE__*/function () { ...@@ -1109,12 +1103,12 @@ export var getPhotoAndUpload = /*#__PURE__*/function () {
}, _callee46); }, _callee46);
})); }));
return function (_x47) { return function (_x46) {
return _ref48.apply(this, arguments); return _ref48.apply(this, arguments);
}; };
}()); }());
_context47.next = 3; _context47.next = 3;
return invoke.bind("getPhotoAndUpload")(opt); return invoke.bind("choosePhotoAndUpload")(opt);
case 3: case 3:
case "end": case "end":
...@@ -1124,7 +1118,7 @@ export var getPhotoAndUpload = /*#__PURE__*/function () { ...@@ -1124,7 +1118,7 @@ export var getPhotoAndUpload = /*#__PURE__*/function () {
}, _callee47); }, _callee47);
})); }));
return function (_x46) { return function (_x45) {
return _ref47.apply(this, arguments); return _ref47.apply(this, arguments);
}; };
}())); }()));
...@@ -1137,10 +1131,573 @@ export var getPhotoAndUpload = /*#__PURE__*/function () { ...@@ -1137,10 +1131,573 @@ export var getPhotoAndUpload = /*#__PURE__*/function () {
}, _callee48); }, _callee48);
})); }));
return function getPhotoAndUpload(_x45) { return function choosePhotoAndUpload(_x44) {
return _ref46.apply(this, arguments); return _ref46.apply(this, arguments);
}; };
}(); }();
/*
* @name getPhotoAndUpload 拍照或选择文件后上传
* options {
* sourceType --['album', 'camera']相册选择和摄像头的选择,可二者同时
* takeOptions: {
* quality: 0.6,
* includeBase64: true,
* saveToPhotos: false,
* } --拍照的options,无特殊情况几乎不用设置
* chooseOptions:{
* includeBase64: true,
* } --拍照的options,无特殊情况几乎不用设置
* uploadOptions: {
* tokenMode: string, --归类方式 project or user,默认project
* appId: string, --所属的app代码,默认为common,建议输入
* signature: true, --是否需要签名上传,默认为true
* } --图片上传的options
* }
*/
export var getPhotoAndUpload = /*#__PURE__*/function () {
var _ref49 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(opt) {
return _regeneratorRuntime.wrap(function _callee51$(_context51) {
while (1) {
switch (_context51.prev = _context51.next) {
case 0:
return _context51.abrupt("return", new Promise( /*#__PURE__*/function () {
var _ref50 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(resolve) {
return _regeneratorRuntime.wrap(function _callee50$(_context50) {
while (1) {
switch (_context50.prev = _context50.next) {
case 0:
invoke.define('getPhotoAndUploadCompleted', /*#__PURE__*/function () {
var _ref51 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(result) {
return _regeneratorRuntime.wrap(function _callee49$(_context49) {
while (1) {
switch (_context49.prev = _context49.next) {
case 0:
resolve(result);
case 1:
case "end":
return _context49.stop();
}
}
}, _callee49);
}));
return function (_x49) {
return _ref51.apply(this, arguments);
};
}());
_context50.next = 3;
return invoke.bind("getPhotoAndUpload")(opt);
case 3:
case "end":
return _context50.stop();
}
}
}, _callee50);
}));
return function (_x48) {
return _ref50.apply(this, arguments);
};
}()));
case 1:
case "end":
return _context51.stop();
}
}
}, _callee51);
}));
return function getPhotoAndUpload(_x47) {
return _ref49.apply(this, arguments);
};
}();
/*
* @name alertDialog 信息提示对话框
* options {
* title, -- 标题
* description, -- 描述内容
* status, --状态 normal(默认),warning,error,success
* }
*/
export var alertDialog = /*#__PURE__*/function () {
var _ref52 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(opt) {
return _regeneratorRuntime.wrap(function _callee54$(_context54) {
while (1) {
switch (_context54.prev = _context54.next) {
case 0:
return _context54.abrupt("return", new Promise( /*#__PURE__*/function () {
var _ref53 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(resolve) {
return _regeneratorRuntime.wrap(function _callee53$(_context53) {
while (1) {
switch (_context53.prev = _context53.next) {
case 0:
invoke.define('alertDialogCompleted', /*#__PURE__*/function () {
var _ref54 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(result) {
return _regeneratorRuntime.wrap(function _callee52$(_context52) {
while (1) {
switch (_context52.prev = _context52.next) {
case 0:
resolve(result);
case 1:
case "end":
return _context52.stop();
}
}
}, _callee52);
}));
return function (_x52) {
return _ref54.apply(this, arguments);
};
}());
_context53.next = 3;
return invoke.bind("alertDialog")(opt);
case 3:
case "end":
return _context53.stop();
}
}
}, _callee53);
}));
return function (_x51) {
return _ref53.apply(this, arguments);
};
}()));
case 1:
case "end":
return _context54.stop();
}
}
}, _callee54);
}));
return function alertDialog(_x50) {
return _ref52.apply(this, arguments);
};
}();
/*
* @name confirmDialog 信息确认对话框
* options {
* title, -- 标题
* description, -- 描述内容
* }
* @result 确认true, 放弃false
*/
export var confirmDialog = /*#__PURE__*/function () {
var _ref55 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(opt) {
return _regeneratorRuntime.wrap(function _callee57$(_context57) {
while (1) {
switch (_context57.prev = _context57.next) {
case 0:
return _context57.abrupt("return", new Promise( /*#__PURE__*/function () {
var _ref56 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(resolve) {
return _regeneratorRuntime.wrap(function _callee56$(_context56) {
while (1) {
switch (_context56.prev = _context56.next) {
case 0:
invoke.define('confirmDialogCompleted', /*#__PURE__*/function () {
var _ref57 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(result) {
return _regeneratorRuntime.wrap(function _callee55$(_context55) {
while (1) {
switch (_context55.prev = _context55.next) {
case 0:
resolve(result);
case 1:
case "end":
return _context55.stop();
}
}
}, _callee55);
}));
return function (_x55) {
return _ref57.apply(this, arguments);
};
}());
_context56.next = 3;
return invoke.bind("confirmDialog")(opt);
case 3:
case "end":
return _context56.stop();
}
}
}, _callee56);
}));
return function (_x54) {
return _ref56.apply(this, arguments);
};
}()));
case 1:
case "end":
return _context57.stop();
}
}
}, _callee57);
}));
return function confirmDialog(_x53) {
return _ref55.apply(this, arguments);
};
}();
/*
* @name inputDialog 文本输入对话框
* options {
* title, -- 标题
* description, -- 描述内容
* }
* @result
*/
export var inputDialog = /*#__PURE__*/function () {
var _ref58 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(opt) {
return _regeneratorRuntime.wrap(function _callee60$(_context60) {
while (1) {
switch (_context60.prev = _context60.next) {
case 0:
return _context60.abrupt("return", new Promise( /*#__PURE__*/function () {
var _ref59 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(resolve) {
return _regeneratorRuntime.wrap(function _callee59$(_context59) {
while (1) {
switch (_context59.prev = _context59.next) {
case 0:
invoke.define('inputDialogCompleted', /*#__PURE__*/function () {
var _ref60 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(result) {
return _regeneratorRuntime.wrap(function _callee58$(_context58) {
while (1) {
switch (_context58.prev = _context58.next) {
case 0:
resolve(result);
case 1:
case "end":
return _context58.stop();
}
}
}, _callee58);
}));
return function (_x58) {
return _ref60.apply(this, arguments);
};
}());
_context59.next = 3;
return invoke.bind("inputDialog")(opt);
case 3:
case "end":
return _context59.stop();
}
}
}, _callee59);
}));
return function (_x57) {
return _ref59.apply(this, arguments);
};
}()));
case 1:
case "end":
return _context60.stop();
}
}
}, _callee60);
}));
return function inputDialog(_x56) {
return _ref58.apply(this, arguments);
};
}();
/*
* @name liveDetect 人脸活体检测
* options {
* includeBase64, --
* scale, --
* cropHeight, --
* cropWidth, --
* }
* @result {uri, type, fileName, base64}
*/
export var liveDetect = /*#__PURE__*/function () {
var _ref61 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(opt) {
return _regeneratorRuntime.wrap(function _callee63$(_context63) {
while (1) {
switch (_context63.prev = _context63.next) {
case 0:
return _context63.abrupt("return", new Promise( /*#__PURE__*/function () {
var _ref62 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(resolve) {
return _regeneratorRuntime.wrap(function _callee62$(_context62) {
while (1) {
switch (_context62.prev = _context62.next) {
case 0:
invoke.define('liveDetectCompleted', /*#__PURE__*/function () {
var _ref63 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(result) {
return _regeneratorRuntime.wrap(function _callee61$(_context61) {
while (1) {
switch (_context61.prev = _context61.next) {
case 0:
resolve(result);
case 1:
case "end":
return _context61.stop();
}
}
}, _callee61);
}));
return function (_x61) {
return _ref63.apply(this, arguments);
};
}());
_context62.next = 3;
return invoke.bind("liveDetect")(opt);
case 3:
case "end":
return _context62.stop();
}
}
}, _callee62);
}));
return function (_x60) {
return _ref62.apply(this, arguments);
};
}()));
case 1:
case "end":
return _context63.stop();
}
}
}, _callee63);
}));
return function liveDetect(_x59) {
return _ref61.apply(this, arguments);
};
}();
/*
* @name takeIdCard 捕捉拍摄身份证
* options {
* includeBase64, --
* quality, --
* }
* @result {uri, type, fileName, base64}
*/
export var takeIdCard = /*#__PURE__*/function () {
var _ref64 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(opt) {
return _regeneratorRuntime.wrap(function _callee66$(_context66) {
while (1) {
switch (_context66.prev = _context66.next) {
case 0:
return _context66.abrupt("return", new Promise( /*#__PURE__*/function () {
var _ref65 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(resolve) {
return _regeneratorRuntime.wrap(function _callee65$(_context65) {
while (1) {
switch (_context65.prev = _context65.next) {
case 0:
invoke.define('takeIdCardCompleted', /*#__PURE__*/function () {
var _ref66 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(result) {
return _regeneratorRuntime.wrap(function _callee64$(_context64) {
while (1) {
switch (_context64.prev = _context64.next) {
case 0:
resolve(result);
case 1:
case "end":
return _context64.stop();
}
}
}, _callee64);
}));
return function (_x64) {
return _ref66.apply(this, arguments);
};
}());
_context65.next = 3;
return invoke.bind("takeIdCard")(opt);
case 3:
case "end":
return _context65.stop();
}
}
}, _callee65);
}));
return function (_x63) {
return _ref65.apply(this, arguments);
};
}()));
case 1:
case "end":
return _context66.stop();
}
}
}, _callee66);
}));
return function takeIdCard(_x62) {
return _ref64.apply(this, arguments);
};
}();
/*
* @name scanCarNo 识别车牌
* options {
* includeBase64, -- 标题
* }
* @result
*/
export var scanCarNo = /*#__PURE__*/function () {
var _ref67 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(opt) {
return _regeneratorRuntime.wrap(function _callee69$(_context69) {
while (1) {
switch (_context69.prev = _context69.next) {
case 0:
return _context69.abrupt("return", new Promise( /*#__PURE__*/function () {
var _ref68 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(resolve) {
return _regeneratorRuntime.wrap(function _callee68$(_context68) {
while (1) {
switch (_context68.prev = _context68.next) {
case 0:
invoke.define('scanCarNoCompleted', /*#__PURE__*/function () {
var _ref69 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(result) {
return _regeneratorRuntime.wrap(function _callee67$(_context67) {
while (1) {
switch (_context67.prev = _context67.next) {
case 0:
resolve(result);
case 1:
case "end":
return _context67.stop();
}
}
}, _callee67);
}));
return function (_x67) {
return _ref69.apply(this, arguments);
};
}());
_context68.next = 3;
return invoke.bind("scanCarNo")(opt);
case 3:
case "end":
return _context68.stop();
}
}
}, _callee68);
}));
return function (_x66) {
return _ref68.apply(this, arguments);
};
}()));
case 1:
case "end":
return _context69.stop();
}
}
}, _callee69);
}));
return function scanCarNo(_x65) {
return _ref67.apply(this, arguments);
};
}();
/*
* @name scanBusinessLicense 识别营业执照
* options {
* includeBase64, -- 标题
* }
* @result
*/
export var scanBusinessLicense = /*#__PURE__*/function () {
var _ref70 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(opt) {
return _regeneratorRuntime.wrap(function _callee72$(_context72) {
while (1) {
switch (_context72.prev = _context72.next) {
case 0:
return _context72.abrupt("return", new Promise( /*#__PURE__*/function () {
var _ref71 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(resolve) {
return _regeneratorRuntime.wrap(function _callee71$(_context71) {
while (1) {
switch (_context71.prev = _context71.next) {
case 0:
invoke.define('scanBusinessLicenseCompleted', /*#__PURE__*/function () {
var _ref72 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(result) {
return _regeneratorRuntime.wrap(function _callee70$(_context70) {
while (1) {
switch (_context70.prev = _context70.next) {
case 0:
resolve(result);
case 1:
case "end":
return _context70.stop();
}
}
}, _callee70);
}));
return function (_x70) {
return _ref72.apply(this, arguments);
};
}());
_context71.next = 3;
return invoke.bind("scanBusinessLicense")(opt);
case 3:
case "end":
return _context71.stop();
}
}
}, _callee71);
}));
return function (_x69) {
return _ref71.apply(this, arguments);
};
}()));
case 1:
case "end":
return _context72.stop();
}
}
}, _callee72);
}));
return function scanBusinessLicense(_x68) {
return _ref70.apply(this, arguments);
};
}();
export var EVENTS_TYPE = { export var EVENTS_TYPE = {
keyboardWillShow: 'keyboardWillShow', keyboardWillShow: 'keyboardWillShow',
// 键盘即将出现 // 键盘即将出现
...@@ -1167,11 +1724,19 @@ export default { ...@@ -1167,11 +1724,19 @@ export default {
launchFingerSign: launchFingerSign, launchFingerSign: launchFingerSign,
launchShare: launchShare, launchShare: launchShare,
getToken: getToken, getToken: getToken,
getCurrProject: getCurrProject,
previewImage: previewImage, previewImage: previewImage,
getUpToken: getUpToken, getUpToken: getUpToken,
uploadImage: uploadImage, uploadImage: uploadImage,
uploadImageThrough: uploadImageThrough, uploadImageThrough: uploadImageThrough,
takePhotoAndUpload: takePhotoAndUpload, takePhotoAndUpload: takePhotoAndUpload,
choosePhotoAndUpload: choosePhotoAndUpload, choosePhotoAndUpload: choosePhotoAndUpload,
getPhotoAndUpload: getPhotoAndUpload getPhotoAndUpload: getPhotoAndUpload,
alertDialog: alertDialog,
confirmDialog: confirmDialog,
inputDialog: inputDialog,
liveDetect: liveDetect,
takeIdCard: takeIdCard,
scanCarNo: scanCarNo,
scanBusinessLicense: scanBusinessLicense
}; };
\ No newline at end of file
import React from 'react'
import moment from 'moment'
import {Button} from "antd-mobile";
import {_Bridge} from "../components"
export default class extends React.Component {
constructor(props) {
super(props);
this.state = {
result: null
}
}
doFunc = async (options)=> {
this.setState({result: null}, async ()=>{
const result = await _Bridge.getToken(options);
this.setState({result: result})
})
};
render() {
return (
<div>
<h1 style={{textAlign: "center"}}>百度AI</h1>
<div style={{padding: 20}}>
<Button
style={{marginBottom: 20}}
onClick={async ()=>{
try {
const result = await _Bridge.liveDetect({
});
_Bridge.alertDialog("认证结果", result)
} catch (e) {
await _Bridge.alertDialog({title: "发生错误", e})
}
}}
>人脸活体验证</Button>
<Button
style={{marginBottom: 20}}
onClick={async ()=>{
try {
const frontData = await _Bridge.takeIdCard({
front: true,
});
await _Bridge.alertDialog({
title: "正面信息",
description: frontData
});
const backData = await _Bridge.takeIdCard({
front: false,
});
await _Bridge.alertDialog({
title: "背面信息",
description: backData
});
} catch (e) {
await _Bridge.alertDialog({title: "发生错误", e})
}
}}
>识别身份证</Button>
<Button
style={{marginBottom: 20}}
onClick={async ()=>{
try {
const result = await _Bridge.scanCarNo({
});
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.scanCarNo({
});
await _Bridge.alertDialog({
title: "识别结果",
description: result
});
} catch (e) {
await _Bridge.alertDialog({title: "发生错误", e})
}
}}
>识别营业执照</Button>
</div>
</div>
);
}
};
import React from 'react'
import moment from 'moment'
import {Button} from "antd-mobile";
import {_Bridge} from "../components"
export default class extends React.Component {
constructor(props) {
super(props);
this.state = {
result: null
}
}
doFunc = async (options)=> {
this.setState({result: null}, async ()=>{
const result = await _Bridge.getToken(options);
this.setState({result: result})
})
};
render() {
return (
<div>
<h1 style={{textAlign: "center"}}>百度AI</h1>
<div style={{padding: 20}}>
<Button
style={{marginBottom: 20}}
onClick={()=>{
_Bridge.alertDialog({
title: "信息提示",
description: "信息提示信息提示信息提示信息提示"
})
}}
>信息提示对话框</Button>
<Button
style={{marginBottom: 20}}
onClick={async ()=>{
try {
const result = await _Bridge.confirmDialog({
title: "信息确认",
description: "信息确认信息确认信息确认信息确认信息确认信息确认"
});
alert(result);
} catch (e) {
await _Bridge.alertDialog({title: "发生错误", e})
}
}}
>信息确认对话框</Button>
<Button
style={{marginBottom: 20}}
onClick={async ()=>{
try {
const result = await _Bridge.inputDialog({
title: "请输入文本",
});
alert(result);
} catch (e) {
await _Bridge.alertDialog({title: "发生错误", e})
}
}}
>信息输入对话框</Button>
</div>
</div>
);
}
};
...@@ -6,6 +6,7 @@ import 'antd-mobile/dist/antd-mobile.css' ...@@ -6,6 +6,7 @@ import 'antd-mobile/dist/antd-mobile.css'
import {Button} from "antd-mobile"; import {Button} from "antd-mobile";
import {closeWindow} from "../components/_Bridge" import {closeWindow} from "../components/_Bridge"
import {_Bridge} from "../components";
moment.locale("zh-CN"); moment.locale("zh-CN");
...@@ -27,10 +28,18 @@ export default class extends React.Component { ...@@ -27,10 +28,18 @@ export default class extends React.Component {
<Button style={{marginBottom: 20}}>扫描二维码</Button> <Button style={{marginBottom: 20}}>扫描二维码</Button>
</Link> </Link>
<Link to={`/dialog`}>
<Button style={{marginBottom: 20}}>调用对话框</Button>
</Link>
<Link to={`/getPosition`}> <Link to={`/getPosition`}>
<Button style={{marginBottom: 20}}>获取坐标信息</Button> <Button style={{marginBottom: 20}}>获取坐标信息</Button>
</Link> </Link>
<Link to={`/baiduAI`}>
<Button style={{marginBottom: 20}}>百度AI</Button>
</Link>
<Link to={`/launchCQDigitalSign`}> <Link to={`/launchCQDigitalSign`}>
<Button style={{marginBottom: 20}}>重庆建委人脸认证</Button> <Button style={{marginBottom: 20}}>重庆建委人脸认证</Button>
</Link> </Link>
......
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