v2.0 代码提交

This commit is contained in:
zhuoda
2022-10-27 22:14:48 +08:00
parent 207b949484
commit f7e5f6d539
1851 changed files with 108157 additions and 2231 deletions

View File

@@ -0,0 +1,23 @@
import Vue from 'vue';
import Vuex from 'vuex';
import user from './module/user';
import app from './module/app';
Vue.use(Vuex);
export default new Vuex.Store({
state: {
//
},
mutations: {
//
},
actions: {
//
},
modules: {
app,
user
}
});

View File

@@ -0,0 +1,32 @@
/**
* 整个应用相关的状态信息
*
* 比如: keepalive等
*/
export default {
namespaced: true,
state: {
// 缓存路由
keepAliveIncludes: []
},
mutations: {
// 加入keep-alive缓存
pushKeepAliveIncludes(state, val) {
if (state.keepAliveIncludes.length < 30) {
const number = state.keepAliveIncludes.findIndex(e => e === val);
if (number === -1) {
state.keepAliveIncludes.push(val);
}
}
},
// 删除缓存
deleteKeepAliveIncludes(state, val) {
const number = state.keepAliveIncludes.findIndex(e => e === val);
if (number !== -1) {
state.keepAliveIncludes.splice(number, 1);
}
}
}
};

View File

@@ -0,0 +1,41 @@
import cookie from '@/lib/cookie.js';
export default {
namespaced: true,
state: {
token: cookie.getToken(),
// session 信息
sessionInfo: {},
// 是否获取了session
isHaveGotSessionInfo: false,
// 权限集合
privilegeKeySet: new Set()
},
mutations: {
clearSession() {
state.token = null;
state.sessionInfo = null;
state.privilegeKeySet = new Set();
},
updateSession(state, userLoginInfo) {
state.isHaveGotSessionInfo = true;
state.sessionInfo = userLoginInfo;
if (userLoginInfo.privilegeList) {
state.privilegeKeySet = new Set(userLoginInfo.privilegeList.map(e => e.key));
}
}
},
getters: {
// 用户菜单权限
privilegeKeySet: state => state.privilegeKeySet,
isSuperMan: state => state.sessionInfo.isSuperMan,
actualName: state => state.sessionInfo.actualName,
loginUserId: state => state.sessionInfo.id
},
actions: {
// 登录
handleLogin({ commit }, params) {
}
}
};