fix: make phone authorization skippable in registration

getPhoneNumber requires verified enterprise miniprogram account.
Allow users to skip phone auth and complete registration without it.
这个提交包含在:
Guoguo
2026-05-06 06:29:03 -07:00
父节点 52456d850e
当前提交 c065d3fdce
修改 4 个文件,包含 46 行新增8 行删除
+18 -4
查看文件
@@ -18,7 +18,8 @@ Page({
loading: false,
avatarUrl: DEFAULT_AVATAR,
nickname: '',
phone: ''
phone: '',
phoneSkipped: false
},
onLoad: function () {
@@ -47,10 +48,23 @@ Page({
}
},
onSkipPhone: function () {
var self = this
wx.showModal({
title: '跳过手机号',
content: '跳过后部分功能可能受限,确定跳过吗?',
success: function (res) {
if (res.confirm) {
self.setData({ phoneSkipped: true })
}
}
})
},
onGetPhoneNumber: function (e) {
var self = this
if (!e.detail || !e.detail.code) {
wx.showToast({ title: '需要授权手机号才能完成注册', icon: 'none' })
wx.showToast({ title: '手机号授权未成功,可跳过此步骤', icon: 'none' })
return
}
self.setData({ loading: true })
@@ -96,8 +110,8 @@ Page({
var nickname = (self.data.nickname || '').trim()
var avatarUrl = self.data.avatarUrl
if (!self.data.phone) {
wx.showToast({ title: '请先授权手机号', icon: 'none' })
if (!self.data.phone && !self.data.phoneSkipped) {
wx.showToast({ title: '请先授权手机号,或点击跳过', icon: 'none' })
return
}