123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <template>
- <div>
- <HotPromoted :items="items"></HotPromoted>
- <div class="text-center">
- <v-btn class="buttons" color="primary">{{ $t('enterprise.moreBtn') }}</v-btn>
- </div>
- </div>
- </template>
- <script setup name="popularEnterprises">
- import HotPromoted from '@/components/Enterprise/hotPromoted.vue'
- import { ref, reactive } from 'vue'
- import { getHotEnterprise } from '@/api/enterprise'
- import { getDict } from '@/hooks/web/useDictionaries'
- import { dealDictData } from '@/views/recruit/position/components/dict'
- const items = ref([])
- const dictObj = reactive({
- payUnit: [], // 薪资单位
- scale: [], // 规模
- industry: [], // 行业
- edu: [], // 学历
- exp: [], // 工作经验
- area: [], // 地区
- financing: [] // 融资类型
- })
- const dictList = [
- { type: 'menduner_pay_unit', value: 'payUnit', key: 'payUnit', label: 'payName' },
- { type: 'menduner_education_type', value: 'edu', key: 'eduType', label: 'eduName' },
- { type: 'menduner_exp_type', value: 'exp', key: 'expType', label: 'expName' },
- { type: 'menduner_area_type', value: 'area', key: 'areaId', label: 'areaName', params: {}, apiType: 'areaList', nameKey: 'name', valueKey: 'id' },
- { type: 'menduner_financing_status', value: 'financing', key: 'financingStatus', label: 'financingName', isEnter: true },
- { type: 'menduner_scale', value: 'scale', key: 'scale', label: 'scaleName', isEnter: true },
- { type: 'menduner_industry_type', value: 'industry', key: 'industryId', label: 'industryName', params: {}, apiType: 'industryList', nameKey: 'nameCn', valueKey: 'id', isEnter: true }
- ]
- // 热门企业
- const getHotEnterpriseList = async () => {
- const { list } = await getHotEnterprise({ pageNo: 1, pageSize: 9 })
- dictList.forEach(item => {
- items.value = list.map(e => {
- if (item.isEnter) {
- const valueKey = item.nameKey ? item.nameKey : 'label'
- const idKey = item.valueKey ? item.valueKey : 'value'
- e[item.label] = dictObj[item.value].find(k => Number(k[idKey]) === e[item.key])[valueKey]
- }
- const list = e.jobList
- if (!item.isEnter) {
- // 职位列表
- e.jobList = dealDictData(e.jobList, list)
- }
- return e
- })
- })
- }
- // 字典
- const getDictList = async () => {
- dictList.forEach(async (val) => {
- const { data } = await getDict(val.type, val.params, val.apiType)
- dictObj[val.value] = data
- })
- }
- const getData = async () => {
- await getDictList()
- getHotEnterpriseList()
- }
- getData()
- </script>
|