用户模块
This commit is contained in:
@@ -198,10 +198,14 @@ const prePage = () => {
|
||||
}
|
||||
|
||||
const loginSuccess = (data) => {
|
||||
uni.setStorageSync('userInfo', data)
|
||||
uni.setStorageSync('token', data.token_type + ' ' + data.access_token)
|
||||
uni.setStorageSync('access_token', data.token_type + ' ' + data.access_token)
|
||||
uni.setStorageSync('refresh_token', data.refresh_token)
|
||||
let strings = data.access_token.split('.') //截取token,获取载体
|
||||
var userInfo = JSON.parse(decodeURIComponent(escape(window.atob(strings[1].replace(/-/g, '+').replace(/_/g, '/')))))
|
||||
userInfo.authorities = userInfo.authorities[0]
|
||||
uni.setStorageSync('userInfo', userInfo)
|
||||
uni.reLaunch({
|
||||
url: '/pages/user/login',
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user