Forráskód Böngészése

找人-根据职位推荐

Xiao_123 3 hónapja
szülő
commit
5140423db3

+ 28 - 0
api/search.js

@@ -0,0 +1,28 @@
+import request from "@/utils/request"
+
+// 获取发布的职位列表
+export const getJobAdvertised = async (params) => {
+	return request({
+		url: '/app-api/menduner/system/recruit/job-advertised/list',
+		method: 'GET',
+		params,
+		custom: {
+			showLoading: false,
+			auth: true
+		}
+	})
+}
+
+// 根据职位id获取推荐人才列表
+export const getPersonRecommendPage = (params) => {
+	return request({
+		url: '/app-api/menduner/system/recruit/person-recommend/page',
+		method: 'GET',
+		params,
+		custom: {
+			openEncryption: true,
+			showLoading: false,
+			auth: false
+		}
+	})
+}

+ 105 - 0
pages/index/components/recommend.vue

@@ -0,0 +1,105 @@
+<template>
+	<view>
+		<view style="padding: 0 15px;">
+			<uni-data-select 
+				v-model="query.jobId" 
+				:clear="false" 
+				:localdata="jobList" 
+				@change="handleChangeJob" 
+				placeholder="招聘中职位"
+			></uni-data-select>
+		</view>
+		
+		<scroll-view class="scrollBox" :scroll-y="true" :scroll-top="scrollTop" @scrolltolower="loadingMore" @scroll="onScroll" style="position:relative;">
+			<TalentItem v-if="query.jobId && (items?.length || more !== 'loading')" :items="items" />
+			<uni-load-more v-if="query.jobId" :status="more" />
+			<view v-else class="noJobId">请选择要推荐人才的职位</view>
+		</scroll-view>
+	</view>
+</template>
+
+<script setup>
+import { ref, nextTick } from 'vue'
+import TalentItem from './talentItem.vue'
+import { getPersonRecommendPage } from '@/api/search'
+import { dealDictArrayData } from '@/utils/position'
+
+defineProps({ jobList: Array })
+
+const query = ref({
+	pageNo: 1,
+	paeSize: 20,
+	jobId: null
+})
+const items = ref([])
+const scrollTop = ref(0)
+const old = ref({
+  scrollTop: 0
+})
+const more = ref('more')
+const total = ref(0)
+
+// 根据职位id获取推荐人才列表
+const getRecommendList = async () => {
+  try {
+		more.value = 'loading'
+		const { data } = await getPersonRecommendPage(query.value)
+		scrollTop.value = old.value.scrollTop
+    nextTick(() => {
+      scrollTop.value = 0
+    })
+
+		if (!data.list.length) {
+			more.value = 'noMore'
+			return
+		}
+
+		const list = dealDictArrayData([], data.list).map(e => {
+      e.areaName = e.area?.str ?? ''
+      e.regName = e.reg?.str ?? ''
+      return e
+    })
+		items.value = items.value.concat(list)
+		total.value = data.total
+
+		if (items.value.length === +data.total) {
+      more.value = 'noMore'
+      return
+    }
+	} catch {
+		query.value.pageNo--
+		more.value = 'more'
+	}
+}
+
+// 选择招聘中职位
+const handleChangeJob = (e) => {
+	query.value.pageNo = 1
+	items.value = []
+	if (e) getRecommendList()
+}
+
+// 加载更多
+const loadingMore = () => {
+  more.value = 'loading'
+  query.value.pageNo++
+	getRecommendList()
+}
+
+const onScroll = (e) =>{
+  old.value.scrollTop = e.detail.scrollTop
+}
+</script>
+
+<style scoped lang="scss">
+.noJobId {
+	text-align: center;
+	line-height: 60vh;
+	color: #666;
+}
+.scrollBox{
+  padding-bottom: 24rpx;
+  box-sizing: border-box;
+	margin-top: 10px;
+}
+</style>

+ 80 - 0
pages/index/components/talentItem.vue

