更新记录

1.0.0(2024-06-07)

初始版本


平台兼容性

Android Android CPU类型 iOS
适用版本区间:7.0 - 13.0 armeabi-v7a:支持,arm64-v8a:支持,x86:未测试 ×

原生插件通用使用流程:

  1. 购买插件,选择该插件绑定的项目。
  2. 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
  3. 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
  4. 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
  5. 开发完毕后正式云打包

付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios

注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择


人脸采集插件使用说明

1、插件说明 本插件是基于Hms开发的人脸采集工具,支持静态活体检测。

2、使用步骤

1)导入插件

2)注册插件、配置数据监听方法

3、代码示例

<template>
    <view>
        <view>
            <button type="primary" @click="openFrontCameraPage">前置摄像头</button>
            <button type="primary" @click="openCustomPage">自定义页面</button>
            <button type="primary" @click="testMethod">交互测试</button>
        </view>
        <view>
            <text>活体:{{live}} </text>
        </view>
        <view>
            <text>可信值:{{score}}</text>
        </view>
        <view>
            <image :src="`data:image/jpeg;base64,${imageData}`" mode="widthFix" style="width: 400rpx;"></image>
        </view>

    </view>

</template>
<script>
// 获取 module
const facecollectSdk = uni.requireNativePlugin('ls-face-kit-plugin');
const modal = uni.requireNativePlugin('modal');
export default {

    data() {
        return {
            imageData:'',
            enableSound: true,
            live: '否',
            score: '0'
        }
    },
    onLoad() {
        //监听数据更新进度信息
        var globalEvent = uni.requireNativePlugin('globalEvent');
        globalEvent.addEventListener('faceApiEvent', function(result) {
            modal.toast({
                message: result.status,
                duration: 3
            });
        });

    },
    onShow() {

    },
    methods: {

        openCustomPage(){
            if(!facecollectSdk){
                modal.toast({
                    message: '插件未加载',
                    duration: 3
                });
            }
            facecollectSdk.openCustomPage(
            {}
            ,(ret) => {
                console.log(ret)
                if(ret.status){
                    this.imageData = ret.base64Image;
                    this.live = ret.live ? "是" : "否";
                    this.score = ret.score + "";
                }
                modal.toast({
                    message: ret.message,
                    duration: 3
                });
            })
        },
        openFrontCameraPage(){
            if(!facecollectSdk){
                modal.toast({
                    message: '插件未加载',
                    duration: 3
                });
            }
            facecollectSdk.openFrontCameraPage({},
                (ret) => {
                    console.log(ret)
                    if(ret.status){
                        this.imageData = ret.base64Image;
                        this.live = ret.live ? "是" : "否";
                        this.score = ret.score + "";
                    }
                    modal.toast({
                        message: ret.message,
                        duration: 3
                    });
                })
        },
        testMethod(){
            facecollectSdk.testMethod({
                    'mac': '1111111',
                    'template': 'bbbbbbbbb'
                },
                (ret) => {
                    modal.toast({
                        message: ret,
                        duration: 3
                    });
                })
        }
    }
};
</script>

<style>

.uni-list-cell {
    margin: 0rpx;
    padding-top: 20rpx;
    padding-bottom: 20rpx;
    height: 100rpx;
    /* background-color: #09BB07; */
    border-bottom-color: #CCCCCC;
    border-bottom-width: 1rpx;
}
.uni-list-cell-left {
    margin: 0rpx;
    padding: 0rpx;
}
.uni-list-cell-db {
    margin: 0rpx;
    padding-left: 20rpx;
    flex: 1;
    justify-content: flex-end;
}
.arrow {

    margin-top: 4rpx;
    width: 16rpx;
    height: 28rpx;
    margin-left: 0rpx;
    margin-right: 30rpx;
}
.uni-input{
    justify-content: flex-end;
}
</style>

隐私、权限声明

1. 本插件需要申请的系统权限列表:

1、相机权限

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不具备存储功能,采集到的人脸照片直接返回到页面进行展示。

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问