瀏覽代碼

招聘职位分页改为加载更多

Xiao_123 4 月之前
父節點
當前提交
51c4758328

File diff suppressed because it is too large
+ 0 - 0
src/assets/svg/jobFair.svg


+ 20 - 13
src/views/recruit/personal/jobFair/details/components/jobCard.vue

@@ -26,12 +26,7 @@
 				</div>
 			</v-card>
 		</v-hover>
-		<CtPagination
-      :total="total"
-      :page="query.pageNo"
-      :limit="query.pageSize"
-      @handleChange="handleChangePage"
-    ></CtPagination>
+		<div :class="['loading', {'defaultLink-i': !loadingType}]" @click="handleChangePage">{{ loadingText[loadingType] }}</div>
 	</div>
 	<Empty v-else :elevation="false" message="该企业暂无在招职位,换个企业试试吧"></Empty>
 </template>
@@ -58,7 +53,6 @@ const query = reactive({
 	keyword: '',
 	jobFairId: props.jobFairId
 })
-const total = ref(0)
 // 城市、学历、工作经验
 const desc = [
   { mdi: 'mdi-map-marker-outline', value: 'areaName' },
@@ -75,19 +69,23 @@ const textItem = ref({
 	hideDetails: true,
   appendInnerIcon: 'mdi-magnify'
 })
+const loadingText = ['加载更多', '加载中...', '没有更多数据了']
+const loadingType = ref(0)
 
 // 职位列表
 const getPositionList = async () => {
 	loading.value = true
+	loadingType.value = 1
 	try {
-		const { list, total: number } = await getJobFairEntJobPage(query)
+		const { list, total } = await getJobFairEntJobPage(query)
 		if (!list || !list.length) {
 			items.value = []
 			total.value = 0
+			loadingType.value = 2
 			return
 		}
-		total.value = number
-		items.value = dealDictArrayData([], list)
+		items.value = items.value.concat(dealDictArrayData([], list))
+		loadingType.value = items.value.length === total ? 2 : 0
 		loading.value = false
 	} catch {}
 }
@@ -99,9 +97,10 @@ const handleSearch = (val) => {
 	getPositionList()
 }
 
-// 分页
-const handleChangePage = (index) => {
-  query.pageNo = index
+// 加载更多
+const handleChangePage = () => {
+  if (loadingType.value) return // 没有更多数据了
+  query.pageNo++
   getPositionList()
 }
 
@@ -110,6 +109,8 @@ watch(
 	(val) => {
 		query.enterpriseId = val
 		query.keyword = ''
+		query.pageNo = 1
+		items.value = []
 		getPositionList()
 	},
 	{ immediate: true }
@@ -136,4 +137,10 @@ const handleClick = (id) => {
 		color: var(--v-primary-base)
 	}
 }
+.loading {
+  margin-top: 8px;
+  text-align: center;
+  font-size: 13px;
+  color: gray;
+}
 </style>

+ 1 - 1
src/views/recruit/personal/jobFair/details/index.vue

@@ -81,7 +81,7 @@ const getList = async () => {
 		const list = result?.list || []
 		if (list.length) {
 			items.value = items.value.concat(dealDictArrayData([], list))
-			loadingType.value = list.length  === result.total ? 2 : 0
+			loadingType.value = items.value.length === result.total ? 2 : 0
 			enterpriseId.value = items.value[0].id
 			enterpriseName.value = formatName(items.value[0].anotherName || items.value[0].name)
 		} else {

Some files were not shown because too many files changed in this diff