|
@@ -24,67 +24,24 @@
|
|
|
|
|
|
<script setup name="hotPromotedPositions">
|
|
|
import PositionCard from '@/components/Position/item.vue'
|
|
|
-import { ref, reactive } from 'vue'
|
|
|
-import { useRouter } from 'vue-router'
|
|
|
+import { ref } from 'vue'
|
|
|
import { getPromotedPosition, getLatestPosition, getUrgentPosition } from '@/api/position'
|
|
|
-import { getDict } from '@/hooks/web/useDictionaries'
|
|
|
+import { dealData } from '@/views/recruit/position/components/dict'
|
|
|
|
|
|
const tab = ref(1)
|
|
|
const items = ref([])
|
|
|
-const dictObj = reactive({
|
|
|
- payUnit: [], // 薪资单位
|
|
|
- scale: [], // 规模
|
|
|
- industry: [], // 行业
|
|
|
- edu: [], // 学历
|
|
|
- exp: [], // 工作经验
|
|
|
- area: [] // 地区
|
|
|
-})
|
|
|
-const dictList = [
|
|
|
- { type: 'menduner_pay_unit', value: 'payUnit', key: 'payUnit', label: 'payName' },
|
|
|
- { type: 'menduner_scale', value: 'scale', key: 'scale', label: 'scaleName' },
|
|
|
- { type: 'menduner_industry_type', value: 'industry', key: 'industryId', label: 'industryName', params: {}, apiType: 'industryList', nameKey: 'nameCn', valueKey: 'id' },
|
|
|
- { 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' }
|
|
|
-]
|
|
|
|
|
|
// 推荐职位
|
|
|
const getPositionList = async () => {
|
|
|
const api = tab.value === 1 ? getPromotedPosition : (tab.value === 2 ? getLatestPosition : getUrgentPosition)
|
|
|
const { list } = await api({ pageNo: 1, pageSize: 9 })
|
|
|
- dictList.forEach(item => {
|
|
|
- items.value = list.map(e => {
|
|
|
- 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]) === Number(e[item.key]))[valueKey] || ''
|
|
|
- e.active = false
|
|
|
- return e
|
|
|
- })
|
|
|
- })
|
|
|
+ items.value = dealData(items.value, list)
|
|
|
}
|
|
|
-
|
|
|
-// 字典
|
|
|
-const getDictList = async () => {
|
|
|
- dictList.forEach(async (val) => {
|
|
|
- const { data } = await getDict(val.type, val.params, val.apiType)
|
|
|
- dictObj[val.value] = data
|
|
|
- })
|
|
|
-}
|
|
|
-getDictList()
|
|
|
getPositionList()
|
|
|
|
|
|
// 职位详情
|
|
|
-const info = ref({})
|
|
|
-const router = useRouter()
|
|
|
const handlePosition = (item) => {
|
|
|
- info.value = item
|
|
|
- let routeData = router.resolve({
|
|
|
- path: `/recruit/position/details/${item.positionId}`,
|
|
|
- query: {
|
|
|
- positionInfo: JSON.stringify(info)
|
|
|
- }
|
|
|
- })
|
|
|
- window.open(routeData.href)
|
|
|
+ window.open(`/recruit/position/details/${item.positionId}`)
|
|
|
}
|
|
|
const handleEnterprise = (item) => {
|
|
|
console.log(item, 'enterprise-item')
|