import api from '@/api/api'

const getters = {
  sidebar: state => state.app.sidebar,
  size: state => state.app.size,
  device: state => state.app.device,
  visitedViews: state => state.tagsView.visitedViews,
  cachedViews: state => state.tagsView.cachedViews,
  token: state => state.user.token,
  avatar: state => state.user.avatar,
  name: state => state.user.name,
  introduction: state => state.user.introduction,
  userId: state => state.user.userId,
  roles: state => state.user.roles,
  permissions: state => state.user.permissions,
  permission_routes: state => state.permission.routes,
  topbarRouters: state => state.permission.topbarRouters,
  defaultRoutes: state => state.permission.defaultRoutes,
  sidebarRouters: state => state.permission.sidebarRouters,
  indexnum(state) {
    if (!state.dict.indexnum) {
      api.inquireGradegradelistUserPeriod({ status: 1, periodStatus: 2, pageSize: 1, pageNum: 1 }).then(res => {
        state.dict.indexnum = res.total
      })
    }
    return state.dict.indexnum
  },
  roleList(state) {
    if (!state.dict.roleList) {
      api.obtainRoleList({ status: 1 }).then(res => {
        state.dict.roleList = res.rows
      })
    }
    return state.dict.roleList
  },
  systemtenantlist(state) {
    if (!state.dict.systemtenantlist) {
      api.systemtenantlist({ status: 1 }).then(res => {
        state.dict.systemtenantlist = res.rows
      })
    }
    return state.dict.systemtenantlist
  },
  educationType(state) {
    if (!state.dict.educationType) {
      api.inquireCourseEducationType({ status: 1 }).then(res => {
        state.dict.educationType = res.rows
      })
    }
    return state.dict.educationType
  },
  projectType(state) {
    if (!state.dict.projectType) {
      api.inquireCourseProjectType({ status: 1 }).then(res => {
        state.dict.projectType = res.rows
      })
    }
    return state.dict.projectType
  },
  businessLevel(state) {
    if (!state.dict.businessLevel) {
      api.inquirebusinessList({ status: 1 }).then(res => {
        state.dict.businessLevel = res.rows
      })
    }
    return state.dict.businessLevel
  },
  sujectType(state) {
    if (!state.dict.sujectType) {
      api.inquireCourseSubject({ status: 1 }).then(res => {
        state.dict.sujectType = res.rows
      })
    }
    return state.dict.sujectType
  },
  Professional(state) {
    if (!state.dict.Professional) {
      api.inquireCourseMajor({ status: 1 }).then(res => {
        state.dict.Professional = res.rows
      })
    }
    return state.dict.Professional
  },
  schoolList(state) {
    if (!state.dict.schoolList) {
      api.inquireUserSchool({ status: 1 }).then(res => {
        state.dict.schoolList = res.rows
      })
    }
    return state.dict.schoolList
  },
  courseExamine(state) {
    if (!state.dict.courseExamine) {
      api.inquireCourseExamine({ status: 1 }).then(res => {
        state.dict.courseExamine = res.rows
      })
    }
    return state.dict.courseExamine
  },
  certificate(state) {
    if (!state.dict.certificate) {
      api.inquireBaseCertificate({ status: 1 }).then(res => {
        state.dict.certificate = res.rows
      })
    }
    return state.dict.certificate
  },
  certificateName(state) {
    if (!state.dict.certificateName) {
      api.inquireBaseCertificatecommon({ status: 1 }).then(res => {
        state.dict.certificateName = res.rows
      })
    }
    return state.dict.certificateName
  },
  certificateTp(state) {
    if (!state.dict.certificateTp) {
      api.inquireBaseCertificatetp({ status: 1 }).then(res => {
        state.dict.certificateTp = res.rows
      })
    }
    return state.dict.certificateTp
  },
  labelList(state) {
    if (!state.dict.labelList) {
      api.inquireCourseLabelList({ status: 1 }).then(res => {
        state.dict.labelList = res.rows
      })
    }
    return state.dict.labelList
  },
  payList(state) {
    if (!state.dict.payList) {
      api.inquirepayaislelist({ status: 1 }).then(res => {
        state.dict.payList = res.rows
      })
    }
    return state.dict.payList
  },
  paypayee(state) {
    if (!state.dict.paypayee) {
      api.inquirepaypayee({ status: 1 }).then(res => {
        state.dict.paypayee = res.rows
      })
    }
    return state.dict.paypayee
  },
  paysource(state) {
    if (!state.dict.paysource) {
      api.inquirepaysource({ status: 1 }).then(res => {
        state.dict.paysource = res.rows
      })
    }
    return state.dict.paysource
  },
  payvisit(state) {
    if (!state.dict.payvisit) {
      api.inquirepayvisit({ status: 1 }).then(res => {
        state.dict.payvisit = res.rows
      })
    }
    return state.dict.payvisit
  },
  payserve(state) {
    if (!state.dict.payserve) {
      api.inquirepayserve({ status: 1 }).then(res => {
        state.dict.payserve = res.rows
      })
    }
    return state.dict.payserve
  },
  paysupply(state) {
    if (!state.dict.paysupply) {
      api.inquirepaysupply({ status: 1 }).then(res => {
        state.dict.paysupply = res.rows
      })
    }
    return state.dict.paysupply
  },
  paynature(state) {
    if (!state.dict.paynature) {
      api.inquirepaynature({ status: 1 }).then(res => {
        state.dict.paynature = res.rows
      })
    }
    return state.dict.paynature
  },
  paycost(state) {
    if (!state.dict.paycost) {
      api.inquirepaycost({ status: 1 }).then(res => {
        state.dict.paycost = res.rows
      })
    }
    return state.dict.paycost
  },
  paperexam(state) {
    if (!state.dict.paperexam) {
      api.inquirepaperexamList({ status: 1 }).then(res => {
        state.dict.paperexam = res.rows
      })
    }
    return state.dict.paperexam
  },
  areas(state) {
    if (!state.dict.areas) {
      api.inquireapplyAreas({ status: 1, areaType: 1 }).then(res => {
        state.dict.areas = res.rows
      })
    }
    return state.dict.areas
  },
  cityList(state) {
    if (!state.dict.cityList) {
      api.inquireapplyCityList({ status: 1, areaType: 2 }).then(res => {
        state.dict.cityList = res.rows
      })
    }
    return state.dict.cityList
  },
  classList(state) {
    if (!state.dict.classList) {
      api.inquireGradegradeList({ status: 1 }).then(res => {
        state.dict.classList = res.rows
      })
    }
    return state.dict.classList
  },
  examLists(state) {
    if (!state.dict.examLists) {
      api.inquiresystemapplyList({ status: "0,1,2" }).then(res => {
        state.dict.examLists = res.rows
      })
    }
    return state.dict.examLists
  },
  examList(state) {
    if (!state.dict.examList) {
      api.inquiresystemapplyList({ status: 1 }).then(res => {
        state.dict.examList = res.rows
      })
    }
    return state.dict.examList
  },
  applySiteAddress(state) {
    if (!state.dict.applySiteAddress) {
      api.inquiresystemsite({ status: 1 }).then(res => {
        state.dict.applySiteAddress = res.rows
      })
    }
    return state.dict.applySiteAddress
  },
  beforeList(state) {
    if (!state.dict.beforeList) {
      api.inquiresystembefore({ status: 1 }).then(res => {
        state.dict.beforeList = res.rows
      })
    }
    return state.dict.beforeList
  },
  beforeLists(state) {
    if (!state.dict.beforeLists) {
      api.inquiresystembefore({ status: '0,1,2' }).then(res => {
        state.dict.beforeLists = res.rows
      })
    }
    return state.dict.beforeLists
  },
}
export default getters
