Browse Source

添加聊天列表删除功能

wkw 6 tháng trước cách đây
mục cha
commit
6f1434cd07

+ 4 - 1
src/App.vue

@@ -3,7 +3,10 @@
 
 <template>
 	<div>
-		<router-view></router-view>
+		<keep-alive>
+			<router-view v-if="$route.meta.keepAlive" />
+		</keep-alive>
+		<router-view v-if="!$route.meta.keepAlive" />
 	</div>
 </template>
 <style>

+ 54 - 2
src/components/messageCom/messageCom.vue

@@ -147,7 +147,7 @@
 								v-if="item.content && (item.messageType === 96 || item.messageType === 97)">{{item.content }}</div>
 
 							<div style="width: 100%;color: #999999;font-size: 12px;padding-left: 50px;margin-top: 4px;">
-								{{item.createTime}}
+								{{ getDateDiff(item.createTime) }}
 							</div>
 						</div>
 						<!-- 我发的消息 -->
@@ -233,7 +233,7 @@
 							<img class="message-boxs-avatar" :src="avatar?avatar:'/default.jpg'" alt="" />
 							<div
 								style="width: 100%;color: #999999;font-size: 12px;padding-right: 50px;margin-top: 4px;text-align: right;">
-								{{item.createTime}}
+								{{ getDateDiff(item.createTime) }}
 							</div>
 						</div>
 					</div>
