//起到一个快捷访问的作用

import {
  generateColors
} from '@/utils/theme';
import {
  MAIN_COLOR
} from '@/constant';
import {
  getItem
} from '@/utils/storage';
const getters = {
  token: (state) => state.user.token,
  activeId: (state) => state.user.activeId,
  deptId: (state) => state.user.deptId,
  deptList: (state) => state.user.deptList,
  menuList: (state) => state.user.menuList,
  userName: (state) => state.user.userName,
  userInfo: (state) => state.user.userInfo,
  routeReady: (state) => state.permission.routeReady,
  keepLiiveRoute: (state) => state.user.keepLiiveRoute,
  /** 如果retuen true  表示用户信息已存在 */
  hashUserInfo: (state) => {
    return JSON.stringify(state.user.userInfo) !== '{}';
  },
  cssVar: (state) => {
    return {
      ...state.theme.variables,
      ...generateColors(getItem(MAIN_COLOR))
    };
  },
  sidebarOpened: (state) => state.app.sidebarOpened,
  mainColor: (state) => state.theme.mainColor,
  tagsViewList: (state) => state.app.tagsViewList,
  bdmap: (state) => state.bdmap,
  leftShows: (state) => state.display.leftShows,
  rightShows: (state) => state.display.rightShows,
  tsgzTimeFlsg: (state) => state.display.tsgzTimeFlsg,
  tourInfo: (state) => state.display.tourInfo,
  tourSign: (state) => state.display.tourSign
};

export default getters;
