flat: 修改全职岗位和零工岗位问题
This commit is contained in:
@@ -1,15 +1,27 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="title">
|
||||
全部
|
||||
</view>
|
||||
<block v-for="(item, index) in city" :key="index">
|
||||
<view class="search">
|
||||
<input
|
||||
v-model="searchKeyword"
|
||||
type="text"
|
||||
class="search-input"
|
||||
placeholder="请输入关键词搜索"
|
||||
@input="handleSearch"
|
||||
@focus="isSearchFocused = true"
|
||||
@blur="handleSearchBlur"
|
||||
/>
|
||||
</view>
|
||||
<view class="title">
|
||||
全部
|
||||
</view>
|
||||
<block v-for="(item, index) in filteredResults" :key="index">
|
||||
<view class="cityList" @click="cityClick(item)">
|
||||
{{ item.name }}
|
||||
<image src="../../../static/img/correct.svg" v-if="id === item.id" mode=""></image>
|
||||
<image v-else-if="layer !== maxLayer" src="../../../static/img/right.svg" mode=""></image>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<view class="" v-if="layer === maxLayer" style="height: 230rpx;background-color: #f6f6f6;"></view>
|
||||
<view class="btn" v-if="layer === maxLayer" @click="comfirm">
|
||||
<view class="bottombtn">
|
||||
@@ -37,7 +49,11 @@
|
||||
id: '',
|
||||
label: '',
|
||||
|
||||
tradeId: '',
|
||||
tradeId: '',
|
||||
searchKeyword: '', // 模糊关键字搜索
|
||||
isSearchFocused: true,
|
||||
searchFields: ['name'],
|
||||
type: 1
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -51,7 +67,20 @@
|
||||
} else {
|
||||
return this.workTypeList;
|
||||
}
|
||||
}
|
||||
},
|
||||
filteredResults() {
|
||||
if (!this.searchKeyword) {
|
||||
return this.city
|
||||
}
|
||||
|
||||
const keyword = this.searchKeyword.toLowerCase()
|
||||
return this.city.filter(item => {
|
||||
return this.searchFields.some(field => {
|
||||
const value = this.getObjectValue(item, field)
|
||||
return value && value.toLowerCase().includes(keyword)
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
getWorktypesList(1).then(res => {
|
||||
@@ -64,12 +93,15 @@
|
||||
tradeId,
|
||||
parentId,
|
||||
layer,
|
||||
maxLayer
|
||||
maxLayer,
|
||||
type
|
||||
}) {
|
||||
this.parentId = parentId
|
||||
this.tradeId = tradeId || 0
|
||||
this.layer = parseInt(layer || 1)
|
||||
this.maxLayer = parseInt(maxLayer || 2)
|
||||
this.maxLayer = parseInt(maxLayer || 2)
|
||||
console.log(type, 'type')
|
||||
this.type = type
|
||||
},
|
||||
onShow: function() {},
|
||||
methods: {
|
||||
@@ -88,18 +120,32 @@
|
||||
},
|
||||
goCityInfo(item) {
|
||||
uni.navigateTo({
|
||||
url: `./skill?layer=${this.layer + 1}&maxLayer=${this.maxLayer}&parentId=${item.id}&parentLabel=${item.name}`
|
||||
url: `./skill?layer=${this.layer + 1}&maxLayer=${this.maxLayer}&parentId=${item.id}&parentLabel=${item.name}&type=${this.type}`
|
||||
})
|
||||
},
|
||||
comfirm: function() {
|
||||
if (this.id) {
|
||||
uni.$emit('setworkTypes', {
|
||||
detail: {
|
||||
id: this.id,
|
||||
label: this.label,
|
||||
parentLabel: this.$route.query.parentLabel
|
||||
}
|
||||
})
|
||||
if (this.id) {
|
||||
console.log(this.type)
|
||||
if (this.type == '1') {
|
||||
console.log('00000000')
|
||||
uni.$emit('setworkTypes', {
|
||||
detail: {
|
||||
id: this.id,
|
||||
label: this.label,
|
||||
parentLabel: this.$route.query.parentLabel
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('1111111')
|
||||
uni.$emit('setSkill', {
|
||||
detail: {
|
||||
id: this.id,
|
||||
label: this.label,
|
||||
parentLabel: this.$route.query.parentLabel,
|
||||
parentTwoLabel: this.$route.query.parentTwoLabel
|
||||
},
|
||||
})
|
||||
}
|
||||
uni.navigateBack({
|
||||
delta: this.layer
|
||||
})
|
||||
@@ -109,7 +155,23 @@
|
||||
icon: "none"
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// 模糊搜索
|
||||
handleSearch() {
|
||||
|
||||
console.log(this.searchKeyword)
|
||||
},
|
||||
// 失去焦点
|
||||
handleSearchBlur() {
|
||||
|
||||
},
|
||||
// 获取对象深层值
|
||||
getObjectValue(obj, path) {
|
||||
return path.split('.').reduce((current, key) => {
|
||||
return current && current[key] !== undefined ? current[key] : ''
|
||||
}, obj)
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
@@ -185,5 +247,18 @@
|
||||
|
||||
page {
|
||||
background-color: #fefefe;
|
||||
}
|
||||
}
|
||||
|
||||
.search {
|
||||
width: 80%;
|
||||
height: 60rpx;
|
||||
margin: 10rpx auto;
|
||||
border: 1rpx solid #dddddd;
|
||||
border-radius: 40rpx;
|
||||
padding-left: 30rpx;
|
||||
}
|
||||
.search-input {
|
||||
width: 80%;
|
||||
height: 60rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user