特易招,招聘小程序
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.

543 lines
12 KiB

10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
2 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
8 months ago
8 months ago
10 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
8 months ago
8 months ago
2 months ago
8 months ago
2 months ago
8 months ago
10 months ago
8 months ago
2 months ago
10 months ago
2 months ago
2 months ago
10 months ago
10 months ago
8 months ago
10 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
10 months ago
8 months ago
8 months ago
10 months ago
8 months ago
2 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
2 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
10 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
2 months ago
2 months ago
2 months ago
10 months ago
8 months ago
10 months ago
8 months ago
10 months ago
  1. <template>
  2. <view class="page">
  3. <navbar title="编辑招工信息" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="form">
  5. <view class="help-issue">
  6. <text>招工标题</text>
  7. <text style="color: #BD3624;">*</text>
  8. </view>
  9. <view class="form-sheet-cell">
  10. <input type="text" class="title-input"
  11. v-model="form.title"/>
  12. </view>
  13. <uv-cell
  14. title="所在城市"
  15. rightIconStyle="fontSize: 30rpx;"
  16. :value="form.areaId_dictText || '请选择所在城市'"
  17. @click="openAddressPicker"
  18. isLink
  19. ></uv-cell>
  20. <uv-cell
  21. title="工作地点"
  22. rightIconStyle="fontSize: 30rpx;"
  23. :value="form.workAddress &&
  24. (form.workAddress.length > 12 ?
  25. form.workAddress.substring(0, 12) + '...' :
  26. form.workAddress)
  27. || '请选择招工地点'"
  28. @click="selectAddr"
  29. isLink
  30. ></uv-cell>
  31. <uv-cell
  32. title="所属工种"
  33. rightIconStyle="fontSize: 30rpx;"
  34. :value="form.typeId_dictText || '请选择所属工种'"
  35. @click="openJobTypePicker"
  36. isLink
  37. ></uv-cell>
  38. <uv-cell
  39. title="工龄要求"
  40. rightIconStyle="fontSize: 30rpx;"
  41. :value="form.workAge || '请选择工龄要求'"
  42. @click="openPicker('workAge')"
  43. isLink
  44. ></uv-cell>
  45. <uv-cell
  46. title="学历要求"
  47. rightIconStyle="fontSize: 30rpx;"
  48. :value="form.qulification || '请选择学历要求'"
  49. @click="openPicker('qulification')"
  50. isLink
  51. ></uv-cell>
  52. <uv-cell
  53. title="截止日期"
  54. rightIconStyle="fontSize: 30rpx;"
  55. :value="form.deadline ? $dayjs(form.deadline).format('YYYY-MM-DD') : '请选择招工截止日期'"
  56. @click="openDatePicker"
  57. isLink
  58. ></uv-cell>
  59. <!-- <view class="form-sheet-cell">
  60. <view class="label">
  61. 工作地点
  62. </view>
  63. <view>
  64. 请选择招工地点
  65. </view>
  66. <view class="right-icon">
  67. <uv-icon
  68. name="arrow-right"
  69. ></uv-icon>
  70. </view>
  71. </view>
  72. <view class="form-sheet-cell">
  73. <view class="label">
  74. 学历要求
  75. </view>
  76. <view>
  77. 请选择学历要求
  78. </view>
  79. <view class="right-icon">
  80. <uv-icon
  81. name="arrow-right"
  82. ></uv-icon>
  83. </view>
  84. </view>
  85. <view class="form-sheet-cell">
  86. <view class="label">
  87. 工龄要求
  88. </view>
  89. <view>
  90. 请选择工龄要求
  91. </view>
  92. <view class="right-icon">
  93. <uv-icon
  94. name="arrow-right"
  95. ></uv-icon>
  96. </view>
  97. </view>
  98. <view class="form-sheet-cell">
  99. <view class="label">
  100. 所属工种
  101. </view>
  102. <view>
  103. 请选择工种
  104. </view>
  105. <view class="right-icon">
  106. <uv-icon
  107. name="arrow-right"
  108. ></uv-icon>
  109. </view>
  110. </view> -->
  111. <view class="form-sheet-cell">
  112. <view class="label">
  113. 薪资范围
  114. </view>
  115. <view class="price">
  116. <input placeholder="最小值" v-model="form.salaryLow" />
  117. ~
  118. <input placeholder="最大值" v-model="form.salaryUp" />
  119. </view>
  120. </view>
  121. <!-- <view class="form-sheet-cell">
  122. <view class="label">
  123. 结算方式
  124. </view>
  125. <uv-radio-group v-model="radiovalue">
  126. <view class="price">
  127. <uv-radio
  128. :customStyle="{margin: '8px'}"
  129. v-for="(item, index) in priceList"
  130. :key="index"
  131. iconSize="30rpx"
  132. size="40rpx"
  133. labelSize="26rpx"
  134. :label="item.name"
  135. :name="item.name">
  136. </uv-radio>
  137. </view>
  138. </uv-radio-group>
  139. </view> -->
  140. <view class="form-sheet-cell">
  141. <view class="label">
  142. 工作性质
  143. </view>
  144. <uv-radio-group v-model="form.natureId">
  145. <view class="price">
  146. <uv-radio
  147. :customStyle="{margin: '8px'}"
  148. v-for="(item, index) in natureList"
  149. :key="index"
  150. iconSize="30rpx"
  151. size="40rpx"
  152. labelSize="26rpx"
  153. :label="item.name"
  154. :name="item.id">
  155. </uv-radio>
  156. </view>
  157. </uv-radio-group>
  158. </view>
  159. <view class="form-sheet-cell">
  160. <view class="label">
  161. 联系电话
  162. </view>
  163. <input placeholder="请输入联系电话" v-model="form.phone" />
  164. </view>
  165. <view class="">
  166. <uv-textarea
  167. v-model="form.workDetail"
  168. count
  169. :maxlength="300"
  170. autoHeight
  171. placeholder="请输入职位详情"></uv-textarea>
  172. </view>
  173. <uv-picker ref="picker"
  174. :columns="columns"
  175. @confirm="pickerConfirm"></uv-picker>
  176. <uv-datetime-picker
  177. ref="datetimePicker"
  178. v-model="datePickerValue"
  179. mode="date"
  180. :minDate="minDate"
  181. @confirm="datePickerConfirm">
  182. </uv-datetime-picker>
  183. <!-- 地址选择组件 -->
  184. <AddressPicker ref="addressPicker" onlyCity @confirm="onAddressConfirm" />
  185. <!-- 工种选择组件 -->
  186. <JobTypePicker ref="jobTypePicker" @confirm="onJobTypeConfirm" />
  187. <view class="uni-color-btn"
  188. @click="submit">
  189. 发布
  190. </view>
  191. </view>
  192. </view>
  193. </template>
  194. <script>
  195. import { mapState } from 'vuex'
  196. import AddressPicker from '@/components/AddressPicker.vue'
  197. import JobTypePicker from '@/components/JobTypePicker.vue'
  198. export default {
  199. components: {
  200. AddressPicker,
  201. JobTypePicker
  202. },
  203. data() {
  204. return {
  205. form : {
  206. // jobContext : '',
  207. phone : '',
  208. workAddress:'',
  209. title : '',
  210. workAge : '',
  211. natureId : 0,
  212. areaId : '', // 地址ID,用于提交给后端
  213. areaId_dictText : '', // 地址文字,用于显示
  214. typeId_dictText : '',
  215. qulification : '',
  216. deadline : '',
  217. },
  218. radiovalue : '',
  219. priceList : [
  220. {
  221. name : '日结',
  222. },
  223. {
  224. name : '月结',
  225. },
  226. ],
  227. picker : {
  228. workAge : [
  229. '不限经验',
  230. ],
  231. qulification : [
  232. '不限学历',
  233. '初中',
  234. '高中',
  235. '专科',
  236. '本科',
  237. '研究生',
  238. '博士',
  239. ],
  240. jobTypeList : [],
  241. },
  242. pickerKey : 'workAge',
  243. jobId : 0,
  244. datePickerValue : Date.now(),
  245. minDate : Date.now(),
  246. }
  247. },
  248. onLoad({jobId}) {
  249. if(jobId){
  250. this.jobId = jobId
  251. this.getDetail()
  252. }
  253. for (var i = 0; i < 30; i++) {
  254. this.picker.workAge.push((i + 1) + '年经验')
  255. }
  256. // this.form.addId = this.cityList[0].id
  257. this.form.natureId = this.natureList[0].id
  258. },
  259. computed : {
  260. columns(){
  261. return [this.picker[this.pickerKey]]
  262. },
  263. ...mapState(['natureList', 'jobTypeList', 'addressList']),
  264. },
  265. methods: {
  266. getDetail() {
  267. let data = {
  268. jobId: this.jobId
  269. }
  270. if (uni.getStorageSync('token')) {
  271. data.token = uni.getStorageSync('token')
  272. }
  273. this.$api('employeeQueryJobById', data, res => {
  274. if (res.code == 200) {
  275. let detail = res.result.jobInfo
  276. // 如果后端没有直接返回地址文字,则根据areaId查找地址文字
  277. if(detail.areaId && !detail.areaId_dictText) {
  278. this.addressList.forEach(address => {
  279. if(address.id == detail.areaId){
  280. detail.areaId_dictText = address.adress
  281. }
  282. })
  283. }
  284. // 回显工种文本
  285. if(detail.typeId) {
  286. detail.typeId_dictText = this.getJobTypeTextById(detail.typeId)
  287. }
  288. delete detail.createBy
  289. delete detail.createTime
  290. delete detail.headImage
  291. delete detail.hanHaiMember
  292. delete detail.updateTime
  293. delete detail.updateBy
  294. // 保留areaId用于提交给后端
  295. this.form = detail
  296. if(detail.deadline) {
  297. this.datePickerValue = new Date(detail.deadline).getTime()
  298. }
  299. }
  300. })
  301. },
  302. openPicker(key, picker){
  303. this.pickerKey = key
  304. if(picker){
  305. picker.open()
  306. }else{
  307. this.$refs.picker.open()
  308. }
  309. },
  310. pickerConfirm(e){
  311. let data = e.value[0]
  312. if(data && data.id){
  313. this.form[this.pickerKey] = data.id
  314. this.form[this.pickerKey + '_dictText'] = data.name || data.adress
  315. }else{
  316. this.form[this.pickerKey] = data
  317. }
  318. },
  319. openDatePicker() {
  320. this.$refs.datetimePicker.open()
  321. },
  322. datePickerConfirm(e) {
  323. this.form.deadline = this.$dayjs(e.value).format('YYYY-MM-DD HH:mm:ss')
  324. this.datePickerValue = e.value
  325. },
  326. submit(){
  327. // if(this.fileList.length == 0){
  328. // return uni.showToast({
  329. // title: '请上传图片',
  330. // icon : 'none'
  331. // })
  332. // }
  333. if (this.$utils.verificationAll(this.form, {
  334. title: '请输入招工标题',
  335. areaId_dictText: '请选择所在城市',
  336. workAddress : '请选择工作地点',
  337. workAge : '请选择工龄要求',
  338. // company : '请输入招聘公司',
  339. salaryLow : '请输入薪资范围',
  340. salaryUp : '请输入薪资范围',
  341. // iconText: '请输入标签',
  342. // userName: '请输入联系人',
  343. phone: '请输入联系电话',
  344. // jobContext : '请输入职位描述',
  345. qulification : '请选择学历要求',
  346. workDetail: '请输入职位详情',
  347. deadline: '请选择招工截止日期',
  348. // gsContext : '请输入公司介绍',
  349. })) {
  350. return
  351. }
  352. // 验证手机号格式
  353. const phoneReg = /^1[3-9]\d{9}$/
  354. if (!phoneReg.test(this.form.phone)) {
  355. return uni.showToast({
  356. title: '请输入正确的手机号码',
  357. icon: 'none'
  358. })
  359. }
  360. // 验证截止日期不能早于今天
  361. const today = this.$dayjs().startOf('day')
  362. const deadlineDate = this.$dayjs(this.form.deadline).startOf('day')
  363. if (deadlineDate.isBefore(today)) {
  364. return uni.showToast({
  365. title: '截止日期不能早于今天',
  366. icon: 'none'
  367. })
  368. }
  369. this.$api(this.jobId ? 'updateJob' : 'addJob', this.form, res => {
  370. if(res.code == 200){
  371. uni.showToast({
  372. title: '发布成功!',
  373. icon: 'none'
  374. })
  375. setTimeout(uni.navigateBack, 1000, -1)
  376. }
  377. })
  378. },
  379. //地图上选择地址
  380. selectAddr() {
  381. uni.chooseLocation({
  382. success: (res) => {
  383. this.setAddress(res)
  384. }
  385. });
  386. },
  387. //提取用户选择的地址信息复制给表单数据
  388. setAddress(res) {
  389. //经纬度信息
  390. this.form.latitude = res.latitude
  391. this.form.longitude = res.longitude
  392. // if (res.name) { //用户直接选择城市的逻辑
  393. if (!res.address && res.name) { //用户直接选择城市的逻辑
  394. return this.form.workAddress = res.name
  395. }
  396. if (res.address || res.name) {
  397. return this.form.workAddress = res.address + res.name
  398. }
  399. this.form.workAddress = '' //用户啥都没选就点击勾选
  400. this.form.latitude = ''
  401. this.form.longitude = ''
  402. },
  403. // 打开地址选择器
  404. openAddressPicker() {
  405. this.$refs.addressPicker.open()
  406. },
  407. // 地址选择确认回调
  408. onAddressConfirm(addressResult) {
  409. // 保存地址文字用于显示
  410. this.form.areaId_dictText = addressResult.fullAddress
  411. // 保存地址ID用于提交给后端
  412. this.form.areaId = addressResult.selectedId
  413. },
  414. // 打开工种选择器
  415. openJobTypePicker() {
  416. this.$refs.jobTypePicker.open()
  417. },
  418. // 工种选择确认回调
  419. onJobTypeConfirm(jobTypeResult) {
  420. // 保存工种文字用于显示
  421. this.form.typeId_dictText = jobTypeResult.selectedJobType.name
  422. // 保存工种ID用于提交给后端
  423. this.form.typeId = jobTypeResult.selectedId
  424. },
  425. // 根据ID获取工种文本(用于回显)
  426. getJobTypeTextById(id) {
  427. if (!id) return ''
  428. // 在一级工种中查找
  429. for (let jobType of this.jobTypeList) {
  430. if (jobType.id == id) {
  431. return jobType.name
  432. }
  433. }
  434. // 如果没找到,返回空字符串
  435. // 实际项目中可能需要异步获取下级工种进行查找
  436. return ''
  437. },
  438. }
  439. }
  440. </script>
  441. <style scoped lang="scss">
  442. .page{
  443. background-color: #fff;
  444. min-height: 100vh;
  445. box-sizing: border-box;
  446. color: #333333;
  447. font-size: 28rpx;
  448. /deep/ text{
  449. font-size: 28rpx !important;
  450. }
  451. .form{
  452. padding: 30rpx;
  453. .help-issue {
  454. margin: 20rpx;
  455. }
  456. .title-input{
  457. border: 1px solid $uni-color;
  458. width: 100%;
  459. border-radius: 10rpx;
  460. padding: 10rpx 20rpx;
  461. box-sizing: border-box;
  462. height: 65rpx;
  463. }
  464. .form-sheet-cell{
  465. display: flex;
  466. background-color: #fff;
  467. padding: 20rpx 30rpx;
  468. align-items: center;
  469. .label{
  470. width: 160rpx;
  471. }
  472. .price{
  473. display: flex;
  474. text-align: center;
  475. input{
  476. width: 150rpx;
  477. border: 1px solid $uni-color;
  478. margin: 0 10rpx;
  479. }
  480. }
  481. input{
  482. flex: 1;
  483. background-color: rgba($uni-color, 0.1);
  484. padding: 10rpx 20rpx;
  485. border-radius: 10rpx;
  486. }
  487. .right-icon{
  488. margin-left: auto;
  489. }
  490. }
  491. }
  492. /deep/ .uv-textarea{
  493. background-color: rgba($uni-color, 0.1) !important;
  494. min-height: 400rpx;
  495. }
  496. }
  497. </style>