1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
| /*
| * @Author: 小明丶
| * @Date: 2019-08-19 15:23:17
| * @LastEditors: 小明丶
| * @LastEditTime: 2021-01-05 15:20:51
| * @Description:
| */
| import Vue from 'vue';
| import Vuex from "vuex";
| import md5 from 'blueimp-md5';
| import mutations from "./mutations";
| import test from "./module/test";
| // 数据持久化到session的插件
| import createPersistedState from 'vuex-persistedstate';
| import { calcArea } from '@/utils/index';
|
| import {
| SET_SESSION_ID,
| SET_FOOTER_NAV,
| SET_USER_INFO,
| SET_AREA_LIST,
| SET_BCAKCOLOR,
| SET_BCJBCOLORF,
| SET_BCJBCOLORB,
| SET_DEFAULT_BG_COLOR,
| SET_LAST_COLOR
| } from './mutations-types';
|
| Vue.use(Vuex);
|
| export default new Vuex.Store({
| plugins: [createPersistedState({ storage: window.sessionStorage })],
| state: {
| AppLoading: false,
| sessionId: '',//判断是否登录
| footerNav: [], //底部导航
| userPage: [], //管理页面 用户有的权限页面
| userinfo: {}, //用户信息
| areaList: {//地区列表
| province_list: {}, //省
| city_list: {}, //市
| county_list: {}, //地区、县
| },
| msgCount: {},
| inviteCode: '', //邀请码
| lastColor:'#423d5d',
| backColor:'#0173FE',//主题色
| backJbColorF:'#8F6AFF',//主题渐变色
| backJbColorB:'#9459EC',
| defaultBgColor:'linear-gradient(180deg, #554E7A, #423D5D)',
| },
| getters: {
| orgType(state) {
| return state.userinfo.orgType
| },
| orgId(state) {
| return state.userinfo.orgId
| }
| },
| mutations,
| actions: {
| // 获取地区列表
| // getArea({ commit }) {
| // Vue.prototype.$api.getArea().then((res) => {
| // let { provList } = res.body;
| // let obj = calcArea(provList)
| // commit(SET_AREA_LIST, {
| // province_list: obj.province_list,
| // city_list: obj.city_list,
| // county_list: obj.county_list
| // })
| // }).catch((err) => {
|
| // });
| // },
| // 设置主题色
| setColor({commit},{backColor,backJbColorF,backJbColorB,defaultBgColor, lastColor}){
| console.log('defaultBgColor:',defaultBgColor)
| commit(SET_BCAKCOLOR,backColor)
| commit(SET_BCJBCOLORF,backJbColorF)
| commit(SET_BCJBCOLORB,backJbColorB)
| commit(SET_DEFAULT_BG_COLOR,defaultBgColor)
| commit(SET_LAST_COLOR,lastColor)
| }
| },
| modules: {
| test
| }
| })
|
|