Bladeren bron

fix:求职爱好

jianghaili 7 maanden geleden
bovenliggende
commit
0304014d07
1 gewijzigde bestanden met toevoegingen van 70 en 64 verwijderingen
  1. 70 64
      package/jobIntention/preferenceSetting.vue

+ 70 - 64
package/jobIntention/preferenceSetting.vue

@@ -10,15 +10,15 @@
 				<view class="nav-right"></view>
 			</view>
 		</view>
-		
+
 		<!-- 主要内容 -->
 		<view class="main-content">
 			<view class="job-title">{{ jobTitle }}-职位偏好</view>
 			<view class="description">根据你的偏好设置,为你推荐更匹配的职位</view>
-			
+
 			<view class="preference-section">
 				<view class="section-title">请选择你的从事偏好</view>
-				
+
 				<!-- 偏好标签网格 -->
 				<view class="preference-grid">
 					<view v-for="(parent, pIndex) in preferenceOptions" :key="pIndex" class="preference-group">
@@ -26,16 +26,12 @@
 						<view class="preference-title">
 							<text>{{ parent.postSkillName }}</text>
 						</view>
-				
+
 						<!-- 二级可选项 -->
 						<view class="preference-children">
-							<view 
-								v-for="(child, cIndex) in parent.childrenList" 
-								:key="cIndex"
-								class="preference-tag"
+							<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(child.postSkillName)">
 								<text>{{ child.postSkillName }}</text>
 							</view>
 						</view>
@@ -44,7 +40,7 @@
 
 			</view>
 		</view>
-		
+
 		<!-- 底部确定按钮 -->
 		<view class="bottom-btn-container">
 			<view class="confirm-btn" @click="confirmSelection">
@@ -55,13 +51,13 @@
 </template>
 
 <script>
