瑶都万能墙
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

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
10 months ago
11 months ago
9 months ago
11 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
10 months ago
10 months ago
11 months ago
10 months ago
11 months ago
11 months ago
11 months ago
10 months ago
11 months ago
11 months ago
11 months ago
10 months ago
11 months ago
10 months ago
10 months ago
11 months ago
10 months ago
11 months ago
10 months ago
10 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
10 months ago
11 months ago
11 months ago
11 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
11 months ago
10 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
11 months ago
  1. <template>
  2. <view class="page">
  3. <navbar :title="isEdit ? '编辑招工' : '发布招工'" 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"
  11. v-model="form.title"
  12. class="title-input"/>
  13. </view>
  14. <!-- <uv-cell
  15. title="学历要求"
  16. rightIconStyle="fontSize: 30rpx;"
  17. :value="form.school || '请选择学历要求'"
  18. @click="openPicker('school')"
  19. isLink
  20. ></uv-cell> -->
  21. <!-- <uv-cell
  22. title="工作地点"
  23. rightIconStyle="fontSize: 30rpx;"
  24. :value="form.address || '请选择招工地点'"
  25. @click="selectAddr"
  26. isLink
  27. ></uv-cell> -->
  28. <uv-cell
  29. title="工龄要求"
  30. rightIconStyle="fontSize: 30rpx;"
  31. :value="form.workYear || '请选择工龄要求'"
  32. @click="openPicker('workYear')"
  33. isLink
  34. ></uv-cell>
  35. <!-- <view class="form-sheet-cell">
  36. <view class="label">
  37. 薪资范围
  38. </view>
  39. <view class="price">
  40. <input placeholder="最小薪资" v-model="form.minPrice" />
  41. ~
  42. <input placeholder="最大薪资" v-model="form.maxPrice" />
  43. </view>
  44. </view> -->
  45. <view class="form-sheet-cell">
  46. <view class="label">
  47. 招聘公司
  48. </view>
  49. <input placeholder="请输入招聘公司" v-model="form.company" />
  50. </view>
  51. <view class="form-sheet-cell">
  52. <view class="label">
  53. 薪资范围
  54. </view>
  55. <input placeholder="请输入薪资范围" v-model="form.minPrice" />
  56. </view>
  57. <!-- <view class="form-sheet-cell">
  58. <view class="label">
  59. 结算方式
  60. </view>
  61. <uv-radio-group v-model="radiovalue">
  62. <view class="price">
  63. <uv-radio
  64. :customStyle="{margin: '8px'}"
  65. v-for="(item, index) in priceList"
  66. :key="index"
  67. iconSize="30rpx"
  68. size="40rpx"
  69. labelSize="26rpx"
  70. :label="item.name"
  71. :name="item.name">
  72. </uv-radio>
  73. </view>
  74. </uv-radio-group>
  75. </view>
  76. <view class="form-sheet-cell">
  77. <view class="label">
  78. 工作性质
  79. </view>
  80. <uv-radio-group v-model="radiovalue">
  81. <view class="price">
  82. <uv-radio
  83. :customStyle="{margin: '8px'}"
  84. v-for="(item, index) in jopList"
  85. :key="index"
  86. iconSize="30rpx"
  87. size="40rpx"
  88. labelSize="26rpx"
  89. :label="item.name"
  90. :name="item.name">
  91. </uv-radio>
  92. </view>
  93. </uv-radio-group>
  94. </view> -->
  95. <view class="form-sheet-cell">
  96. <view class="label">
  97. 标签
  98. </view>
  99. <input placeholder="请输入标签(多个用,号分割)" v-model="form.iconText" />
  100. </view>
  101. <!-- <view class="form-sheet-cell">
  102. <view class="label">
  103. 联系人
  104. </view>
  105. <input placeholder="请输入联系人" v-model="form.userName" />
  106. </view> -->
  107. <view class="form-sheet-cell">
  108. <view class="label">
  109. 联系人
  110. </view>
  111. <input placeholder="请输入联系人" v-model="form.userName" />
  112. </view>
  113. <view class="form-sheet-cell">
  114. <view class="label">
  115. 联系电话
  116. </view>
  117. <input placeholder="请输入联系电话" v-model="form.userPhone" />
  118. </view>
  119. <view class="category">
  120. <view class="title">
  121. 选择地区
  122. </view>
  123. <view class="tagList">
  124. <view
  125. :class="{act : t.id == form.addId}"
  126. @click="form.addId = t.id"
  127. v-for="(t, i) in cityList"
  128. :key="i">
  129. {{ t.name }}
  130. </view>
  131. </view>
  132. </view>
  133. <view class=""
  134. style="margin-top: 20rpx;">
  135. <uv-textarea
  136. v-model="form.jobContext"
  137. count
  138. :maxlength="300"
  139. autoHeight
  140. placeholder="请输入职位描述"></uv-textarea>
  141. </view>
  142. <view class=""
  143. style="margin-top: 20rpx;">
  144. <uv-textarea
  145. v-model="form.school"
  146. count
  147. :maxlength="300"
  148. autoHeight
  149. placeholder="请输入岗位要求"></uv-textarea>
  150. </view>
  151. <view class=""
  152. style="margin-top: 20rpx;">
  153. <uv-textarea
  154. v-model="form.jobDetails"
  155. count
  156. :maxlength="300"
  157. autoHeight
  158. placeholder="请输入岗位详细介绍"></uv-textarea>
  159. </view>
  160. <view class=""
  161. style="margin-top: 20rpx;">
  162. <uv-textarea
  163. v-model="form.gsContext"
  164. count
  165. :maxlength="300"
  166. autoHeight
  167. placeholder="请输入公司介绍"></uv-textarea>
  168. </view>
  169. <view class="uni-color-btn"
  170. @click="submit">
  171. {{ isEdit ? '保存修改' : '发布' }}
  172. </view>
  173. <!-- 编辑模式下显示删除按钮 -->
  174. <view v-if="isEdit" class="delete-btn"
  175. @click="deleteJob">
  176. 删除招工
  177. </view>
  178. </view>
  179. <uv-picker ref="picker"
  180. :columns="columns"
  181. @confirm="pickerConfirm"></uv-picker>
  182. </view>
  183. </template>
  184. <script>
  185. import { mapState } from 'vuex'
  186. export default {
  187. data() {
  188. return {
  189. jobId: '', // 工作ID,用于编辑模式
  190. isEdit: false, // 是否为编辑模式
  191. form : {
  192. title: '', // 招工标题
  193. school : '', // 岗位要求
  194. workYear : '', // 工龄要求
  195. minPrice : '', // 薪资范围
  196. maxPrice : '', // 最大薪资(保留字段)
  197. address : '', // 工作地点(保留字段)
  198. addId : '', // 地区ID
  199. company : '', // 招聘公司
  200. gsContext : '', // 公司介绍
  201. jobContext : '', // 职位描述
  202. jobDetails: '', // 岗位详细介绍
  203. iconText: '', // 标签
  204. userName: '', // 联系人
  205. userPhone: '', // 联系电话
  206. },
  207. radiovalue : '',
  208. priceList : [
  209. {
  210. name : '日结',
  211. },
  212. {
  213. name : '月结',
  214. },
  215. ],
  216. jopList : [
  217. {
  218. name : '正式工',
  219. },
  220. {
  221. name : '临时工',
  222. },
  223. ],
  224. picker : {
  225. workYear : [
  226. '不限',
  227. ],
  228. school : [
  229. '不限',
  230. '初中',
  231. '高中',
  232. '专科',
  233. '本科',
  234. '研究生',
  235. '博士',
  236. ],
  237. },
  238. pickerKey : 'workYear',
  239. }
  240. },
  241. onLoad(options) {
  242. // 初始化工龄选项
  243. for (var i = 0; i < 30; i++) {
  244. this.picker.workYear.push((i + 1) + '年')
  245. }
  246. // 检查是否是编辑模式
  247. if (options.id) {
  248. this.jobId = options.id
  249. this.isEdit = true
  250. this.getJobDetail()
  251. } else {
  252. // 新增模式,设置默认地区
  253. if (this.cityList && this.cityList.length > 0) {
  254. this.form.addId = this.cityList[0].id
  255. }
  256. }
  257. },
  258. computed : {
  259. columns(){
  260. return [this.picker[this.pickerKey]]
  261. },
  262. ...mapState(['cityList', 'category']),
  263. },
  264. watch: {
  265. // 监听cityList变化,用于处理异步加载的城市数据
  266. cityList: {
  267. handler(newVal) {
  268. if (newVal && newVal.length > 0 && !this.isEdit && !this.form.addId) {
  269. this.form.addId = newVal[0].id
  270. }
  271. },
  272. immediate: true
  273. }
  274. },
  275. methods: {
  276. // 获取工作详情数据
  277. getJobDetail() {
  278. this.$api('getJobDetail', { id: this.jobId }, res => {
  279. if (res.code == 200) {
  280. const data = res.result
  281. // 回显基本信息
  282. this.form = {
  283. ...this.form,
  284. title: data.title || '',
  285. school: data.school || '',
  286. workYear: data.workYear || '',
  287. minPrice: data.minPrice || '',
  288. maxPrice: data.maxPrice || '',
  289. address: data.address || '',
  290. addId: data.addId || (this.cityList.length > 0 ? this.cityList[0].id : ''),
  291. company: data.company || '',
  292. gsContext: data.gsContext || '',
  293. jobContext: data.jobContext || '',
  294. jobDetails: data.jobDetails || '',
  295. iconText: data.iconText || '',
  296. userName: data.userName || '',
  297. userPhone: data.userPhone || '',
  298. }
  299. } else {
  300. uni.showToast({
  301. title: res.msg || '获取工作信息失败',
  302. icon: 'none'
  303. })
  304. }
  305. })
  306. },
  307. openPicker(key){
  308. this.pickerKey = key
  309. this.$refs.picker.open()
  310. },
  311. pickerConfirm(e){
  312. this.form[this.pickerKey] = e.value[0]
  313. },
  314. // 提交
  315. submit(){
  316. if (this.$utils.verificationAll(this.form, {
  317. title: '请输入招工标题',
  318. workYear : '请选择工龄要求',
  319. company : '请输入招聘公司',
  320. minPrice : '请输入薪资范围',
  321. iconText: '请输入标签',
  322. userName: '请输入联系人',
  323. userPhone: '请输入联系电话',
  324. jobContext : '请输入职位描述',
  325. school : '请输入岗位要求',
  326. jobDetails: '请输入岗位详细介绍',
  327. gsContext : '请输入公司介绍',
  328. })) {
  329. return
  330. }
  331. // 根据是否是编辑模式调用不同的API
  332. const apiName = this.isEdit ? 'editMyJob' : 'publishJob'
  333. const params = this.isEdit ? { ...this.form, id: this.jobId } : this.form
  334. this.$api(apiName, params, res => {
  335. if(res.code == 200){
  336. uni.showToast({
  337. title: this.isEdit ? '修改成功!' : '发布成功!',
  338. icon: 'none'
  339. })
  340. setTimeout(() => {
  341. uni.navigateBack()
  342. }, 1000)
  343. } else {
  344. uni.showToast({
  345. title: res.msg || (this.isEdit ? '修改失败' : '发布失败'),
  346. icon: 'none'
  347. })
  348. }
  349. })
  350. },
  351. // 删除招工
  352. deleteJob() {
  353. uni.showModal({
  354. title: '确认删除',
  355. content: '确定要删除这个招工信息吗?删除后无法恢复。',
  356. confirmColor: '#ff4757',
  357. success: (res) => {
  358. if (res.confirm) {
  359. this.$api('deleteMyJob', { id: this.jobId }, res => {
  360. if (res.code == 200) {
  361. uni.showToast({
  362. title: '删除成功!',
  363. icon: 'none'
  364. })
  365. setTimeout(() => {
  366. uni.navigateBack()
  367. }, 1000)
  368. } else {
  369. uni.showToast({
  370. title: res.msg || '删除失败',
  371. icon: 'none'
  372. })
  373. }
  374. })
  375. }
  376. }
  377. })
  378. },
  379. }
  380. }
  381. </script>
  382. <style scoped lang="scss">
  383. .page{
  384. background-color: #fff;
  385. min-height: 100vh;
  386. box-sizing: border-box;
  387. color: #333333;
  388. font-size: 28rpx;
  389. /deep/ text{
  390. font-size: 28rpx !important;
  391. }
  392. input{
  393. width: 450rpx;
  394. }
  395. .form{
  396. padding: 30rpx;
  397. .help-issue {
  398. margin: 20rpx;
  399. }
  400. .title-input{
  401. border: 1px solid $uni-color;
  402. width: 100%;
  403. border-radius: 10rpx;
  404. padding: 10rpx 20rpx;
  405. box-sizing: border-box;
  406. height: 65rpx;
  407. }
  408. .form-sheet-cell{
  409. display: flex;
  410. background-color: #fff;
  411. padding: 20rpx 30rpx;
  412. align-items: center;
  413. .label{
  414. width: 160rpx;
  415. }
  416. .price{
  417. display: flex;
  418. text-align: center;
  419. input{
  420. width: 150rpx;
  421. border: 1px solid $uni-color;
  422. margin: 0 10rpx;
  423. }
  424. }
  425. .right-icon{
  426. margin-left: auto;
  427. }
  428. }
  429. }
  430. .category{
  431. padding: 20rpx;
  432. .title{
  433. // font-weight: 900;
  434. // font-size: 30rpx;
  435. }
  436. .tagList{
  437. display: flex;
  438. flex-wrap: wrap;
  439. padding: 10rpx 0;
  440. view{
  441. background: rgba($uni-color, 0.1);
  442. padding: 10rpx 20rpx;
  443. margin: 10rpx;
  444. border-radius: 10rpx;
  445. font-size: 26rpx;
  446. }
  447. .act{
  448. color: #fff;
  449. background: $uni-color;
  450. }
  451. }
  452. }
  453. .delete-btn {
  454. background: #ff4757;
  455. color: white;
  456. text-align: center;
  457. padding: 20rpx;
  458. margin: 30rpx;
  459. border-radius: 40rpx;
  460. font-size: 28rpx;
  461. font-weight: bold;
  462. &:active {
  463. background: #ff3742;
  464. }
  465. }
  466. }
  467. </style>