uni.login({
provider: 'univerify',
univerifyStyle: { // 自定义登录框样式
//参考univerifyStyle 数据结构
"fullScreen": "true",
"backgroundColor": "#FFFFFF",
// "backgroundColor": "#EB4F2A",
// "backgroundImage": "/static/images/login/denglubg.png",
"backgroundImage": "",
"phoneNum": {
"color": "#333333", // 手机号文字颜色 默认值:#202020
"fontSize": "46px",
},
"authButton": {
"normalColor": "#EB4F2A", // 授权按钮正常状态背景颜色 默认值:#3479f5
"highlightColor": "#EB4F2A", // 授权按钮按下状态背景颜色 默认值:#2861c5(仅ios支持)
"disabledColor": "#EB4F2A", // 授权按钮不可点击时背景颜色 默认值:#73aaf5(仅ios支持)
"textColor": "#ffffff", // 授权按钮文字颜色 默认值:#ffffff
"title": "本机号码一键登录", // 授权按钮文案 默认值:“本机号码一键登录”
"borderRadius": "24px", // 授权按钮圆角 默认值:"24px" (按钮高度的一半)
"fontSize": "34px",
},
"otherLoginButton": {
"visible": "true", // 是否显示其他登录按钮,默认值:true
"normalColor": "", // 其他登录按钮正常状态背景颜色 默认值:透明
"highlightColor": "", // 其他登录按钮按下状态背景颜色 默认值:透明
"textColor": "#888888", // 其他登录按钮文字颜色 默认值:#656565
"title": "其他方式登录", // 其他登录方式按钮文字 默认值:“其他登录方式”
"borderColor": "", //边框颜色 默认值:透明(仅iOS支持)
"borderRadius": "0px", // 其他登录按钮圆角 默认值:"24px" (按钮高度的一半)
"fontSize": "34px",
},
"privacyTerms": {
"defaultCheckBoxState": "false", // 条款勾选框初始状态 默认值: true
"uncheckedImage": "/static/images/login/xieyiweixuanzhong.png", // 可选 条款勾选框未选中状态图片(仅支持本地图片 建议尺寸 24x24px)(3.2.0+ 版本支持)
"checkedImage": "/static/images/login/xieyixuanzhong.png", //
"textColor": "#999999", // 文字颜色 默认值:#BBBBBB
"termsColor": "#cd0e0e", // 协议文字颜色 默认值: #5496E3
"prefix": "我已阅读并同意", // 条款前的文案 默认值:“我已阅读并同意”
"suffix": "并使用本机号码登录", // 条款后的文案 默认值:“并使用本机号码登录”
"privacyItems": [ // 自定义协议条款,最大支持2个,需要同时设置url和title. 否则不生效
{
"url": ${getApp().globalData.BaseUrl}html/userAgreement
, // 点击跳转的协议详情页面
"title": "用户服务协议" // 协议名称
},
{
"url": ${getApp().globalData.BaseUrl}html/privacyAgreement
, // 点击跳转的协议详情页面
"title": "隐私条款" // 协议名称
}
],
},
},
success(res) { // 登录成功
console.log(res.authResult); // {openid:'登录授权唯一标识',access_token:'接口返回的 token'}
},
fail(res) { // 登录失败
console.log(res);
}
})