Xiao_123 hai 8 meses
pai
achega
a954e837e9
Modificáronse 5 ficheiros con 282 adicións e 3 borrados
  1. 103 1
      api/common.js
  2. 12 0
      api/user.js
  3. 9 2
      pagesA/seenMe/index.vue
  4. 110 0
      utils/position.js
  5. 48 0
      utils/useDictionaries.js

+ 103 - 1
api/common.js

@@ -73,7 +73,109 @@ export const getDictData = (params) => {
     params,
     custom: {
       showLoading: false,
-      auth: true
+      auth: false
+    }
+  })
+}
+
+// 获取行业列表
+export const getIndustryListData = (params) => {
+  return request({
+    url: '/menduner/system/industry/list',
+    method: 'GET',
+    params,
+    custom: {
+      showLoading: false,
+      auth: false
+    }
+  })
+}
+
+// 获取技能列表
+export const getSkillList = () => {
+  return request({
+    url: '/menduner/system/skill/list',
+    method: 'GET',
+    custom: {
+      showLoading: false,
+      auth: false
+    }
+  })
+}
+
+// 获取行业树形
+export const getIndustryTreeData = (params) => {
+  return request({
+    url: '/menduner/system/industry/get/tree',
+    method: 'GET',
+    params,
+    custom: {
+      showLoading: false,
+      auth: false
+    }
+  })
+}
+
+// 获取地区列表
+export const getAreaListData = (params) => {
+  return request({
+    url: '/menduner/system/area/list',
+    method: 'GET',
+    params,
+    custom: {
+      showLoading: false,
+      auth: false
+    }
+  })
+}
+
+// 获取地区获取地区map
+export const getAreaMapData = (params) => {
+  return request({
+    url: '/menduner/system/area/map',
+    method: 'GET',
+    params,
+    custom: {
+      showLoading: false,
+      auth: false
+    }
+  })
+}
+
+// 获得职位类型
+export const getPositionTreeData = (params) => {
+  return request({
+    url: '/menduner/system/position/get/tree',
+    method: 'GET',
+    params,
+    custom: {
+      showLoading: false,
+      auth: false
+    }
+  })
+}
+
+// 获取职位列表
+export const getPositionData = (params) => {
+  return request({
+    url: '/menduner/system/position/list',
+    method: 'GET',
+    params,
+    custom: {
+      showLoading: false,
+      auth: false
+    }
+  })
+}
+
+// 获取区域树形
+export const getAreaTreeData = () => {
+  return request({
+    url: '/menduner/system/area/get/tree',
+    method: 'GET',
+    custom: {
+      showLoading: false,
+      auth: false
     }
   })
 }

+ 12 - 0
api/user.js

@@ -49,4 +49,16 @@ export const getInterestedMePage = (params) => {
       auth: true
     }
   })
+}
+
+// 众聘比例信息
+export const getPublicRatio = () => {
+  return request({
+    url: '/menduner/system/hire-commission-ratio/get',
+    method: 'GET',
+    custom: {
+      showLoading: false,
+      auth: false
+    }
+  })
 }

+ 9 - 2
pagesA/seenMe/index.vue

@@ -5,6 +5,7 @@
 <script setup>
 import { ref } from 'vue'
 import { getInterestedMePage } from '@/api/user'
