更新记录

1.0.1(2026-04-10) 下载此版本

支持鸿蒙平台

1.0.0(2024-11-25) 下载此版本

  • 新建号码认证uts插件

平台兼容性

uni-app(3.96)

Vue2 Vue3 Vue3插件版本 Chrome Safari app-vue app-vue插件版本 app-nvue app-nvue插件版本 Android Android插件版本 iOS iOS插件版本 鸿蒙 鸿蒙插件版本
× 1.0.1 - - 1.0.0 1.0.0 4.4 1.0.0 12 1.0.0 12 1.0.1
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 小红书小程序 快应用-华为 快应用-联盟
- - - - - - - - - - - -

uni-app x(3.96)

Chrome Safari Android iOS 鸿蒙 微信小程序
- - - - - -

其他

多语言 暗黑模式 宽屏模式
× ×

号码认证

网易易盾 提供直连三大运营商,一步校验手机号与当前 SIM 卡号一致性。优化注册/登录/支付等场景验证流程
了解更多产品信息或体验试用,请访问 号码认证产品页

更新提醒

  • 在使用前请确保已申请到易盾一键登录的业务id

平台支持(兼容性)

Android iOS harmony
适用版本区间:5.0以上 适用版本区间:9以上 12及以上

资源引入/集成

从 dcloud 插件市场下载对应插件 yidun-quickpass。导入插件之后一定要自定义基座方可生效,自定义基座说明请参考 https://ask.dcloud.net.cn/article/35115;鸿蒙可以直接点击运行->运行到手机或模拟->运行到鸿蒙

调用示例

<template>
  <view>
    <button @click="initLogin('quickLogin')">初始化</button>
    <button @click="verifyNumber">授权验证</button>
  </view>
</template>

