getPhoneNumber按钮不能唤起授权弹窗
发布于 4 年前 作者 xiuying90 17396 次浏览 来自 问答

APPID:wx41ad20987ed5159c

getPhoneNumber

<button class=‘btn’ open-type=“getPhoneNumber” bindgetphonenumber=“getPhoneNumber”>登录</button>

if (e.detail.errMsg === ‘getPhoneNumber:ok’) {

     wx.request({    

        url: app.globalData.globalUrl + “users/register_bind”,

        data: {

            p: ‘wx’,

            openid: openid,

            encrypt: e.detail.encryptedData,

            iv: e.detail.iv,

        },

        method: ‘POST’,

        header: {

            ‘Accept’: ‘application/json’ // 默认值

        },

        success: function (res) {

            console.log(res.data) 

        }

    })

} else if (e.detail.errMsg === ‘getPhoneNumber:fail user deny’) {

    wx.showModal({

        title: ‘提示’,

        content: ‘您拒绝了授权,将无法正常体验。’,

        showCancel: false,

        confirmText: ‘重新授权’,

        success: function (res) {

            if (res.confirm) {

            console.log(‘用户点击确定’)

            }

        }

    })

} else if (e.detail.errMsg === ‘getPhoneNumber:fail 用户未绑定手机,请先在微信客户端进行绑定后重试’) {

    wx.showModal({

        title: ‘提示’,

        content: ‘您未绑定手机,请先在微信客户端进行绑定后重试。绑定方法:设置》账号与安全》手机号’,

        showCancel: false,

        confirmText: ‘重新授权’,

        success: function (res) {

            if (res.confirm) {

                console.log(‘用户点击确定’)

            }

        }

    })

}else{

    wx.showModal({

        title: ‘提示’,

        content: ‘网络繁忙,请稍后再试’,

        showCancel: false,

        confirmText: ‘我知道了’,

        success: function (res) {

            if (res.confirm) {

                console.log(‘用户点击确定’)

            }

        }

    })

}

部分机型不能唤起弹窗,iPhone6不能唤起弹窗,点击按钮华为也有几款无反应。

通过e.detail.errMsg 判断提示也不能触发提示框,说明e.detail.errMsg没有返回信息。

2 回复

你好,我在华为机上测试正常,麻烦提供如下信息,谢谢:

1、提供出现问题的机型和微信版本号

2、提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

这个列表是在那儿呀  我看文档里没有些最低支持的版本

回到顶部