收藏
回答

微信手机号登录偶发性出现不成功

问题类型 API/组件名称 微信版本 基础库版本
Bug login 未知 3.14.2
在OPPO平板上微信登录,使用getphonenumber调用手机号登录,偶发性的出现失败的情况,点击按钮3次,但只有一次执行了
const loginres = await store.dispatch('user/loginByWxTel', params)函数并请求服务端返回数据登录了,并且页面会有一个加载的loading,在代码中没有loading的动画,
具体图片如下:

具体代码如下:

登录按钮
<button hover-class="none" class="login-button" style="margin-top: 20rpx;" v-if="state.checked"
						:disabled="state.disabled" :class="{disabled: state.disabled}" open-type="getPhoneNumber"
						@getphonenumber="handleLoginByWxTel">
						手机号一键登录
					</button>
登录函数:
const handleLoginByWxTel = throttle(async (e) => {
		if (state.checked) {
			if (e.detail.errMsg == "getPhoneNumber:ok") {
				let params = {
					fastCode: e.detail.code
				}
				const loginres = await store.dispatch('user/loginByWxTel', params)
				if (loginres.code == 200) {
					api.studyStartCheck().then(res => {
						if (res.code == -1002 || res.code == -1003 || res.code == -1004) {
							return uni.reLaunch({
								url: '/page/stage-regist/stage-regist'
							})
						}else{
							return uni.reLaunch({
								url: '/pages/index/index'
							})
						}
						/* if (!rootPage.value || rootPage.value == "") {
							return uni.reLaunch({
								url: '/pages/index/index'
							})
						} else {
							let route = rootPage.value
							return uni.reLaunch({
								url: route,
							})
						} */
					})
				}
			}
		} else {
			$toast({
				msg: '<span style="color: #FFF;">请先勾选用户协议和隐私政策~</span>',
				showIcon: false,
				customStyle: {
					background: '#696969',
					width: '442rpx',
					height: '58rpx',
					'border-radius': '50rpx'
				}
			})
		}
	},2000,{
		leading: true,
		trailing: false
	})


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

1 个回答

  • 智能回答 智能回答 本次回答由AI生成
    02-08
    有用
    回复
登录 后发表内容