|
@@ -7,29 +7,13 @@ import classes from '@frame/store/classes';
|
|
|
import schPlan from '@frame/store/sch-plan';
|
|
|
import schimport from '@frame/store/sch-import';
|
|
|
import login from '@frame/store/login';
|
|
|
-
|
|
|
+import * as ustate from '@frame/store/user/state';
|
|
|
+import * as umutations from '@frame/store/user/mutations';
|
|
|
Vue.use(Vuex);
|
|
|
|
|
|
export default new Vuex.Store({
|
|
|
modules: { student, teacher, trainplan, schPlan, schimport, classes, login },
|
|
|
- state: { user: {} },
|
|
|
- mutations: {
|
|
|
- setUser(state, payload) {
|
|
|
- let res = true;
|
|
|
-
|
|
|
- if (payload) state.user = payload;
|
|
|
- else {
|
|
|
-
|
|
|
- let user = sessionStorage.getItem('user');
|
|
|
- if (user) state.user = JSON.parse(user);
|
|
|
- else {
|
|
|
- res = false;
|
|
|
- state.user = undefined;
|
|
|
- console.warn('用户未登录');
|
|
|
- }
|
|
|
- }
|
|
|
- return res;
|
|
|
- },
|
|
|
- },
|
|
|
+ state: { ...ustate },
|
|
|
+ mutations: { ...umutations },
|
|
|
actions: {},
|
|
|
});
|