Browse Source

热门职位

Xiao_123 1 year ago
parent
commit
187aa1441c

+ 8 - 0
src/api/common/index.js

@@ -63,4 +63,12 @@ export const getIndustryTreeData = async (params) => {
     url: '/app-api/menduner/system/industry/get/tree',
     params
   })
+}
+
+// 获取行业列表
+export const getIndustryListData = async (params) => {
+  return await request.get({
+    url: '/app-api/menduner/system/industry/list',
+    params
+  })
 }

+ 2 - 2
src/hooks/web/useDictionaries.js

@@ -1,4 +1,4 @@
-import { getDictData, getIndustryTreeData } from '@/api/common/index'
+import { getDictData, getIndustryListData } from '@/api/common/index'
 // 定义对应的api
 // const DICT_CITY_API = {
 //   menduner_exp_type: getDictData
@@ -22,7 +22,7 @@ export const getDict = (type, params, apiType = 'dict') => {
       const query = params ? params : { type }
       const apiFn = {
         dict: getDictData,
-        industryDict: getIndustryTreeData
+        industryList: getIndustryListData
       }
       apiFn[apiType](query).then(data => {
         setDict(type, data, Date.now())

+ 6 - 6
src/views/Home/personal/components/hotPromotedPositions.vue

@@ -37,8 +37,8 @@ const dictObj = reactive({
 })
 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: {} }
+  { type: 'menduner_scale', value: 'scale', key: 'scale', label: 'scaleName' },
+  { type: 'menduner_industry_type', value: 'industry', key: 'industryId', label: 'industryName', params: {}, apiType: 'industryList' }
 ]
 
 // 推荐职位
@@ -47,9 +47,9 @@ const getPositionList = async () => {
   const { list } = await api({ pageNo: 1, pageSize: 9 })
   dictList.forEach(item => {
     items.value = list.map(e => {
-      // const valueKey = item.type === 'menduner_industry_type' ? 'nameCn' : 'label'
-      // const idKey = item.type === 'menduner_industry_type' ? 'id' : 'value'
-      e[item.label] = dictObj[item.value].find(k => Number(k.value) === e[item.key]).label
+      const valueKey = item.type === 'menduner_industry_type' ? 'nameCn' : 'label'
+      const idKey = item.type === 'menduner_industry_type' ? 'id' : 'value'
+      e[item.label] = dictObj[item.value].find(k => Number(k[idKey]) === e[item.key])[valueKey]
       return e
     })
   })
@@ -58,7 +58,7 @@ const getPositionList = async () => {
 // 字典
 const getDictList = async () => {
   dictList.forEach(async (val) => {
-    const { data } = await getDict(val.type, val.params)
+    const { data } = await getDict(val.type, val.params, val.apiType)
     dictObj[val.value] = data
   })
 }