feat(apply): 手机号冲突走微信验证并号,待审核支持修改资料
This commit is contained in:
+22
-3
@@ -1,6 +1,9 @@
|
||||
// pages/launch/index.js
|
||||
// 启动页:冷启动先解析身份再决定去首页还是入驻申请页,
|
||||
// 避免默认首页先渲染一帧再被全局守卫重定向。
|
||||
//
|
||||
// 特殊分支:从未使用过的新用户没有账号,wxSignin 只带 code 会返回「缺少手机号」,
|
||||
// 这不是网络故障——直接进申请页,由申请页用表单里的姓名+手机号完成注册。
|
||||
const role = require('../../utils/role.js')
|
||||
|
||||
Page({
|
||||
@@ -14,9 +17,15 @@ Page({
|
||||
|
||||
enter() {
|
||||
this.setData({ error: '' })
|
||||
role
|
||||
.ensureRoleSafe(true)
|
||||
const app = getApp()
|
||||
// 先单独走一次登录,才能拿到失败原因(ensureRoleSafe 会把错误吞成 ok:false)
|
||||
app.ensureLogin()
|
||||
.then((user) => {
|
||||
console.info('[launch] 登录成功', user && user.profile && user.profile.mobile)
|
||||
return role.ensureRoleSafe(true)
|
||||
})
|
||||
.then((detail) => {
|
||||
console.info('[launch] 角色解析:', detail.ok ? detail.role : '解析失败')
|
||||
if (!detail.ok) {
|
||||
this.setData({ error: '网络异常,请重试' })
|
||||
return
|
||||
@@ -27,7 +36,17 @@ Page({
|
||||
}
|
||||
wx.switchTab({ url: '/pages/home/index' })
|
||||
})
|
||||
.catch(() => this.setData({ error: '网络异常,请重试' }))
|
||||
.catch((err) => {
|
||||
const msg = err && err.message ? err.message : ''
|
||||
console.warn('[launch] 进入失败:', msg)
|
||||
// 新用户首次使用:后端返回「缺少手机号」,进申请页注册
|
||||
if (msg.indexOf('手机号') > -1) {
|
||||
console.info('[launch] 新用户未注册,转入申请页')
|
||||
wx.reLaunch({ url: '/pages/apply/index' })
|
||||
return
|
||||
}
|
||||
this.setData({ error: '网络异常,请重试' })
|
||||
})
|
||||
},
|
||||
|
||||
onRetry() {
|
||||
|
||||
Reference in New Issue
Block a user