|
@@ -10,8 +10,7 @@ const store = new Vuex.Store({
|
|
|
modules: {},
|
|
|
state: {
|
|
|
name: '这里是全局的',
|
|
|
- projects: [
|
|
|
- ],
|
|
|
+ projects: [],
|
|
|
projectId: 'Pj4419000005',
|
|
|
comeUrl: '',
|
|
|
flag: 'wanke',
|
|
@@ -49,20 +48,32 @@ const store = new Vuex.Store({
|
|
|
state.lastRoute = val
|
|
|
storage.set(KEY_LAST_ROUTE, val)
|
|
|
},
|
|
|
- setUserInfo(state, { userInfo }) {
|
|
|
+ setUserInfo(state, {
|
|
|
+ userInfo
|
|
|
+ }) {
|
|
|
state.userInfo = userInfo
|
|
|
}
|
|
|
},
|
|
|
actions: {
|
|
|
- async loadUserInfo(context, { token }) {
|
|
|
- let res = await axios.get('/server/userInfo', { params: { token: token } })
|
|
|
+ async loadUserInfo(context, {
|
|
|
+ token
|
|
|
+ }) {
|
|
|
+ let res = await axios.get('/server/userInfo', {
|
|
|
+ params: {
|
|
|
+ token: token
|
|
|
+ }
|
|
|
+ })
|
|
|
if (res.data.result == 'success') {
|
|
|
// commit 到vuex, 供全局使用
|
|
|
- context.commit('setUserInfo', { userInfo: res.data })
|
|
|
- context.commit('setProjects', { projects: res.data.projects })
|
|
|
+ context.commit('setUserInfo', {
|
|
|
+ userInfo: res.data
|
|
|
+ })
|
|
|
+ context.commit('setProjects', {
|
|
|
+ projects: res.data.projects
|
|
|
+ })
|
|
|
localStorage.setItem('token', token)
|
|
|
} else {
|
|
|
- let ssoServer = 'http://sso.sagacloud.cn'
|
|
|
+ let ssoServer = 'http://10.199.143.85:7003'
|
|
|
let redirectUrl = window.location.protocol + '//' + window.location.host + '/auth'
|
|
|
window.location.href = `${ssoServer}/login?redirectUrl=${redirectUrl}`
|
|
|
}
|