xxdezh hace 7 meses
padre
commit
a554e60cc6
Se han modificado 1 ficheros con 129 adiciones y 105 borrados
  1. 129 105
      pages/index/index.vue

+ 129 - 105
pages/index/index.vue

@@ -139,7 +139,8 @@
 
 								<view class="topbg-sx-box-r flex align-center">
 									<!-- 城市 -->
-									<view class="topbg-sx-box-r-i flex align-center" style="" @click="goNav('/package/screen/city?city='+city+'&county='+county+'&type='+'search')">
+									<view class="topbg-sx-box-r-i flex align-center" style=""
+										@click="goNav('/package/screen/city?city='+city+'&county='+county+'&type='+'search')">
 										<text style="margin-right: 10rpx;">{{county?county:city?city:'选择城市'}}</text>
 										<u-icon name="arrow-down" color="#016bf6" size="16"></u-icon>
 									</view>
@@ -147,20 +148,22 @@
 									<!-- <text style="color: #CCCCCC;margin-left: 30rpx;margin-right: 30rpx;">|</text> -->
 									<block v-if="current != typeList.length - 1">
 										<!-- 筛选 -->
-										<view class="topbg-sx-box-filter flex align-center" :class="{ activeColor: filledFieldsCount }">
+										<view class="topbg-sx-box-filter flex align-center"
+											:class="{ activeColor: filledFieldsCount }">
 											<text style="margin-right: 10rpx;"
 												@click="goNavs('/package/screen/screen')">筛选{{filledFieldsCount}}</text>
-											<u-icon name="arrow-down" :color="filledFieldsCount?'#016bf6':'#999999'" size="16"
-												@click="goNavs('/package/screen/screen')"></u-icon>
+											<u-icon name="arrow-down" :color="filledFieldsCount?'#016bf6':'#999999'"
+												size="16" @click="goNavs('/package/screen/screen')"></u-icon>
 										</view>
 									</block>
 									<block v-else>
 										<!-- 筛选 -->
-										<view class="topbg-sx-box-filter flex align-center" :class="{ activeColor: filledFieldsCount }">
+										<view class="topbg-sx-box-filter flex align-center"
+											:class="{ activeColor: filledFieldsCount }">
 											<text style="margin-right: 10rpx;"
 												@click="goNavs('/package/screen/screenComp')">筛选{{filledFieldsCount}}</text>
-											<u-icon name="arrow-down" color="filledFieldsCount?'#016bf6':'#999999'" size="16"
-												@click="goNavs('/package/screen/screenComp')"></u-icon>
+											<u-icon name="arrow-down" color="filledFieldsCount?'#016bf6':'#999999'"
+												size="16" @click="goNavs('/package/screen/screenComp')"></u-icon>
 										</view>
 									</block>
 								</view>
@@ -628,9 +631,9 @@
 		},
 		computed: {
 			filledFieldsCount() {
-		       const fields = [this.education, this.experience, this.industry, this.salaryRange, this.companyPeople];
-		       const count = fields.filter(item => item).length;
-		       return count > 0 ? '·' + count : '';
+				const fields = [this.education, this.experience, this.industry, this.salaryRange, this.companyPeople];
+				const count = fields.filter(item => item).length;
+				return count > 0 ? '·' + count : '';
 			}
 		},
 		watch: {
@@ -739,47 +742,9 @@
 				})
 				that.directionList = prefer
 			})
