Parcourir la source

招聘会:克隆职位发布

Xiao_123 il y a 8 heures
Parent
commit
8ce9edeb95
3 fichiers modifiés avec 25 ajouts et 24 suppressions
  1. 2 1
      components/positionItem/index.vue
  2. 4 1
      pagesB/jobFair/editJob.vue
  3. 19 22
      pagesB/jobFair/join.vue

+ 2 - 1
components/positionItem/index.vue

@@ -47,6 +47,7 @@ import {
 const props = defineProps({
   jobId: String,
   fairId: String,
+  isClone: { type: Boolean, default: false }
 })
 
 const jobId = ref('')
@@ -119,7 +120,7 @@ const getSubmitParams = async() => {
     if (!submitParams.payTo) return uni.showToast({ title: '请填写最高薪资', icon: 'none', duration: 2000 })
   }
   
-  if (jobId.value) submitParams.id = jobId.value  // 有id则为编辑
+  if (jobId.value && !props.isClone) submitParams.id = jobId.value  // 有id则为编辑, 职位克隆不需要id
   saveEmit()
 }
 // 

+ 4 - 1
pagesB/jobFair/editJob.vue

@@ -1,6 +1,6 @@
 <template>
   <view>
-    <position :jobId="jobId" :fairId="jobFairId" />
+    <position :jobId="jobId" :fairId="jobFairId" :isClone="isClone" />
   </view>
 </template>
 
@@ -11,8 +11,11 @@ import position from '@/components/positionItem'
 
 const jobId = ref('')
 const jobFairId = ref('')
+const isClone = ref(false)
+
 onLoad((options) => {
 	jobFairId.value = options.jobFairId
   jobId.value = options.jobId
+  if (options?.isClone) isClone.value = true
 })
 </script>

+ 19 - 22
pagesB/jobFair/join.vue

@@ -20,12 +20,14 @@
           </view>
           <view class="ss-m-l-20 label-text">{{ item?.hrName }}</view>
         </view>
-        <view class="list-shape">
+        <view class="list-shape" :style="{'border-radius': item?.hrName ? '0 0 12px 12px' : '12px'}">
           <view>
 						<view class="titleBox">
-							<view style="display: flex;align-items: center;">
+							<view style="display: flex; align-items: center;">
+								<image v-if="item.jobFairId" src="/static/svg/jobFair.svg" class=" ss-m-r-10" style="width: 20px; height: 20px;"></image>
 								<rich-text v-if="item.name?.indexOf('style') !== -1" class="job-name" :nodes="item.name"></rich-text>
 								<view v-else class="job-name">{{ formatName(item.name) }}</view>
+								<span v-if="item.status === '1'" class="color-error">(已关闭)</span>
 							</view>
 						</view>
 						<view class="d-flex align-center justify-space-between ss-m-t-20">
@@ -41,9 +43,12 @@
 								</span>
 							</view>
 						</view>
+						<view v-if="item.jobFairName" class="color-primary font-size-13 ss-m-t-10">
+							招聘会:{{ item.jobFairName }}
+						</view>
 					</view>
           <view class="sub-li-bottom">
-						<view class="sub-li-bottom-item" @tap.stop="handleJoin(item)">添加至招聘会</view>
+						<view class="sub-li-bottom-item" @tap.stop="handleJoin(item)">克隆加入</view>
           </view>
         </view>
       </view>
@@ -56,15 +61,14 @@
 import { ref } from 'vue'
 import { onLoad } from '@dcloudio/uni-app'
 import { formatName } from '@/utils/getText.js'
-import { joinJobFairPosition, getJobFairPositionList } from '@/api/jobFair.js'
+import { getJobAdvertisedList } from '@/api/new/position'
 import { dealDictArrayData } from '@/utils/position'
 import { getUserAvatar } from '@/utils/avatar'
 
 const query = ref({
 	pageSize: 10,
 	pageNo: 1,
-	name: null,
-	jobFairId: null
+	name: null
 })
 const items = ref([])
 const more = ref('more')
@@ -73,7 +77,7 @@ const total = ref(0)
 const getData = async () => {
   try {
 		more.value = 'loading'
-		const { data } = await getJobFairPositionList(query.value)
+		const { data } = await getJobAdvertisedList(query.value)
 
 		if (!data.list.length) {
 			more.value = 'noMore'
@@ -113,27 +117,21 @@ const loadingMore = () => {
 	getData()
 }
 
+const jobFairId = ref('')
 onLoad(async (options) => {
-	query.value.jobFairId = options.jobFairId
+	jobFairId.value = options.jobFairId
 
 	query.value.pageNo = 1
 	await getData()
 })
 
-// 加入职位
+// 克隆职位-跳转招聘会职位编辑
 const handleJoin = async (item) => {
-	uni.showLoading({ title: '加载中' })
-	try {
-		await joinJobFairPosition({ jobId: item.id, jobFairId: query.value.jobFairId })
-		uni.hideLoading()
-		uni.showToast({ title: '加入成功', icon: 'success' })
-
-		setTimeout(() => {
-			uni.navigateBack({ delta: 1 })
-		}, 1000)
-	} catch (e) {
-		uni.hideLoading()
-	}
+	if (!item.id) return uni.showToast({ title: '缺少职位ID', icon: 'none' })
+
+	uni.navigateTo({
+		url: `/pagesB/jobFair/editJob?jobId=${item.id}&jobFairId=${jobFairId.value}&isClone=1`
+	})
 }
 </script>
 
@@ -210,7 +208,6 @@ const handleJoin = async (item) => {
 
 .list-shape {
   background-color: #fff;
-  border-radius: 0 0 12px 12px;
 	padding: 30rpx;
   .titleBox {
     display: flex;