|
|
@@ -21,16 +21,27 @@
|
|
|
|
|
|
<!-- 偏好标签网格 -->
|
|
|
<view class="preference-grid">
|
|
|
- <view
|
|
|
- v-for="(item, index) in preferenceOptions"
|
|
|
- :key="index"
|
|
|
- class="preference-tag"
|
|
|
- :class="{ active: selectedPreferences.includes(item.postSkillName) }"
|
|
|
- @click="togglePreference(item.postSkillName)"
|
|
|
- >
|
|
|
- <text>{{ item.postSkillName }}</text>
|
|
|
+ <view v-for="(parent, pIndex) in preferenceOptions" :key="pIndex" class="preference-group">
|
|
|
+ <!-- 一级标题 -->
|
|
|
+ <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"
|
|
|
+ :class="{ active: selectedPreferences.includes(child.postSkillName) }"
|
|
|
+ @click="togglePreference(child.postSkillName)"
|
|
|
+ >
|
|
|
+ <text>{{ child.postSkillName }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -52,9 +63,7 @@ export default {
|
|
|
jobTitle: '岗位',
|
|
|
jobId:'',
|
|
|
selectedPreferences: [],
|
|
|
- preferenceOptions: [
|
|
|
-
|
|
|
- ]
|
|
|
+ preferenceOptions: []
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
@@ -86,14 +95,12 @@ export default {
|
|
|
goBack() {
|
|
|
uni.navigateBack()
|
|
|
},
|
|
|
- togglePreference(item) {
|
|
|
- const index = this.selectedPreferences.indexOf(item)
|
|
|
- if (index > -1) {
|
|
|
- // 如果已选中,则取消选中
|
|
|
- this.selectedPreferences.splice(index, 1)
|
|
|
+ togglePreference(name) {
|
|
|
+ const index = this.selectedPreferences.indexOf(name);
|
|
|
+ if (index === -1) {
|
|
|
+ this.selectedPreferences.push(name);
|
|
|
} else {
|
|
|
- // 如果未选中,则添加到选中列表
|
|
|
- this.selectedPreferences.push(item)
|
|
|
+ this.selectedPreferences.splice(index, 1);
|
|
|
}
|
|
|
},
|
|
|
confirmSelection() {
|