i***@guotouxinda.com
i***@guotouxinda.com
  • 发布:2021-05-10 20:40
  • 更新:2021-05-11 10:35
  • 阅读:1015

一键登录 获取userInfo后 axios请求后台 不执行then 也不执行 catch

分类:HTML5+
        univerifyLogin: function() {  
            this.$loading.show();  
            if (!plus || !plus.oauth) {  
                this.$loading.hide();  
                this.univerifyLoginStatus = true;  
                return false  
            }  
            this.getPlusOAuthServices(() => {  
                if (this.univerify == null) {  
                    this.univerifyLoginStatus = true;  
                    //this.$toast('授权失败! ');  
                }  
                this.$loading.hide()  
                this.univerify.login(  
                    (oauth) => {  
                        var userInfo = oauth.target  
                        this.$http  
                            .post(Api.auth.one_login, {  
                                access_token: userInfo.authResult.access_token,  
                                openid: userInfo.authResult.openid,  
                            })  
                            .then((res) => {  
                                if (res.data.code === 0) {  
                                    this.$store.commit('login', res.data.data)  
                                    if (window.localStorage.getItem('returnUrl')) {  
                                        this.$router.replace(  
                                            window.localStorage.getItem('returnUrl')  
                                        )  
                                        return  
                                    }  
                                    this.$router.replace({  
                                        name: 'Home'  
                                    })  
                                } else {  
                                    this.$alert(res.data.msg)  
                                }  

                            })  
                            .catch((error) => {  
                                this.$loading.hide()  
                                this.univerifyLoginStatus = true;  
                                this.$toast('登录失败!' + error.message)  
                            }).then(() => {  
                                this.univerify.closeAuthView();  
                                this.$loading.hide()  
                            })  
                    },  
                    err => {  
                        // 授权失败 error  
                        this.univerifyLoginStatus = true;  
                        this.univerify.closeAuthView();  
                        this.$loading.hide()  
                        //this.$toast('一键登录授权失败!')  
                    }, {  
                        univerifyStyle: {  
                            "fullScreen": "true", // 是否全屏显示,默认值: "false"  
                            "backgroundColor": "#ffffff", // 授权页面背景颜色,默认值:#ffffff  
                            "backgroundImage": "", // 全屏显示的背景图片,默认值:"" (仅支持本地图片,只有全屏显示时支持)  
                            "icon": {  
                                "path": 'login.png' // 自定义显示在授权框中的logo,仅支持本地图片 默认显示App logo  
                            },  
                            "phoneNum": {  
                                "color": "#333333" // 手机号文字颜色 默认值:#202020  
                            },  
                            "slogan": {  
                                "color": "#666666" //  slogan 字体颜色 默认值:#BBBBBB  
                            },  
                            "authButton": {  
                                "normalColor": "#FF8254", // 授权按钮正常状态背景颜色 默认值:#3479f5  
                                "highlightColor": "#F24748", // 授权按钮按下状态背景颜色 默认值:#2861c5(仅ios支持)  
                                "disabledColor": "#f5f5f5", // 授权按钮不可点击时背景颜色 默认值:#73aaf5(仅ios支持)  
                                "textColor": "#ffffff", // 授权按钮文字颜色 默认值:#ffffff  
                                "title": "一键登录", // 授权按钮文案 默认值:“本机号码一键登录”  
                                "borderRadius": "24px" // 授权按钮圆角 默认值:"24px" (按钮高度的一半)  
                            },  
                            "otherLoginButton": {  
                                "visible": "true", // 是否显示其他登录按钮,默认值:true  
                                "normalColor": "", // 其他登录按钮正常状态背景颜色 默认值:透明  
                                "highlightColor": "", // 其他登录按钮按下状态背景颜色 默认值:透明  
                                "textColor": "#656565", // 其他登录按钮文字颜色 默认值:#656565  
                                "title": "其他登录方式", // 其他登录方式按钮文字 默认值:“其他登录方式”  
                                "borderColor": "", //边框颜色 默认值:透明(仅iOS支持)  
                                "borderRadius": "0px" // 其他登录按钮圆角 默认值:"0px"  
                            },  
                            "privacyTerms": {  
                                "defaultCheckBoxState": "true", // 条款勾选框初始状态 默认值: true  
                                "textColor": "#333333", // 文字颜色 默认值:#BBBBBB  
                                "termsColor": "#FF8254", //  协议文字颜色 默认值: #5496E3  
                                "prefix": "我已阅读并同意", // 条款前的文案 默认值:“我已阅读并同意”  
                                "suffix": "并使用本机号码登录", // 条款后的文案 默认值:“并使用本机号码登录”  
                                "privacyItems": [  
                                    // 自定义协议条款,最大支持2个,需要同时设置url和title. 否则不生效  
                                    {  
                                        "url": "https://", // 点击跳转的协议详情页面  
                                        "title": "《金牡丹注册及隐私协议》" // 协议名称  
                                    }  
                                ]  
                            }  
                        }  
                    }  
                )  
            })  
        },
2021-05-10 20:40 负责人:无 分享
已邀请:
i***@guotouxinda.com

i***@guotouxinda.com (作者)

只有IOS 才会有

i***@guotouxinda.com

i***@guotouxinda.com (作者)

去掉 univerifyStyle 自定义样式就可以,有人知道是不是我用的方式不对,环境 5+app 打包真机调试 IOS 有这种问题,安卓就没有

该问题目前已经被锁定, 无法添加新回复