Appearance
方法事件
注意
方法事件为组件方法调用后异步回调事件
用法示例
js
//事件
onEventMethod(e) {
console.log(e.detail)
}js
function onEventMethod(e : JSONObject) {
console.log("onEvent:" + e.toJSONString())
}回调示例
json
{
"type": "register",
"data": {
"data": {
"userId": "123",
"userName": "leven",
"faceId": 1431,
"imagePath": "/storage/emulated/0/Android/data/test.leven.uniplugin.com/files/Pictures/faceDB/registerFaces/123###leven_1702028708665.jpg",
"registerTime": 1702028708670,
"featureData": []
},
"message": "",
"code": 0
}
}json
{
"type": "switchCamera",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "stop",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "start",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "closeFace",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "openFace",
"data": {
"data": {},
"message": "",
"code": 0
}
}json
{
"type": "getCameraData",
"data": {
"data": {
"supportedPreviewSizes": [
{
"height": 1080,
"width": 1920
},
{
"height": 1200,
"width": 1600
},
{
"height": 1080,
"width": 1440
},
{
"height": 1080,
"width": 1260
},
{
"height": 960,
"width": 1280
},
{
"height": 1080,
"width": 1080
},
{
"height": 720,
"width": 1584
},
{
"height": 1080,
"width": 960
},
{
"height": 768,
"width": 1280
},
{
"height": 720,
"width": 1280
},
{
"height": 768,
"width": 1024
},
{
"height": 738,
"width": 1024
},
{
"height": 720,
"width": 960
},
{
"height": 540,
"width": 960
},
{
"height": 720,
"width": 720
},
{
"height": 600,
"width": 800
},
{
"height": 480,
"width": 864
},
{
"height": 540,
"width": 720
},
{
"height": 480,
"width": 800
},
{
"height": 480,
"width": 720
},
{
"height": 480,
"width": 640
},
{
"height": 400,
"width": 640
},
{
"height": 360,
"width": 640
},
{
"height": 288,
"width": 352
},
{
"height": 240,
"width": 320
},
{
"height": 180,
"width": 320
},
{
"height": 144,
"width": 176
}
],
"cameraId": 1
},
"message": "",
"code": 0
}
}回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| type | String | 事件类型,请参考下方说明 |
| data | Object | 事件数据 |
| data.code | Integer | 事件结果类型,0.成功,其他:失败 |
| data.data | Integer | 事件结果数据 |
| data.message | String | 事件结果消息 |
回调事件类型说明
注册人脸
类型名称
register
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.userId | String | 注册的用户id |
| data.userName | String | 注册的用户名字 |
| data.faceId | String | sdk保存的用户id |
| data.imagePath | String | 注册后本地保存的头像路径 |
| data.registerTime | Integer | 注册时间 |
| data.featureData | byte[] | 人脸特征数据 |
| code | Integer | 返回类型,0.成功,其他:失败 |
切换相机
类型名称
switchCamera
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
关闭预览
类型名称
stop
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
开启预览
类型名称
start
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
关闭人脸识别
类型名称
closeFace
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
开启人脸识别
类型名称
openFace
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| code | Integer | 返回类型,0.成功,其他:失败 |
获取摄像头数据
类型名称
getCameraData
回调说明
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| message | String | 消息提示 |
| data | Object | 数据对象 |
| data.supportedPreviewSizes | Object[] | 相机支持的预览分辨率 |
| data.supportedPreviewSizes.width | Integer | 分辨率的宽 |
| data.supportedPreviewSizes.height | Integer | 分辨率的高 |
| data.cameraId | Integer | 当前预览的摄像头,1.前置,0.后置 |
| code | Integer | 返回类型,0.成功,其他:失败 |
