Commit 21a85664 authored by 潘永坪's avatar 潘永坪

登录优化

parent 438d3a35
......@@ -45,6 +45,7 @@ export default {
data.companyId=uni.getStorageSync('enterOptions').query.companyId||''
}
this.$request('wechat/wx/getUserInfoByCode', data).then(res => {
try{
if (res.code == '00') {
let openid = res.data.openid
uni.setStorageSync('openid', openid)
......@@ -56,6 +57,12 @@ export default {
icon: 'none'
})
}
}catch(e){
uni.showToast({
title: e,
icon: 'none'
})
}
}).catch(err => {
uni.showToast({
title: '登录失败,请退出并重新登录',
......@@ -75,6 +82,7 @@ export default {
login(openid,userId,source){
let datas = {openid,userId,source}
this.$request('wechatUser/login/findWxUserAndLogin', datas).then(res => {
try{
//通过openid获取token
if (res.code == '00') {
let token = res.data.token || ''
......@@ -106,6 +114,12 @@ export default {
icon: 'none'
})
}
}catch(e){
uni.showToast({
title: e,
icon: 'none'
})
}
}).catch(err => {
uni.showToast({
title: '登录失败,请退出并重新登录',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment