Bladeren bron

人才地图-人才搜索-详情:展示人才标签

Xiao_123 3 dagen geleden
bovenliggende
commit
310cff149d

+ 3 - 2
src/api/recruit/enterprise/talentMap/search.js

@@ -1,10 +1,11 @@
 import request from '@/config/axios'
 
 // 根据条件获取人才列表
-export const getTalentList = async (data) => {
+export const getTalentList = async (data, signal) => {
 	return await request.post({
 		url: '/api/parse/query-kg',
-		data
+		data,
+		signal
 	})
 }
 

+ 1 - 4
src/config/axios/service.js

@@ -325,10 +325,7 @@ service.interceptors.response.use(
       message = t('sys.api.apiRequestFailed') + message.substr(message.length - 3)
     }
 
-    if (error.config && error.config.url && error.config.url === '/app-api/menduner/system/auth/weixin/login/authorize/code') {
-      console.log(error, '取消请求')
-    }
-    else Snackbar.error(message)
+    if (message !== 'canceled') Snackbar.error(message)
     return Promise.reject(error)
   }
 )

+ 4 - 4
src/views/login/index.vue

@@ -325,11 +325,11 @@ const disabledClick = () => {
 }
 
 const tabChange = (val) => {
+  if (abortController.value) {
+    abortController.value.abort()
+    abortController.value = null
+  }
   if (val === 3) {
-    if (abortController.value) {
-      abortController.value.abort()
-      abortController.value = null
-    }
     query.value.clientId = generateUUID()
     getSocialAuthRedirect()
   }

+ 11 - 1
src/views/recruit/enterprise/newTalentMap/search/components/baseInfo.vue

@@ -1,6 +1,16 @@
 <template>
   <div class="title">基本信息</div>
   <v-container class="descriptions pa-0">
+    <v-row no-gutters class="descriptions-row">
+      <v-col :cols="12">
+        <div class="d-flex">
+          <div class="label">人才标签</div>
+          <div class="value">
+            <v-chip v-for="val in tagList" :key="val.talent" class="mr-2 mb-2" small color="primary" label>{{ val.tag }}</v-chip>
+          </div>
+        </div>
+      </v-col>
+    </v-row>
     <v-row no-gutters class="descriptions-row">
       <v-col :cols="12">
         <div class="d-flex">
@@ -176,7 +186,7 @@
 
 <script setup>
 defineOptions({ name: 'NewTalentMapSearch-detail' })
-defineProps({data: Object})
+defineProps({ data: Object, tagList: Array })
 </script>
 
 <style lang="scss" scoped>

+ 46 - 18
src/views/recruit/enterprise/newTalentMap/search/index.vue

@@ -1,16 +1,19 @@
 <template>
 	<div>
-		<v-card elevation="5" class="px-10 py-10 d-flex align-center" :height="items.length ? 'auto' : '300px'">
-			<TextInput
-        v-model="content"
-        :item="textItem"
-        @enter="handleSearch"
-        @appendInnerClick="handleSearch"
-      ></TextInput>
-      <v-btn color="primary" width="100" class="ml-5" :loading="loading" @click="handleSearch">搜 索</v-btn>
+		<v-card elevation="5" class="px-10 py-10 d-flex flex-column justify-center" :height="items.length ? 'auto' : '300px'">
+			<div class="d-flex align-center">
+        <TextInput
+          v-model="content"
+          :item="textItem"
+          @enter="handleSearch"
+          @appendInnerClick="handleSearch"
+        ></TextInput>
+        <v-btn color="primary" width="100" class="ml-5" :loading="loading" @click="handleSearch">搜 索</v-btn>
+      </div>
+      <div v-if="!isSearch" class="color-999 mt-1 font-size-14">例如:有酒店筹开经验,且担任总经理的人</div>
 		</v-card>
 
-		<v-card v-if="items && items.length" elevation="5" class="mt-3">
+		<v-card v-if="isSearch" elevation="5" class="mt-3">
 			<CtTable
 				:items="items"
 				class="pa-3"
@@ -34,28 +37,33 @@
       <!-- 名片 -->
       <div v-if="previewUrl">
         <div class="color-primary font-size-18 font-weight-bold">名片</div>
-		    <img width="100%" :src="previewUrl" />
+		    <div class="text-center cursor-pointer" @click="showPreview = true">
+          <img width="300" height="400" :src="previewUrl" />
+        </div>
       </div>
       <!-- 基本信息 -->
-      <baseInfo :data="detail"></baseInfo>
+      <baseInfo :data="detail" :tagList="talentTags"></baseInfo>
       <!-- 职业轨迹 -->
       <careerPath :data="detail"></careerPath>
 		</v-navigation-drawer>
 	</div>
 
 	<Loading :visible="detailLoading"></Loading>
+
+  <PreviewImage v-if="showPreview" :initialIndex="0" :urlList="[previewUrl]" @close="showPreview = !showPreview" />
 </template>
 
 <script setup>
 defineOptions({ name: 'NewTalentMapSearch' })
 import { ref } from 'vue'
 import { getTalentList, getBusinessCardDetails } from '@/api/recruit/enterprise/talentMap/search'
-import { getTalentCardByImagePath } from '@/api/recruit/enterprise/talentMap/labeling'
+import { getTalentCardByImagePath, getTalentTagById } from '@/api/recruit/enterprise/talentMap/labeling'
 import Snackbar from '@/plugins/snackbar'
 import baseInfo from './components/baseInfo.vue'
 import careerPath from './components/careerPath.vue'
 
 const loading = ref(false)
+const showPreview = ref(false)
 const detailLoading = ref(false)
 const content = ref('')
 const items = ref([])
@@ -76,14 +84,23 @@ const textItem = ref({
 	hideDetails: true,
   appendInnerIcon: 'mdi-magnify'
 })
+const isSearch = ref(false)
+const abortController = ref(null)
 
 // 人才列表
 const getList = async () => {
 	loading.value = true
 	try {
-		const data = await getTalentList({ query_requirement: content.value })
-		items.value = data || []
-    if (!data || !data.length) Snackbar.warning('暂无数据,请更换查询条件后再试')
+    abortController.value = new AbortController()
+		const signal = abortController.value.signal
+		const data = await getTalentList({ query_requirement: content.value }, signal)
+    if (!data || !data.length) {
+      Snackbar.warning('暂无数据,请更换查询条件后再试')
+      items.value = []
+      isSearch.value = false
+      return
+    }
+    items.value = data || []
 	} finally {
 		loading.value = false
 	}
@@ -92,15 +109,16 @@ const getList = async () => {
 // 查看详情
 const showDetail = ref(false)
 const detail = ref({})
+const talentTags = ref([])
 const previewUrl = ref(null)
-const handleDetail = async (item) => {
-	if (!item?.pg_id) {
+const handleDetail = async ({ pg_id }) => {
+	if (!pg_id) {
 		return
 	}
 
   detailLoading.value = true
 	try {
-    const result = await getBusinessCardDetails(item.pg_id)
+    const result = await getBusinessCardDetails(pg_id)
     if (!result || !Object.keys(result).length) return Snackbar.warning('暂无详细信息,去查看其他人的信息吧~')
     detail.value = result
 
@@ -110,6 +128,10 @@ const handleDetail = async (item) => {
       previewUrl.value = URL.createObjectURL(data)
     }
 
+    // 获取人才标签
+		const tagData = await getTalentTagById(pg_id)
+		talentTags.value = tagData ?? []
+
     showDetail.value = true
   } finally {
     detailLoading.value = false
@@ -120,8 +142,14 @@ const handleDetail = async (item) => {
 const handleSearch = async (value, type) => {
   if (type === 'clear') {
     items.value = []
+    isSearch.value = false
+    if (abortController.value) {
+      abortController.value.abort() 
+      abortController.value = null
+    }
     return
   }
+  isSearch.value = true
   if (!type && !content.value) return Snackbar.warning('请输入您的描述信息定位人才')
   getList()
 }