补充微信登录和注册申请重提
This commit is contained in:
@@ -42,6 +42,15 @@ module.exports = {
|
||||
})
|
||||
},
|
||||
|
||||
resubmitRegistration(data) {
|
||||
return request({
|
||||
url: '/user/workbench/register/resubmit',
|
||||
method: 'POST',
|
||||
params: { __baseUrl: API_DOMAIN },
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
sendCode(phone) {
|
||||
return request({
|
||||
url: '/user/send-verification-code',
|
||||
@@ -81,6 +90,15 @@ module.exports = {
|
||||
})
|
||||
},
|
||||
|
||||
wechatAutoLogin(wxCode) {
|
||||
return request({
|
||||
url: '/user/wechat-mini/auto-login',
|
||||
method: 'POST',
|
||||
params: { __baseUrl: API_DOMAIN },
|
||||
data: { wxCode }
|
||||
})
|
||||
},
|
||||
|
||||
getPhoneLoginShops(phone) {
|
||||
return request({
|
||||
url: `/user/check/login-shops/phone/${encodeURIComponent(phone)}`,
|
||||
|
||||
@@ -481,7 +481,24 @@ Page({
|
||||
wx.navigateTo({ url: '/pages/register/index' })
|
||||
},
|
||||
|
||||
wechatLogin() {
|
||||
wx.showToast({ title: '请先使用账号登录', icon: 'none' })
|
||||
async wechatLogin() {
|
||||
try {
|
||||
const loginResult = await new Promise((resolve, reject) => {
|
||||
wx.login({ success: resolve, fail: reject })
|
||||
})
|
||||
const result = await authApi.wechatAutoLogin(loginResult.code)
|
||||
if (result.status === 'NEED_MANUAL_LOGIN') {
|
||||
wx.showToast({ title: '新账号请先完成手机号注册和身份审核', icon: 'none', duration: 2500 })
|
||||
setTimeout(() => this.goRegister(), 900)
|
||||
return
|
||||
}
|
||||
if (result.status !== 'SUCCESS' || !result.accessToken) {
|
||||
throw new Error(result.message || '微信登录暂不可用')
|
||||
}
|
||||
getApp().setSession(result)
|
||||
wx.reLaunch({ url: '/pages/planning/index' })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '微信快捷登录失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -116,6 +116,7 @@ function isAuthFreePath(url) {
|
||||
'/user/workbench/shops/available',
|
||||
'/user/send-verification-code',
|
||||
'/user/phone-login',
|
||||
'/user/wechat-mini/',
|
||||
'/user/check/login-shops/',
|
||||
'/legal-agreement/current'
|
||||
].some(path => String(url || '').includes(path))
|
||||
|
||||
Reference in New Issue
Block a user