Переглянути джерело

Merge branch 'master' of https://git.nanodreamtech.com/Boss/yizhizan-h5

7 місяців тому
батько
коміт
f173d349a6
1 змінених файлів з 77 додано та 43 видалено
  1. 77 43
      pages/index/index.vue

+ 77 - 43
pages/index/index.vue

@@ -167,7 +167,7 @@
 				<block v-if="current != typeList.length - 1">
 					<view class="gwList flex justify-center" v-if="dataList.length > 0">
 						<view class="gwList-box">
-							<scroll-view scroll-y="true" style="width: 100%;height: 100%;">
+							<scroll-view scroll-y="true" style="width: 100%;height: 100%;" refresher-enabled="true" :refresher-threshold="80" refresher-background="#F2F2F7" refresher-default-style="white" :refresher-triggered="isRefreshing" @refresherrefresh="handlePullDownRefresh" @refresherpulling="onPullingDown" @scrolltolower="loadMore" scroll-with-animation="true">
 								<view class="gwList-box-item flex justify-center" @click="gotoInfo(item.postPushId)"
 									v-for="(item, index) in dataList" :key="index">
 									<view class="gwList-box-item-box">
@@ -243,7 +243,7 @@
 					<empty />
 				</view>
 			</view>
-			<!-- 企业版 -->
+			<!---------------------------------------- 企业版 -------------------------------------------------------->
 			<view v-else class="page-container" :style="{ paddingTop: (12 + statusBarHeight) + 'px' }">
 				<view class="topbg-sticky">
 					<!-- 标题-搜索 -->
@@ -368,6 +368,7 @@
 				<!-- 简历列表 -->
 				<view class="qyList flex justify-center">
 					<view class="qyList-box">
+						<scroll-view scroll-y="true" style="width: 100%;height: 100%;" refresher-enabled="true" :refresher-threshold="80" refresher-background="#F2F2F7" refresher-default-style="white" :refresher-triggered="isRefreshing" @refresherrefresh="handlePullDownRefresh" @refresherpulling="onPullingDown" @scrolltolower="loadMore" scroll-with-animation="true">
 						<view class="qyList-box-item flex justify-center" v-for="(item, index) in datasList"
 							:key="index"
 							@click="goNav('/pages/talentSearch/resumeDetail?resumesId=' + item.resumesId + '&postPushId=' + (jobSxTypeList.length > 0 ? jobSxTypeList[currentJobSx].id : ''))">
@@ -444,6 +445,7 @@
 								</view>
 							</view>
 						</view>
+						</scroll-view>
 						<empty :isShow="false" v-if="datasList.length == 0" />
 					</view>
 				</view>
