const baseInfo = {
  set (info) {
    localStorage.setItem('baseInfo', JSON.stringify(info))
  },
  get (...arg) {
    let baseInfo = JSON.parse(localStorage.getItem('baseInfo'))
    if (baseInfo === null) {
      return null
    }
    if (arg.length === 0 || arg[0] === '') {
      return baseInfo
    } else {
      return baseInfo[arg[0]]
    }
  },
  clear () {
    localStorage.removeItem('baseInfo')
  },
  menu () {
    return this.get('menu')
  },
  decLevels () {
    return this.get('decLevels')
  },
  empLevels () {
    return this.get('empLevels')
  },
  regTypes () {
    return this.get('regTypes')
  },
  adminRoles () {
    return this.get('adminRoles')
  },
  superAdminRoleId () {
    return this.get('superAdminRoleId')
  },
  setDaysDiff (daysDiff) {
    let baseInfo = {
      daysDiff: daysDiff
    }
    localStorage.setItem('baseInfo', JSON.stringify(baseInfo))
  },
  daysDiff () {
    return this.get('daysDiff')
  },
  shopWalletType () {
    return this.get('shopWalletType')
  },
  decRoles () {
    return this.get('decRoles')
  },
  subCompanies () {
    return this.get('subCompanies')
  },
  allStatus () {
    return this.get('allStatus')
  },
  dealTypes () {
    return this.get('dealTypes')
  },
  systems () {
    return this.get('systems')
  },
  allOpenBank () {
    return this.get('allOpenBank')
  },
  allNation () {
    return this.get('allNation')
  },
  nowPeriodNum () {
    return this.get('nowPeriodNum')
  },
}

export default baseInfo