This commit is contained in:
@@ -4,6 +4,7 @@ const { BRAND_CONFIG } = require('../../utils/config')
|
||||
const loginFlow = require('../../utils/login-flow')
|
||||
const { requestSubscribeMessages } = require('../../utils/subscribe-message')
|
||||
const { showErrorToast, toUserMessage } = require('../../utils/toast')
|
||||
const { showActionModal } = require('../../utils/action-modal')
|
||||
|
||||
function wxLoginCode() {
|
||||
return new Promise((resolve, reject) => wx.login({
|
||||
@@ -135,14 +136,13 @@ Page({
|
||||
|
||||
async chooseRememberMode() {
|
||||
if (this.data.rememberMe) return true
|
||||
return new Promise(resolve => wx.showModal({
|
||||
const result = await showActionModal(this, {
|
||||
title: '记住登录',
|
||||
content: loginFlow.REMEMBER_LOGIN_PROMPT,
|
||||
confirmText: '确认',
|
||||
cancelText: '取消',
|
||||
success: result => resolve(loginFlow.resolveRememberChoice(result)),
|
||||
fail: () => resolve(null)
|
||||
}))
|
||||
cancelText: '取消'
|
||||
})
|
||||
return loginFlow.resolveRememberChoice(result)
|
||||
},
|
||||
|
||||
async quickLogin() {
|
||||
@@ -196,22 +196,20 @@ Page({
|
||||
: status === 'NEED_MANUAL_LOGIN' ? '需要完成注册' : '登录失败'
|
||||
const content = result.registrationRejectReason || toUserMessage(result, '请稍后重试')
|
||||
const canRetry = status === 'ERROR' || status === 'NEED_MANUAL_LOGIN' || status === 'REJECTED'
|
||||
wx.showModal({
|
||||
const choice = await showActionModal(this, {
|
||||
title,
|
||||
content,
|
||||
showCancel: canRetry,
|
||||
confirmText: status === 'REJECTED' ? '重新提交' : canRetry ? '重新登录' : '知道了',
|
||||
cancelText: '取消',
|
||||
success: choice => {
|
||||
if (!choice.confirm) return
|
||||
if (status === 'REJECTED' && result.registrationTicket) this.navigateToRegistration(result)
|
||||
else if (status === 'REJECTED') {
|
||||
this._resumeRegistrationAfterRejected = true
|
||||
this.quickLogin()
|
||||
}
|
||||
else if (status === 'ERROR' || status === 'NEED_MANUAL_LOGIN') this.quickLogin()
|
||||
}
|
||||
cancelText: canRetry ? '取消' : '',
|
||||
confirmText: status === 'REJECTED' ? '重新提交' : canRetry ? '重新登录' : '知道了'
|
||||
})
|
||||
if (!choice.confirm) return
|
||||
if (status === 'REJECTED' && result.registrationTicket) this.navigateToRegistration(result)
|
||||
else if (status === 'REJECTED') {
|
||||
this._resumeRegistrationAfterRejected = true
|
||||
this.quickLogin()
|
||||
}
|
||||
else if (status === 'ERROR' || status === 'NEED_MANUAL_LOGIN') this.quickLogin()
|
||||
|
||||
},
|
||||
|
||||
navigateToRegistration(result) {
|
||||
|
||||
Reference in New Issue
Block a user