1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <template>
- <div>
- <HotPromoted :items="items"></HotPromoted>
- <div class="text-center">
- <v-btn class="buttons" color="primary" to="/recruit/personal/company">{{ $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 { dealDictArrayData } from '@/views/recruit/personal/position/components/dict'
- const items = ref([])
- const dictObj = reactive({
- payUnit: [], // 薪资单位
- scale: [], // 规模
- industry: [], // 行业
- edu: [], // 学历
- exp: [], // 工作经验
- area: [], // 地区
- financing: [] // 融资类型
- })
- const dictList = ref([
- { 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.value.forEach(item => {
- items.value = list.map(e => {
- if (item.isEnter) {
- const valueKey = item.nameKey ? item.nameKey : 'label'
- const idKey = item.valueKey ? item.valueKey : 'value'
- const obj = dictObj[item.value].find(k => k[idKey] === e.enterprise[item.key])
- if (!obj) return
- e[item.label] = obj[valueKey]
- }
- const list = e.jobList
- if (!item.isEnter) {
- // 职位列表
- e.jobList = dealDictArrayData([], list).slice(0, 3)
- }
- return e
- })
- })
- }
- // 字典
- const getDictList = async () => {
- dictList.value.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>
|