@@ -0,0 +1,80 @@
+<template>
+	<view>
+		<uni-card v-for="(val, index) in items" :key="index" :is-shadow="true" @tap.stop="handleDetail(val)" :border='false' shadow="0px 0px 3px 1px rgba(0,0,0,0.2)">
+			<!-- 基本信息 -->
+			<view class="d-flex align-center">
+				<image class="avatar" :src="getUserAvatar(val.avatar, val.sex)" mode="scaleToFill"></image>
+				<view style="flex: 1; margin-left: 10px;">
+					<view class="font-size-18">{{ val.name }}</view>
+					<view class="ss-m-t-10">
+						<span 
+							class="color-666"
+							v-for="(key, index) in desc" 
+							:key="index"
+						>
+							{{ val[key] }}
+							<span v-if="index !== desc.length - 1 && val[key]" class="ss-m-x-10">|</span>
+						</span>
+					</view>
+				</view>
+			</view>
+			<!-- 感兴趣职位 -->
+			<view v-if="val.position?.positionNames" class="ss-m-t-15 color-666">
+				感兴趣职位:{{ val.position?.positionNames || '暂无' }}
+			</view>
+			<!-- 最近一份工作经验 -->
+			<view v-if="val?.lastWorkExp && showLastWorkExp" class="ss-m-t-15 color-666">
+				<view>
+					<uni-icons type="smallcircle" class="ss-m-r-10" color="#666"></uni-icons>
+					{{ val.lastWorkExp.enterpriseName }}
+				</view>
+				<view class="ss-m-l-45">
+					<span>{{ val.lastWorkExp.positionName }}</span>
+					<span v-if="val.lastWorkExp.startTime" class="ss-m-l-20">
+						{{ val.lastWorkExp.startTime ? timesTampChange(val.lastWorkExp.startTime, 'Y-M') : '暂无' }}
+						- 
+						{{ val.lastWorkExp.endTime ? timesTampChange(val.lastWorkExp.endTime, 'Y-M') : val.lastWorkExp.startTime ? '至今' : '' }}
+					</span>
+				</view>
+			</view>
+		</uni-card>
+	</view>
+</template>
+
+<script setup>
+import { getUserAvatar } from '@/utils/avatar.js'
+import { timesTampChange } from '@/utils/date'
+
+defineProps({
+	items: Array,
+	showLastWorkExp: {
+		type: Boolean,
+		default: true
+	}
+})
+
+const desc = ['jobStatusName', 'eduName', 'expName']
+
+const handleDetail = ({ userId }) => {
+	if (!userId) {
+		uni.showToast({
+			title: '资源获取失败,请稍后重试',
+			icon: 'none',
+			duration: 2000
+		})
+		return
+	}
+	uni.navigateTo({
+		url: `/pagesB/personnelDetails/index?id=${userId}`
+	})
+}
+</script>
+
+<style scoped lang="scss">
+.avatar {
+  width: 60px;
+  height: 60px;
+  border-radius: 50%;
+  margin: auto;
+}
+</style>

+ 14 - 10
pages/index/jobFair.vue

@@ -3,17 +3,21 @@
 </template>
 
 <script setup>
-	import layoutPage from '@/layout'
-	import { onShow } from '@dcloudio/uni-app'
-	
+import layoutPage from '@/layout'
+import { onShow } from '@dcloudio/uni-app'
+import { getAccessToken } from '@/utils/request'
+import { showAuthModal } from '@/hooks/useModal'
+
+onShow(() => {
 	// 设置自定义tabbar选中值
-	onShow(() => {
-	    const currentPage = getCurrentPages()[0];  // 获取当前页面实例
-	    const currentTabBar = currentPage?.getTabBar?.();
-	
-	    // 设置当前tab页的下标index
-	    currentTabBar?.setData({ selected: 3 });
-	})
+  const currentPage = getCurrentPages()[0]  // 获取当前页面实例
+  const currentTabBar = currentPage?.getTabBar?.()
+
+  // 设置当前tab页的下标index
+  currentTabBar?.setData({ selected: 3 })
+
+	if (!getAccessToken()) return showAuthModal()
+})
 </script>
 
 <style scoped lang="scss">

+ 59 - 22
pages/index/search.vue

@@ -1,32 +1,69 @@
 <template>
 	<layout-page>
-		<view @tap="handleTo">企业-找人</view>
+		<view >
+      <view style="padding: 15px;">
+				<uni-segmented-control 
+					:current="current"
+					:values="tabList"
+					@clickItem="changeControl"
+					styleType="text"
+					activeColor="#00B760"
+				></uni-segmented-control>
+			</view>
+
+			<!-- 职位推荐 -->
+			<view v-if="current === 0">
+				<RecommendPage :jobList="jobList" />
+			</view>
+			<!-- 条件筛选 -->
+			<view v-else>条件</view>
+
+    </view>
 	</layout-page>
 </template>
 
 <script setup>