<script>
 import {
    registerWithBusinessID,
    getPhoneNumberCompletion,
    authorizeLoginCompletion
} from '@/uni_modules/yidun-quickpass'
export default {
    methods: {
        initLogin() {
            // 初始化
            registerWithBusinessID({
                    businessId: '从易盾获取业务id',
                    timeout: 3000
                }, onResponse: (success) => {
                    // 回调处理
                    if (success) {} else {}
                })
        },
        // 预取号
        verifyNumber() {
            getPhoneNumberCompletion({
                onSuccess: (token, mobile) => {
                    // TODO: 预取号成功处理,可以进行调起授权页
                    authorizeLoginCompletion({
                        onSuccess: (token, accessToken) => {},
                        onError: (token, code, msg) => {},
                        onCancel: () => {}
                    })
                },
                onError: (toekn, msg) => {}
            })
        }
    }
</script>

更多使用场景请参考 demo

SDK 方法说明

在 yidun-quickpass 中引入 api

import { 
    registerWithBusinessID, 
    shouldQuickLogin, 
    getPhoneNumberCompletion,
    setCustomView,
    authorizeLoginCompletion,
    closeAuthController,
    numberVerify
} from '@/uni_modules/yidun-quickpass'

1. 初始化

初始化一键登录

代码说明:

registerWithBusinessID({
  businessId: //'从易盾获取的id',
  timeout: 3
}, {
    onResponse: (success) => {
        if (success) {
        } else {
        }
    }
})

参数说明:

  • 入参说明:

    参数 类型 是否必填 默认值 描述
    businessId String 易盾分配的业务 id
    debug boolean false 是否打开日志开关
    timeout Number 3 运营商预取号和授权登录接口的超时时间,单位秒
  • 回调说明:

    onResponse: (success) => {
    if (success) {
        // 初始化成功
    } else {
        // 初始化失败
    }
    }

2. 检查网络环境(此 api 仅 Android 和 iOS 有效)

检测网络状况等条件是否具备进行一键登录

代码说明:

let ret = shouldQuickLogin()

返回值说明:

  • 返回值说明:

    返回值 类型 描述
    ret boolean 是否具备一键登录网络环境,true具备,false不具备

3. 预取号

代码说明:

getPhoneNumberCompletion({
    onSuccess: (token, mobile) => {
        // 预取号成功
    },
    onError: (token, msg) => {
        // 预取号失败
    }
})

参数说明:

  • 回调参数说明:

    回调参数 类型 描述
    token String 易盾token,用于校验
    mobile String 掩码
    msg String 预取号异常信息

4. 自定义授权页面

在工程目录下添加 json 配置文件,可配置项参考下面说明

代码说明:

setCustomView(options,{
    onAction: (action, checked) => {
        // 授权页内部view和自定义view点击事件回调
    },
    onLifeCycle: (lifeCycle) => {
        // 页面生命周期
    }
})

参数说明:

  • 入参说明:

    参数 类型 是否必填 默认值 描述
    options UTSJSONObject 自定义配置项json字符串

options 可配置项说明: android版

开发者不得通过任何技术手段,将授权页面的隐私栏、手机掩码号、供应商品牌内容隐藏、覆盖
网易易盾与运营商会对应用授权页面进行审查,若发现上述违规行为,网易易盾有权将您的一键登录功能下线
所有使用到的图标请放置在nativeResources/android/res/drawable目录下(命名只支持a-z、0-9和下划线),如果没有请在工程目录下创建,config配置文件中只配置图标的名字

安卓规范示意图 自定义展示图

状态栏
配置项 说明
statusBarColor:String 设置状态栏背景颜色,十六进制RGB值,如 "#ff0000"
isStatusBarDarkColor:boolean 设置状态栏字体图标颜色是否为暗色(黑色)
导航栏
配置项 说明
navBackIcon:String 导航栏图标,这里配置图标名字
navBackIconWidth:int 设置导航栏返回图标的宽度,单位 dp
navBackIconHeight:int 设置导航栏返回图标的高度,单位 dp
navBackIconGravity:int 设置导航栏返回图标位置,居左 3,居右 5,默认居左
navBackIconMargin:int 设置导航栏返回图标上下左右边距,单位 dp
isHideBackIcon:boolean 设置是否隐藏导航栏返回按钮
navBackgroundColor:String 设置导航栏背景颜色,十六进制RGB值,如 "#ff0000"
navHeight:int 设置导航栏高度,单位 dp
navTitle:String 设置导航栏标题
navTitleColor:String 设置导航栏标题颜色,十六进制RGB值,如 "#ff0000"
navTitleSize:int 设置导航栏标题大小,单位 sp
navTitleDpSize:int 设置导航栏标题大小,单位 dp
isNavTitleBold:boolean 设置导航栏标题是否为粗体
isHideNav:boolean 设置是否隐藏导航栏
应用 Logo
配置项 说明
logoIconName:String 应用 logo 图标,这里配置图标名字
logoWidth:int 设置应用logo宽度,单位dp
logoHeight:int 设置应用 logo 高度,单位 dp
logoTopYOffset:int 设置 logo 顶部 Y 轴偏移,单位 dp
logoBottomYOffset:int 设置 logo 距离屏幕底部偏移,单位 dp
logoXOffset:int 设置 logo 水平方向的偏移,单位 dp
isHideLogo:boolean 设置是否隐藏 logo
手机掩码
配置项 说明
maskNumberColor:String 设置手机掩码颜色,十六进制RGB值,如 "#ff0000"
maskNumberSize:int 设置手机掩码字体大小,单位 px
maskNumberXOffset:int 设置手机掩码水平方向的偏移,单位 dp
maskNumberDpSize:int 设置手机掩码字体大小,单位 dp
maskNumberTopYOffset:int 设置手机掩码顶部Y轴偏移,单位 dp
maskNumberBottomYOffset:int 设置手机掩码距离屏幕底部偏移,单位 dp
认证品牌
配置项 说明
sloganSize:int 设置认证品牌字体大小,单位 px
sloganDpSize:int 设置认证品牌字体大小,单位 dp
sloganColor:String 设置认证品牌颜色,十六进制RGB值,如 "#ff0000"
sloganTopYOffset:int 设置认证品牌顶部 Y 轴偏移,单位 dp
sloganBottomYOffset:int 设置认证品牌距离屏幕底部偏移,单位 dp
sloganXOffset:int 设置认证品牌水平方向的偏移,单位 dp
登录按钮
配置项 说明
loginBtnText:String 设置登录按钮文本
loginBtnTextSize:int 设置登录按钮文本字体大小,单位 px
loginBtnTextDpSize:int 设置登录按钮文本字体大小,单位 dp
loginBtnTextColor:String 设置登录按钮文本颜色,十六进制RGB值,如 "#ff0000"
loginBtnWidth:int 设置登录按钮宽度,单位 dp
loginBtnHeight:int 设置登录按钮高度,单位 dp
loginBtnMarginLeft:int 设置登录按钮左边距,单位 dp
loginBtnMarginRight:int 设置登录按钮右边距,单位 dp
loginBtnBackgroundRes:String 设置登录按钮背景图标,这里配置图标名字
loginBtnTopYOffset:int 设置登录按钮顶部Y轴偏移,单位 dp
loginBtnBottomYOffset:int 设置登录按钮距离屏幕底部偏移,单位 dp
loginBtnXOffset:int 设置登录按钮水平方向的偏移,单位 dp
隐私协议
配置项 说明
privacyTextColor:String 设置隐私栏文本颜色,不包括协议 ,如若隐私栏协议文案为:登录即同意《中国移动认证条款》且授权 QuickLogin 登录, 则该API对除协议‘《中国移动认证条款》’区域外的其余文本生效
privacyDialogTextColor:String 设置协议未勾选弹窗隐私栏文本颜色,不包括协议
privacyProtocolColor:String 设置隐私栏协议颜色 。例如:登录即同意《中国移动认证条款》且授权 QuickLogin 登录 , 则该 API 仅对‘《中国移动认证条款》’文案生效
privacyDialogProtocolColor:String 设置协议未勾选弹窗隐私栏协议颜色
privacySize:int 设置隐私栏区域字体大小,单位 px
privacyDpSize:int 设置隐私栏区域字体大小,单位 dp
privacyTopYOffset:int 设置隐私栏顶部Y轴偏移,单位 dp
privacyBottomYOffset:int 设置隐私栏距离屏幕底部偏移,单位 dp
privacyWidth:int 设置隐私栏区域宽度,单位 dp
privacyTextMarginLeft:int 设置隐私栏复选框和文字内边距,单位 dp
privacyMarginLeft:int 设置隐私栏水平方向的偏移,单位 dp
privacyMarginRight:int 设置隐私栏右侧边距,单位 dp
privacyState:boolean 设置隐私栏协议复选框勾选状态,true 勾选,false 不勾选
isHidePrivacyCheckBox:boolean 设置是否隐藏隐私栏勾选框
isPrivacyTextGravityCenter:boolean 设置隐私栏文案换行后是否居中对齐,如果为true则居中对齐,否则左对齐
checkBoxGravity:int 设置隐私栏勾选框与文本协议对齐方式,可选择顶部(48),居中(17),底部(80)等
checkBoxWith:int 设置隐私栏复选框宽度,单位 dp
checkBoxHeight:int 设置隐私栏复选框高度,单位 dp
checkedImageName:String 设置隐私栏复选框选中时的图片资源,这里配置图标名字
unCheckedImageName:String 设置隐私栏复选框未选中时的图片资源,这里配置图标名字
privacyTextStart:String 设置隐私栏声明部分起始文案 。如:隐私栏声明为"登录即同意《隐私政策》和《中国移动认证条款》且授权易盾授予本机号码",则可传入"登录即同意"
privacyTextStartSize:int 隐私栏起始文案字体大小
privacyLineSpacingAdd:int 隐私栏文本间距
privacyLineSpacingMul:int 隐私栏文本间距倍数
protocolConnect:String 设置隐私栏运营商协议和自定义协议的连接符
userProtocolConnect:String 设置隐私栏自定义协议之间的连接符
operatorPrivacyAtLast:boolean 运营商协议是否在末尾
isHidePrivacySmh:boolean 是否隐藏运营商协议书名号
protocolText:String 设置隐私栏协议文本
protocolLink:String 设置隐私栏协议链接
protocol2Text:String 设置隐私栏协议 2 文本
protocol2Link:String 设置隐私栏协议 2 链接
protocol3Text:String 设置隐私栏协议 3 文本
protocol3Link:String 设置隐私栏协议 3 链接
privacyTextEnd:String 设置隐私栏声明部分尾部文案。如:隐私栏声明为"登录即同意《隐私政策》和《中国移动认证条款》且授权易盾授予本机号码",则可传入"且授权易盾授予本机号码"
协议详情 Web 页面导航栏
配置项 说明
protocolNavTitle:String 设置协议 Web 页面导航栏标题,如果需要根据不同运营商设置不同标题
protocolNavTitleColor:String 设置协议 Web 页面导航栏标题颜色
protocolNavBackIcon:String 设置协议 Web 页面导航栏返回图标,这里配置图标名字
protocolNavColor:String 设置协议Web页面导航栏颜色
protocolNavBackIconMargin:int 设置协议Web页面导航栏返回按钮距离左边距离
protocolNavHeight:int 设置协议 Web 页面导航栏高度
protocolNavTitleSize:int 设置协议Web页面导航栏标题大小,单位 px
protocolNavTitleDpSize:int 设置协议 Web 页面导航栏标题大小,单位 dp
protocolNavBackIconWidth:int 设置协议 Web 页面导航栏返回按钮宽度,单位 dp
protocolNavBackIconHeight:int 设置协议 Web 页面导航栏返回按钮高度,单位 dp
其他
配置项 说明
backgroundImage:String 设置登录页面背景,这里配置图片名字
backgroundGif:String 设置登录页面背景为 Gif,这里配置图片名字
backgroundVideo:String 设置登录页面背景为视频地址,如http://xxx
backgroundVideoImage:String 设置登录页面背景为视频封面地址,如http://xxx
enterAnimation:String 页面进入动画,默认支持了yd_dialog_fade_in,配合dialog模式淡入
exitAnimation:String 页面退出动画,默认支持了yd_dialog_fade_out,配合dialog模式淡出
isShowLoading:boolean 设置授权登录页是否显示loading View
isBackPressedAvailable:boolean 授权登录页物理返回键是否可用
isVirtualButtonHidden:boolean 是否隐藏虚拟键
isLandscape:boolean 是否横屏
isDialogMode:boolean 是否弹窗模式
dialogWidth:int 授权页弹窗宽度,单位 dp
dialogHeight:int 授权页弹窗高度,单位 dp
dialogX:int 授权页弹窗 X 轴偏移量,以屏幕中心为原点
dialogY:int 授权页弹窗 Y 轴偏移量,以屏幕中心为原点
isBottomDialog:boolean 授权页弹窗是否贴于屏幕底部
true:显示在屏幕底部,dialogY 失效
false:不显示在屏幕底部,以 dialogY 参数为准
isProtocolDialogMode:boolean 协议详情页是否开启弹窗模式
isPrivacyDialogAuto:boolean 协议未勾选弹窗点击是否自动登录
isShowPrivacyDialog:boolean 是否显示协议未勾选默认弹窗
privacyDialogText:String 协议未勾选弹窗自定义message
privacyDialogSize:int 协议未勾选弹窗文本字体大小
自定义view
配置项 说明
widgets:JsonArray 自定义view数组
∟ viewId:String 控件 id
∟ type:String 控件类型,可选值为 TextView、Button、ImageView
∟ top:int 控件距离顶部的偏移,单位 dp
∟ left:int 控件距离左侧的偏移,单位 dp
∟ right:int 控件距离右侧的偏移,单位 dp
∟ bottom:int 控件距离底部的偏移,和top互斥,单位 dp
∟ width:int 控件宽度,单位 dp,默认自适应内容
∟ height:int 控件高度,单位 dp,默认自适应内容
∟ text:String 控件文本
∟ font:int 控件文本大小,单位 sp
∟ textColor:String 控件文本颜色,十六进制颜色码
∟ clickable:boolean 控件是否可点击
∟ backgroundColor:String 控件背景颜色,十六进制颜色码
∟ backgroundImgPath:String 控件背景图片,这里配置图片名字
∟ positionType:int 添加控件的位置类型,1表示位于导航栏部分,0表示位于导航栏下方的body部分,默认为0

options 可配置项说明: 鸿蒙版

开发者不得通过任何技术手段,将授权页面的隐私栏、手机掩码号、供应商品牌内容隐藏、覆盖
网易易盾与运营商会对应用授权页面进行审查,若发现上述违规行为,网易易盾有权将您的一键登录功能下线
所有使用到的图标请放置在打出的鸿蒙工程(unpackage/dist/dev/app-harmony)resources(entry/src/main/resources/base/media)目录下,config配置文件中只配置图标的名字

弹窗模式
配置项 类型 说明
popUpType string 默认值:FULL,支持FULL、CENTER、BOTTOM全屏弹出
竖屏时,支持全屏、中间弹出、底部弹出
横屏时,仅支持全屏和中间弹出,即设置为底部弹出,在横屏后,会以中间弹出
背景和边框样式
配置项 类型 说明
popUpPageWidth string\number 弹窗模式下宽度
中间弹出时,默认值为 '90%'
底部弹出时,默认值为 '100%'
popUpPageHeight string\number 弹窗模式下高度
中间弹出时,默认值为 '50%'
底部弹出时,默认值为 '50%'
horizontalPopUpPageWidth string\number 中间弹出时横屏弹框宽度,默认值为 '50%'
horizontalPopUpPageHeight string\number 中间弹出时横屏弹框高度,默认值为 '90%'
backgroundColor string 背景颜色
默认值为 '#ffffff'
backgroundBorderRadius number 背景圆角半径,全屏弹出时设置无效
默认值为 0
backgroundImage string 背景图片
默认值为空
backgroundImageRepeat string 背景图重复样式
默认值为空,支持NoRepeat、X、Y、XY
backgroundImageSize string 背景图宽高,填充样式
默认值为空 ,支持Auto、Contain、Cover、FILL
backgroundImagePosition string 背景图位置
默认值为空,支持Bottom、BottomEnd、BottomStart、Center、End、Start、Top、TopEnd、TopStart
backgroundVideo string 背景视频
默认值为空
backgroundVideoMutex boolean 背景视频静音
默认值为 true
backgroundVideoLoop boolean 背景视频循环
默认值为 true
backgroundVideoAutoPlay boolean 背景视频自动播放
默认值为 true
backgroundVideoControls boolean 背景视频是否显示视频控制器
默认值为 false
backgroundVideoObjectFit string 背景视频填充方式
默认值为Auto、Contain、Cover、Fill
backgroundHalfModalMaskHideAbility boolean 半屏弹出时,背景蒙板关闭能力
默认值为 false
backgroundMaskColor string 半屏弹出时,背景蒙板颜色
默认值为 "#ffffff"
backgroundMaskOpacity number 半屏弹出时,背景蒙板透明度
默认值为 1
renderOrderConfig string[] 授权控件渲染元素和顺序设置
默认值为全部出现,可根据实际情况进行调整,支持icon、phone、operator、login、otherlogin、blank、privacy
关闭按钮 Logo
配置项 类型 说明
closeImgHide boolean 是否隐藏关闭按钮
默认值为 false
closeImgName string 关闭按钮图片资源
closeImgWidth number 关闭按钮宽
默认值为 25
closeImgHeight number 关闭按钮高
默认值为 25
closeImgMarginTop number 关闭按钮上边距
默认值为 10
closeImgMarginRight number 关闭按钮右边距
默认值为 15
导航栏
  • 全屏弹出时有效
配置项 类型 说明
fullModalTopTimeBarColor string 全屏弹出时,时间栏颜色
默认值为 "#ffffff"
fullModalTopTimeBarHeight number 全屏弹出时,时间栏高度
默认值为 30
fullModalBackImgName string 全屏弹出时,导航栏返回键按钮图片
fullModalBackImgWidth number 全屏弹出时,导航栏返回键按钮宽
默认值为40
fullModalBackImgHeight number 全屏弹出时,导航栏返回键按钮高
默认值为40
fullModalBackImgColor string 全屏弹出时,导航栏返回键按钮填充颜色
默认值为 "#000000"
fullModalTitle string 全屏弹出时,导航栏标题文本
默认值为 "免密登录"
fullModalTitleFontSize number 全屏弹出时,导航栏标题字体大小
默认值为 24
fullModalTitleFontColor string 全屏弹出时,导航栏标题字体颜色
默认值为 "#000000"
fullModalNavTitleFontWeight number 全屏弹出时,导航栏标题字体粗细
默认值为400
fullModalNavTitleFontFamily string 全屏弹出时,导航栏标题字体
默认值为 ""
fullModalNavHeight number 全屏弹出时,导航栏高度
默认值为 50
fullModalNavBackgroundColor string 全屏弹出时,导航栏背景颜色
默认值为 "#ffffff"
fullModalNavHide boolean 全屏弹出时,导航栏是否隐藏
默认值为 false
fullModalBackImgMarginLeft number 全屏弹出时,返回键左边距
默认值为 0
应用 Logo
配置项 类型 说明
iconImgName string Logo图片名
iconImgWidth number 应用Logo图片宽
默认值为60
iconImgHeight number 应用Logo图片高
默认值为60
iconImgHide boolean 是否隐藏应用Logo
默认值为 false
iconImgMarginTop number Logo上边距,仅在全屏弹出和底部弹出时有效
默认值为10
centerModalIconImgMargin number 中间弹窗Logo边距
手机掩码配置
配置项 类型 说明
mobileNumberFontSize number 手机号字体大小
mobileNumberFontColor string 手机号字体颜色
mobileNumberMarginTop number 手机号上边距
mobileNumberFontWeight number 手机号字体粗细
默认400
mobileNumberFontFamily string 手机号字体
默认值为 ""
mobileNumberBackgroundImage string 手机号背景图片
mobileNumberBackgroundImageSize string 手机号背景图填充样式
默认值为空 ,支持Auto、Contain、Cover、FILL
认证品牌配置
配置项 类型 说明
operatorBrandFontSize number 认证品牌字体大小
operatorBrandFontColor string 认证品牌字体颜色
operatorBrandMarginTop number 认证品牌上边距
operatorBrandFontWeight number 认证品牌字体粗细
默认400
operatorBrandFontFamily string 认证品牌字体
默认值为 ""
登录按钮配置
配置项 类型 说明
loginBtnContent string 登陆按钮文本内容
loginBtnBackgroundColor string 登陆按钮背景色
loginBtnWidth number|string 登陆按钮宽度
loginBtnHeight number|string 登陆按钮高度
loginBtnBorderRadius number 登陆按钮圆角半径
loginBtnType string 登陆按钮类型
支持Normal、Capsule、Circle、ROUNDED_RECTANGLE
loginBtnFontSize number 登陆按钮字体大小
loginBtnFontColor string 登陆按钮字体颜色
loginBtnFontWeight number 登陆按钮字体粗细
默认400
loginBtnFontFamily string 登陆按钮字体
默认值为 ""
loginBtnMarginTop number 登陆按钮上边距
loginBtnBackgroundImage string 登陆按钮背景图片
loginBtnBackgroundImageRepeat string 登陆按钮背景图重复样式
默认值为空,支持NoRepeat、X、Y、XY
loginBtnBackgroundImageSize string 登陆按钮背景图填充样式
默认值为空 ,支持Auto、Contain、Cover、FILL
其他登录按钮配置
配置项 类型 说明
otherLoginBtnHide boolean 是否隐藏其他登录按钮
otherLoginBtnContent string 其他登录按钮文本
otherLoginBtnBackgroundColor string 其他登录按钮背景色
otherLoginBtnWidth number|string 其他登录按钮宽度
otherLoginBtnHeight number|string 其他登录按钮高度
otherLoginBtnBorderRadius number 其他登录按钮圆角半径
otherLoginBtnType string 其他登录按钮类型
支持Normal、Capsule、Circle、ROUNDED_RECTANGLE
otherLoginBtnFontSize number 其他登录按钮字体大小
otherLoginBtnFontColor string 其他登录按钮字体颜色
otherLoginBtnFontWeight number 其他登录按钮字体粗细
默认400
otherLoginBtnFontFamily string 其他登录按钮字体
默认值为 ""
otherLoginBtnMarginTop number 其他登录按钮上边距
otherLoginBtnBackgroundImage string 其他登录按钮背景图片
otherLoginBtnBackgroundImageRepeat string 其他登录按钮背景图重复样式<
默认值为空,支持NoRepeat、X、Y、XY
otherLoginBtnBackgroundImageSize string 其他登录按钮背景图填充样式
默认值为空 ,支持Auto、Contain、Cover、FILL
隐私政策配置
配置项 类型 说明
checkBoxUnselectedColor string 复选框未选中颜色
checkBoxSelectedColor string 复选框选中颜色
checkBoxShape string 复选框形状
支持CIRCLE、ROUNDED_SQUARE
checkBoxWidth number 复选框宽度
checkBoxHeight number 复选框高度
checkBoxMarginTop number 复选框上边距
checkBoxState boolean 复选框默认选中状态
checkBoxVisible boolean 复选框是否可见
privacySmhShow boolean 是否隐藏运营商协议书名号
privacyTextStart string 隐私政策开始文字
privacyTextNormalFontSize number 隐私政策默认文本字体大小
privacyTextNormalFontColor string 隐私政策默认文本字体颜色
privacyTextNormalFontWeight number 隐私政策默认文本字体粗细
默认400
privacyTextNormalFontFamily string 隐私政策默认文本字体
privacyTextUrlLinkFontSize number 隐私政策默认超链接文本字体大小
privacyTextUrlLinkFontColor string 隐私政策默认超链接文本字体颜色
privacyTextUrlLinkFontWeight number 隐私政策默认超链接文本字体粗细
默认400
privacyTextUrlLinkFontFamily string 隐私政策默认超链接文本字体
privacyTextMarginLeft number 隐私文本左边距
privacyTextMarginRight number 隐私文本右边距
privacyRowWidth number|string 隐私政策宽度
privacyVerticalAlign string 隐私政策垂直对齐
支持Top、Center、Bottom
privacyRowMarginBottom number 隐私政策文本和复选框整体下边距
隐私协议文本配置
属性 类型 说明
protocolText string 用户协议文本
protocolLink string 用户协议链接
protocol2Text string 第二个协议文本
protocol2Link string 第二个协议链接
protocol3Text string 第三个协议文本
protocol3Link string 第三个协议链接
protocolConnect string 运营商协议和用户协议连接符
userProtocolConnect string 用户协议连接符
operatorPrivacyAtLast boolean 运营商隐私政策是否放最后
privacyTextEnd string 隐私政策结束文字
隐私政策弹窗配置
属性 类型 说明
privacyDialogTextMargin number 隐私政策弹窗文本上边距
privacyDialogCancelBtnContent string 隐私政策弹窗取消按钮文字
privacyDialogCancelBtnFontSize number 隐私政策弹窗取消按钮字体大小
privacyDialogCancelBtnFontColor string 隐私政策弹窗取消按钮字体颜色
privacyDialogCancelBtnFontWeight number 隐私政策弹窗取消按钮字体粗细
privacyDialogCancelBtnFontFamily string 隐私政策弹窗取消按钮字体
privacyDialogConfirmBtnContent string 隐私政策弹窗确认按钮文字
privacyDialogConfirmBtnFontSize number 隐私政策弹窗确认按钮字体大小
privacyDialogConfirmBtnFontColor string 隐私政策弹窗确认按钮字体颜色
privacyDialogConfirmBtnFontWeight number 隐私政策弹窗确认按钮字体粗细
privacyDialogConfirmBtnFontFamily string 隐私政策弹窗确认按钮字体
privacyDialogBackgroundColor string 隐私政策弹窗背景色
privacyDialogBorderRadius number 隐私政策弹窗圆角半径
privacyDialogWidth number|string 隐私政策弹窗宽度
horizontalPrivacyDialogWidth number|string 隐私政策横屏弹窗宽度
privacyDialogTextNormalContent string 隐私政策弹窗默认文本内容
默认值为 "请您仔细阅读"
privacyDialogTextNormalFontSize number 隐私政策弹窗默认文本字体大小
privacyDialogTextNormalFontColor string 隐私政策弹窗默认文本字体颜色
privacyDialogTextNormalFontWeight number 隐私政策弹窗默认文本字体粗细
privacyDialogTextNormalFontFamily string 隐私政策弹窗默认文本字体族
privacyDialogTextUrlLinkFontSize number 隐私政策弹窗超链接文本字体大小
privacyDialogTextUrlLinkFontColor string 隐私政策弹窗超链接文本字体颜色
privacyDialogTextUrlLinkFontWeight number 隐私政策弹窗超链接文本字体粗细
privacyDialogTextUrlLinkFontFamily string 隐私政策弹窗超链接文本字体族
Web页面导航栏配置
属性 类型 说明
webPageBackImgName string 导航栏返回按钮图片名
webPageBackImgWidth number 导航栏返回按钮宽度
webPageBackImgHeight number 导航栏返回按钮高度
webPageBackImgColor string 导航栏返回按钮颜色
webPageTitleFontSize number 导航栏标题字体大小
webPageTitleFontColor string 导航栏标题字体颜色
webPageNavTitleFontWeight number 导航栏标题字体粗细
webPageNavTitleFontFamily string 导航栏标题字体
webPageTopTimeBarColor string 时间栏颜色
webPageTopTimeBarHeight number 时间栏高度
webPageNavBackgroundColor string 导航栏背景色
webPageNavHeight number 导航栏高度
webPageBackImgMarginLeft number 返回按钮左边距
其他配置
属性 类型 说明
isBackPressAvailable boolean 物理返回键是否可用
isShowPrivacyDialog boolean 是否显示隐私政策弹窗
使用示例
// 鸿蒙UTS插件配置示例
const harmonyConfig = {
  // 弹窗模式
  popUpType: "FULL",

  // 背景样式
  backgroundColor: "#ffffff",
  backgroundBorderRadius: 10,

  // 关闭按钮
  closeImgHide: false,
  closeImgName: "ico_close",
  closeImgWidth: 25,
  closeImgHeight: 25,

  // 应用Logo
  iconImgName: "ico_logo", 
  iconImgWidth: 64,
  iconImgHeight: 64,

  // 手机掩码
  mobileNumberFontSize: 24,
  mobileNumberFontColor: "#000000",
  mobileNumberFontWeight: 700,

  // 登录按钮
  loginBtnContent: "本机号码一键登录",
  loginBtnWidth: 260,
  loginBtnHeight: 48,
  loginBtnBackgroundColor: "#007AFF",
  loginBtnFontColor: "#ffffff",

  // 隐私政策
  checkBoxShape: "CIRCLE",
  checkBoxSelectedColor: "#ff0000",
  checkBoxUnselectedColor: "#00ff00",
  privacyTextStart: "登录并同意",
  protocolText: "《用户协议》",
  protocolLink: "https://www.example.com/protocol", 
  // 渲染顺序
  renderOrderConfig: ["icon", "phone", "operator", "login", "otherlogin", "blank", "privacy"]
};

options 可配置项说明: iOS版

设计规范概览 开发者不得通过任何技术手段,将授权页面的隐私栏、手机掩码号、供应商品牌内容隐藏、覆盖
网易易盾与运营商会对应用授权页面进行审查,若发现上述违规行为,网易易盾有权将您的一键登录功能下线 iOS设计规范 自定义展示图

基础配置
属性 说明
backgroundColor 设置授权页面背景颜色
authWindowPop 设置窗口类型
0 表示全屏模式
1 表示窗口在屏幕的中间
2 表示窗口在屏幕的底部(不支持横屏)
faceOrientation 设置授权页面方向
0 表示竖屏
1 表示左横屏
2 表示右横屏
3 表示左右横屏
4 表示屏幕全旋转
bgImage 设置授权转背景图片,例如 :"图片名.后缀"
hidesBottomBarWhenPushed 进入下一个页面前,将该属性设置为YES即可隐藏TabBar,默认不隐藏
statusBarStyle 授权页状态栏的颜色 0:黑色,1:白色
转场动画
属性 说明
modalTransitionStyle 设置授权转场动画
0 表示下推
1 表示翻转
2 表示淡出
自定义控件
"widgets": [
        {
           "type": "UIButton", 
           "UIButtonType": 0, 
           "image": "static/weixin.png",
           "title": "",    
           "titleColor": "#000000",
           "titleFont": 12,
           "cornerRadius": 20,
           "action": "handleCustomEvent1",
           "frame": {"mainScreenLeftDistance":100,"mainScreenTopDistance":360,"width":32,"height":32},
           "backgroundImage":"static/yidun_logo.png"
        },
        {
            "type": "UIButton",
            "UIButtonType": 0, 
            "image": "static/qq.png",
            "title": "",    
            "titleColor": "#FFFFFF",
            "titleFont": 12,
            "cornerRadius": 20,
            "action": "handleCustomEvent2",
            "frame": {"mainScreenCenterXWithLeftDistance":0,"mainScreenTopDistance":360,"width":32,"height":32},
            "backgroundImage": "static/yidun_logo.png"
        },
        {
            "type": "UIButton",
            "UIButtonType": 0, 
            "image": "static/weibo.png",
            "title": "",
            "titleColor": "#FFFFFF",
            "titleFont": 12,
            "cornerRadius": 20,
            "action": "handleCustomEvent3",
            "frame": {"mainScreenLeftDistance":100,"mainScreenRightDistance":360,"mainScreenTopDistance":32,"height":32},
            "backgroundImage": "static/yidun_logo.png"
        },
        {
            "type": "UILabel",
            "textColor": "#FFFFFF",
            "font": 15,
            "cornerRadius": 20,
            "action": "handleCustomLabel",
            "text": "其他登录方式",
            "textAlignment": 1,
            "frame": {"mainScreenLeftDistance":0,"mainScreenRightDistance":310,"mainScreenBottomDistance":200,"height":32}
        }
    ]
配置项 说明
widgets:JsonArray 自定义view数组
∟ type:String 控件类型,可选值为 UILabel、UIButton
∟ image:String UIButton显示的图片。内容为图片名,不需要加图片后缀
∟ title:String UIButton显示的文字
∟ titleColor:String UIButton显示的字体颜色
∟ titleFont:int 字体的大小
∟ cornerRadius:int 控件的圆角
∟ backgroundImage:String UIButton的背景图片
∟ backgroundColor:String 控件背景颜色
∟ mainScreenLeftDistance:int 距离屏幕左边的距离,默认为0
∟ mainScreenRightDistance:int 距离屏幕右边的距离,默认为0
∟ mainScreenTopDistance:int 距离屏幕顶部的距离,默认为0
∟ mainScreenCenterXWithLeftDistance:int 为0时,居中显示。大于0,向屏幕左侧偏移。小于0,向右侧偏移
∟ width:int 控件的宽度,默认为0
∟ height:int 控件的高度,默认为0
∟ textAlignment:int 0,文本左对齐。1,文本居中显示。2文本右对齐
∟ text:String UILabel显示的文字
∟ textColor:String UILabel的字体颜色
∟ action:String 设置可点击控件的点击事件,在监听中回调。详见事件监听
背景设置视频
属性 说明
localVideoFileName 设置视频本地名称 例如xx.mp4*
isRepeatPlay 设置是否重复播放视频,YES 表示重复播放,NO 表示不重复播放
背景设置 Gif
属性 说明
animationRepeatCount 设置动画重复的次数 -1无限重复
animationDuration 设置动画的时长
导航栏
属性 说明
navBarHidden 导航栏是否隐藏
navBgColor 设置导航栏背景颜色
navText 设置导航栏标题
navTextFont 设置导航栏标题字体大小
navTextColor 设置导航栏标题字体颜色
navTextHidden 设置导航栏标题是否隐藏,默认不隐藏
navReturnImg 设置导航返回图标,例如:"back-1"
navReturnImgLeftMargin 设置导航返回图标距离屏幕左边的距离,默认0
navReturnImgBottomMargin 设置导航返回图标距离屏幕底部的距离,默认0
navReturnImgWidth 设置导航返回图标的宽度,默认44
navReturnImgHeight 设置导航返回图标的高度 , 默认44
应用 Logo
属性 说明
logoIconName 设置logo图片, 例如 :"图片名.后缀"]
logoWidth 设置logo图片宽度
logoHeight 设置logo图片高度
logoOffsetTopY 设置logo图片沿Y轴偏移量, logoOffsetTopY为距离屏幕顶部的距离 ,默认为20
logoOffsetX 设置logo图片沿X轴偏移量,logoOffsetX = 0居中显示
logoHidden 设置logo图片是否隐藏,默认不隐藏
手机掩码
属性 说明
numberColor 设置手机号码字体颜色
numberFont 设置手机号码字体大小, 默认18
numberOffsetTopY 设置手机号码沿Y轴偏移量, numberOffsetTopY为距离屏幕顶部的距离 ,默认为100
numberOffsetX 设置logo图片沿X轴偏移量,logoOffsetX = 0居中显示
numberHeight 设置手机号码框的高度 默认27
numberCornerRadius 设置手机号码的控件的圆角
numberLeftContent 设置手机号码的左边描述内容,默认为空
numberRightContent 设置手机号码的右边描述内容,默认为空色
认证品牌
属性 说明
brandColor 设置认证服务品牌文字颜色
brandBackgroundColor 设置认证服务品牌背景颜色
brandFont 设置认证服务品牌文字字体 默认12
brandWidth 设置认证服务品牌的宽度, 默认200
brandHeight 设置认证服务品牌的高度, 默认16
brandLogoWidth 设置认证服务品牌的宽度
brandLogoHeight 设置认证服务品牌的高度
brandLogoOffsetMargin 认证服务品牌x轴的偏移量
brandOffsetX 设置认证服务品牌X偏移量 ,brandOffsetX = 0居中显示
brandOffsetTopY 设置认证服务品牌Y偏移量, brandOffsetTopY为距离屏幕顶部的距离 ,默认为150
brandHidden 设置是否隐藏认证服务品牌,默认显示
登录按钮
属性 说明
logBtnText 设置登录按钮文本
loginBtnTextSize 设置登录按钮字号
logBtnTextColor 设置登录按钮文本颜色
logBtnOffsetTopY 设置登录按钮Y偏移量 ,logBtnOffsetTopY为距离屏幕顶部的距离 ,默认为200
logBtnRadius 设置登录按钮圆角,默认8
logBtnUsableBGColor 设置登录按钮背景颜色
logBtnEnableImg 设置登录按钮可用状态下的背景图片
logBtnHighlightedImg 登录按钮高亮状态下的背景图片
logBtnOriginLeft 登录按钮的左边距 ,横屏默认40 ,竖屏默认260
logBtnOriginRight 设置登录按钮的左边距,横屏默认40 ,竖屏默认260
logBtnHeight 设置登录按钮的高度,默认44
隐私协议

