fix: make phone authorization skippable in registration
getPhoneNumber requires verified enterprise miniprogram account. Allow users to skip phone auth and complete registration without it.
这个提交包含在:
@@ -16,7 +16,7 @@ Page({
|
||||
|
||||
app.doLogin().then(function (data) {
|
||||
self.setData({ loading: false })
|
||||
if (data && (data.is_new_user || !data.user_info || !data.user_info.phone)) {
|
||||
if (data && data.is_new_user) {
|
||||
wx.redirectTo({ url: '/pages/register/register' })
|
||||
} else {
|
||||
wx.switchTab({ url: '/pages/index/index' })
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -26,11 +26,19 @@
|
||||
<text class="phone-text">{{phone}}</text>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:elif="{{phoneSkipped}}">
|
||||
<view class="phone-done phone-skipped">
|
||||
<text class="phone-text">已跳过,可稍后在设置中授权</text>
|
||||
</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<button class="phone-btn" open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumber" disabled="{{loading}}">
|
||||
授权手机号
|
||||
</button>
|
||||
<view class="phone-hint">手机号用于接收服务通知,必须授权</view>
|
||||
<view class="phone-actions">
|
||||
<view class="phone-hint">手机号用于接收服务通知</view>
|
||||
<view class="phone-skip" bindtap="onSkipPhone">跳过</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
|
||||
@@ -84,11 +84,27 @@
|
||||
border: none;
|
||||
}
|
||||
|
||||
.phone-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 12rpx;
|
||||
padding: 0 8rpx;
|
||||
}
|
||||
|
||||
.phone-hint {
|
||||
font-size: 24rpx;
|
||||
color: #999999;
|
||||
text-align: center;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.phone-skip {
|
||||
font-size: 24rpx;
|
||||
color: #E6508C;
|
||||
}
|
||||
|
||||
.phone-skipped {
|
||||
background: #f5f5f5;
|
||||
border-color: #d9d9d9;
|
||||
}
|
||||
|
||||
.phone-done {
|
||||
|
||||
在新工单中引用
屏蔽一个用户