@@ -503,6 +503,58 @@
 			}, 1000);
 		},
 		methods: {
+			getDateDiff(data) {
+				// 兼容字符串或时间戳
+				let timePublish;
+				if (typeof data === 'string') {
+					// PC 浏览器可以正常识别 "2026-01-05 18:46:39"
+					timePublish = new Date(data.replace(/-/g, '/')); // 保留这步以防某些老浏览器异常
+				} else if (typeof data === 'number') {
+					timePublish = new Date(data);
+				} else {
+					timePublish = data instanceof Date ? data : new Date();
+				}
+
+				if (isNaN(timePublish.getTime())) return '';
+
+				const timeNow = new Date();
+
+				const publishYear = timePublish.getFullYear();
+				const publishMonth = timePublish.getMonth() + 1;
+				const publishDate = timePublish.getDate();
+				const publishHour = timePublish.getHours().toString().padStart(2, '0');
+				const publishMinute = timePublish.getMinutes().toString().padStart(2, '0');
+
+				// 计算两个日期的“自然日”差值
+				const nowZero = new Date(timeNow.getFullYear(), timeNow.getMonth(), timeNow.getDate());
+				const publishZero = new Date(publishYear, timePublish.getMonth(), publishDate);
+				const diffDays = Math.floor((nowZero - publishZero) / (1000 * 60 * 60 * 24));
+
+				const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
+				const weekStr = weekDays[timePublish.getDay()];
+				const sameYear = publishYear === timeNow.getFullYear();
+
+				let result = '';
+
+				if (diffDays === 0) {
+					// 今天
+					result = `${publishHour}:${publishMinute}`;
+				} else if (diffDays === 1) {
+					// 昨天
+					result = `昨天 ${publishHour}:${publishMinute}`;
+				} else if (diffDays < 7) {
+					// 一周内
+					result = `${weekStr} ${publishHour}:${publishMinute}`;
+				} else if (sameYear) {
+					// 同一年
+					result = `${publishMonth}月${publishDate}日 ${publishHour}:${publishMinute}`;
+				} else {
+					// 跨年
+					result = `${publishYear}年${publishMonth}月${publishDate}日 ${publishHour}:${publishMinute}`;
+				}
+
+				return result;
+			},
 			getChangYong() {
 				let state = 0
 				if (this.userType == 1) {

+ 30 - 0
src/router.js

@@ -24,42 +24,52 @@ const routes = [{
 		path: '/index',
 		name: 'index',
 		component: () => import("./views/index/index.vue"), //引入首页页面
+		meta: { keepAlive: true }
 	}, {
 		path: '/indexCompany',
 		name: 'indexCompany',
 		component: () => import("./views/index/indexCompany.vue"), //引入企业端首页页面
+		meta: { keepAlive: true }
 	}, {
 		path: '/enterpriseList',
 		name: 'enterpriseList',
 		component: () => import("./views/enterpriseList/index.vue"), //企业页面
+		meta: { keepAlive: false }
 	}, {
 		path: '/enterpriseInfo',
 		name: 'enterpriseInfo',
 		component: () => import("./views/enterpriseList/info.vue"), //企业详情
+		meta: { keepAlive: false }
 	}, {
 		path: '/addResume',
 		name: 'addResume',
 		component: () => import("./views/resume/addResume.vue"), //引入添加简历页面
+		meta: { keepAlive: false }
 	}, {
 		path: '/postInfo',
 		name: 'postInfo',
 		component: () => import("./views/post/postInfo.vue"), //引入添加简历页面
+		meta: { keepAlive: false }
 	}, {
 		path: '/resumeInfo',
 		name: 'resumeInfo',
 		component: () => import("./views/resume/resumeInfo.vue"), //引入简历详情页面
+		meta: { keepAlive: false }
 	}, {
 		path: '/search',
 		name: 'search',
 		component: () => import("./views/search/index.vue"), //引入搜索页面
+		meta: { keepAlive: false }
 	}, {
 		path: '/searchCom',
 		name: 'searchCom',
 		component: () => import("./views/search/searchCom.vue"), //引入简历搜索页面
+		meta: { keepAlive: false }
 	}, {
 		path: '/message',
 		name: 'message',
 		component: () => import("./views/message/index.vue"), //引入消息页面
+		meta: { keepAlive: false }
 	}, {
 		path: '/setting',
 		name: 'setting',
@@ -78,88 +88,108 @@ const routes = [{
 				path: '/setting/myTeam',
 				name: 'myTeam',
 				component: () => import("./views/setting/myTeam.vue"), //引入我的团队页面
+				meta: { keepAlive: false },
 
 			}, {
 				path: '/setting/myMoney',
 				name: 'myMoney',
 				component: () => import("./views/setting/myMoney.vue"), //引入我的收益页面
+				meta: { keepAlive: false },
 
 			}, {
 				path: '/setting/getMoney',
 				name: 'getMoney',
 				component: () => import("./views/setting/getMoney.vue"), //引入提现页面
+				meta: { keepAlive: false },
 
 			}]
 		}, {
 			path: '/setting/shield',
 			name: 'shield',
 			component: () => import("./views/setting/shield.vue"), //引入屏蔽公司页面
+			meta: { keepAlive: false },
 		}, {
 			path: '/setting/blacklist',
 			name: 'blacklist',
 			component: () => import("./views/setting/blacklist.vue"), //引入黑名单页面
+			meta: { keepAlive: false },
 		}, {
 			path: '/setting/transference',
 			name: 'transference',
 			component: () => import("./views/setting/transference.vue"), //引入转让企业页面
+			meta: { keepAlive: false },
 		}, {
 			path: '/setting/agreement',
 			name: 'agreement',
 			component: () => import("./views/setting/agreement.vue"), //引入协议页面
+			meta: { keepAlive: false },
 		}, {
 			path: '/setting/agreementU',
 			name: 'agreementU',
 			component: () => import("./views/setting/agreementU.vue"), //引入协议页面
+			meta: { keepAlive: false },
 		}, {
 			path: '/setting/agreementG',
 			name: 'agreementG',
 			component: () => import("./views/setting/agreementG.vue"), //引入协议页面
+			meta: { keepAlive: false },
 		}, {
 			path: '/setting/help',
 			name: 'help',
 			component: () => import("./views/setting/help.vue"), //引入帮助页面
+			meta: { keepAlive: false },
 		}, {
 			path: '/setting/logoff',
 			name: 'logoff',
 			component: () => import("./views/setting/logOff.vue"), //引入注销账号页面
+			meta: { keepAlive: false },
 		}, {
 			path: '/setting/upDataPassWord',
 			name: 'upDataPassWord',
 			component: () => import("./views/setting/upDataPassWord.vue"), //引入修改密码页面
+			meta: { keepAlive: false },
 		}],
 
 	}, {
 		path: '/interview',
 		name: 'interview',
 		component: () => import("./views/interview/interview.vue"), //引入面试记录页面
+		meta: { keepAlive: false },
 	}, {
 		path: '/recordUser',
 		name: 'recordUser',
 		component: () => import("./views/record/record.vue"), //引入记录页面
+		meta: { keepAlive: false },
 	}, {
 		path: '/enterprise',
 		name: 'enterprise',
 		component: () => import("./views/enterprise/enterprise.vue"), //引入企业中心页面
+		meta: { keepAlive: false },
 	}, {
 		path: '/money',
 		name: 'money',
 		component: () => import("./views/money/money.vue"), //引入会员页面
+		meta: { keepAlive: false },
 	}, {
 		path: '/myPostPush',
 		name: 'myPostPush',
 		component: () => import("./views/myPostPush/myPostPush.vue"), //引入我的招聘页面
+		meta: { keepAlive: false },
 	}, {
 		path: '/record',
 		name: 'record',
 		component: () => import("./views/interview/record.vue"), //引入企业页面
+		meta: { keepAlive: false },
 	}, {
 		path: '/myCollect',
 		name: 'myCollect',
 		component: () => import("./views/jilu/myCollect.vue"), //引入企业收藏页面
+		meta: { keepAlive: false },
 	}, {
 		path: '/jilu',
 		name: 'jilu',
 		component: () => import("./views/jilu/jilu.vue"), //引入简历记录/浏览记录页面
+		meta: { keepAlive: false },
 	}],
 
 }, {

+ 266 - 29
src/views/message/index.vue

@@ -87,13 +87,10 @@
 								</div>
 							</div>
 							<div class="content-l-box-item-r" style="flex-shrink: 0;">
-								{{item.messageTime?getMonthOrDay(item.messageTime):''}}
-								<!-- <div class="flex justify-end" style="margin-top: 5px;">
-									<div v-if="item.contentCount"
-										class="content-l-box-item-r-dian flex align-center justify-center">
-										{{item.contentCount}}
-									</div>
-								</div> -->
+								{{item.messageTime? getDateDiff(item.messageTime):''}}
+								<div class="flex justify-end delete-btn" style="margin-top: 5px;" @click="deleteMsg(item)">
+									删除
+								</div>
 							</div>
 						</div>
 					</div>
@@ -122,15 +119,12 @@
 							{{title}}
 						</div>
 						<el-divider direction="vertical" />
-						<div class="content-r-msg-title-n" v-if="postPushInfo.stationName">
-							{{postPushInfo.stationName}}
+						<div class="content-r-msg-title-n" v-if="postPushInfo.ruleClassifyName">
+							{{ postPushInfo.ruleClassifyName }}
 						</div>
 						<div class="content-r-msg-title-p" v-if="postPushInfo.salaryRange">
 							{{postPushInfo.salaryRange}}
 						</div>
-						<div class="content-r-msg-title-e" v-if="postPushInfo.education">
-							{{postPushInfo.education}}
-						</div>
 					</view>
 					<view class="content-r-msg-title flex align-center" v-if="userType == 2">
 						<div class="content-r-msg-title-s" v-if="resumesInfo.userName">
@@ -140,16 +134,71 @@
 						<div class="content-r-msg-title-n" v-if="resumesInfo.intentionRuleClassifyName">
 							{{resumesInfo.intentionRuleClassifyName}}
 						</div>
-						<div class="content-r-msg-title-p" v-if="resumesInfo.intentionSalaryRange">
-							{{resumesInfo.intentionSalaryRange}}
-						</div>
-						<div class="content-r-msg-title-e" v-if="resumesInfo.resumesWorkExperience">
-							{{ resumesInfo.resumesWorkExperience || '0' }}年
-						</div>
 					</view>
 					<!-- 聊天记录 -->
 					<div class="content-r-msg-chat flex align-center justify-center">
 						<div ref="messageBox" class="content-r-msg-chats">
+							<!-- 岗位简介 -->
+							<div class="resume-box" v-if="JSON.stringify(postPushInfo) != '{}' && userType == 1" @click.stop="handleClick(postPushInfo.postPushId)">
+								<div class="position-title">{{ postPushInfo.ruleClassifyName || '暂无岗位' }}
+									<span class="position-num">{{ postPushInfo.salaryRange }}</span>
+								</div>
+								<div class="company-text">{{ title }}  {{ postPushInfo.company ? postPushInfo.company.companyPeople : '0人' }}</div>
+								<div class="resume-label information flex flex-wrap">
+									<el-tag type="info">{{ postPushInfo.education }}</el-tag>
+									<el-tag type="info">{{ postPushInfo.experience }}</el-tag>
+									<el-tag type="info" v-if="postPushInfo.company">{{ postPushInfo.company.workRestTime }}</el-tag>
+									<el-tag type="info" v-for="(item, index) in postPushInfo.welfareTag ? postPushInfo.welfareTag.split(';') : []"
+										:key="index">{{ item }}</el-tag>
+								</div>
+								<template v-if="isHtmlContent">
+									<div :class="['position-content', !isJobDescExpanded ? 'position-content-itemAll' : '']" v-html="postPushInfo.positionDetails"></div>
+								</template>
+								<template v-else>
+									<div :class="['position-content', !isJobDescExpanded ? 'position-content-itemAll' : '']">{{ postPushInfo.positionDetails }}</div>
+								</template>
+								<div class="expand-more" @click.stop="isJobDescExpanded = !isJobDescExpanded">{{ isJobDescExpanded ? '收起' : '展开更多' }}</div>
+								<!-- hr信息 -->
+								<div class="flex align-center personnel">
+									<img class="resume-avatar"  :src="postPushInfo.hr && postPushInfo.hr.hrImg ? postPushInfo.hr.hrImg : '/default.jpg'" alt="" style="width: 35px;height: 35px;">
+									<div>{{ postPushInfo.user && postPushInfo.user.userName ? postPushInfo.user.userName : '未知' }}·{{ postPushInfo.hr && postPushInfo.hr.hrPosition || '创始人' }}</div>
+								</div>
+								<div class="resume-time resume-label">{{ conversationInfo.createTime && conversationInfo.createTime }}向你发起沟通</div>
+							</div>
+							<!-- 简历简介  -->
+							<div class="resume-box" v-if="JSON.stringify(resumesInfo) != '{}' && userType == 2" @click="goToPage">
+								<div class="flex align-center">
+									<img class="resume-avatar" :src="resumesInfo && resumesInfo.avatar || '/default.jpg'" alt="" />
+									<div class="flex flex-direction justify-between" style="gap: 5px;">
+										<div>期望:{{ resumesInfo.intentionRuleClassifyName }}
+											<span class="text-color">{{ resumesInfo.intentionSalaryRange }}</span>
+										</div>
+										<div class="resume-label flex">
+											<span>{{ resumesInfo.resumesWorkExperience || 0 }}年</span>
+											<span>{{ postPushInfo.education }}</span>
+											<span>{{ postPushInfo.salaryRange }}</span>
+											<span>{{ resumesStatusMap[resumesInfo.resumesStatus] || '未知' }}</span>
+										</div>
+									</div>
+								</div>
+								<div class="resume-label information">{{
+									resumesInfo.resumesListDtoList && resumesInfo.resumesListDtoList.companyName || '' }}·{{
+										resumesInfo.resumesListDtoList && resumesInfo.resumesListDtoList.lastWorkPosition || ''
+									}}</div>
+								<div class="resume-label information">{{
+									resumesInfo.resumesListDtoList && resumesInfo.resumesListDtoList.school || '' }}·{{
+										resumesInfo.resumesListDtoList && resumesInfo.resumesListDtoList.profession || '' }}
+								</div>
+								<div class="resume-tag flex flex-wrap">
+									<el-tag type="info" v-for="(skill, skillIndex) in resumesInfo.resumesListDtoList && resumesInfo.resumesListDtoList.intentIndustry && resumesInfo.resumesListDtoList.intentIndustry.split('/') || []"
+										:key="skillIndex">{{ skill }}</el-tag>
+								</div>
+								<div class="information resume-content">{{ resumesInfo.adv }}</div>
+								<div class="resume-time resume-label flex">
+									<span>{{ conversationInfo.createTime && conversationInfo.createTime }}</span>
+									<span>沟通的职位-{{ resumesInfo.intentionRuleClassifyName }}</span>
+								</div>
+							</div>
 							<div class="message-box-item" v-for="(item,index) in megList" :key="index">
 								<!-- 对方的消息 -->
 								<div class="message-boxs message-box-l flex flex-wrap" v-if="item.userId != userId">
@@ -265,7 +314,7 @@
 									<div class="message-box-l-con inv-style" v-if="item.content && (item.messageType === 96 || item.messageType === 97)">{{ item.content }}</div>
 									<div
 										style="width: 100%;color: #999999;font-size: 12px;padding-left: 50px;margin-top: 4px;">
-										{{item.createTime}}
+										{{ getDateDiff(item.createTime) }}
 									</div>
 								</div>
 								<!-- 我发的消息 -->
@@ -350,7 +399,7 @@
 									<img class="message-boxs-avatar" :src="avatar?avatar:'/default.jpg'" alt="" />
 									<div
 										style="width: 100%;color: #999999;font-size: 12px;padding-right: 50px;margin-top: 4px;text-align: right;">
-										{{item.createTime}}
+										{{getDateDiff(item.createTime)}}
 									</div>
 
 									
@@ -492,6 +541,7 @@
 		components: { AttachmentSelectDialog },
 		data() {
 			return {
+				isJobDescExpanded: false,
 				showDialog: false,
 				miamshi: {
 					hrPhone: '', //手机号
@@ -576,7 +626,14 @@
 				isShowCommon:false, //是否显示常用语
 				changYongList:[],
 				webSocketState:false,
-				webSco:null
+				webSco:null,
+				conversationInfo: {},
+				resumesStatusMap: {
+					0: '离职-随时到岗',
+					1: '在职-月内到岗',
+					2: '在职-考虑机会',
+					3: '在职-暂不考虑'
+				}
 			}
 		},
 		computed: {
@@ -588,6 +645,10 @@
 			},
 			avatar() {
 				return this.$store.state.avatar;
+			},
+			isHtmlContent() {
+				const str = this.postPushInfo?.positionDetails || '';
+				return /<[^>]+>/.test(str);
 			}
 		},
 		mounted() {
@@ -601,6 +662,110 @@
 			}, 1000);
 		},
 		methods: {
+			deleteMsg(item){
+				ElMessageBox.confirm(
+					'确定删除这条消息?',
+					'温馨提示', {
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					type: 'warning',
+				})
+				.then(() => {
+					this.$Request.get(`/app/chat/deleteConversation?chatConversationId=${item.chatConversationId}`).then(res => {
+						if (res.code == 0) {
+							ElMessage({
+								message: res.msg || '删除成功',
+								type: 'success',
+								duration: 1500,
+								offset: this.screenHeight / 2
+							})
+							this.getChatList()
+						} 
+					});
+				})
+			},
+			getDateDiff(data) {
+				// 兼容字符串或时间戳
+				let timePublish;
+				if (typeof data === 'string') {
+					// PC 浏览器可以正常识别 "2026-01-05 18:46:39"
+					timePublish = new Date(data.replace(/-/g, '/')); // 保留这步以防某些老浏览器异常
+				} else if (typeof data === 'number') {
+					timePublish = new Date(data);
+				} else {
+					timePublish = data instanceof Date ? data : new Date();
+				}
+
+				if (isNaN(timePublish.getTime())) return '';
+
+				const timeNow = new Date();
+
+				const publishYear = timePublish.getFullYear();
+				const publishMonth = timePublish.getMonth() + 1;
+				const publishDate = timePublish.getDate();
+				const publishHour = timePublish.getHours().toString().padStart(2, '0');
+				const publishMinute = timePublish.getMinutes().toString().padStart(2, '0');
+
+				// 计算两个日期的“自然日”差值
+				const nowZero = new Date(timeNow.getFullYear(), timeNow.getMonth(), timeNow.getDate());
+				const publishZero = new Date(publishYear, timePublish.getMonth(), publishDate);
+				const diffDays = Math.floor((nowZero - publishZero) / (1000 * 60 * 60 * 24));
+
+				const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
+				const weekStr = weekDays[timePublish.getDay()];
+				const sameYear = publishYear === timeNow.getFullYear();
+
+				let result = '';
+
+				if (diffDays === 0) {
+					// 今天
+					result = `${publishHour}:${publishMinute}`;
+				} else if (diffDays === 1) {
+					// 昨天
+					result = `昨天 ${publishHour}:${publishMinute}`;
+				} else if (diffDays < 7) {
+					// 一周内
+					result = `${weekStr} ${publishHour}:${publishMinute}`;
+				} else if (sameYear) {
+					// 同一年
+					result = `${publishMonth}月${publishDate}日 ${publishHour}:${publishMinute}`;
+				} else {
+					// 跨年
+					result = `${publishYear}年${publishMonth}月${publishDate}日 ${publishHour}:${publishMinute}`;
+				}
+
+				return result;
+			},
+			goToPage(){
+				if (localStorage.getItem('token')) {
+					this.$router.push({
+						name: 'resumeInfo',
+						query: {
+							resumesId: this.resumesId,
+							postPushId: this.postPushId,
+							ruleClassifyId: this.postPushInfo?.ruleClassifyId || '',
+						}
+					})
+				} else {
+					this.$router.push({
+						name: 'login'
+					})
+				}
+			},
+			handleClick(postPushId){
+				if (localStorage.getItem('token')) {
+					this.$router.push({
+						name: 'postInfo',
+						query: {
+							postPushId: postPushId
+						}
+					})
+				} else {
+					this.$router.push({
+						name: 'login'
+					})
+				}
+			},
 			getChangYong() {
 				let state = 0
 				if (this.userType == 1) {
@@ -1285,6 +1450,7 @@
 					params: data
 				}).then(res => {
 					if (res.code == 0) {
+						this.conversationInfo = res.data
 						if (res.data.isSendWx) { //是否交换微信
 							this.isSendWx = true
 						} else {
@@ -1368,14 +1534,6 @@
 					}
 				})
 			},
-			//把时间转换为月日
-			getMonthOrDay(time) {
-				let date = new Date(time) // 获取时间
-				// var year = date.getFullYear() // 获取年
-				let month = date.getMonth() + 1 // 获取月
-				let strDate = date.getDate() // 获取日
-				return month + '月' + strDate + '日'
-			},
 			getChatList() {
 				let data = {
 					page: 1,
@@ -1891,4 +2049,83 @@
 		border-radius: 50%;
 		background: #d9d9d9;
 	}
+	.resume-box{
+		margin-bottom: 20px;
+		background-color: #F0F0F0;
+		border-radius: 8px;
+		padding: 15px;
+		cursor: pointer;
+		.resume-avatar{
+			width: 46px;
+			height: 46px;
+			border-radius: 50%;
+			margin-right: 10px;
+		}
+		.text-color{
+			color: #016BF6;
+			font-size: 14px;
+			margin-left: 5px;
+		}
+		.resume-label{
+			color: #9ca4ab;
+			font-size: 14px;
+			gap: 10px;
+		}
+		.information{
+			margin: 10px 0;
+		}
+		.resume-tag{
+			gap:6px;
+		}
+		.resume-content{
+			color: #616e7c;
+			font-size: 14px;
+		}
+		.resume-time{
+			border-top: 1px solid #e9e3e3;
+			padding-top: 5px;
+		}
+		.position-title{
+			font-size: 20px;
+			font-weight: 500;
+		}
+		.position-num{
+			color: #016bf6;
+			font-size: 16px;
+			margin-left: 10px;
+		}
+		.company-text{
+			color: #9ca4ab;
+			margin-top: 5px;
+		}
+		.position-content{
+			color: #999999;
+			font-size: 14px;
+			white-space: pre-wrap;
+		}
+		.position-content-itemAll{
+			display: -webkit-box;
+			-webkit-line-clamp: 4;
+			-webkit-box-orient: vertical;
+			overflow: hidden;
+			text-overflow: ellipsis;
+		}
+		.expand-more{
+			color: #007AFF;
+			font-size: 14px;
+			cursor: pointer;
+			margin-top: 10px;
+		}
+		.personnel{
+			margin: 10px 0;
+			font-size: 14px;
+			color: #1A1A1A;
+		}
+	}
+	.delete-btn{
+		display: none;
+	}
+	.content-l-box-item:hover .delete-btn {
+		display: flex;
+	}
 </style>

+ 38 - 9
src/views/resume/addResume.vue

@@ -914,7 +914,7 @@
                                 margin-left: 10px;
                                 font-size: 13px;
                                 color: #999999;
-                            ">{{ industryArr.length }}/5</span>
+                            ">{{ industryArr.length }}</span>
                         <el-button @click="addHangye()" style="margin-left: 10px" type="primary">确定</el-button>
                     </div>
                 </div>
@@ -930,7 +930,7 @@
                     <div class="preference-children">
                         <div v-for="(child, cIndex) in parent.childrenList" :key="cIndex" class="preference-tag"
                             :class="{ active: industryArr.includes(child.postSkillName) }"
-                            @click="togglePreference(child.postSkillName)">
+                            @click="togglePreference(pIndex,child.postSkillName)">
                             <span>{{ child.postSkillName }}</span>
                         </div>
                     </div>
@@ -1773,18 +1773,47 @@ export default {
             });
         },
         // 切换从事方向选择状态
