收藏
回答

手机号快捷登录问题?

<button class="cu-btn author-btn" open-type="getPhoneNumber" @getphonenumber="phoneLogin">手机号快捷登录</button>

phoneLogin(e) {

            uni.showLoading({

                title: '登录中',

            })

            if (e.mp.detail.errMsg == 'getPhoneNumber:ok') {

                wxappGetUserInfo({

                    encryptedData: e.mp.detail.encryptedData,

                    iv: e.mp.detail.iv,

                    code: this.code,

                    spread: cookie.get('spread'),

                })

                    .then(res => {

                        console.log(res)

                        store.commit('login', res.token, dayjs(res.expires_time))

                        store.dispatch('userInfo', true)

                        uni.setStorageSync('uid', res.user.userId)

                        store.dispatch('setUserInfo', res.user)

                        this.$yrouter.reLaunch({

                            path: cookie.get('redirect').replace(/\ /g, ''),

                        })

                        uni.switchTab({

                            url: '/pages/home/index'

                        })

                        // 关闭 showLoading提示

                        uni.hideLoading()

                       

                        uni.showToast({

                            title: '登录成功',

                            icon: 'none'

                        })

                    })

                    .catch(error => {

                        console.log(error)

                        console.log('登录接口调用失败')

                        this.getLoginCode()

                    })

            } else {

                uni.showToast({

                    title: '已拒绝授权2',

                    icon: 'none',

                    duration: 2000,

                })

            }

        },

,我在微信设置中除了绑定手机号并没有找到需要验证手机号的地方,一般用户需要这种问题估计也不知道改怎么解决,请问这种情况改怎么处理,换一种登陆方式吗

回答关注问题邀请回答
收藏

3 个回答

  • 神经蛙
    神经蛙
    2025-12-17

    这个并不是让你去主动验证。用真实手机扫码打开小程序获取手机号的意思,而不是在模拟器中。

    2025-12-17
    有用 2
    回复
  • 一笑皆春
    一笑皆春
    2025-12-17

    这种是授权手机号的时候,会弹出一个验证短信验证码的弹窗,验证一下就行了

    2025-12-17
    有用 1
    回复
  • 智能回答 智能回答 本次回答由AI生成
    2025-12-17
    有用 1
登录 后发表内容