接口对接修改
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import request from './request'
|
||||
import cache from './cacheKey.js'
|
||||
import { queryDictDataCache } from '../api/dictionary.js'
|
||||
import cacheKey from './cacheKey.js'
|
||||
const toast = (title, duration = 1500, call, mask = false, icon = 'none') => {
|
||||
if (Boolean(title) === false) {
|
||||
return
|
||||
@@ -198,14 +200,23 @@ const prePage = () => {
|
||||
}
|
||||
|
||||
const loginSuccess = (data) => {
|
||||
console.log(data);
|
||||
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, '/')))))
|
||||
console.log(escape,atob);
|
||||
var userInfo = JSON.parse(decodeURIComponent(escape(atob(strings[1].replace(/-/g, '+').replace(/_/g, '/')))))
|
||||
userInfo.authorities = userInfo.authorities[0]
|
||||
uni.setStorageSync('userInfo', userInfo)
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
console.log('reLaunch');
|
||||
queryDictDataCache().then((res) => {
|
||||
uni.setStorageSync(cacheKey.dictData, res.data)
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user