flat: 暂存

This commit is contained in:
Apcallover
2024-03-24 23:38:33 +08:00
parent c0bed3ad7f
commit fb6772bf81
6 changed files with 303 additions and 39 deletions

View File

@@ -117,7 +117,7 @@
<u-picker :show="showTrade" ref="tradePicker" keyName="name" :columns="tradeColumns" @confirm="tradeConfirm"
@cancel="tradeClose" @close="tradeClose">
</u-picker>
<u-picker :show="showSkills" ref="skillPicker" keyName="name" :columns="skillColumns"
<u-picker :show="showSkills" ref="skillPicker" keyName="name" :columns="skillColumns" @change="skillsChange"
@confirm="skillConfirm" @cancel="skillClose" @close="skillClose">
</u-picker>
<!-- <u-picker :show="showNature" ref="naturePicker" :columns="natureColumns"
@@ -142,7 +142,7 @@
<script>
import dic from '@/common/dic.js'
import { submitInfo } from '@/api/userrecruit.js'
import { submitInfo, getWorktypesBaseList } from '@/api/userrecruit.js'
export default {
data() {
return {
@@ -210,7 +210,8 @@
birthday: Number(new Date()),
wageColumns: dic.taskSalary,
tradeColumns: dic.tradeArr,
skillColumns: [],
skillColumns: [],
skillColumnsIndex: [0, 0],
natureColumns: dic.natureArr,
ageColumns: dic.ageArr,
eduColumns: dic.eduArr,
@@ -281,8 +282,34 @@
},
},
}
},
methods: {
},
props: {
company: {
default: null,
}
},
created() {
if(this.company) {
this.backfill(this.company)
}
this.getWorkTypes()
},
watch: {
company(val) {
if(!val) return;
this.backfill(val)
}
},
methods: {
backfill(info) {
const { manager, companyTid, companyName, companyDesc, telphone } = info
this.info.jobCompanyScale = companyTid
this.info.jobCompanyName = companyName
this.info.callName = manager
this.info.callTel = telphone
this.info.jobCompanyDescription = companyDesc
},
wageConfirm(e) {
const {
value
@@ -296,7 +323,10 @@
this.info.tradeNames = value[0].name
this.showTrade = false
},
skillConfirm() {
skillConfirm(e) {
const { value, indexs } = e
this.skillColumnsIndex = indexs
this.info.skillNames = this.getSkilDataNameWhereId(indexs).join('-')
this.showSkills = false
},
// natureConfirm(e) {
@@ -411,10 +441,19 @@
// uni.$u.toast('校验通过')
// }).catch(errors => {
// uni.$u.toast('校验失败')
// })
this.info.jobType = 0
// })
const names = this.getSkilDataNameWhereId( this.skillColumnsIndex, true)
const ids = this.getSkilDataNameWhereId( this.skillColumnsIndex, false)
this.info.jobType = 0
let params = {
...this.info,
worktypeIds: ids[0], // 工种一级id
skillIds: ids[1], // 工种二级id
worktypeNames: names[0], // 工种名称
skillNames: names[1], // 工种二级名称
}
let that = this
submitInfo(this.info).then(res => {
submitInfo(params).then(res => {
if(res.data.code == 200) {
that.reset()
uni.$u.toast('发布成功')
@@ -463,7 +502,48 @@
},
hideKeyboard() {
uni.hideKeyboard()
}
},
skillsChange(e) {
const { columnIndex, index, picker = this.$refs.uPicker } = e
let [ index1, index2 ] = this.skillColumnsIndex
switch (columnIndex) {
case 0:
index1 = index;
index2 = 0
break
case 1:
index2 = index;
break
}
const Indexs = [index1, index2]
picker.setColumnValues(1, this.skillData[index1].child.map((item) => item.name))
this.skillColumnsIndex = Indexs
},
getSkilDataNameWhereId(Indexs, type = true) {
if(!this.skillData) {return}
const [ index1, index2 ] = Indexs
const work1 = this.skillData[index1]
const work2 = work1.child[index2]
if(type) {
return [work1.name, work2.name]
} else {
return [work1.id, work2.id]
}
},
async getWorkTypes() {
let resData = await getWorktypesBaseList({type: 1})
if(resData.data.code === 200) {
const { data } = resData.data
const arr = []
// 1、 空间换时间策略/user/userrecruit/saveApp
arr.push(data.map((item) => item.name));
arr.push(data[0].child.map((item) => item.name))
this.skillColumnsIndex = [0, 0]
this.skillData = data
this.skillColumns = arr
}
}
}
}
</script>