+import { dealDictObjData } from '@/utils/position'
 
 const queryParams = ref({
   pageNo: 1,
@@ -13,8 +14,14 @@ const queryParams = ref({
 
 const list = ref([])
 const getList = async () => {
-  const { data } = await getInterestedMePage(queryParams.value)
-  list.value = data
+  const res = await getInterestedMePage(queryParams.value)
+  const { data } = res
+  if (!data.list.length) return
+  list.value = data.list.map(e => {
+    e.enterprise = dealDictObjData({}, e.enterprise)
+    e.active = false
+    return e
+  })
 }
 
 getList()

+ 110 - 0
utils/position.js

@@ -0,0 +1,110 @@
+import { reactive, ref } from 'vue'
+import { getDict } from './useDictionaries'
+import { getPublicRatio } from '@/api/user'
+
+const dictObj = reactive({
+  payUnit: [], // 薪资单位
+  scale: [], // 规模
+  industry: [], // 行业
+  edu: [], // 学历
+  exp: [], // 工作经验
+  area: [], // 地区
+  jobStatus: [], // 求职状态
+  marital: [], // 婚姻状态
+  financing: [] // 融资阶段
+})
+const dictList = ref([
+  { type: 'menduner_pay_unit', value: 'payUnit', key: 'payUnit', label: 'payName' },
+  { type: 'menduner_financing_status', value: 'financing', key: 'financingStatus', label: 'financingName' },
+  { type: 'menduner_scale', value: 'scale', key: 'scale', label: 'scaleName' },
+  { type: 'menduner_job_status', value: 'jobStatus', key: 'jobStatus', label: 'jobStatusName' },
+  { type: 'menduner_marital_status', value: 'marital', key: 'maritalStatus', label: 'maritalStatusName' },
+  { 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' },
+  { type: 'positionData', value: 'position', key: 'positionId', label: 'positionName', params: {}, apiType: 'positionData', nameKey: 'nameCn', valueKey: 'id' }
+])
+
+// 字典
+const getDictList = async () => {
+  dictList.value.forEach(async (val) => {
+    const { data } = await getDict(val.type, val.params, val.apiType)
+    dictObj[val.value] = data.data
+  })
+}
+export const getDictListData = async () => {
+  await getDictList()
+}
+getDictListData()
+
+export const dealDictArrayData = (res, list) => {
+  res = list.map(item => {
+    Object.keys(item).map(e => {
+      const data = dictList.value.find(k => k.key === e)
+      if (!data) return
+      const valueKey = data.nameKey ? data.nameKey : 'label'
+      const idKey = data.valueKey ? data.valueKey : 'value'
+      if (!dictObj[data.value] || !Object.keys(dictObj[data.value]).length) return
+      const result = dictObj[data.value].find(val => val[idKey] === item[e])
+      if (!result) return
+      item[data.label] = result[valueKey] || ''
+    })
+    return { ...item, active: false, select: false }
+  })
+  return res
+}
+
+export const dealDictObjData = (res, obj) => {
+  res = obj
+  Object.keys(obj).map(e => {
+    const data = dictList.value.find(k => k.key === e)
+    if (!data) return
+    const valueKey = data.nameKey ? data.nameKey : 'label'
+    const idKey = data.valueKey ? data.valueKey : 'value'
+    const result = dictObj[data.value]?.find(val => val[idKey] === obj[e])
+    if (!result) return
+    res[data.label] = result[valueKey]
+    res = { ...obj, ...res }
+  })
+  return res
+}
+
+// 获取单个字典对应的数值
+export const getDictValueWithLabel = (dict, value, valueKey = 'value', labelKey = 'label') => {
+  let result = ''
+  getDict(dict).then(({ data }) => {
+    if (!data || !data.length) return
+    const obj = data.find(e => e[valueKey] === value)
+    if (!obj) return
+    result = obj[labelKey]
+  })
+  return result
+}
+
+// 计算众聘佣金
+let data
+const list = ['headhuntRate', 'recommendRate', 'cvRate'] // 平台、推荐人、投递人
+const getRation = async () => {
+  data = await getPublicRatio()
+}
+// getRation()
+
+export const rechargeRatio = () => { return 10 }
+
+export const commissionCalculation = (count, type) => {
+  if (!data || !Object.keys(data).length) return
+  // 所占的百分比
+  const ratio = parseFloat(data[list[type]]) / 100 // 所占的百分比-> 50%变为0.5 (不能改)
+  // 积分变成金额
+  const value = count * ratio / rechargeRatio()
+  return value % 1 === 0 ? Math.floor(value) : value.toFixed(2)
+}
+
+// "分"和"元" 转化。 type-> toCent:提交给后端需要乘以100; toYuan:回显需要除以100)
+export const FenYuanTransform = (count, type='toYuan') => {
+  if ((count - 0) === 0) return 0
+  if (!count) return ''
+  const Magnification = type === 'toCent' ? 100 : 1/100 
+  return type === 'toCent' ? (count - 0)*Magnification : ((count - 0)*Magnification).toFixed(2)
+}

+ 48 - 0
utils/useDictionaries.js

@@ -0,0 +1,48 @@
+import {
+  getDictData,
+  getIndustryListData,
+  getSkillList,
+  getIndustryTreeData,
+  getAreaListData,
+  getAreaMapData,
+  getPositionTreeData,
+  getAreaTreeData,
+  getPositionData
+} from '@/api/common'
+
+const setDict = (type, val, cacheTime = 7200) => {
+  uni.setStorageSync(type, JSON.stringify({
+    data: val,
+    expire: Date.now() + cacheTime * 1000
+  }))
+}
+
+export const getDict = (type, params, apiType = 'dict') => {
+    if (!type) {
+      return []
+    }
+    return new Promise((resolve) => {
+      const item = uni.getStorageSync(type)
+      const catchData = item ? JSON.parse(item) : null
+      if (catchData && catchData.expire && (Date.now() <= catchData.expire)) {
+        return resolve({ data: catchData.data })
+      }
+      // 传参按照规范参数传
+      const query = params ? params : { type }
+      const apiFn = {
+        dict: getDictData,
+        positionTreeData: getPositionTreeData, // 职位tree
+        areaTreeData: getAreaTreeData, // 区域tree
+        industryTreeData: getIndustryTreeData, // 行业tree
+        industryList: getIndustryListData,
+        skillList: getSkillList,
+        areaList: getAreaListData,
+        areaMap: getAreaMapData,
+        positionData: getPositionData
+      }
+      apiFn[apiType](query).then(data => {
+        setDict(type, data, Date.now())
+        resolve({ data })
+      })
+    })
+}