-	
-				  		
-			uni.getLocation({
-				type: 'wgs84', //wgs84  gcj02
-				success: function(res) {
-					console.log(res, '地理位置');
-					that.latitude = res.latitude;
-					that.longitude = res.longitude;
-					if (that.userType == 1) {
-						// that.getUserList();
-						that.getPostType()
-					} else {
-						that.getCompanyClassify()
-					}
-					// console.log(uni.getStorageSync('city') == '', '22222222222')
-					if (!uni.getStorageSync('city') || uni.getStorageSync('city') == '' || uni.getStorageSync(
-							'city') == null) {
-						// #ifdef APP-PLUS
-						if (res.address) {
-							that.city = res.address.city
-						} else {
-							that.getSelectCity(that.longitude, that.latitude);
-						}
-						// #endif
-						// #ifndef APP
-						that.getSelectCity(that.longitude, that.latitude);
-						// #endif
-					}
-				},
-				fail: function() {
-					console.log('获取地址失败');
-					// 获取位置失败时也要关闭加载并调用数据接口
-					uni.hideLoading()
-					// 即使没有位置信息,也要加载数据
-					if (that.userType == 1) {
-						that.getPostType()
-					} else {
-						that.getCompanyClassify()
-					}
-				}
-			})
+
+
+
 			this.getDomWidth()
 			this.$Request.getT('/app/common/type/255').then(res => {
 				if (res.code === 0) {
@@ -859,7 +824,7 @@
 		},
 		onShow() {
 			let that = this;
-			
+
 			this.getBannerList()
 			this.getgridList()
 			this.getgonggaoList()
@@ -893,13 +858,13 @@
 			}
 
 			this.token = uni.getStorageSync('token');
-			const condition=this.$queue.getFilterData()
+			const condition = this.$queue.getFilterData()
 			this.education = condition.education //学历
 			this.experience = condition.experience //经验
 			this.industry = condition.industry //行业
 			this.salaryRange = condition.salaryRange //薪资
 			this.companyPeople = condition.companyPeople //公司规模
-			
+
 			// this.getPostType();
 			if (this.userType == 1) {
 				uni.setNavigationBarColor({
@@ -987,6 +952,57 @@
 					url: '/my/enterpriseInfo/enterpriseInfo?companyId=' + item.companyId
 				})
 			},
+			// 
+			async getLocalJobs() {
+				const hasLocation = await this.$queue.checkPermission(
+					'location',
+					'获取位置需要定位权限,用于推荐同城的求职岗位'
+				);
+				if (!hasLocation) return;
+				// 权限通过,调用定位API
+				uni.getLocation({
+					type: 'wgs84', //wgs84  gcj02
+					success: function(res) {
+						console.log(res, '地理位置');
+						that.latitude = res.latitude;
+						that.longitude = res.longitude;
+						if (that.userType == 1) {
+							// that.getUserList();
+							that.getPostType()
+						} else {
+							that.getCompanyClassify()
+						}
+						// console.log(uni.getStorageSync('city') == '', '22222222222')
+						if (!uni.getStorageSync('city') || uni.getStorageSync('city') == '' || uni
+							.getStorageSync(
+								'city') == null) {
+							// #ifdef APP-PLUS
+							if (res.address) {
+								that.city = res.address.city
+							} else {
+								that.getSelectCity(that.longitude, that.latitude);
+							}
+							// #endif
+							// #ifndef APP
+							that.getSelectCity(that.longitude, that.latitude);
+							// #endif
+						}
+					},
+					fail: function() {
+						console.log('获取地址失败');
+						// 获取位置失败时也要关闭加载并调用数据接口
+						uni.hideLoading()
+						// 即使没有位置信息,也要加载数据
+						if (that.userType == 1) {
+							that.getPostType()
+						} else {
+							that.getCompanyClassify()
+						}
+					}
+				})
+			},
+
+
 			//获取公司列表
 			getComanyList() {
 				let data = {
@@ -1176,33 +1192,37 @@
 						this.companyName = res.data.companyAllName
 						uni.setStorageSync('companyStatus', this.companyStatus)
 						uni.setStorageSync('companyId', res.data.companyId)
-						this.companyId=this.companyId
-						if(this.companyStatus==1){
+						this.companyId = this.companyId
+						if (this.companyStatus == 1) {
 							uni.showModal({
 								title: '提示',
 								content: '企业正在认证审核中。',
 								complete(ret) {
 									if (ret.confirm) {
-									uni.navigateTo({ url: "/my/renzheng/editCompany" });
+										uni.navigateTo({
+											url: "/my/renzheng/editCompany"
+										});
 									}
 								}
 							})
 						}
-						if(this.companyStatus==3){
+						if (this.companyStatus == 3) {
 							uni.showModal({
 								title: '提示',
 								content: '企业认证被拒绝。请修改',
 								complete(ret) {
 									if (ret.confirm) {
-									uni.navigateTo({ url: "/package/jobIntention/underReview" });
+										uni.navigateTo({
+											url: "/package/jobIntention/underReview"
+										});
 									}
 								}
 							})
-							
+
 						}
-						
-						
-						
+
+
+
 					} else {
 						this.companyStatus = ''
 					}
@@ -1296,44 +1316,47 @@
 
 				}
 				this.$Request.postJson('/app/resumes/selectResumesList', data).then(res => {
-				  // 1. 停止下拉刷新和隐藏loading(无论请求结果如何都执行)
-				  uni.stopPullDownRefresh()
-				  uni.hideLoading()
-				
-				  // 2. 第一层校验:确保res、res.data、res.data.records都存在且为数组
-				  if (res.code == 0 && res.data && Array.isArray(res.data.records)) {
-				    this.totalPage = res.data.totalPage
-				    this.totlo = res.data.totalPage // 注意:变量名疑似笔误(totlo → totalPage?)
-				
-				    // 3. 处理列表:过滤null/undefined元素 + 安全访问skillTags
-				    const list = res.data.records
-				      .filter(item => item !== null && item !== undefined) // 过滤空元素
-				      .map(item => {
-				        // 安全赋值:item存在时才访问skillTags,否则赋值为空字符串
-				        item.skills = item?.skillTags || '';
-				        return item;
-				      });
-				
-				    // 4. 分页赋值(避免空数组覆盖)
-				    if (this.page == 1) {
-				      this.datasList = list
-				    } else {
-				      this.datasList = [...this.datasList, ...list]
-				    }
-				  } else {
-				    // 5. 异常情况:仅第一页清空列表,避免翻页时丢失数据
-				    if (this.page === 1) {
-				      this.datasList = []
-				    }
-				    // 可选:提示用户无数据
-				    // uni.showToast({ title: '暂无数据', icon: 'none' })
-				  }
+					// 1. 停止下拉刷新和隐藏loading(无论请求结果如何都执行)
+					uni.stopPullDownRefresh()
+					uni.hideLoading()
+
+					// 2. 第一层校验:确保res、res.data、res.data.records都存在且为数组
+					if (res.code == 0 && res.data && Array.isArray(res.data.records)) {
+						this.totalPage = res.data.totalPage
+						this.totlo = res.data.totalPage // 注意:变量名疑似笔误(totlo → totalPage?)
+
+						// 3. 处理列表:过滤null/undefined元素 + 安全访问skillTags
+						const list = res.data.records
+							.filter(item => item !== null && item !== undefined) // 过滤空元素
+							.map(item => {
+								// 安全赋值:item存在时才访问skillTags,否则赋值为空字符串
+								item.skills = item?.skillTags || '';
+								return item;
+							});
+
+						// 4. 分页赋值(避免空数组覆盖)
+						if (this.page == 1) {
+							this.datasList = list
+						} else {
+							this.datasList = [...this.datasList, ...list]
+						}
+					} else {
+						// 5. 异常情况:仅第一页清空列表,避免翻页时丢失数据
+						if (this.page === 1) {
+							this.datasList = []
+						}
+						// 可选:提示用户无数据
+						// uni.showToast({ title: '暂无数据', icon: 'none' })
+					}
 				}).catch(err => {
-				  // 6. 捕获请求异常(如网络错误、接口500)
-				  uni.stopPullDownRefresh()
-				  uni.hideLoading()
-				  uni.showToast({ title: '请求失败,请重试', icon: 'none' })
-				  console.error('简历列表请求失败:', err)
+					// 6. 捕获请求异常(如网络错误、接口500)
+					uni.stopPullDownRefresh()
+					uni.hideLoading()
+					uni.showToast({
+						title: '请求失败,请重试',
+						icon: 'none'
+					})
+					console.error('简历列表请求失败:', err)
 				})
 			},
 			/**
@@ -1343,7 +1366,7 @@
 				let data = {
 					companyId: uni.getStorageSync('companyId')
 				}
-				
+
 				this.$Request.getT('/app/postPush/getCompanyClassify', data).then(res => {
 					if (res.code == 0) {
 						let arr = [
@@ -1352,7 +1375,7 @@
 														name: '全部',
 													}, */
 						]
-						console.log("布的岗位列表",res.data.length)
+						console.log("布的岗位列表", res.data.length)
 						if (res.data.length == 0) {
 							// uni.navigateTo({
 							// 	url: '/pages/my/jobPosting?companyId=' + data.companyId + '&status=' + this
@@ -1361,7 +1384,7 @@
 							uni.navigateTo({
 								url: '/pages/jobManagement/jobManagement'
 							})
-							
+
 						}
 						res.data.map(item => {
 							let obj = {
@@ -2751,9 +2774,10 @@
 		color: #333333;
 		font-size: 24upx;
 	}
-	.activeColor{
+
+	.activeColor {
 		color: #016bf6 !important;
-		border:1rpx solid #016bf6;
+		border: 1rpx solid #016bf6;
 		background: #D6E7FD !important;
 	}
 </style>