Commit 4d363e76 by 前端

Merge branch 'zq_dev_3.0' into 'v3.0'

手机号解密失败

See merge request !89
2 parents 0e547e1c a8ba5dbf
...@@ -45,13 +45,11 @@ class UsersApi { ...@@ -45,13 +45,11 @@ class UsersApi {
} }
/**授权手机号登录 */ /**授权手机号登录 */
async authUserPhone(detail, loginToken) { async authUserPhone(detail, loginToken) {
console.log(221)
if (!loginToken) { if (!loginToken) {
wx.$api.showToast('缺少loginToken') wx.$api.showToast('缺少loginToken')
Promise.reject() Promise.reject()
return return
} }
console.log(111)
if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject() if (detail.errMsg && detail.errMsg == 'getPhoneNumber:fail user deny') Promise.reject()
delete detail.errMsg delete detail.errMsg
if (detail.iv && detail.encryptedData) { if (detail.iv && detail.encryptedData) {
......
...@@ -42,7 +42,7 @@ Page({ ...@@ -42,7 +42,7 @@ Page({
this.init() this.init()
}, },
async init() { async init(tip) {
try { try {
const { const {
data, data,
...@@ -51,12 +51,15 @@ Page({ ...@@ -51,12 +51,15 @@ Page({
} = await USERAPI.wxCodeLogin() } = await USERAPI.wxCodeLogin()
if (code == '0') { if (code == '0') {
this.loginToken = data this.loginToken = data
if(tip){
wx.$api.showToast(`${tip == 1 ? '登录':'注册'}信息已失效,请重试`)
}
} else this.reLogin(message) } else this.reLogin(message)
wx.hideLoading() wx.hideLoading()
} catch ({ } catch ({
errMsg errMsg
}) { }) {
console.error(errMsg) console.log(errMsg)
this.reLogin(errMsg) this.reLogin(errMsg)
} }
}, },
...@@ -101,15 +104,15 @@ Page({ ...@@ -101,15 +104,15 @@ Page({
mobile: formData.phone, mobile: formData.phone,
code: formData.code code: formData.code
} }
wx.showLoading()
if(this.data.showLoading || this.data.disabled) return; if(this.data.showLoading || this.data.disabled) return;
this.setShowLoading(true)
USERAPI.phoneSmsLogin(obj).then(({ USERAPI.phoneSmsLogin(obj).then(({
code, code,
data, data,
message, message,
errId errId
}) => { }) => {
this.setShowLoading(false) wx.hideLoading()
if (code == '0') { if (code == '0') {
this.checkLoginUserInfo(data) this.checkLoginUserInfo(data)
} else if(errId=='30990103') { } else if(errId=='30990103') {
...@@ -120,7 +123,7 @@ Page({ ...@@ -120,7 +123,7 @@ Page({
wx.$api.showToast(message || '系统异常') wx.$api.showToast(message || '系统异常')
} }
}).catch(err => { }).catch(err => {
this.setShowLoading(false) wx.hideLoading()
wx.$api.showToast('系统异常') wx.$api.showToast('系统异常')
}) })
}, },
...@@ -132,7 +135,7 @@ Page({ ...@@ -132,7 +135,7 @@ Page({
/**多个账号 */ /**多个账号 */
console.log(loginUserInfoList,'loginUserInfoList') console.log(loginUserInfoList,'loginUserInfoList')
if (loginUserInfoList.length > 1) wx.$router.go('/pages/authentication/accountItems/accountItems', { if (loginUserInfoList.length > 1) wx.$router.reLaunch('/pages/authentication/accountItems/accountItems', {
sessionId, sessionId,
...this.options ...this.options
}) })
...@@ -184,8 +187,12 @@ Page({ ...@@ -184,8 +187,12 @@ Page({
// this.setData({ // this.setData({
// smsLoading: false // smsLoading: false
// }) // })
if (code == '0') this.countDown(countDown) if (code == '0') {
else wx.$api.showToast(message || '发送验证码失败') wx.$api.showToast('验证码已发送')
this.countDown(countDown)
}else{
wx.$api.showToast(message || '发送验证码失败')
}
}).catch(err => { }).catch(err => {
// this.setData({ // this.setData({
// smsLoading: false // smsLoading: false
...@@ -220,27 +227,30 @@ Page({ ...@@ -220,27 +227,30 @@ Page({
detail detail
}) { }) {
if (!detail.code || this.data.showLoading) return if (!detail.code || this.data.showLoading) return
this.setShowLoading(true) // this.setShowLoading(true)
wx.showLoading()
USERAPI.authUserPhone(detail, this.loginToken).then(({ USERAPI.authUserPhone(detail, this.loginToken).then(({
code, code,
data, data,
message, message,
errId errId
}) => { }) => {
this.setShowLoading(false) wx.hideLoading()
if (code == '0'){ if (code == '0'){
this.checkLoginUserInfo(data) this.checkLoginUserInfo(data)
}else if(errId=='30990103'){ }else if(errId=='30990103'){
this.setData({ this.setData({
authorized:true authorized:true
}) })
}else if(errId == '200122'){
this.init(1)
}else{ }else{
wx.$api.showToast(message || '系统异常') wx.$api.showToast(message || '系统异常')
} }
}).catch(({ }).catch(({
errMsg errMsg
}) => { }) => {
this.setShowLoading(false) wx.hideLoading()
wx.$api.showToast('系统异常') wx.$api.showToast('系统异常')
}) })
}, },
......
...@@ -22,7 +22,7 @@ Page({ ...@@ -22,7 +22,7 @@ Page({
headerHeight: height, headerHeight: height,
}); });
}, },
async init() { async init(tip) {
try { try {
const { const {
data, data,
...@@ -30,10 +30,10 @@ Page({ ...@@ -30,10 +30,10 @@ Page({
message message
} = await USERAPI.wxCodeLogin() } = await USERAPI.wxCodeLogin()
if (code == '0') { if (code == '0') {
this.setData({
disabled: false
})
this.loginToken = data this.loginToken = data
if(tip){
wx.$api.showToast(`${tip == 1 ? '登录':'注册'}信息已失效,请重试`)
}
} else this.reLogin(message) } else this.reLogin(message)
wx.hideLoading() wx.hideLoading()
} catch ({ } catch ({
...@@ -83,9 +83,12 @@ Page({ ...@@ -83,9 +83,12 @@ Page({
}, },
register(params,detail){ register(params,detail){
USERAPI.register(params).then((res) => { USERAPI.register(params).then((res) => {
console.log(res,'errId')
if (res.code == '0'){ if (res.code == '0'){
this.toLogin(detail) this.toLogin(detail)
}else{ }else if(res.errId == '200122'){
this.init(2)
}else {
wx.$api.showToast(res.message || '系统异常') wx.$api.showToast(res.message || '系统异常')
} }
}) })
...@@ -99,6 +102,8 @@ Page({ ...@@ -99,6 +102,8 @@ Page({
}) => { }) => {
if (code == '0'){ if (code == '0'){
this.checkLoginUserInfo(data) this.checkLoginUserInfo(data)
}else if(errId == '200122'){
this.init(1)
}else{ }else{
wx.$api.showToast(message || '系统异常') wx.$api.showToast(message || '系统异常')
} }
......
...@@ -42,7 +42,7 @@ Page({ ...@@ -42,7 +42,7 @@ Page({
onLoad(options) { onLoad(options) {
this.init() this.init()
}, },
async init() { async init(tip) {
try { try {
const { const {
data, data,
...@@ -51,6 +51,9 @@ Page({ ...@@ -51,6 +51,9 @@ Page({
} = await USERAPI.wxCodeLogin() } = await USERAPI.wxCodeLogin()
if (code == '0') { if (code == '0') {
this.loginToken = data this.loginToken = data
if(tip){
wx.$api.showToast(`${tip == 1 ? '登录':'注册'}信息已失效,请重试`)
}
} else this.reLogin(message) } else this.reLogin(message)
wx.hideLoading() wx.hideLoading()
} catch ({ } catch ({
...@@ -111,6 +114,8 @@ Page({ ...@@ -111,6 +114,8 @@ Page({
USERAPI.register(params).then((res) => { USERAPI.register(params).then((res) => {
if (res.code == '0'){ if (res.code == '0'){
this.toLogin() this.toLogin()
}else if(res.errId == '200122'){
this.init(2)
}else{ }else{
wx.$api.showToast(res.message || '系统异常') wx.$api.showToast(res.message || '系统异常')
} }
...@@ -126,6 +131,8 @@ Page({ ...@@ -126,6 +131,8 @@ Page({
}) => { }) => {
if (code == '0'){ if (code == '0'){
this.checkLoginUserInfo(data) this.checkLoginUserInfo(data)
}else if(errId == '200122'){
this.init(1)
}else{ }else{
wx.$api.showToast(message || '系统异常') wx.$api.showToast(message || '系统异常')
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!