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

490 lines
11 KiB

7 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
5 months ago
5 months ago
5 months ago
7 months ago
7 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
5 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
7 months ago
5 months ago
5 months ago
7 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
7 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
7 months ago
5 months ago
7 months ago
5 months ago
7 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="openPicker('areaId',$refs.addressListPicker)"
  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-picker ref="addressListPicker"
  181. :columns="[addressList]"
  182. keyName="adress"
  183. @confirm="pickerConfirm"></uv-picker>
  184. <uv-datetime-picker
  185. ref="datetimePicker"
  186. v-model="datePickerValue"
  187. mode="date"
  188. :minDate="minDate"
  189. @confirm="datePickerConfirm">
  190. </uv-datetime-picker>
  191. <view class="uni-color-btn"
  192. @click="submit">
  193. 发布
  194. </view>
  195. </view>
  196. </view>
  197. </template>
  198. <script>
  199. import { mapState } from 'vuex'
  200. export default {
  201. data() {
  202. return {
  203. form : {
  204. // jobContext : '',
  205. phone : '',
  206. workAddress:'',
  207. title : '',
  208. workAge : '',
  209. natureId : 0,
  210. areaId_dictText : '',
  211. typeId_dictText : '',
  212. qulification : '',
  213. deadline : '',
  214. },
  215. radiovalue : '',
  216. priceList : [
  217. {
  218. name : '日结',
  219. },
  220. {
  221. name : '月结',
  222. },
  223. ],
  224. picker : {
  225. workAge : [
  226. '不限经验',
  227. ],
  228. qulification : [
  229. '不限学历',
  230. '初中',
  231. '高中',
  232. '专科',
  233. '本科',
  234. '研究生',
  235. '博士',
  236. ],
  237. jobTypeList : [],
  238. },
  239. pickerKey : 'workAge',
  240. jobId : 0,
  241. datePickerValue : Date.now(),
  242. minDate : Date.now(),
  243. }
  244. },
  245. onLoad({jobId}) {
  246. if(jobId){
  247. this.jobId = jobId
  248. this.getDetail()
  249. }
  250. for (var i = 0; i < 30; i++) {
  251. this.picker.workAge.push((i + 1) + '年经验')
  252. }
  253. // this.form.addId = this.cityList[0].id
  254. this.form.natureId = this.natureList[0].id
  255. },
  256. computed : {
  257. columns(){
  258. return [this.picker[this.pickerKey]]
  259. },
  260. ...mapState(['natureList', 'jobTypeList', 'addressList']),
  261. },
  262. methods: {
  263. getDetail() {
  264. let data = {
  265. jobId: this.jobId
  266. }
  267. if (uni.getStorageSync('token')) {
  268. data.token = uni.getStorageSync('token')
  269. }
  270. this.$api('employeeQueryJobById', data, res => {
  271. if (res.code == 200) {
  272. let detail = res.result.jobInfo
  273. this.addressList.forEach(address => {
  274. if(address.id == detail.areaId){
  275. detail.areaId_dictText = address.adress
  276. }
  277. })
  278. this.jobTypeList.forEach(type => {
  279. if(type.id == detail.typeId){
  280. detail.typeId_dictText = type.name
  281. }
  282. })
  283. delete detail.createBy
  284. delete detail.createTime
  285. delete detail.headImage
  286. delete detail.hanHaiMember
  287. delete detail.updateTime
  288. delete detail.updateBy
  289. this.form = detail
  290. if(detail.deadline) {
  291. this.datePickerValue = new Date(detail.deadline).getTime()
  292. }
  293. }
  294. })
  295. },
  296. openPicker(key, picker){
  297. this.pickerKey = key
  298. if(picker){
  299. picker.open()
  300. }else{
  301. this.$refs.picker.open()
  302. }
  303. },
  304. pickerConfirm(e){
  305. let data = e.value[0]
  306. if(data && data.id){
  307. this.form[this.pickerKey] = data.id
  308. this.form[this.pickerKey + '_dictText'] = data.name || data.adress
  309. }else{
  310. this.form[this.pickerKey] = data
  311. }
  312. },
  313. openDatePicker() {
  314. this.$refs.datetimePicker.open()
  315. },
  316. datePickerConfirm(e) {
  317. this.form.deadline = this.$dayjs(e.value).format('YYYY-MM-DD HH:mm:ss')
  318. this.datePickerValue = e.value
  319. },
  320. submit(){
  321. // if(this.fileList.length == 0){
  322. // return uni.showToast({
  323. // title: '请上传图片',
  324. // icon : 'none'
  325. // })
  326. // }
  327. if (this.$utils.verificationAll(this.form, {
  328. title: '请输入招工标题',
  329. workAddress : '请选择工作地点',
  330. workAge : '请选择工龄要求',
  331. // company : '请输入招聘公司',
  332. salaryLow : '请输入薪资范围',
  333. salaryUp : '请输入薪资范围',
  334. // iconText: '请输入标签',
  335. // userName: '请输入联系人',
  336. phone: '请输入联系电话',
  337. // jobContext : '请输入职位描述',
  338. qulification : '请选择学历要求',
  339. workDetail: '请输入职位详情',
  340. deadline: '请选择招工截止日期',
  341. // gsContext : '请输入公司介绍',
  342. })) {
  343. return
  344. }
  345. // 验证手机号格式
  346. const phoneReg = /^1[3-9]\d{9}$/
  347. if (!phoneReg.test(this.form.phone)) {
  348. return uni.showToast({
  349. title: '请输入正确的手机号码',
  350. icon: 'none'
  351. })
  352. }
  353. // 验证截止日期不能早于今天
  354. const today = this.$dayjs().startOf('day')
  355. const deadlineDate = this.$dayjs(this.form.deadline).startOf('day')
  356. if (deadlineDate.isBefore(today)) {
  357. return uni.showToast({
  358. title: '截止日期不能早于今天',
  359. icon: 'none'
  360. })
  361. }
  362. this.$api(this.jobId ? 'updateJob' : 'addJob', this.form, res => {
  363. if(res.code == 200){
  364. uni.showToast({
  365. title: '发布成功!',
  366. icon: 'none'
  367. })
  368. setTimeout(uni.navigateBack, 1000, -1)
  369. }
  370. })
  371. },
  372. //地图上选择地址
  373. selectAddr() {
  374. uni.chooseLocation({
  375. success: (res) => {
  376. this.setAddress(res)
  377. }
  378. });
  379. },
  380. //提取用户选择的地址信息复制给表单数据
  381. setAddress(res) {
  382. //经纬度信息
  383. this.form.latitude = res.latitude
  384. this.form.longitude = res.longitude
  385. // if (res.name) { //用户直接选择城市的逻辑
  386. if (!res.address && res.name) { //用户直接选择城市的逻辑
  387. return this.form.workAddress = res.name
  388. }
  389. if (res.address || res.name) {
  390. return this.form.workAddress = res.address + res.name
  391. }
  392. this.form.workAddress = '' //用户啥都没选就点击勾选
  393. this.form.latitude = ''
  394. this.form.longitude = ''
  395. },
  396. }
  397. }
  398. </script>
  399. <style scoped lang="scss">
  400. .page{
  401. background-color: #fff;
  402. min-height: 100vh;
  403. box-sizing: border-box;
  404. color: #333333;
  405. font-size: 28rpx;
  406. /deep/ text{
  407. font-size: 28rpx !important;
  408. }
  409. .form{
  410. padding: 30rpx;
  411. .help-issue {
  412. margin: 20rpx;
  413. }
  414. .title-input{
  415. border: 1px solid $uni-color;
  416. width: 100%;
  417. border-radius: 10rpx;
  418. padding: 10rpx 20rpx;
  419. box-sizing: border-box;
  420. height: 65rpx;
  421. }
  422. .form-sheet-cell{
  423. display: flex;
  424. background-color: #fff;
  425. padding: 20rpx 30rpx;
  426. align-items: center;
  427. .label{
  428. width: 160rpx;
  429. }
  430. .price{
  431. display: flex;
  432. text-align: center;
  433. input{
  434. width: 150rpx;
  435. border: 1px solid $uni-color;
  436. margin: 0 10rpx;
  437. }
  438. }
  439. input{
  440. flex: 1;
  441. background-color: rgba($uni-color, 0.1);
  442. padding: 10rpx 20rpx;
  443. border-radius: 10rpx;
  444. }
  445. .right-icon{
  446. margin-left: auto;
  447. }
  448. }
  449. }
  450. /deep/ .uv-textarea{
  451. background-color: rgba($uni-color, 0.1) !important;
  452. min-height: 400rpx;
  453. }
  454. }
  455. </style>