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

import { generateColors } from "@/utils/theme";
import { MAIN_COLOR } from "@/constant";
import { getItem } from "@/utils/storage";
const getters = {
  token: (state) => state.user.token,
  routerName: (state) => state.user.routerName,
  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,
  defaultDeptName: (state) => state.user.defaultDeptName,
  /** 如果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,
  isBig: (state) => state.app.isBig,
  mainColor: (state) => state.theme.mainColor,
  tagsViewList: (state) => state.app.tagsViewList,
  bdmap: (state) => state.bdmap,
  width: (state) => state.app.width,
  title: (state) => state.title,//添加动态路由标题
  urlMd5: (state) => state.app.urlMd5,
  timec: (state) => state.app.timec,
};

export default getters;
