Jelajahi Sumber

Merge branch 'dev' of https://git.citupro.com/zhengnaiwen_citu/menduner into dev

lifanagju_citu 10 bulan lalu
induk
melakukan
7a013cfd44
1 mengubah file dengan 46 tambahan dan 20 penghapusan
  1. 46 20
      src/views/recruit/personal/shareJob/index.vue

+ 46 - 20
src/views/recruit/personal/shareJob/index.vue

@@ -13,26 +13,30 @@
           <span class="salary">{{ info.payFrom }}-{{ info.payTo }}/{{ positionInfo.payName }}</span>
         </div>
         <div class="d-flex justify-space-between mt-4">
-          <div>
-            <div class="banner-tags">
-              <div v-for="k in desc" :key="k.mdi" class="mr-3">
-                <v-icon color="var(--color-666)" size="20">{{ k.mdi }}</v-icon>
-                <span class="f-w-600 ml-1">{{ positionInfo[k.value] }}</span>
-              </div>
-            </div>
-            <div class="mt-4" v-if="info?.tagList">
-              <v-chip size="small" class="mr-1 mb-1" color="primary" label v-for="(k, i) in info.tagList" :key="i">{{ k }}</v-chip>
+          <div class="banner-tags">
+            <div v-for="k in desc" :key="k.mdi" class="mr-3">
+              <v-icon color="var(--color-666)" size="20">{{ k.mdi }}</v-icon>
+              <span class="f-w-600 ml-1">{{ positionInfo[k.value] }}</span>
             </div>
           </div>
+          <div class="mt-4" v-if="info?.tagList">
+            <v-chip size="small" class="mr-1 mb-1" color="primary" label v-for="(k, i) in info.tagList" :key="i">{{ k }}</v-chip>
+          </div>
+        </div>
+        <div class="text-end d-flex align-center justify-space-between mt-3">
           <v-btn
             class="button-item radius"
             color="warning" 
             variant="outlined" 
-            prepend-icon="mdi-heart-outline"
-            @click="null"
-          >{{ $t('position.collection') }}</v-btn>
+            :prepend-icon="isCollection ? 'mdi-heart' : 'mdi-heart-outline'"
+            @click="handleCollection"
+          >{{ isCollection ? $t('position.cancelFavorite') : $t('position.collection') }}</v-btn>
+          <publicRecruitment v-if="info.hire" width="50" height="60"></publicRecruitment>
+        </div>
+        <div v-if="info.hire" class="mt-3">
+          <v-chip v-if="info.hirePrice" label color="primary">赏金:{{ info.hirePrice }}元</v-chip>
+          <v-chip v-if="info.hirePoint" label color="primary">积分:{{ info.hirePoint }}点</v-chip>
         </div>
-        {{ info.hire }}
         <v-divider class="mt-3"></v-divider>
         <div class="mt-3 mb-1 f-w-600">{{ $t('position.jobResponsibilities') }}</div>
         <div class="requirement" v-html="info.content?.replace(/\n/g, '</br>')"></div>
@@ -56,7 +60,7 @@
             <span style="color: var(--color-666);font-size: 15px;">{{ info.address }}</span>
           </div>
         </div>
-        <div class="mb-5 text-center" style="height: 80px; line-height: 80px;">
+        <div class="text-center my-10">
           <v-btn class="mr-2 radius button-item" color="success" variant="outlined" target="_blank" to="/recruit/personal/position">{{ $t('position.moreBtn') }}</v-btn>
           <v-btn class="radius button-item" color="primary" :disabled="delivery" @click="handleDelivery">{{ delivery ? $t('position.delivered') : $t('position.submitResume') }}</v-btn>
         </div>
@@ -88,7 +92,7 @@
 <script setup>
 defineOptions({name: 'recruit-personal-shareJob-index'})
 import { onMounted, ref } from 'vue';
-import { getPositionDetails, jobCvRelCheckSend } from '@/api/position'
+import { getPositionDetails, jobCvRelCheckSend, getPersonJobUnfavorite, getPersonJobFavorite, getJobFavoriteCheck } from '@/api/position'
 import { dealDictObjData } from '@/utils/position'
 import handleDeliveryCom from './components/handleDeliveryCom.vue'
 import login from './components/login.vue'
@@ -123,6 +127,28 @@ const handleCheckJobDelivery = async () => {
   return delivery.value
 }
 
+// 效验求职者是否有收藏该职位
+const isCollection = ref(false)
+const getCollectionStatus = async () => {
+  if (!jobId) return
+  const data = await getJobFavoriteCheck({ jobId })
+  isCollection.value = data
+}
+
+const handleLogin = () => {
+  showQuickResumeDialog.value = true
+  showHandleDelivery.value = !showQuickResumeDialog.value
+}
+
+// 收藏&取消收藏职位
+const handleCollection = async () => {
+  if (!getPersonalToken()) return handleLogin()
+  if (!jobId) return
+  const api = isCollection.value ? getPersonJobUnfavorite : getPersonJobFavorite
+  await api(isCollection.value ? jobId : { jobId })
+  await getCollectionStatus()
+}
+
 // 判断有没有jobId跟sharedById,没有的话关闭当前窗口
 if (!jobId) { // !sharedById
   Snackbar.warning('当前打开的链接无效')
@@ -131,7 +157,10 @@ if (!jobId) { // !sharedById
   }, 2000)
 } else {
   getPositionDetail()
-  if (getPersonalToken()) handleCheckJobDelivery()
+  if (getPersonalToken()) {
+    handleCheckJobDelivery()
+    getCollectionStatus()
+  }
 }
 
 const desc = [
@@ -147,10 +176,7 @@ const handleDelivery = () => {
   if (getPersonalToken()) {
     showHandleDelivery.value = true
     showQuickResumeDialog.value = !showHandleDelivery.value
-  } else {
-    showQuickResumeDialog.value = true
-    showHandleDelivery.value = !showQuickResumeDialog.value
-  }
+  } else handleLogin()
 }
 
 // 快速登录成功