-        togglePreference(skillName) {
-            // 查找索引
-            const index = this.industryArr.indexOf(skillName);
+        // togglePreference(a,skillName) {
+        //     // 查找索引
+        //     const index = this.industryArr.indexOf(skillName);
             
+        //     if (index > -1) {
+        //         // 如果已选择,则取消选择
+        //         this.industryArr.splice(index, 1);
+        //     } else {
+        //         // 如果未选择,检查是否达到选择上限
+        //         if (this.industryArr.length >= 5) {
+        //             ElMessage({
+        //                 message: '最多添加五条',
+        //                 type: 'info',
+        //                 duration: 1500,
+        //                 offset: this.screenHeight / 2
+        //             });
+        //             return;
+        //         }
+        //         // 添加选择
+        //         this.industryArr.push(skillName);
+        //     }
+        // },
+        // 切换从事方向选择状态
+        togglePreference(pIndex, skillName) {
+            const parent = this.industryList[pIndex]; // 当前分类
+            console.log(parent)
+            console.log(this.industryArr)
+            const selectedInGroup = parent.childrenList.filter(item =>
+                this.industryArr.includes(item.postSkillName)
+            );
+
+            const index = this.industryArr.indexOf(skillName);
+
             if (index > -1) {
-                // 如果已选择,则取消选择
+                // 取消选择
                 this.industryArr.splice(index, 1);
             } else {
-                // 如果未选择,检查是否达到选择上限
-                if (this.industryArr.length >= 5) {
+                // 检查当前分类是否已选满 5 个
+                if (selectedInGroup.length >= 5) {
                     ElMessage({
-                        message: '最多添加五条',
+                        message: '每个分类最多选择五个',
                         type: 'info',
                         duration: 1500,
                         offset: this.screenHeight / 2