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

510 lines
11 KiB

9 months ago
7 months ago
9 months ago
7 months ago
9 months ago
7 months ago
1 month ago
7 months ago
9 months ago
7 months ago
9 months ago
7 months ago
7 months ago
7 months ago
7 months ago
9 months ago
9 months ago
7 months ago
9 months ago
7 months ago
9 months ago
7 months ago
9 months ago
7 months ago
9 months ago
7 months ago
9 months ago
7 months ago
9 months ago
7 months ago
9 months ago
7 months ago
9 months ago
7 months ago
9 months ago
7 months ago
9 months ago
7 months ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
9 months ago
7 months ago
1 month ago
9 months ago
1 month ago
9 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
9 months ago
7 months ago
9 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
9 months ago
7 months ago
7 months ago
9 months ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
1 month ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
9 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
1 month ago
9 months ago
7 months ago
9 months ago
7 months ago
9 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="openPicker('typeId', $refs.jobTypeListPicker)"
  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-picker ref="jobTypeListPicker"
  177. :columns="[jobTypeList]"
  178. keyName="name"
  179. @confirm="pickerConfirm"></uv-picker>
  180. <uv-datetime-picker
  181. ref="datetimePicker"
  182. v-model="datePickerValue"
  183. mode="date"
  184. :minDate="minDate"
  185. @confirm="datePickerConfirm">
  186. </uv-datetime-picker>
  187. <!-- 地址选择组件 -->
  188. <AddressPicker ref="addressPicker" onlyCity @confirm="onAddressConfirm" />
  189. <view class="uni-color-btn"
  190. @click="submit">
  191. 发布
  192. </view>
  193. </view>
  194. </view>
  195. </template>
  196. <script>
  197. import { mapState } from 'vuex'
  198. import AddressPicker from '@/components/AddressPicker.vue'
  199. export default {
  200. components: {
  201. AddressPicker
  202. },
  203. data() {
  204. return {
  205. form : {
  206. // jobContext : '',
  207. phone : '',
  208. workAddress:'',
  209. title : '',
  210. workAge : '',
  211. natureId : 0,
  212. areaId_dictText : '',
  213. typeId_dictText : '',
  214. qulification : '',
  215. deadline : '',
  216. },
  217. radiovalue : '',
  218. priceList : [
  219. {
  220. name : '日结',
  221. },
  222. {
  223. name : '月结',
  224. },
  225. ],
  226. picker : {
  227. workAge : [
  228. '不限经验',
  229. ],
  230. qulification : [
  231. '不限学历',
  232. '初中',
  233. '高中',
  234. '专科',
  235. '本科',
  236. '研究生',
  237. '博士',
  238. ],
  239. jobTypeList : [],
  240. },
  241. pickerKey : 'workAge',
  242. jobId : 0,
  243. datePickerValue : Date.now(),
  244. minDate : Date.now(),
  245. }
  246. },
  247. onLoad({jobId}) {
  248. if(jobId){
  249. this.jobId = jobId
  250. this.getDetail()
  251. }
  252. for (var i = 0; i < 30; i++) {
  253. this.picker.workAge.push((i + 1) + '年经验')
  254. }
  255. // this.form.addId = this.cityList[0].id
  256. this.form.natureId = this.natureList[0].id
  257. },
  258. computed : {
  259. columns(){
  260. return [this.picker[this.pickerKey]]
  261. },
  262. ...mapState(['natureList', 'jobTypeList', 'addressList']),
  263. },
  264. methods: {
  265. getDetail() {
  266. let data = {
  267. jobId: this.jobId
  268. }
  269. if (uni.getStorageSync('token')) {
  270. data.token = uni.getStorageSync('token')
  271. }
  272. this.$api('employeeQueryJobById', data, res => {
  273. if (res.code == 200) {
  274. let detail = res.result.jobInfo
  275. // 如果后端没有直接返回地址文字,则根据areaId查找地址文字
  276. if(detail.areaId && !detail.areaId_dictText) {
  277. this.addressList.forEach(address => {
  278. if(address.id == detail.areaId){
  279. detail.areaId_dictText = address.adress
  280. }
  281. })
  282. }
  283. this.jobTypeList.forEach(type => {
  284. if(type.id == detail.typeId){
  285. detail.typeId_dictText = type.name
  286. }
  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. delete detail.areaId // 删除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. // 只保存地址文字,不保存ID
  410. this.form.areaId_dictText = addressResult.fullAddress
  411. },
  412. }
  413. }
  414. </script>
  415. <style scoped lang="scss">
  416. .page{
  417. background-color: #fff;
  418. min-height: 100vh;
  419. box-sizing: border-box;
  420. color: #333333;
  421. font-size: 28rpx;
  422. /deep/ text{
  423. font-size: 28rpx !important;
  424. }
  425. .form{
  426. padding: 30rpx;
  427. .help-issue {
  428. margin: 20rpx;
  429. }
  430. .title-input{
  431. border: 1px solid $uni-color;
  432. width: 100%;
  433. border-radius: 10rpx;
  434. padding: 10rpx 20rpx;
  435. box-sizing: border-box;
  436. height: 65rpx;
  437. }
  438. .form-sheet-cell{
  439. display: flex;
  440. background-color: #fff;
  441. padding: 20rpx 30rpx;
  442. align-items: center;
  443. .label{
  444. width: 160rpx;
  445. }
  446. .price{
  447. display: flex;
  448. text-align: center;
  449. input{
  450. width: 150rpx;
  451. border: 1px solid $uni-color;
  452. margin: 0 10rpx;
  453. }
  454. }
  455. input{
  456. flex: 1;
  457. background-color: rgba($uni-color, 0.1);
  458. padding: 10rpx 20rpx;
  459. border-radius: 10rpx;
  460. }
  461. .right-icon{
  462. margin-left: auto;
  463. }
  464. }
  465. }
  466. /deep/ .uv-textarea{
  467. background-color: rgba($uni-color, 0.1) !important;
  468. min-height: 400rpx;
  469. }
  470. }
  471. </style>