若勾选框需要展示,请务必设置勾选框的选中态图片与未选中态图片 协议未勾选时,登录按钮是否可点击可以自定义设置,弹窗提示的样式也可以自定义

属性 说明
unCheckedImageName 图片名
checkedImageName 图片名
checkboxWH 设置复选框大小(只能正方形) ,默认 12
privacyState 设置隐私条款check框默认状态
checkBoxAlignment 设置隐私条款check框位置
0 表示相对协议顶对齐
1 表示相对协议中对齐
2 表示相对协议下对齐 默认顶对齐
checkedHidden 隐藏复选框
checkBoxMargin 设置复选框距离隐私条款的边距 默认 8
appPrivacyOriginLeft 设置隐私条款距离屏幕左边的距离 默认 60
appPrivacyOriginRight 设置隐私条款距离屏幕右边的距离 默认 40
appPrivacyOriginBottomMargin 设置隐私条款距离屏幕的距离 默认 40
privacyNavReturnImg 设置用户协议界面,导航栏返回图标,默认用导航栏返回图标
appPrivacyText 设置隐私的内容模板:全句可自定义但必须保留"《默认》"字段表明SDK默认协议,否则设置不生效。必设置项(参考SDK的demo)appPrivacyText设置内容:登录并同意《默认》和易盾协议1、网易协议2登录并支持一键登录,展示:登录并同意中国移动条款协议和易盾协议1、网易协议2登录并支持一键登录
appFPrivacyText 设置开发者隐私条款协议名称(第一个协议)
appFPrivacyURL 设置开发者隐私条款协议url(第一个协议)
appSPrivacyText 设置开发者隐私条款协议名称(第二个协议)
appSPrivacyURL 设置开发者隐私条款协议url(第二个协议)
appTPrivacyText 设置开发者隐私条款协议名称(第三个协议)
appTPrivacyURL 设置开发者隐私条款协议url(第三个协议)
appFourPrivacyText 设置开发者隐私条款协议名称(第四个协议)
appFourPrivacyURL 设置开发者隐私条款协议url(第四个协议)
appPrivacyAlignment 0 : 隐私条款居左显示, 1: 居中显示, 2 :居右显示
appPrivacyOriginLeftMargin 隐私条款距离屏幕左边的距离
shouldHiddenPrivacyMarks 设置是否隐藏"《默认》" 两边的《》,默认不隐藏
privacyColor 设置隐私条款名称颜色
privacyFont 设置隐私条款字体的大小
protocolColor 设置协议条款协议名称颜色
showPrivacyDialog 0 显示自定义提示框;1 显示系统提示框 ;2 隐藏提示框
弹窗模式
属性 说明
popBackgroundColor 弹窗模式的背景颜色
scaleW 自定义窗口宽度
scaleH 自定义窗口高度
closePopImg 设置弹窗模式下关闭按钮的图片,⚠️(必传)
closePopImgWidth 设置弹窗模式下关闭按钮图片的宽度 默认20*
closePopImgHeight 设置弹窗模式下关闭按钮图片的高度 默认20
closePopImgOriginY 设置关闭按钮距离顶部的距离,默认距离顶部10,距离 = 10 + closePopImgOriginY
closePopImgOriginX 设置关闭按钮距离父视图右边的距离,默认距离为10,距离 = 10 + closePopImgOriginX
authWindowCenterOriginY 设置居中弹窗沿Y轴移动的距离。例如 :authWindowCenterOriginY = 10 表示中间点沿Y轴向下偏移10个像素
authWindowCenterOriginX 设置居中弹窗沿X轴移动的距离。例如 :authWindowCenterOriginX = 10 表示中间点沿X轴向右偏移10个像素
popCenterCornerRadius 设置居中弹窗模式下,弹窗的圆角,默认圆角为16
popBottomCornerRadius 设置底部弹窗模式下,弹窗的圆角,默认圆角为16,注:只可修改顶部左右二边的值
isOpenSwipeGesture 设置底部弹窗模式下,是否开启轻扫手势,向下轻扫关闭弹窗。默认关闭
openBackTapGestureRecognizer 始弹窗模式下,后面的点击手势,默认关闭
  • 回调函数说明(onLifeCycle 仅 Android 和 iOS 有效):
    onAction: (action, checked) => {
        // 授权页内部view和自定义view点击事件回调
        // action当前点击view的名称 cheched 当前复选框的状态(仅在复选框事件和登录按钮点击事件中有效)
    },
    onLifeCycle: (lifeCycle) => {
        // 页面生命周期
    }

    action 取值说明:
    Android

  • privacy -- 隐私协议点击事件
  • checkbox -- 复选框点击事件(含checked: 0/1)
  • loginButton -- 登录按钮点击事件(含checked: 0/1)
  • leftBackButton -- 左上角返回按钮点击事件

