提交 2e3bc05f authored 作者: CRS's avatar CRS

nwe

上级 15ae2122
......@@ -42,6 +42,9 @@ export default {
console.log(res.data.data)
this.$store.commit('changeUserData', res.data.data);
this.$router.push({name: 'firstHome'})
this.$store.commit('changeSession', { // 存值
session: res.data.data.sessionId
});
} else {
this.$message.error(res.data.msg);
}
......
import axios from 'axios';
// import Qs from 'qs';
import baseUrl from '../../config';
import store from '../store';
// axios.defaults.withCredentials = true;
// 添加请求拦截器
axios.interceptors.request.use(function (config) {
// console.log(store.getters.getSession.session)
config.headers.session = store.getters.getSession.session;
// 预处理请求信息(config 发出的数据) 下方是三种请求,李迪凡的
if (config.method === 'post' || config.method === 'put' || config.method === 'delete') {
// POST传参序列化
......
......@@ -30,6 +30,12 @@ const actions = {
jumpOther: payload
})
},
changeSession(store, payload) {
store.commit({
type: 'changeSession',
session: payload
})
},
};
export default actions;
......@@ -14,7 +14,10 @@ const getters = {
},
getJumpOther(state) {
return state.jumpOther
}
},
getSession(state) {
return state.session
},
};
export default getters;
......@@ -15,6 +15,9 @@ const mutations = {
changeJumpOther(state, payload) {
state.jumpOther = payload;
},
changeSession(state, payload) {
state.session = payload;
},
};
export default mutations;
......@@ -5,6 +5,7 @@ const state = {
homeClick: {}, // 首页点击的模块
nowPath: '', // 当前页面路径
jumpOther: '', // 跳转到其他页面,修改顶部子菜单样式
session: '', // 请求session
};
export default state;
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论