Jelajahi Sumber

人才详情-立即沟通

Xiao_123 2 bulan lalu
induk
melakukan
dda07eaa9a

+ 1 - 0
hooks/useIM.js

@@ -404,6 +404,7 @@ export async function prologue ({userId, enterpriseId, text}) {
 export async function talkToUser ({userId, text}) {
   const { channel, isNewTalk } = await checkConversation(userId)
   if (!isNewTalk) send(text, channel)
+  return channel
 }
 
 // 检测是否存在频道

+ 0 - 3
pages/index/communicate.vue

@@ -121,9 +121,6 @@ const handleTo = (item) => {
 	const query = {
 		id: userInfoVo?.userInfoResp?.userId,
 		name: thatName,
-		postName: postNameCn,
-		enterpriseName: formatName(enterpriseAnotherName),
-		enterpriseId: userInfoVo?.userInfoResp?.enterpriseId,
 		channelID: channel_id,
 		channelType: channel_type,
 		avatar: userInfoVo?.userInfoResp?.avatar,

+ 1 - 1
pages/index/components/talentItem.vue

@@ -89,7 +89,7 @@ const handleDetail = ({ userId }) => {
 		return
 	}
 	uni.navigateTo({
-		url: `/pagesB/personnelDetails/index?id=${userId}`
+		url: `/pagesB/personnelDetails/index?id=${userId}&type=1`
 	})
 }
 </script>

+ 112 - 10
pagesB/personnelDetails/index.vue

@@ -1,5 +1,5 @@
 <template>
-	<view style="padding: 15px 15px 70px 15px; position: relative;">
+	<view style="padding: 15px 15px 70px 15px;">
 		<baseInfo v-if="cvData?.person" :data="cvData?.person" />
 
 		<view v-if="skillExp?.length">
@@ -46,8 +46,15 @@
 			<trainingExperience :data="cvData?.trainList" />
 		</view>
 
-		<view class="bottom-actions">
-			操作按钮
+		<view class="bottom-sticky">
+			<view class="bottom-content">
+        <!-- <button class="bottom-content-tool shareButtonCss" open-type="share">
+          <uni-icons type="redo-filled" size="24" color="#00B760" style="line-height: 24px;"/>
+          <span style="color:#00B760;font-weight:bold;line-height: 22px;">分享</span>
+        </button> -->
+				<button class="btnStyle bgButtons ss-m-l-15" type="primary" plain="true" @tap="handleSend">立即沟通</button>
+        <button class="buttons btnStyle" type="primary" @click="handleInvite">邀请面试</button>
+      </view>
 		</view>
 	</view>
 </template>
@@ -66,6 +73,10 @@ import jobIntention from './components/jobIntention.vue'
 import workExp from './components/workExp.vue'
 import eduExp from './components/eduExp.vue'
 import trainingExperience from './components/trainingExperience.vue'
+import { getJobAdvertisedList } from '@/api/new/position'
+import { defaultText, talkToUser } from '@/hooks/useIM'
+import { getAccessToken } from '@/utils/request'
+import { showAuthModal } from '@/hooks/useModal'
 
 const cvData = ref({})
 
@@ -109,8 +120,17 @@ const getDetail = async (id) => {
 	}
 }
 
+// 职位列表
+const jobNum = ref(0)
+const getJobList = async () => {
+  const { data } = await getJobAdvertisedList({ pageNo: 1, pageSize: 10, hasExpiredData: false, status: 0 })
+  jobNum.value = data?.total || 0
+}
+
+
+const btnType = ref('') // 1: 人才详情 2:简历投递
 onLoad(async (options) => {
-	const { id } = options
+	const { id, type } = options
 	if (!id) {
 		uni.showToast({
 			title: '缺少人员id',
@@ -121,8 +141,67 @@ onLoad(async (options) => {
 		}, 1000)
 		return
 	}
+	btnType.value = type
 	await getDetail(id)
+
+	getJobList()
 })
+
+// 邀请面试
+const handleInvite = async () => {
+	if (!getAccessToken()) {
+    showAuthModal()
+    return
+  }
+  // 企业必须有招聘中的职位才能发起沟通
+  if (jobNum.value === 0) {
+		uni.showToast({
+			title: '请先发布招聘职位',
+			icon: 'none',
+			duration: 2000
+		})
+		return
+	}
+}
+
+// 立即沟通
+const handleSend = async () => {
+	if (!getAccessToken()) {
+    showAuthModal()
+    return
+  }
+  // 企业必须有招聘中的职位才能发起沟通
+  if (jobNum.value === 0) {
+		uni.showToast({
+			title: '请先发布招聘职位',
+			icon: 'none',
+			duration: 2000
+		})
+		return
+	}
+  const userId = cvData.value.person.userId
+  if (!userId) return
+  const channel = await talkToUser({ userId, text: defaultText })
+
+	const query = {
+		id: userId,
+		name: cvData.value?.person?.name || cvData.value?.person?.phone,
+		channelID: channel.channelID,
+		channelType: channel.channelType,
+		avatar: cvData.value.person?.avatar,
+		sex: cvData.value.person?.sex,
+	}
+
+	const queryStr = Object.keys(query).reduce((r, v) => {
+		if (!query[v]) {
+			return r
+		}
+		return r += `${v}=${encodeURIComponent(query[v])}&`
+	}, '?')
+	uni.navigateTo({
+    url: `/pagesA/chart/index${queryStr.slice(0, -1)}`
+  })
+}
 </script>
 
 <style scoped lang="scss">
@@ -160,11 +239,34 @@ onLoad(async (options) => {
     font-size: 24rpx;
   }
 }
-.bottom-actions {
-	position: fixed;
-	width: 100%;
-	bottom: 0;
-	height: 50px;
-	background-color: #fff;
+.bottom-content {
+  display: flex;
+  justify-content: space-evenly;
+  align-items: center;
+  width: 100%;
+  margin: 20rpx 0;
+  .btnStyle {
+    flex: 1;
+    margin-right: 20rpx;
+		border-radius: 50rpx;
+  }
+  .bgButtons {
+    border: 2rpx solid #00B760;
+    color: #00B760;
+  }
+  .shareButtonCss {
+    font-size: 16px;
+    background: unset;
+    &::after{
+      border:none !important;
+    }
+  }
+  &-tool {
+    width: 160rpx;
+    display: flex;
+    justify-content: center;
+    flex-direction: column;
+    align-items: center;
+  }
 }
 </style>