-	import layoutPage from '@/layout'
-	import { onShow } from '@dcloudio/uni-app'
-	
-	// // 测试数据
-	// uni.switchTab({
-  //   url: '/pages/index/position'
-  // })
-	
+import layoutPage from '@/layout'
+import { ref } from 'vue'
+import { onShow } from '@dcloudio/uni-app'
+import { getAccessToken } from '@/utils/request'
+import { showAuthModal } from '@/hooks/useModal'
+import { getJobAdvertised, getPersonRecommendPage } from '@/api/search'
+import { dealDictArrayData } from '@/utils/position'
+import { formatName } from '@/utils/getText'
+import RecommendPage from './components/recommend.vue'
+
+const current = ref(0)
+const tabList = ['职位推荐', '条件筛选']
+
+// 职位列表
+const jobList = ref([])
+const getJobList = async () => {
+  const { data } = await getJobAdvertised({ status: 0 })
+  if (data.length) {
+    const list = dealDictArrayData([], data)
+    jobList.value = list.map(e => {
+      return { text: `${formatName(e.name)}_${e.areaName ? e.area?.str : '全国'}`, value: e.id, data: e }
+    })
+  }
+}
+
+onShow(() => {
 	// 设置自定义tabbar选中值
-	onShow(() => {
-	    const currentPage = getCurrentPages()[0];  // 获取当前页面实例
-	    const currentTabBar = currentPage?.getTabBar?.();
-	
-	    // 设置当前tab页的下标index
-	    currentTabBar?.setData({ selected: 0 });
-	})
-
-	const handleTo = () => {
-		uni.navigateTo({
-			url: '/pagesB/personnelDetails/index?id=1'
-		})
-	}
+  const currentPage = getCurrentPages()[0]  // 获取当前页面实例
+  const currentTabBar = currentPage?.getTabBar?.()
+
+  // 设置当前tab页的下标index
+  currentTabBar?.setData({ selected: 0 })
+
+	if (!getAccessToken()) return showAuthModal()
+
+	getJobList()
+})
+
+const changeControl = (e) =>{
+  current.value = e.currentIndex
+}
 </script>
 
 <style scoped lang="scss">

+ 18 - 24
pagesB/personnelDetails/index.vue

@@ -1,11 +1,11 @@
 <template>
 	<view style="padding: 15px 15px 70px 15px; position: relative;">
 		<baseInfo v-if="cvData?.person" :data="cvData?.person" />
-		<view class="gap-line"></view>
 
-		<view>
+		<view v-if="skillExp?.length">
+			<view class="gap-line"></view>
 			<view class="title-line">职业技能</view>
-			<view class="tags" v-if="skillExp?.length">
+			<view class="tags">
         <view
           v-for="skill in skillExp"
           :key="skill.title"
@@ -14,42 +14,36 @@
           {{ skill.title }}
         </view>
       </view>
-			<view v-else class="color-999 text-center">暂无数据</view>
 		</view>
 
-		<view class="gap-line"></view>
-		<view>
+		<view v-if="cvData?.person?.advantage">
+			<view class="gap-line"></view>
 			<view class="title-line">个人优势</view>
-			<advantage v-if="cvData?.person?.advantage" :data="cvData?.person?.advantage" />
-			<view v-else class="color-999 text-center">暂无数据</view>
+			<advantage :data="cvData?.person?.advantage" />
 		</view>
 
-		<view class="gap-line"></view>
-		<view>
+		<view v-if="cvData?.interestedList?.length">
+			<view class="gap-line"></view>
 			<view class="title-line">求职意向</view>
-			<jobIntention v-if="cvData?.interestedList?.length" :data="dealJobData(cvData?.interestedList || [])" />
-			<view v-else class="color-999 text-center">暂无数据</view>
+			<jobIntention :data="dealJobData(cvData?.interestedList || [])" />
 		</view>
 
-		<view class="gap-line"></view>
-		<view>
+		<view v-if="cvData?.eduList?.length">
+			<view class="gap-line"></view>
 			<view class="title-line">教育经历</view>
-			<eduExp v-if="cvData?.eduList?.length" :data="cvData?.eduList" />
-			<view v-else class="color-999 text-center">暂无数据</view>
+			<eduExp :data="cvData?.eduList" />
 		</view>
 
-		<view class="gap-line"></view>
-		<view>
+		<view v-if="cvData?.workList?.length">
+			<view class="gap-line"></view>
 			<view class="title-line">工作经历</view>
-			<workExp v-if="cvData?.workList?.length" :data="cvData?.workList" />
-			<view v-else class="color-999 text-center">暂无数据</view>
+			<workExp :data="cvData?.workList" />
 		</view>
 
-		<view class="gap-line"></view>
-		<view>
+		<view v-if="cvData?.trainList?.length">
+			<view class="gap-line"></view>
 			<view class="title-line">培训经历</view>
-			<trainingExperience v-if="cvData?.trainList?.length" :data="cvData?.trainList" />
-			<view v-else class="color-999 text-center">暂无数据</view>
+			<trainingExperience :data="cvData?.trainList" />
 		</view>
 
 		<view class="bottom-actions">