前端-胡立永 4 weeks ago
parent
commit
53ef92e455
2 changed files with 4 additions and 259 deletions
  1. +0
    -255
      pages/demo/JobTypePickerDemo.vue
  2. +4
    -4
      pages/index/index.vue

+ 0
- 255
pages/demo/JobTypePickerDemo.vue View File

@ -1,255 +0,0 @@
<template>
<view class="page">
<navbar title="工种选择组件示例" leftClick @leftClick="$utils.navigateBack" />
<view class="content">
<view class="demo-section">
<view class="section-title">单选模式</view>
<view class="demo-item">
<uv-cell
title="选择工种(单选)"
rightIconStyle="fontSize: 30rpx;"
:value="singleResult.fullJobType || '请选择工种'"
@click="openSinglePicker"
isLink
></uv-cell>
<view v-if="singleResult.selectedId" class="result-info">
<text>选中ID: {{ singleResult.selectedId }}</text>
<text>选中工种: {{ singleResult.selectedJobType?.name }}</text>
</view>
</view>
</view>
<view class="demo-section">
<view class="section-title">多选模式</view>
<view class="demo-item">
<uv-cell
title="选择工种(多选)"
rightIconStyle="fontSize: 30rpx;"
:value="multipleResult.fullJobType || '请选择工种'"
@click="openMultiplePicker"
isLink
></uv-cell>
<view v-if="multipleResult.selectedIds && multipleResult.selectedIds.length > 0" class="result-info">
<text>选中ID数组: {{ multipleResult.selectedIds.join(',') }}</text>
<text>选中数量: {{ multipleResult.selectedIds.length }}</text>
</view>
</view>
</view>
<view class="demo-section">
<view class="section-title">只选择到二级工种</view>
<view class="demo-item">
<uv-cell
title="选择工种(二级)"
rightIconStyle="fontSize: 30rpx;"
:value="subTypeResult.fullJobType || '请选择工种'"
@click="openSubTypePicker"
isLink
></uv-cell>
<view v-if="subTypeResult.selectedId" class="result-info">
<text>选中ID: {{ subTypeResult.selectedId }}</text>
<text>选中工种: {{ subTypeResult.selectedJobType?.name }}</text>
</view>
</view>
</view>
<view class="demo-section">
<view class="section-title">"选择整个工种"选项</view>
<view class="demo-item">
<uv-cell
title="选择工种(整个工种)"
rightIconStyle="fontSize: 30rpx;"
:value="wholeTypeResult.fullJobType || '请选择工种'"
@click="openWholeTypePicker"
isLink
></uv-cell>
<view v-if="wholeTypeResult.selectedId" class="result-info">
<text>选中ID: {{ wholeTypeResult.selectedId }}</text>
<text>选中工种: {{ wholeTypeResult.selectedJobType?.name }}</text>
</view>
</view>
</view>
<view class="demo-section">
<view class="section-title">使用说明</view>
<view class="usage-info">
<text class="usage-title">组件属性</text>
<text> multiple: 是否支持多选</text>
<text> onlySubType: 是否只选择到二级工种</text>
<text> showSelectWholeType: 是否显示"选择整个工种"选项</text>
<text class="usage-title">返回数据</text>
<text> selectedId: 单选时的工种ID</text>
<text> selectedIds: 多选时的工种ID数组</text>
<text> fullJobType: 完整的工种名称文本</text>
<text> selectedJobType: 选中的工种对象</text>
</view>
</view>
</view>
<!-- 工种选择组件 -->
<JobTypePicker
ref="singlePicker"
@confirm="onSingleConfirm"
/>
<JobTypePicker
ref="multiplePicker"
:multiple="true"
@confirm="onMultipleConfirm"
/>
<JobTypePicker
ref="subTypePicker"
:onlySubType="true"
@confirm="onSubTypeConfirm"
/>
<JobTypePicker
ref="wholeTypePicker"
:showSelectWholeType="true"
@confirm="onWholeTypeConfirm"
/>
</view>
</template>
<script>
import JobTypePicker from '@/components/JobTypePicker.vue'
export default {
components: {
JobTypePicker
},
data() {
return {
singleResult: {}, //
multipleResult: {}, //
subTypeResult: {}, //
wholeTypeResult: {} //
}
},
onLoad() {
//
this.$store.commit('getJobTypeList')
},
methods: {
//
openSinglePicker() {
this.$refs.singlePicker.open()
},
//
openMultiplePicker() {
this.$refs.multiplePicker.open()
},
//
openSubTypePicker() {
this.$refs.subTypePicker.open()
},
//
openWholeTypePicker() {
this.$refs.wholeTypePicker.open()
},
//
onSingleConfirm(result) {
console.log('单选结果:', result)
this.singleResult = result
},
//
onMultipleConfirm(result) {
console.log('多选结果:', result)
this.multipleResult = result
},
//
onSubTypeConfirm(result) {
console.log('二级工种结果:', result)
this.subTypeResult = result
},
//
onWholeTypeConfirm(result) {
console.log('整个工种结果:', result)
this.wholeTypeResult = result
}
}
}
</script>
<style scoped lang="scss">
.page {
background: #f5f5f5;
min-height: 100vh;
}
.content {
padding: 20rpx;
}
.demo-section {
margin-bottom: 40rpx;
background: #fff;
border-radius: 20rpx;
overflow: hidden;
.section-title {
padding: 30rpx 30rpx 20rpx;
font-size: 32rpx;
font-weight: bold;
color: #333;
border-bottom: 1px solid #f0f0f0;
}
.demo-item {
padding: 0;
.result-info {
padding: 20rpx 30rpx;
background: #f8f9fa;
border-top: 1px solid #f0f0f0;
text {
display: block;
font-size: 26rpx;
color: #666;
margin-bottom: 10rpx;
&:last-child {
margin-bottom: 0;
}
}
}
}
.usage-info {
padding: 30rpx;
text {
display: block;
font-size: 26rpx;
color: #666;
line-height: 1.6;
margin-bottom: 10rpx;
&.usage-title {
font-weight: bold;
color: #333;
margin-top: 20rpx;
margin-bottom: 15rpx;
&:first-child {
margin-top: 0;
}
}
&:last-child {
margin-bottom: 0;
}
}
}
}
</style>

+ 4
- 4
pages/index/index.vue View File

@ -31,7 +31,7 @@
</view>
<!-- 工人看到的 -->
<view class="content"
<!-- <view class="content"
v-if="!role">
<view class="grid">
<uv-grid :border="false"
@ -52,12 +52,12 @@
|| config_other_job " mode="aspectFill"></image>
<text class="grid-text">其他招工</text>
<!--
|| `/static/image/home/5.png` -->
|| `/static/image/home/5.png`
</uv-grid-item>
</uv-grid>
</view>
</view>
</view> -->
<!-- 筛选器 -->
<screenWork ref="screenWork" @clickItem="clickItem"/>


Loading…
Cancel
Save