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

513 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
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
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
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="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 : '', // 地址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. this.jobTypeList.forEach(type => {
  285. if(type.id == detail.typeId){
  286. detail.typeId_dictText = type.name
  287. }
  288. })
  289. delete detail.createBy
  290. delete detail.createTime
  291. delete detail.headImage
  292. delete detail.hanHaiMember
  293. delete detail.updateTime
  294. delete detail.updateBy
  295. // 保留areaId用于提交给后端
  296. this.form = detail
  297. if(detail.deadline) {
  298. this.datePickerValue = new Date(detail.deadline).getTime()
  299. }
  300. }
  301. })
  302. },
  303. openPicker(key, picker){
  304. this.pickerKey = key
  305. if(picker){
  306. picker.open()
  307. }else{
  308. this.$refs.picker.open()
  309. }
  310. },
  311. pickerConfirm(e){
  312. let data = e.value[0]
  313. if(data && data.id){
  314. this.form[this.pickerKey] = data.id
  315. this.form[this.pickerKey + '_dictText'] = data.name || data.adress
  316. }else{
  317. this.form[this.pickerKey] = data
  318. }
  319. },
  320. openDatePicker() {
  321. this.$refs.datetimePicker.open()
  322. },
  323. datePickerConfirm(e) {
  324. this.form.deadline = this.$dayjs(e.value).format('YYYY-MM-DD HH:mm:ss')
  325. this.datePickerValue = e.value
  326. },
  327. submit(){
  328. // if(this.fileList.length == 0){
  329. // return uni.showToast({
  330. // title: '请上传图片',
  331. // icon : 'none'
  332. // })
  333. // }
  334. if (this.$utils.verificationAll(this.form, {
  335. title: '请输入招工标题',
  336. areaId_dictText: '请选择所在城市',
  337. workAddress : '请选择工作地点',
  338. workAge : '请选择工龄要求',
  339. // company : '请输入招聘公司',
  340. salaryLow : '请输入薪资范围',
  341. salaryUp : '请输入薪资范围',
  342. // iconText: '请输入标签',
  343. // userName: '请输入联系人',
  344. phone: '请输入联系电话',
  345. // jobContext : '请输入职位描述',
  346. qulification : '请选择学历要求',
  347. workDetail: '请输入职位详情',
  348. deadline: '请选择招工截止日期',
  349. // gsContext : '请输入公司介绍',
  350. })) {
  351. return
  352. }
  353. // 验证手机号格式
  354. const phoneReg = /^1[3-9]\d{9}$/
  355. if (!phoneReg.test(this.form.phone)) {
  356. return uni.showToast({
  357. title: '请输入正确的手机号码',
  358. icon: 'none'
  359. })
  360. }
  361. // 验证截止日期不能早于今天
  362. const today = this.$dayjs().startOf('day')
  363. const deadlineDate = this.$dayjs(this.form.deadline).startOf('day')
  364. if (deadlineDate.isBefore(today)) {
  365. return uni.showToast({
  366. title: '截止日期不能早于今天',
  367. icon: 'none'
  368. })
  369. }
  370. this.$api(this.jobId ? 'updateJob' : 'addJob', this.form, res => {
  371. if(res.code == 200){
  372. uni.showToast({
  373. title: '发布成功!',
  374. icon: 'none'
  375. })
  376. setTimeout(uni.navigateBack, 1000, -1)
  377. }
  378. })
  379. },
  380. //地图上选择地址
  381. selectAddr() {
  382. uni.chooseLocation({
  383. success: (res) => {
  384. this.setAddress(res)
  385. }
  386. });
  387. },
  388. //提取用户选择的地址信息复制给表单数据
  389. setAddress(res) {
  390. //经纬度信息
  391. this.form.latitude = res.latitude
  392. this.form.longitude = res.longitude
  393. // if (res.name) { //用户直接选择城市的逻辑
  394. if (!res.address && res.name) { //用户直接选择城市的逻辑
  395. return this.form.workAddress = res.name
  396. }
  397. if (res.address || res.name) {
  398. return this.form.workAddress = res.address + res.name
  399. }
  400. this.form.workAddress = '' //用户啥都没选就点击勾选
  401. this.form.latitude = ''
  402. this.form.longitude = ''
  403. },
  404. // 打开地址选择器
  405. openAddressPicker() {
  406. this.$refs.addressPicker.open()
  407. },
  408. // 地址选择确认回调
  409. onAddressConfirm(addressResult) {
  410. // 保存地址文字用于显示
  411. this.form.areaId_dictText = addressResult.fullAddress
  412. // 保存地址ID用于提交给后端
  413. this.form.areaId = addressResult.selectedId
  414. },
  415. }
  416. }
  417. </script>
  418. <style scoped lang="scss">
  419. .page{
  420. background-color: #fff;
  421. min-height: 100vh;
  422. box-sizing: border-box;
  423. color: #333333;
  424. font-size: 28rpx;
  425. /deep/ text{
  426. font-size: 28rpx !important;
  427. }
  428. .form{
  429. padding: 30rpx;
  430. .help-issue {
  431. margin: 20rpx;
  432. }
  433. .title-input{
  434. border: 1px solid $uni-color;
  435. width: 100%;
  436. border-radius: 10rpx;
  437. padding: 10rpx 20rpx;
  438. box-sizing: border-box;
  439. height: 65rpx;
  440. }
  441. .form-sheet-cell{
  442. display: flex;
  443. background-color: #fff;
  444. padding: 20rpx 30rpx;
  445. align-items: center;
  446. .label{
  447. width: 160rpx;
  448. }
  449. .price{
  450. display: flex;
  451. text-align: center;
  452. input{
  453. width: 150rpx;
  454. border: 1px solid $uni-color;
  455. margin: 0 10rpx;
  456. }
  457. }
  458. input{
  459. flex: 1;
  460. background-color: rgba($uni-color, 0.1);
  461. padding: 10rpx 20rpx;
  462. border-radius: 10rpx;
  463. }
  464. .right-icon{
  465. margin-left: auto;
  466. }
  467. }
  468. }
  469. /deep/ .uv-textarea{
  470. background-color: rgba($uni-color, 0.1) !important;
  471. min-height: 400rpx;
  472. }
  473. }
  474. </style>