更新记录

1.0.1(2025-05-03)

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.


[Unreleased]

Added

  • (新功能或特性,尚未发布)

Changed

  • (现有功能的变更)

Fixed

  • (问题修复)

Deprecated

  • (即将废弃的功能)

Removed

  • (已删除的功能)

Security

  • (安全相关更新)

[1.0.1] - 2025-05-03

Fixed

  • 修正安卓回调出错的问题

[1.0.0] - 2025-04-01

Initial Release

  • 插件核心功能上线:支持基础 API 调用和 UI 渲染。

1.0.0(2025-05-03)

[1.0.0] - 2025-04-01

Initial Release

  • 插件核心功能上线:支持基础 API 调用和 UI 渲染。

平台兼容性

Vue2 Vue3
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 4.64,Android:6.0,iOS:13,HarmonyNext:不确定 × × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序 鸿蒙元服务
× × × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × × × × × ×

📦 安装

npm install alipay-face --save

🚀 快速开始

初始化 SDK

import { initSDK } from 'alipay-face';

const result = initSDK(3);
console.log('初始化状态:', result.status);

调用人脸核身

import { verify } from 'alipay-face';

verify({
  certifyId: 'your_certify_id_from_alipay',
  success: (res) => {
    console.log('核身成功:', res);
  },
  fail: (err) => {
    console.error('核身失败:', err.errCode, err.errMsg);
  }
});

📚 API 文档

initSDK(retryCount: number): InitResult

参数 类型 必填 说明
retryCount number 最大重试次数

返回值:

interface InitResult {
  status: boolean
}

verify(options: VerifyOptions): void

参数结构:

interface VerifyOptions {
  certifyId: string
  success?: (res: VerifyResult) => void
  fail?: (err: VerifyFail) => void
  complete?: (res: any) => void
}

interface VerifyResult {
  code: number
  reason: string
  retCode: number
  retMsg: string
}

interface VerifyFail extends IUniError {
  errCode: 9010001 | 9010002
}

⚠️ 错误码说明

错误码 描述
9010001 核身流程ID无效
9010002 支付宝SDK初始化失败

🔧 集成准备

支付宝配置

  1. 登录支付宝开放平台
  2. 添加「人脸核身」功能
  3. 获取 certifyId

Uni-App 配置

{
  "app-plus": {
    "plugins": {
      "alipay-face": {
        "version": "1.0.0",
        "provider": "alipay"
      }
    }
  }
}

📝 注意事项

  1. Android需相机权限
  2. iOS需添加 NSCameraUsageDescription
  3. 建议使用沙箱环境测试

📜 许可证

MIT © 2023 MiKoo NetWrok

隐私、权限声明

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

android.permission.INTERNET,android.permission.CAMERA

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

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

暂无用户评论。

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