wkw 6 月之前
父節點
當前提交
fd97c89571
共有 2 個文件被更改,包括 28 次插入7 次删除
  1. 1 1
      components/btnPopous/btnPopous.vue
  2. 27 6
      package/jobIntention/preferenceSetting.vue

+ 1 - 1
components/btnPopous/btnPopous.vue

@@ -295,7 +295,7 @@ export default {
 			if(this.userId){
 				data = {
 					...data,
-					userId:this.userId
+					hrId:this.userId
 				}
 			}
 			this.$Request.getT("/app/postPush/userGetPostPushList", data).then(res => {

+ 27 - 6
package/jobIntention/preferenceSetting.vue

@@ -31,7 +31,7 @@
 						<view class="preference-children">
 							<view v-for="(child, cIndex) in parent.childrenList" :key="cIndex" class="preference-tag"
 								:class="{ active: selectedPreferences.includes(child.postSkillName) }"
-								@click="togglePreference(child.postSkillName)">
+								@click="togglePreference(pIndex,child.postSkillName)">
 								<text>{{ child.postSkillName }}</text>
 							</view>
 						</view>
@@ -91,15 +91,36 @@ export default {
 		goBack() {
 			uni.navigateBack()
 		},
-		togglePreference(name) {
+		// togglePreference(name) {
+		// 	const index = this.selectedPreferences.indexOf(name);
+		// 	const realLength = this.selectedPreferences.filter(item => item !== '不限').length;
+		// 	if (index === -1) {
+		// 		if (realLength >= 5) {
+		// 			uni.showToast({
+		// 				title: '最多选择5个偏好!',
+		// 				icon: 'none'
+		// 			})
+		// 			return;
+		// 		}
+		// 		this.selectedPreferences.push(name);
+		// 	} else {
+		// 		this.selectedPreferences.splice(index, 1);
+		// 	}
+		// },
+		togglePreference(pIndex, name) {
+			const parent = this.preferenceOptions[pIndex];
+			// 当前分类下已选中的标签(排除不限)
+			const selectedInGroup = parent.childrenList
+				.filter(item => item.postSkillName !== '不限' && this.selectedPreferences.includes(item.postSkillName));
+		
 			const index = this.selectedPreferences.indexOf(name);
-			const realLength = this.selectedPreferences.filter(item => item !== '不限').length;
+		
 			if (index === -1) {
-				if (realLength >= 5) {
+				if (selectedInGroup.length >= 5) {
 					uni.showToast({
-						title: '最多选择5个偏好!',
+						title: '每个分类最多选择5个偏好!',
 						icon: 'none'
-					})
+					});
 					return;
 				}
 				this.selectedPreferences.push(name);