Jelajahi Sumber

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

lyuis 7 bulan lalu
induk
melakukan
9e3fc3e798
3 mengubah file dengan 428 tambahan dan 284 penghapusan
  1. 424 281
      package/jobIntention/completeMsg.vue
  2. 1 1
      package/records/records.vue
  3. 3 2
      pages/my/index.vue

+ 424 - 281
package/jobIntention/completeMsg.vue

@@ -21,22 +21,32 @@
 				<view class="form-label">填写职务</view>
 				<u-input placeholder="真实的职务,更能赢得牛人的信任" v-model="name" :border="false" class="form-input"></u-input>
 			</view>
+			<!-- email -->
+			<view class="form-item">
+				<view class="form-label">填写email</view>
+				<u-input placeholder="填写email,方便牛人联系" v-model="email" :border="false"
+					:class="{ 'form-input': true, 'error': emailError }" @blur="validateEmailOnBlur"></u-input>
+				<!-- 添加错误提示 -->
+				<view v-if="emailError" class="error-message">
+					{{ emailError }}
+				</view>
+			</view>
 			<view class="form-item">
 				<view class="form-label">求职者视角中的效果</view>
-				<view class="form-border" v-for="(item, inx)  in userpost" :key="inx">
+				<view class="form-border" v-for="(item, inx) in userpost" :key="inx">
 					<view class="form-border-top">
-						<view class="form-border-title">{{item.ruleClassifyName}}</view>
-						<view class="form-border-money">{{item.salaryRange}}</view>
+						<view class="form-border-title">{{ item.ruleClassifyName }}</view>
+						<view class="form-border-money">{{ item.salaryRange }}</view>
 					</view>
-					<view class="form-border-desc">{{item.companyName}}{{item.companyPeople}}人</view>
+					<view class="form-border-desc">{{ item.companyName }}{{ item.companyPeople }}人</view>
 					<view class="form-border-img-name">
 						<view class="people-img">
-							<image v-if="item.hr!=null && item.hr.hrImg" :src="item.hr.hrImg" class="avatar-image"
+							<image v-if="item.hr != null && item.hr.hrImg" :src="item.hr.hrImg" class="avatar-image"
 								mode="aspectFill"></image>
 							<image v-else src="@/static/images/jobApplicant/touxiang.svg" mode="scaleToFill"
 								class="user-img" />
 						</view>
-						<view class="people-name">{{item.hr?item.hr.hrPosition:"无"}} 招聘者</view>
+						<view class="people-name">{{ item.hr ? item.hr.hrPosition : "无" }} 招聘者</view>
 					</view>
 				</view>
 			</view>
@@ -45,143 +55,264 @@
 	</view>
 </template>
 <script>
