雪趣snow66
雪趣snow66
  • 发布:2021-10-15 16:33
  • 更新:2021-10-15 16:33
  • 阅读:543

【报Bug】ios系统里测试抖音小程序用户信息授权返回后所有switchTab和navigateTo都失效,不能跳到指定页面或返回。开发工具和安卓都没问题,就iOS真机有问题

分类:uni-app

产品分类: uniapp/小程序/字节跳动

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 3.2.9

第三方开发者工具版本号: 2.25.0.5

基础库版本号: 2.25.0.5

项目创建方式: HBuilderX

示例代码:

<template>
<view class="container">
<view class='header'>
<open-data type="userAvatarUrl" v-if="platform==1"></open-data>
<image src="../../static/logo.png" v-if="platform==6"></image>
</view>
<view class='content'>
<view>为了提供更好的服务,请点击下方授权登录</view>
<text>获得你的公开信息(昵称,头像等)</text>
</view>
<button class='btns bottoms' lang="zh_CN" @click="redindex" v-if="is_login==0" >授权登录</button>
<button class="btns bottoms" open-type="getPhoneNumber" @getphonenumber="onGetPhoneNumber" v-if="is_login==1" >绑定手机</button>
<button class='btns bottoms no-login' type="default" @click="goBack">返回</button>
</view>
</template>

<script>
export default {
data() {
return {
is_login:0 ,//0:先登录后绑定手机,1:直接绑定手机,2:只需要登录
login_type:0,
logo:'../../static/logo.jpg',
platform:6,
}
},
onShow() {
this.platform = this.gldb.platform;
this.login_type = uni.getStorageSync('showBtnType');console.log('.login_type: '+this.login_type);
if(this.login_type==1){
this.is_login = 1;
}
},
methods: {
goBack(){
uni.switchTab({
url:'/pages/index/index'
})
},
redindex(res){
var that = this;
if(that.gldb.platform==1){
uni.getUserProfile({
desc: '登录账号', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
that.gldb.userInfo = res.userInfo;
let tmp = uni.getStorageSync('device_id');

                        uni.clearStorageSync();  
                        uni.setStorageSync('device_id', tmp);  
                        uni.setStorageSync('refreshLogin', 1);  
                        uni.setStorageSync('auto_login',1);  

                        if(that.login_type==2){  
                            that.is_login=2;  
                            uni.removeStorageSync('showBtnType');  

                            /* uni.navigateBack({  
                                delta: 1  
                            }); */  
                            uni.switchTab({  
                                url:'/pages/index/index'  
                            })  
                        }else{  
                            that.is_login=1;  
                        }  
                    }  
                })  
            }else{  
                uni.getSetting({  
                    success: (res) => {  
                        that.login( that.storageData );  
                        if (res.authSetting['scope.userInfo'] == true) {  
                            //同意授权  
                            var isIn = true;                                  
                        }else if(res.authSetting['scope.userInfo'] == false){  
                            //拒绝  
                            console.log('拒绝');  
                            var isIn = false;  
                        }else{  
                            //还有没有授权的操作  
                            var isIn = true;  
                            console.log('还有没有授权的操作');  
                        }  
                        if( isIn == true ){  
                            uni.authorize({  
                                scope: 'scope.userInfo',  
                                success( res ) {  
                                    that.login( that.storageData );                               
                                },  
                                fail(res){  
                                    that.showToast({  
                                        title: '请开启用户信息!',  
                                        duration: 3000  
                                    });  
                                    uni.openSetting({  
                                        success(res) {  
                                            if (res.authSetting['scope.userInfo'] == true) {  
                                                that.login( that.storageData );  
                                            }  
                                        },  
                                        fail(res){  
                                            console.log('fail-openSetting');  
                                        }  
                                    });  

                                }  
                            })                            

                        }else{  
                            uni.openSetting({  
                                success(res) {  
                                    if (res.authSetting['scope.userInfo'] == true) {  
                                        that.login( that.storageData );  
                                    }  
                                }  
                            });  
                        }  
                    }  
                })    

            }  
        },  
        storageData(){  
            var that = this;  
            let tmp = uni.getStorageSync('device_id');  
            uni.clearStorageSync();  

            uni.setStorageSync('device_id', tmp);  
            uni.setStorageSync('refreshLogin', 1);  
            uni.setStorageSync('auto_login','1');  

            if(that.login_type==2){  
                that.is_login=2;  
                uni.removeStorageSync('showBtnType');  
                uni.navigateBack({  
                    delta: 1  
                });  
            }else{  
                that.is_login=1;  
            }  
        },  
        onGetPhoneNumber(e){  
            console.log(e);  
            var that = this;  
            if(e.detail.errMsg=="getPhoneNumber:fail user deny"){       //用户决绝授权    
                //拒绝授权后弹出一些提示    
                that.showToast({  
                    title: '绑定手机后才可以获得下单等更多权限哟!',  
                    duration: 3000  
                });  
            }else{//允许授权  
                uni.setStorageSync('refreshLogin', 1);  
                uni.setStorageSync('ivData', {encryptedData:e.detail.encryptedData,iv:e.detail.iv,type:1});  
                uni.removeStorageSync('showBtnType');console.log( uni.getStorageSync('ivData') );  
                uni.navigateBack({  
                    delta: 1  
                });  
            }   
        }  
    }  
}  

</script>

<style>
.header {
border-bottom: 1px solid #ccc;
text-align: center;
width: 200upx;
height: 200upx;
margin: 100upx auto;
border-radius: 50%;
overflow: hidden;
}

.header image {  
    width: 200upx;  
    height: 200upx;  
}  

.content {  
    margin-left: 50upx;  
    margin-bottom: 90upx;  
    font-size: 24upx;  
}  

.content text {  
    display: block;  
    color: #9d9d9d;  
    margin-top: 40upx;  
}  

.bottoms {  
    text-align: center;  
    border-radius: 80upx;  
    width: 90%;  
    height: 80rpx;  
    line-height: 80rpx;  
    color: #FFFFFF;  
    margin: auto;  
    font-size: 35upx;  
    background: linear-gradient(-90deg, #FF4C11, #FF8225);  
}  

.no-login{  
    margin-top: 40upx;  
}  

open-data{  
    width: 50upx !important;  
    height: 50upx;  
    border-radius: 50%;  
}  

</style>

操作步骤:

授权登录成功后点击返回按钮,返回商品详情页或者首页,未有反应。如果点击系统自带的返回图标会返回商品详情页但是商品详情页的所有按钮一样无反应

预期结果:

返回商品详情页面或主页

实际结果:

未跳转

bug描述:

【报Bug】ios系统里测试抖音小程序用户信息授权返回后所有switchTab和navigateTo都失效,不能跳到指定页面或返回。开发工具和安卓都没问题,就iOS真机有问题。
授权登录成功后点击返回按钮,按理应该返回商品详情页或者首页,但未有反应。如果点击系统左上角的返回图标能返回商品详情页但是商品详情页的所有按钮一样无反应

2021-10-15 16:33 负责人:无 分享
已邀请:

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