iOS

  • loginAction -- 登录按钮点击事件(含checked: 0/1)
  • checkedAction -- 复选框事件(含checked: 0/1)
  • appDPrivacy -- 默认协议点击事件
  • appFPrivacy -- 第一个协议点击事件
  • appSPrivacy -- 第二个协议点击事件

harmony

  • privacy -- 隐私协议点击事件
  • checkbox -- 复选框点击事件(含checked: 0/1)
  • loginButton -- 登录按钮点击事件(含checked: 0/1)
  • backButtom -- 返回按钮点击事件
  • otherLogin -- 其他登录按钮点击事件

lifecycle 取值说明:
Android

  • onCreate -- 页面创建
  • onStart -- 页面已开始活动
  • onResume -- 页面展示
  • onPause -- 页面非活动状态
  • onStop -- 页面已停止
  • onDestroy -- 页面销毁

iOS

  • authViewDidLoad -- 加载授权页
  • authViewWillAppear -- 授权页已经出现
  • authViewWillDisappear -- 授权页将要消失
  • authViewDidDisappear -- 授权页已经消失
  • authViewDealloc -- 授权页销毁

5. 调起授权页面

代码说明:

authorizeLoginCompletion({
    onSuccess: (token, accessToken) => {
        // 授权成功
    },
    onError: (token, code, msg) => {
        // 授权失败
    },
    onCancel: () => {
        // 用户取消取号
    }
})

参数说明:

  • 回调参数说明:

    回调参数 类型 描述
    token String 易盾授权码
    accessToken String 运营商授权码,用于置换真实手机号
    code Number 异常码
    msg String 异常信息

6. 设置协议复选框

代码说明:

checkedSelected(isChecked)

参数说明:

  • 入参说明:

    参数 类型 是否必填 默认值 描述
    isChecked boolean true:复选框勾选,false:复选框取消勾选

7. 清除缓存

代码说明:

clearScripCache()

8. 关闭授权页

插件内部不会主动关闭授权页,请在 authorizeLoginCompletion 回调中主动调用该函数关闭

代码说明:

closeAuthController()

9. 本机校验

用户输入手机号码后,自动校验与当前本机卡号的一致性,无需发送短信验证码

代码说明:

  numberVerify(mobileNumber,  {
    onSuccess: (token, accessToekn) => {
        // 本机校验成功
    },
    onError: (token, code, msg) => {
        // 本机校验失败
    }
})

参数说明:

  • 入参说明:

    参数 类型 是否必填 默认值 描述
    mobileNumber String 手机号
    callback NumberVerifyCallback 回调
  • 回调参数说明:

    回调参数 类型 描述
    token String 易盾校验码
    accessCode String 运营商授权码
    code Number 异常码
    msg String 异常信息

隐私、权限声明

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

网络权限,wifi状态

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

插件不采集任何数据

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

许可协议

MIT协议