-	import navBar from "@/components/nav-bar/index.vue";
-	export default {
-		data() {
-			return {
-				avatar: "",
-				name: "",
-				isok: false,
-				userpost: {}
-			};
+import navBar from "@/components/nav-bar/index.vue";
+export default {
+	data() {
+		return {
+			avatar: "",
+			name: "",
+			isok: false,
+			email: '',
+			emailError: "", // 添加错误提示
+			userpost: {}
+		};
+	},
+	components: {
+		navBar,
+	},
+	onShow() {
+		this.getmypost()
+		this.HrFirst()
+	},
+	methods: {
+		goUploadImg() {
+			uni.navigateTo({
+				url: "/package/jobIntention/companyImg"
+			});
+		},
+		goCompanyReview() {
+			if (this.isok) {
+				uni.navigateTo({
+					url: "/package/jobIntention/companyReview",
+				});
+			}
+			return uni.showToast({
+				title: "请补全资料",
+				icon: "none"
+			});
+
+		},
+		// 选择头像
+		chooseAvatar() {
+			var that = this
+
+			// 1. 先判断系统类型,区分Android/iOS权限
+			const systemInfo = uni.getSystemInfoSync();
+			const isAndroid = systemInfo.system.includes('Android');
+			const permissionType = isAndroid ? 'storage' : 'photos'; // Android=存储,iOS=相册
+
+			// 2. 权限检查(复用之前封装的 checkPermission 函数)
+			const hasPermission = this.$queue.checkPermission(
+				permissionType,
+				isAndroid
+					? '选择/拍摄照片需要相机/相册权限,用于上传HR头像' // Android 专属提示
+					: '选择/拍摄照片需要相机/相册权限,用于上传消HR头像'
+			);
+
+			if (!hasPermission) {
+				uni.showToast({ title: '未获取权限,无法选择照片', icon: 'none' });
+				return;
+			}
+
+
+			uni.chooseImage({
+				count: 1,
+				sizeType: ["compressed"],
+				sourceType: ["album", "camera"],
+				success: (res) => {
+					that.$queue.uploadFile(res.tempFilePaths[0], function (path) {
+						console.log("上传返回?:", path)
+						if (path) {
+							that.avatar = path;
+						}
+
+					})
+
+				},
+			});
 		},
-		components: {
-			navBar,
+		//提交hr 信息
+		// 邮箱验证方法
+		validateEmail(email) {
+			const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+			return emailRegex.test(email);
 		},
-		onShow() {
-			this.getmypost()
-			this.HrFirst()
+		// 邮箱失焦验证
+		validateEmailOnBlur() {
+			if (!this.email) {
+				this.emailError = "邮箱不能为空";
+				return;
+			}
+
+			if (!this.validateEmail(this.email)) {
+				this.emailError = "邮箱格式不正确";
+			} else {
+				this.emailError = "";
+			}
 		},
-		methods: {
-			goUploadImg() {
-				uni.navigateTo({
-					url: "/package/jobIntention/companyImg"
+
+		// 实时验证(可选)
+		onEmailInput(e) {
+			this.email = e;
+			// 如果之前有错误,输入时清除错误提示
+			if (this.emailError && this.email) {
+				this.emailError = "";
+			}
+		},
+		// 验证所有表单字段
+		validateForm() {
+			let isValid = true;
+
+			// 验证头像
+			if (!this.avatar) {
+				uni.showToast({
+					title: "请上传头像",
+					icon: "none"
 				});
-			},
-			goCompanyReview() {
-				if (this.isok) {
-					uni.navigateTo({
-						url: "/package/jobIntention/companyReview",
-					});
-				}
-				return uni.showToast({
-					title: "请补全资料",
+				return false;
+			}
+
+			// 验证职务
+			if (!this.name) {
+				uni.showToast({
+					title: "请输入职务",
 					icon: "none"
 				});
+				return false;
+			}
 
-			},
-			// 选择头像
-			chooseAvatar() {
-				var that = this
-				
-				// 1. 先判断系统类型,区分Android/iOS权限
-							const systemInfo = uni.getSystemInfoSync();
-							const isAndroid = systemInfo.system.includes('Android');
-							const permissionType = isAndroid ? 'storage' : 'photos'; // Android=存储,iOS=相册
-								  
-							// 2. 权限检查(复用之前封装的 checkPermission 函数)
-							const hasPermission = this.$queue.checkPermission(
-							  permissionType,
-							  isAndroid 
-							    ? '选择/拍摄照片需要相机/相册权限,用于上传HR头像' // Android 专属提示
-							    : '选择/拍摄照片需要相机/相册权限,用于上传消HR头像'
-							);
-								  
-							if (!hasPermission) {
-							  uni.showToast({ title: '未获取权限,无法选择照片', icon: 'none' });
-							  return;
-							}
-				
-				
-				uni.chooseImage({
-					count: 1,
-					sizeType: ["compressed"],
-					sourceType: ["album", "camera"],
-					success: (res) => {
-						that.$queue.uploadFile(res.tempFilePaths[0], function(path) {
-							console.log("上传返回?:", path)
-							if (path){
-								that.avatar = path;
-							}
-								
-						})
-
-					},
+			// 验证邮箱
+			if (!this.email) {
+				this.emailError = "邮箱不能为空";
+				uni.showToast({
+					title: "请输入邮箱",
+					icon: "none"
 				});
-			},
-			//提交hr 信息
-
-			submithr() {
-				// 验证必填项
-				if (!this.avatar) {
-					return uni.showToast({
-						title: "请上传头像",
-						icon: "none"
-					});
-				}
-				if (!this.name) {
-					return uni.showToast({
-						title: "请输入职务",
-						icon: "none"
-					});
-				}
-				// 构造提交数据
-				const data = {
-					hrImg: this.avatar, //头像
-					hrPosition: this.name, //职位
-				};
-
-				// 调用接口提交
-				uni.showLoading({
-					title: "提交中..."
+				return false;
+			}
+
+			// 验证邮箱格式
+			if (!this.validateEmail(this.email)) {
+				this.emailError = "邮箱格式不正确";
+				uni.showToast({
+					title: "邮箱格式不正确",
+					icon: "none"
 				});
-				this.$Request.postJson("/app/HrFirst/addHr", data)
-					.then((res) => {
-						uni.hideLoading();
-						if (res.code === 0) {
-							this.isok = true
-							uni.showToast({
-								title: "提交成功,请开始招聘吧。",
-								icon: "success"
-							});
-							// uni.navigateTo({
-							// 	url: "/package/jobIntention/companyReview",
-							// });
-							uni.switchTab({
-								url:'/pages/index/index'
-							})
-							
-						} else {
-							uni.showToast({
-								title: res.msg || "提交失败",
-								icon: "none"
-							});
-						}
-					})
-					.catch((err) => {
-						uni.hideLoading();
-						console.error("提交失败:", err);
+				return false;
+			}
+
+			this.emailError = ""; // 清除错误提示
+			return true;
+		},
+
+		// 提交 hr 信息(修改后的版本)
+		submithr() {
+			// 先验证表单
+			if (!this.validateForm()) {
+				return;
+			}
+
+			// 构造提交数据(添加邮箱)
+			const data = {
+				hrImg: this.avatar, // 头像
+				hrPosition: this.name, // 职位
+				hrEmail: this.email // 添加邮箱
+			};
+
+			// 调用接口提交
+			uni.showLoading({
+				title: "提交中..."
+			});
+			this.$Request.postJson("/app/HrFirst/addHr", data)
+				.then((res) => {
+					uni.hideLoading();
+					if (res.code === 0) {
+						this.isok = true;
 						uni.showToast({
-							title: "网络异常",
+							title: "提交成功,请开始招聘吧。",
+							icon: "success"
+						});
+						uni.switchTab({
+							url: '/pages/index/index'
+						});
+					} else {
+						uni.showToast({
+							title: res.msg || "提交失败",
 							icon: "none"
 						});
+					}
+				})
+				.catch((err) => {
+					uni.hideLoading();
+					console.error("提交失败:", err);
+					uni.showToast({
+						title: "网络异常",
+						icon: "none"
 					});
-			
+				});
 		},
 
+		// submithr() {
+		// 	// 验证必填项
+		// 	if (!this.avatar) {
+		// 		return uni.showToast({
+		// 			title: "请上传头像",
+		// 			icon: "none"
+		// 		});
+		// 	}
+		// 	if (!this.name) {
+		// 		return uni.showToast({
+		// 			title: "请输入职务",
+		// 			icon: "none"
+		// 		});
+		// 	}
+		// 	// 构造提交数据
+		// 	const data = {
+		// 		hrImg: this.avatar, //头像
+		// 		hrPosition: this.name, //职位
+		// 	};
+
+		// 	// 调用接口提交
+		// 	uni.showLoading({
+		// 		title: "提交中..."
+		// 	});
+		// 	this.$Request.postJson("/app/HrFirst/addHr", data)
+		// 		.then((res) => {
+		// 			uni.hideLoading();
+		// 			if (res.code === 0) {
+		// 				this.isok = true
+		// 				uni.showToast({
+		// 					title: "提交成功,请开始招聘吧。",
+		// 					icon: "success"
+		// 				});
+		// 				// uni.navigateTo({
+		// 				// 	url: "/package/jobIntention/companyReview",
+		// 				// });
+		// 				uni.switchTab({
+		// 					url: '/pages/index/index'
+		// 				})
+
+		// 			} else {
+		// 				uni.showToast({
+		// 					title: res.msg || "提交失败",
+		// 					icon: "none"
+		// 				});
+		// 			}
+		// 		})
+		// 		.catch((err) => {
+		// 			uni.hideLoading();
+		// 			console.error("提交失败:", err);
+		// 			uni.showToast({
+		// 				title: "网络异常",
+		// 				icon: "none"
+		// 			});
+		// 		});
+
+		// },
+
 		//获取我发布的岗位列表
 		getmypost() {
-			this.$Request.get("/app/postPush/getMyPostPush",{status:""})
+			this.$Request.get("/app/postPush/getMyPostPush", { status: "" })
 				.then((res) => {
 					if (res.code != 0) {
 						uni.showToast({
@@ -191,11 +322,11 @@
 						return;
 					}
 					this.userpost = res.data.records || {};
-					if(this.userpost[0].hr){
-						this.name=this.userpost[0].hr.hrPosition || ""
-						this.avatar=this.userpost[0].hr.hrImg || ""
+					if (this.userpost[0].hr) {
+						this.name = this.userpost[0].hr.hrPosition || ""
+						this.avatar = this.userpost[0].hr.hrImg || ""
 					}
-				
+
 					console.log("查询我的岗位列表状态", res)
 				})
 				.catch((err) => {
@@ -208,7 +339,7 @@
 		},
 		//Hr 名片
 		HrFirst() {
-			this.$Request.get("/app/HrFirst","")
+			this.$Request.get("/app/HrFirst", "")
 				.then((res) => {
 					if (res.code != 0) {
 						uni.showToast({
@@ -217,7 +348,7 @@
 						});
 						return;
 					}
-				
+
 					console.log("Hr 名片", res)
 				})
 				.catch((err) => {
@@ -228,194 +359,206 @@
 					});
 				});
 		},
-		
+
 	},
-	};
+};
 </script>
 <style scoped lang="scss">
-	.company {
-		position: absolute;
-		left: 0;
-		right: 0;
-		top: 0;
-		bottom: 0;
-		display: flex;
-		flex-direction: column;
-		font-family: DM Sans;
+.company {
+	position: absolute;
+	left: 0;
+	right: 0;
+	top: 0;
+	bottom: 0;
+	display: flex;
+	flex-direction: column;
+	font-family: DM Sans;
 
-		.company-content {
-			flex: 1;
-			padding: 40rpx;
+	.company-content {
+		flex: 1;
+		padding: 40rpx;
+		box-sizing: border-box;
+		overflow: hidden;
+		overflow-y: auto;
+
+		.company-title {
+			color: #333;
+			font-size: 40rpx;
+			font-weight: 600;
+			margin-bottom: 20rpx;
+		}
+
+		.form-label {
+			color: #1f2c37;
+			font-family: DM Sans;
+			font-size: 28rpx;
+			font-weight: 500;
+			line-height: 44rpx;
+			padding-top: 30rpx;
+			padding-bottom: 27rpx;
 			box-sizing: border-box;
-			overflow: hidden;
-			overflow-y: auto;
-
-			.company-title {
-				color: #333;
-				font-size: 40rpx;
-				font-weight: 600;
-				margin-bottom: 20rpx;
-			}
+		}
 
-			.form-label {
-				color: #1f2c37;
-				font-family: DM Sans;
-				font-size: 28rpx;
-				font-weight: 500;
-				line-height: 44rpx;
-				padding-top: 30rpx;
-				padding-bottom: 27rpx;
-				box-sizing: border-box;
-			}
+		.avatar-section {
+			display: flex;
+		}
 
-			.avatar-section {
-				display: flex;
-			}
+		.avatar-upload {
+			display: flex;
+			align-items: center;
+		}
 
-			.avatar-upload {
-				display: flex;
-				align-items: center;
-			}
+		.avatar-preview {
+			width: 48rpx;
+			height: 48rpx;
+			border-radius: 50%;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			margin-right: 20rpx;
+		}
 
-			.avatar-preview {
-				width: 48rpx;
-				height: 48rpx;
-				border-radius: 50%;
-				display: flex;
-				align-items: center;
-				justify-content: center;
-				margin-right: 20rpx;
-			}
+		.avatar-image {
+			width: 100%;
+			height: 100%;
+			border-radius: 50%;
+		}
 
-			.avatar-image {
-				width: 100%;
-				height: 100%;
-				border-radius: 50%;
-			}
+		.upload-view {
+			color: #016bf6;
+			font-family: DM Sans;
+			font-size: 20rpx;
+			font-weight: 500;
+			line-height: 48rpx;
+		}
 
-			.upload-view {
+		.form-item {
+			padding-bottom: 24rpx;
+			box-sizing: border-box;
+
+			.job-txt {
 				color: #016bf6;
 				font-family: DM Sans;
 				font-size: 20rpx;
-				font-weight: 500;
-				line-height: 48rpx;
+				margin-left: 16rpx;
 			}
 
-			.form-item {
-				padding-bottom: 24rpx;
+			.form-border {
+				box-sizing: border-box;
+				border: 1rpx solid rgba(227, 231, 236, 1);
+				border-radius: 12rpx;
+				background: rgba(253, 253, 253, 1);
+				padding: 36rpx;
 				box-sizing: border-box;
 
-				.job-txt {
-					color: #016bf6;
-					font-family: DM Sans;
-					font-size: 20rpx;
-					margin-left: 16rpx;
-				}
-
-				.form-border {
-					box-sizing: border-box;
-					border: 1rpx solid rgba(227, 231, 236, 1);
-					border-radius: 12rpx;
-					background: rgba(253, 253, 253, 1);
-					padding: 36rpx;
-					box-sizing: border-box;
+				.form-border-top {
+					display: flex;
+					justify-content: space-between;
+					align-items: center;
 
-					.form-border-top {
-						display: flex;
-						justify-content: space-between;
-						align-items: center;
-
-						.form-border-title {
-							color: rgba(23, 23, 37, 1);
-							font-family: DM Sans;
-							font-size: 32rpx;
-							font-weight: 700;
-							line-height: 48rpx;
-						}
-
-						.form-border-money {
-							color: #016bf6;
-							font-family: DM Sans;
-							font-size: 24rpx;
-							font-weight: 700;
-							line-height: 40rpx;
-						}
+					.form-border-title {
+						color: rgba(23, 23, 37, 1);
+						font-family: DM Sans;
+						font-size: 32rpx;
+						font-weight: 700;
+						line-height: 48rpx;
 					}
 
-					.form-border-desc {
-						color: rgba(156, 164, 171, 1);
+					.form-border-money {
+						color: #016bf6;
 						font-family: DM Sans;
 						font-size: 24rpx;
-						font-weight: 400;
+						font-weight: 700;
 						line-height: 40rpx;
-						padding: 6rpx 0;
-						box-sizing: border-box;
 					}
+				}
 
-					.form-border-img-name {
-						display: flex;
-						align-items: center;
-						gap: 8rpx;
+				.form-border-desc {
+					color: rgba(156, 164, 171, 1);
+					font-family: DM Sans;
+					font-size: 24rpx;
+					font-weight: 400;
+					line-height: 40rpx;
+					padding: 6rpx 0;
+					box-sizing: border-box;
+				}
 
-						.people-img {
-							image {
-								width: 40rpx;
-								height: 40rpx;
-							}
-						}
+				.form-border-img-name {
+					display: flex;
+					align-items: center;
+					gap: 8rpx;
 
-						.people-name {
-							color: rgba(156, 164, 171, 1);
-							font-family: DM Sans;
-							font-size: 16rpx;
-							font-weight: 400;
+					.people-img {
+						image {
+							width: 40rpx;
+							height: 40rpx;
 						}
 					}
-				}
-			}
 
-			.form-item:last-child {
-				border-bottom: none;
-			}
-
-			.form-label {
-				color: #1f2c37;
-				font-family: DM Sans;
-				font-size: 28rpx;
-				font-weight: 500;
-				line-height: 44rpx;
-				padding-top: 30rpx;
-				padding-bottom: 27rpx;
-				box-sizing: border-box;
+					.people-name {
+						color: rgba(156, 164, 171, 1);
+						font-family: DM Sans;
+						font-size: 16rpx;
+						font-weight: 400;
+					}
+				}
 			}
+		}
 
-			.form-input {
-				flex: 1;
-				box-sizing: border-box;
-				border: 2rpx solid #9ea1a8;
-				border-radius: 100rpx;
-				background: rgba(255, 255, 255, 1);
-				padding: 0rpx 24rpx !important;
-			}
+		.form-item:last-child {
+			border-bottom: none;
 		}
 
-		.bottom-btn {
-			border-radius: 999px;
-			background: rgba(255, 102, 0, 1);
-			display: flex;
-			justify-content: center;
-			align-items: center;
-			color: rgba(255, 255, 255, 1);
+		.form-label {
+			color: #1f2c37;
 			font-family: DM Sans;
-			font-size: 32rpx;
-			font-weight: 400;
-			line-height: 48rpx;
-			padding: 16rpx 32rpx;
+			font-size: 28rpx;
+			font-weight: 500;
+			line-height: 44rpx;
+			padding-top: 30rpx;
+			padding-bottom: 27rpx;
 			box-sizing: border-box;
 		}
+
+		.form-input {
+			flex: 1;
+			box-sizing: border-box;
+			border: 2rpx solid #9ea1a8;
+			border-radius: 100rpx;
+			background: rgba(255, 255, 255, 1);
+			padding: 0rpx 24rpx !important;
+		}
 	}
 
-	::v-deep .u-input {
-		text-align: left !important;
+	.bottom-btn {
+		border-radius: 999px;
+		background: rgba(255, 102, 0, 1);
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		color: rgba(255, 255, 255, 1);
+		font-family: DM Sans;
+		font-size: 32rpx;
+		font-weight: 400;
+		line-height: 48rpx;
+		padding: 16rpx 32rpx;
+		box-sizing: border-box;
 	}
+}
+
+::v-deep .u-input {
+	text-align: left !important;
+}
+
+.error-message {
+	color: #ff4d4f;
+	font-size: 24rpx;
+	margin-top: 8rpx;
+	padding-left: 24rpx;
+}
+
+/* 如果有错误,可以修改输入框边框颜色 */
+.form-input.error {
+	border-color: #ff4d4f !important;
+}
 </style>

+ 1 - 1
package/records/records.vue

@@ -94,7 +94,7 @@
 			  <view class="gwList-box-item-box-label flex align-center flex-wrap">
 			    <view
 			      class="gw-tag"
-			      v-for="(ite, ind) in item.postPush&&item.postPush.positionWelfare.split(',')||[]"
+			      v-for="(ite, ind) in item.postPush&&item.postPush.positionWelfare&&item.postPush.positionWelfare.split(',')||[]"
 			      :key="ind"
 			      >{{ ite }}</view
 			    >

+ 3 - 2
pages/my/index.vue

@@ -373,7 +373,7 @@
 									</view>
 								
 									<view v-if="XCXIsSelect != '否'" class="info-box-header-r-bj flex align-center">
-										{{companyInfo.companyAllName||"编辑企业信息"}}
+										{{companyInfo.companyAllName || "编辑企业信息"}}
 										<image src="@/static/images/jobApplicant/edit-user.svg" mode="scaleToFill"/>
 									</view>
 								</view>
@@ -831,7 +831,6 @@
 			};
 		},
 		onLoad(e) {
-			console.log(e);
 			this.XCXIsSelect = this.$queue.getData("XCXIsSelect");
 			var that=this
 			uni.$on('changeRole',function(res){
@@ -840,6 +839,7 @@
 				that.getUserInfo();
 				that.getUserData();
 				}else{
+					
 					 that.getCompany();
 				}
 				that.$queue.changeTabbar(res.userType)
@@ -858,6 +858,7 @@
 				that.userName = "登录";
 				that.avatar = "../../static/logo.png";
 				that.isVip = false;
+				that.companyInfo = '';
 			})
 		},
 		onUnload(){