@@ -486,6 +488,7 @@ export default {
 			dataList: [],
 			current: 0,
 			typeList: [],
+			isRefreshing: false,
 			currentSx: 0,
 			sxTypeList: [{
 				id: 1,
@@ -529,7 +532,7 @@ export default {
 			limit: 10,
 			latitude: '',
 			longitude: '',
-			totlo: '',
+			totlo: 0,
 			education: '', //学历
 			experience: '', //经验
 			industry: '', //行业
@@ -738,42 +741,28 @@ export default {
 		uni.$off('updateIndexType')
 		// uni.$off('city')
 	},
-	//下拉刷新
-	onPullDownRefresh() {
-		this.page = 1
-		if (this.userType == 1) {
-			if (this.current != this.typeList.length - 1) {
-				this.getUserList()
-			} else {
-				this.getComanyList()
-			}
-		} else {
-			this.getPeopList()
-		}
-	},
 	//加载更多
-	onReachBottom() {
-		if (this.page < this.totlo) {
-			this.page += 1
-			if (this.userType == 1) {
-				if (this.current != this.typeList.length - 1) {
-					this.getUserList()
-				} else {
-					this.getComanyList()
-				}
-			} else {
-				this.getPeopList()
-			}
-
-		}
-	},
+	// onReachBottom() {
+	// 	if (this.page < this.totlo) {
+	// 		this.page += 1
+	// 		if (this.userType == 1) {
+	// 			if (this.current != this.typeList.length - 1) {
+	// 				this.getUserList()
+	// 			} else {
+	// 				this.getComanyList()
+	// 			}
+	// 		} else {
+	// 			this.getPeopList()
+	// 		}
+
+	// 	}
+	// },
 	onHide() {
 		//离开页面时关闭吸顶功能,用于处理h5环境运行下'bottom' of null报错的问题
 		this.enable = false
 	},
 	onShow() {
 		let that = this;
-
 		this.getBannerList()
 		this.getgridList()
 		this.getgonggaoList()
@@ -894,6 +883,45 @@ export default {
 
 	},
 	methods: {
+		//下拉过程
+		onPullingDown() {
+			// 可以在这里处理下拉过程中的逻辑,比如显示下拉进度
+		},
+		//下拉刷新处理
+		handlePullDownRefresh() {
+			this.isRefreshing = true
+			this.page = 1
+			if (this.userType == 1) {
+				if (this.current != this.typeList.length - 1) {
+					this.getUserList()
+				} else {
+					this.getComanyList()
+				}
+			} else {
+				this.getPeopList()
+			}
+		},
+		// 加载更多
+		loadMore() {
+			// 检查是否还有更多数据(当前页码小于总页数)
+			if (this.page < this.totlo) {
+				this.page += 1
+				if (this.userType == 1) {
+					if (this.current != this.typeList.length - 1) {
+						this.getUserList()
+					} else {
+						this.getComanyList()
+					}
+				} else {
+					this.getPeopList()
+				}
+			} else {
+				uni.showToast({
+					title: '已加载全部数据',
+					icon: 'none'
+				})
+			}
+		},
 		//去企业详情
 		goInfo(item) {
 			uni.navigateTo({
@@ -973,7 +1001,7 @@ export default {
 			}
 			this.$Request.getT('/app/company/listCompany', data).then(res => {
 				uni.hideLoading()
-				uni.stopPullDownRefresh()
+				this.isRefreshing = false
 				if (res.code == 0) {
 					this.totlo = res.data.pages
 					if (this.page == 1) {
@@ -988,6 +1016,9 @@ export default {
 						icon: 'none'
 					})
 				}
+			}).catch(err => {
+				this.isRefreshing = false
+				uni.hideLoading()
 			})
 		},
 		isSameName(className, name) {
@@ -1277,7 +1308,7 @@ export default {
 			}
 			this.$Request.postJson('/app/resumes/selectResumesList', data).then(res => {
 				// 1. 停止下拉刷新和隐藏loading(无论请求结果如何都执行)
-				uni.stopPullDownRefresh()
+				this.isRefreshing = false
 				uni.hideLoading()
 
 				// 2. 第一层校验:确保res、res.data、res.data.records都存在且为数组
@@ -1309,14 +1340,14 @@ export default {
 					// uni.showToast({ title: '暂无数据', icon: 'none' })
 				}
 			}).catch(err => {
-				// 6. 捕获请求异常(如网络错误、接口500)
-				uni.stopPullDownRefresh()
-				uni.hideLoading()
-				uni.showToast({
-					title: '请求失败,请重试',
-					icon: 'none'
-				})
-				console.error('简历列表请求失败:', err)
+			// 6. 捕获请求异常(如网络错误、接口500)
+			this.isRefreshing = false
+			uni.hideLoading()
+			uni.showToast({
+				title: '请求失败,请重试',
+				icon: 'none'
+			})
+			console.error('简历列表请求失败:', err)
 			})
 		},
 		/**
@@ -1433,7 +1464,7 @@ export default {
 				//userId: uni.getStorageSync('userId') ? uni.getStorageSync('userId') : ''
 			}
 			this.$Request.get('/app/postPush/userGetPostPushList', data).then(res => {
-				uni.stopPullDownRefresh()
+				this.isRefreshing = false
 				uni.hideLoading()
 				if (res.code == 0) {
 					res.data.records.map(item => {
@@ -1462,6 +1493,9 @@ export default {
 					}
 					this.totlo = res.data.pages
 				}
+			}).catch(err => {
+				this.isRefreshing = false
+				uni.hideLoading()
 			})
 		},
 		/**