1.0.12 • Published 2 years ago

uni-one-login v1.0.12

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Install

项目中提前安装好 阿里云相关sdk manifest.json相关配置 具体案例参考: https://ext.dcloud.net.cn/plugin?spm=a2c4g.11186623.0.0.67039a7crUNMOr&id=4297

$ npm install uni-one-login

API

import { uniOneLogin, setAuthSDKInfo, quitLoginPage, hideLoginLoading } from 'uni-one-login'

// 具体案例详见 https://ext.dcloud.net.cn/plugin?spm=a2c4g.11186623.0.0.67039a7crUNMOr&id=4297 

// 设置秘钥与获取状态code(详见下链接) 
async getResultCode(){
   const secretKey = 'uDC+IlZh7l3ysP6uCqlgpOIJJazBTVXPG746PSNrOA7TQ98GIA0d5/WmbRv1Jg+JwH1mqkqwDDMaMOLcdI5iZsFPPS0tGL3mptZlBH171r9/2KVIIz4/2uuR9qWdCwwtF0nE8KTsnXRIpkngd1E2BekFZwVKqdEy3wn78qT+5CuVA36PsQzdBZmQtEh5KkP3V5anK2gh64h66aFpqmlTfwXU+4o0VbmQBhlLHiQHwdHszVy07RK2R8PdlXhMPCdNJ/4QThg/mAxkAQoL+HAYP0m443eyTMZXbE6rQHGMBh2BNyFpCRrzrw=='

  await setAuthSDKInfo(secretKey)
}

// 获取token  fullscreenStyle-》全屏  alertStyle-》弹屏  sheetStyle-》底部弹  buildFullscreenAndImageBg-》全屏(原生图片背景)   alertAndImageBgStyle-》弹窗(原生图片背景)
// sheetAndGifBgStyle-》 底部弹窗(原生GIF背景)

async goLogin() { 
            const myConfig = {
                presentType: 'alertStyle', // 打开方式
                option: { // 配置参数 文字 样式等 具体配置看上边链接
                    uiConfig: {
                        setAppPrivacyOne: {
                            title: '用户协议',
                            url: 'https://www.taobao.com'
                        },
                        setAppPrivacyTwo: {
                            title: '隐私政策',
                            url: 'https://www.taobao.com'
                        },
                        setBackgroundUi: { // 背景图片
                            backgroundColor: '#081223',
                            imageUrl: 'https://cnnho-static.oss-cn-shanghai.aliyuncs.com/image/lizanPlanet/jxhw/images/default/no_feedback.png'
                        }
                    },
                    // widgets:{  // 授权页自定义元素

                    // }
                }
            }

            const [err, res] = await uniOneLogin(myConfig)
            if (err) { // 错误以及点击其他自定义元素
                const { widgetId } = err
                switch (widgetId) {
                    case 'otherLogin': // 其他登陆方式
                        uni.navigateTo({
                            url: '/pages/index/login/index'
                        })
                        break
                    default:
                        console.log('你猜::', widgetId)
                        break
                }
                console.log('errerrerr', err)
                return
            }
            console.log('resresresresres:::获取的token ', res)
        }


// 关闭一键登录弹框
quitLoginPage()

// 隐藏loading 解决安卓机未主动
hideLoginLoading()
1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.12

2 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago