特易招,招聘小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

440 lines
9.5 KiB

<template>
<view class="page">
<navbar title="编辑招工信息" leftClick @leftClick="$utils.navigateBack" />
<view class="form">
<view class="help-issue">
<text>招工标题</text>
<text style="color: #BD3624;">*</text>
</view>
<view class="form-sheet-cell">
<input type="text" class="title-input"
v-model="form.title"/>
</view>
<uv-cell
title="所在城市"
rightIconStyle="fontSize: 30rpx;"
:value="form.areaId_dictText || '请选择所在城市'"
@click="openPicker('areaId',$refs.addressListPicker)"
isLink
></uv-cell>
<uv-cell
title="工作地点"
rightIconStyle="fontSize: 30rpx;"
:value="form.workAddress &&
(form.workAddress.length > 12 ?
form.workAddress.substring(0, 12) + '...' :
form.workAddress)
|| '请选择招工地点'"
@click="selectAddr"
isLink
></uv-cell>
<uv-cell
title="所属工种"
rightIconStyle="fontSize: 30rpx;"
:value="form.typeId_dictText || '请选择所属工种'"
@click="openPicker('typeId', $refs.jobTypeListPicker)"
isLink
></uv-cell>
<uv-cell
title="工龄要求"
rightIconStyle="fontSize: 30rpx;"
:value="form.workAge || '请选择工龄要求'"
@click="openPicker('workAge')"
isLink
></uv-cell>
<uv-cell
title="学历要求"
rightIconStyle="fontSize: 30rpx;"
:value="form.qulification || '请选择学历要求'"
@click="openPicker('qulification')"
isLink
></uv-cell>
<!-- <view class="form-sheet-cell">
<view class="label">
工作地点
</view>
<view>
请选择招工地点
</view>
<view class="right-icon">
<uv-icon
name="arrow-right"
></uv-icon>
</view>
</view>
<view class="form-sheet-cell">
<view class="label">
学历要求
</view>
<view>
请选择学历要求
</view>
<view class="right-icon">
<uv-icon
name="arrow-right"
></uv-icon>
</view>
</view>
<view class="form-sheet-cell">
<view class="label">
工龄要求
</view>
<view>
请选择工龄要求
</view>
<view class="right-icon">
<uv-icon
name="arrow-right"
></uv-icon>
</view>
</view>
<view class="form-sheet-cell">
<view class="label">
所属工种
</view>
<view>
请选择工种
</view>
<view class="right-icon">
<uv-icon
name="arrow-right"
></uv-icon>
</view>
</view> -->
<view class="form-sheet-cell">
<view class="label">
薪资范围
</view>
<view class="price">
<input placeholder="最小值" v-model="form.salaryLow" />
~
<input placeholder="最大值" v-model="form.salaryUp" />
</view>
</view>
<!-- <view class="form-sheet-cell">
<view class="label">
结算方式
</view>
<uv-radio-group v-model="radiovalue">
<view class="price">
<uv-radio
:customStyle="{margin: '8px'}"
v-for="(item, index) in priceList"
:key="index"
iconSize="30rpx"
size="40rpx"
labelSize="26rpx"
:label="item.name"
:name="item.name">
</uv-radio>
</view>
</uv-radio-group>
</view> -->
<view class="form-sheet-cell">
<view class="label">
工作性质
</view>
<uv-radio-group v-model="form.natureId">
<view class="price">
<uv-radio
:customStyle="{margin: '8px'}"
v-for="(item, index) in natureList"
:key="index"
iconSize="30rpx"
size="40rpx"
labelSize="26rpx"
:label="item.name"
:name="item.id">
</uv-radio>
</view>
</uv-radio-group>
</view>
<view class="form-sheet-cell">
<view class="label">
联系电话
</view>
<input placeholder="请输入联系电话" v-model="form.phone" />
</view>
<view class="">
<uv-textarea
v-model="form.workDetail"
count
:maxlength="300"
autoHeight
placeholder="请输入职位详情"></uv-textarea>
</view>
<uv-picker ref="picker"
:columns="columns"
@confirm="pickerConfirm"></uv-picker>
<uv-picker ref="jobTypeListPicker"
:columns="[jobTypeList]"
keyName="name"
@confirm="pickerConfirm"></uv-picker>
<uv-picker ref="addressListPicker"
:columns="[addressList]"
keyName="adress"
@confirm="pickerConfirm"></uv-picker>
<view class="uni-color-btn"
@click="submit">
发布
</view>
</view>
</view>
</template>
<script>
import { mapState } from 'vuex'
export default {
data() {
return {
form : {
// jobContext : '',
phone : '',
workAddress:'',
title : '',
workAge : '',
natureId : 0,
areaId_dictText : '',
typeId_dictText : '',
qulification : '',
},
radiovalue : '',
priceList : [
{
name : '日结',
},
{
name : '月结',
},
],
picker : {
workAge : [
'不限经验',
],
qulification : [
'不限学历',
'初中',
'高中',
'专科',
'本科',
'研究生',
'博士',
],
jobTypeList : [],
},
pickerKey : 'workAge',
jobId : 0,
}
},
onLoad({jobId}) {
if(jobId){
this.jobId = jobId
this.getDetail()
}
for (var i = 0; i < 30; i++) {
this.picker.workAge.push((i + 1) + '年经验')
}
// this.form.addId = this.cityList[0].id
this.form.natureId = this.natureList[0].id
},
computed : {
columns(){
return [this.picker[this.pickerKey]]
},
...mapState(['natureList', 'jobTypeList', 'addressList']),
},
methods: {
getDetail() {
let data = {
jobId: this.jobId
}
if (uni.getStorageSync('token')) {
data.token = uni.getStorageSync('token')
}
this.$api('employeeQueryJobById', data, res => {
if (res.code == 200) {
let detail = res.result.jobInfo
this.addressList.forEach(address => {
if(address.id == detail.areaId){
detail.areaId_dictText = address.adress
}
})
this.jobTypeList.forEach(type => {
if(type.id == detail.typeId){
detail.typeId_dictText = type.name
}
})
delete detail.createBy
delete detail.createTime
delete detail.headImage
delete detail.hanHaiMember
delete detail.updateTime
delete detail.updateBy
this.form = detail
}
})
},
openPicker(key, picker){
this.pickerKey = key
if(picker){
picker.open()
}else{
this.$refs.picker.open()
}
},
pickerConfirm(e){
let data = e.value[0]
if(data && data.id){
this.form[this.pickerKey] = data.id
this.form[this.pickerKey + '_dictText'] = data.name || data.adress
}else{
this.form[this.pickerKey] = data
}
},
// 提交
submit(){
// if(this.fileList.length == 0){
// return uni.showToast({
// title: '请上传图片',
// icon : 'none'
// })
// }
if (this.$utils.verificationAll(this.form, {
title: '请输入招工标题',
workAddress : '请选择工作地点',
workAge : '请选择工龄要求',
// company : '请输入招聘公司',
salaryLow : '请输入薪资范围',
salaryUp : '请输入薪资范围',
// iconText: '请输入标签',
// userName: '请输入联系人',
phone: '请输入联系电话',
// jobContext : '请输入职位描述',
qulification : '请选择学历要求',
workDetail: '请输入职位详情',
// gsContext : '请输入公司介绍',
})) {
return
}
this.$api(this.jobId ? 'updateJob' : 'addJob', this.form, res => {
if(res.code == 200){
uni.showToast({
title: '发布成功!',
icon: 'none'
})
setTimeout(uni.navigateBack, 1000, -1)
}
})
},
//地图上选择地址
selectAddr() {
uni.chooseLocation({
success: (res) => {
this.setAddress(res)
}
});
},
//提取用户选择的地址信息复制给表单数据
setAddress(res) {
//经纬度信息
this.form.latitude = res.latitude
this.form.longitude = res.longitude
// if (res.name) { //用户直接选择城市的逻辑
if (!res.address && res.name) { //用户直接选择城市的逻辑
return this.form.workAddress = res.name
}
if (res.address || res.name) {
return this.form.workAddress = res.address + res.name
}
this.form.workAddress = '' //用户啥都没选就点击勾选
this.form.latitude = ''
this.form.longitude = ''
},
}
}
</script>
<style scoped lang="scss">
.page{
background-color: #fff;
min-height: 100vh;
box-sizing: border-box;
color: #333333;
font-size: 28rpx;
/deep/ text{
font-size: 28rpx !important;
}
.form{
padding: 30rpx;
.help-issue {
margin: 20rpx;
}
.title-input{
border: 1px solid $uni-color;
width: 100%;
border-radius: 10rpx;
padding: 10rpx 20rpx;
box-sizing: border-box;
height: 65rpx;
}
.form-sheet-cell{
display: flex;
background-color: #fff;
padding: 20rpx 30rpx;
align-items: center;
.label{
width: 160rpx;
}
.price{
display: flex;
text-align: center;
input{
width: 150rpx;
border: 1px solid $uni-color;
margin: 0 10rpx;
}
}
input{
flex: 1;
background-color: rgba($uni-color, 0.1);
padding: 10rpx 20rpx;
border-radius: 10rpx;
}
.right-icon{
margin-left: auto;
}
}
}
/deep/ .uv-textarea{
background-color: rgba($uni-color, 0.1) !important;
min-height: 400rpx;
}
}
</style>