-	var set=0
+var set = 0
 export default {
 	data() {
 		return {
 			statusBarHeight: 0, // 状态栏高度
 			jobTitle: '岗位',
-			jobId:'',
+			jobId: '',
 			selectedPreferences: [],
 			preferenceOptions: []
 		}
@@ -70,24 +66,24 @@ export default {
 		// 获取状态栏高度
 		let systemInfo = uni.getSystemInfoSync();
 		this.statusBarHeight = systemInfo.statusBarHeight || 0;
-		if (options&&options.jobTitle) {
+		if (options && options.jobTitle) {
 			this.jobTitle = decodeURIComponent(options.jobTitle)
 		}
-		if (options&&options.jobId) {
+		if (options && options.jobId) {
 			this.jobId = options.jobId
 		}
-		if(options&&options.selectedPreferences)
+		if (options && options.selectedPreferences)
 			this.selectedPreferences = JSON.parse(decodeURIComponent(options.selectedPreferences))
 		this.getData()
-		set=options&&options.set?options.set:0
+		set = options && options.set ? options.set : 0
 	},
 	methods: {
-		getData(){
+		getData() {
 			let data = {
-				ruleClassifyId:this.jobId
+				ruleClassifyId: this.jobId
 			}
-			this.$Request.getT('/app/userFirst/getPostSkill',data).then(res => {
-				if(res.code==0){
+			this.$Request.getT('/app/userFirst/getPostSkill', data).then(res => {
+				if (res.code == 0) {
 					this.preferenceOptions = res.data
 				}
 			})
@@ -98,6 +94,13 @@ export default {
 		togglePreference(name) {
 			const index = this.selectedPreferences.indexOf(name);
 			if (index === -1) {
+				if (this.selectedPreferences.length > 5) {
+					uni.showToast({
+						title: '最多选择5个偏好!',
+						icon: 'none'
+					})
+					return;
+				}
 				this.selectedPreferences.push(name);
 			} else {
 				this.selectedPreferences.splice(index, 1);
@@ -108,7 +111,7 @@ export default {
 			uni.navigateBack({
 				delta: 1
 			})
-			
+
 			// 通知父页面更新偏好设置
 			uni.$emit('preferenceUpdated', {
 				jobTitle: this.jobTitle,
@@ -126,7 +129,7 @@ export default {
 	background: #fff;
 	display: flex;
 	flex-direction: column;
-    padding: 0 40rpx 40rpx 40rpx;
+	padding: 0 40rpx 40rpx 40rpx;
 }
 
 .navbar-content {
@@ -136,7 +139,8 @@ export default {
 	height: 88rpx;
 }
 
-.nav-left, .nav-right {
+.nav-left,
+.nav-right {
 	width: 60rpx;
 	height: 60rpx;
 	display: flex;
@@ -145,37 +149,37 @@ export default {
 }
 
 .nav-title {
-    color: rgba(51, 51, 51, 1);
-    font-family: DM Sans;
-    font-size: 36rpx;
-    font-weight: 700;
-    line-height: 26px;
-    letter-spacing: 0px;
-    text-align: center;
+	color: rgba(51, 51, 51, 1);
+	font-family: DM Sans;
+	font-size: 36rpx;
+	font-weight: 700;
+	line-height: 26px;
+	letter-spacing: 0px;
+	text-align: center;
 }
 
 .main-content {
-    margin-top:20rpx;
+	margin-top: 20rpx;
 }
 
 .job-title {
-    color: rgba(51, 51, 51, 1);
-    font-family: DM Sans;
-    font-size: 52rpx;
-    font-weight: 700;
-    line-height: 30px;
-    letter-spacing: 0px;
-    text-align: left;
+	color: rgba(51, 51, 51, 1);
+	font-family: DM Sans;
+	font-size: 52rpx;
+	font-weight: 700;
+	line-height: 30px;
+	letter-spacing: 0px;
+	text-align: left;
 }
 
 .description {
-    margin:20rpx 0;
-    color: rgba(102, 102, 102, 1);
-    font-family: DM Sans;
-    font-size: 28rpx;
-    font-weight: 400;
-    letter-spacing: 0px;
-    text-align: left;
+	margin: 20rpx 0;
+	color: rgba(102, 102, 102, 1);
+	font-family: DM Sans;
+	font-size: 28rpx;
+	font-weight: 400;
+	letter-spacing: 0px;
+	text-align: left;
 }
 
 .preference-section {
@@ -183,14 +187,14 @@ export default {
 }
 
 .section-title {
-    color: rgba(34, 37, 42, 1);
-    font-family: DM Sans;
-    font-size: 36rpx;
-    font-weight: 400;
-    line-height: 24px;
-    letter-spacing: 0px;
-    text-align: left;
-    margin-bottom: 20rpx;
+	color: rgba(34, 37, 42, 1);
+	font-family: DM Sans;
+	font-size: 36rpx;
+	font-weight: 400;
+	line-height: 24px;
+	letter-spacing: 0px;
+	text-align: left;
+	margin-bottom: 20rpx;
 }
 
 .preference-grid {
@@ -198,12 +202,13 @@ export default {
 	// flex-wrap: wrap;
 	flex-direction: column;
 	gap: 12rpx;
-	.preference-group{
-	}
-	.preference-children{
+
+	.preference-group {}
+
+	.preference-children {
 		margin-top: 20rpx;
 		display: grid;
-		grid-template-columns: repeat(4,1fr);
+		grid-template-columns: repeat(4, 1fr);
 		gap: 16rpx 10rpx;
 
 	}
@@ -220,6 +225,7 @@ export default {
 	align-items: center;
 	justify-content: center;
 	word-break: break-all;
+
 	text {
 		font-size: 18rpx;
 		color: rgba(102, 102, 102, 1);
@@ -227,17 +233,17 @@ export default {
 		text-align: center;
 		line-height: 1.2;
 	}
-	
+
 	&.active {
 		background: rgba(153, 196, 250, 0.4);
-		border: 0.5px solid  rgba(1, 107, 246, 1);
-		
+		border: 0.5px solid rgba(1, 107, 246, 1);
+
 		text {
 			color: rgba(1, 107, 246, 1);
 			font-weight: 400;
 		}
 	}
-	
+
 	&:active {
 		transform: scale(0.95);
 	}
@@ -261,13 +267,13 @@ export default {
 	display: flex;
 	align-items: center;
 	justify-content: center;
-	
+
 	text {
 		font-size: 32rpx;
 		font-weight: 600;
 		color: #fff;
 	}
-	
+
 	&:active {
 		background: #0056CC;
 	}