jobPostingSecond.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. <template>
  2. <view class="switch-roles">
  3. <nav-bar title="选择职位要求" color="#000"></nav-bar>
  4. <view class="roles-content">
  5. <view class="content">
  6. <view class="title">继续填写</view>
  7. <view class="desc">“{{companyName}}”的职位要求</view>
  8. <view class="step">
  9. <u-steps :list="numList" mode="number" :current="2"></u-steps>
  10. </view>
  11. <!-- 经验要求 -->
  12. <view class="check-title-big">经验要求</view>
  13. <view class="check-select" @click="showExper = true">
  14. <view class="select-txt">{{ selectedExper || "请选择经验要求" }}</view>
  15. <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
  16. </view>
  17. <!-- 最低学历 -->
  18. <view class="check-title-big">最低学历</view>
  19. <view class="check-select" @click="showLevel = true">
  20. <view class="select-txt">{{ selectedLevel || "请选择学历" }}</view>
  21. <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
  22. </view>
  23. <!-- 薪资范围 -->
  24. <view class="check-title-big">薪资范围</view>
  25. <view class="check-select" @click="showMoney = true">
  26. <view class="select-txt">{{ selectedSalary+'——'+salaryTimes || "请选择合理的薪资范围" }}</view>
  27. <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
  28. </view>
  29. <!-- 福利待遇 -->
  30. <view class="check-title-big">福利待遇(选填)</view>
  31. <view class="check-select" @click="goFund">
  32. <view class="select-txt">{{ welfareTag || "请填写奖金绩效" }}</view>
  33. <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
  34. </view>
  35. <!-- 职位关键词 -->
  36. <view class="check-title-big">职位关键词</view>
  37. <view class="check-select" @click="goJobSkill">
  38. <view class="select-txt">{{ positionTag || "被选中的关键词将突出展示给牛人" }}</view>
  39. <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
  40. </view>
  41. <!-- 工作地址 -->
  42. <view class="check-title-big">工作地址</view>
  43. <view class="check-select" @click="goAddAddress">
  44. <view class="select-txt">{{ address || stationName.fullText || "请填写精确的工作地点" }}</view>
  45. <u-icon name="arrow-down" color="#D3D3D6" size="22"></u-icon>
  46. </view>
  47. <view class="txt-desc">
  48. 温馨提示:职位类型、职位名称和工作城市发布后不可修改,请您确保信息正确 <br /><br />
  49. 发布职位即表示同意遵守《招聘行为管理规范》,如违反规则将导致账号被锁定
  50. </view>
  51. </view>
  52. </view>
  53. <view class="submit-btn" @click="submitPost">发布</view>
  54. <!-- 经验选择器 -->
  55. <u-select v-model="showExper" :list="listExper" title="请选择经验" @confirm="onExperConfirm"
  56. @cancel="showExper = false"></u-select>
  57. <!-- 学历选择器 -->
  58. <u-select v-model="showLevel" :list="listLevel" title="请选择学历" @confirm="onLevelConfirm"
  59. @cancel="showLevel = false"></u-select>
  60. <!-- 薪资选择器 -->
  61. <u-select v-model="showMoney" mode="mutil-column" :list="listMoney" title="请选择月薪范围" @confirm="onMoneyConfirm"
  62. @cancel="showMoney = false"></u-select>
  63. </view>
  64. </template>
  65. <script>
  66. import navBar from "@/components/nav-bar/index.vue";
  67. export default {
  68. data() {
  69. return {
  70. // 选中值(用于页面渲染)
  71. selectedExper: "", // 经验
  72. selectedLevel: "", // 学历
  73. selectedSalary: "", // 薪资范围
  74. welfareTag: "", // 福利待遇
  75. positionTag: "", // 职位关键词
  76. stationName: [],
  77. companyName: "",
  78. companyId: "",
  79. status: 1,
  80. pid: "",
  81. address:"",
  82. salaryTimes:"",
  83. // 选择器显示控制
  84. showExper: false,
  85. showLevel: false,
  86. showMoney: false,
  87. // 经验选择数据源
  88. listExper: [{
  89. label: "不限",
  90. value: "不限"
  91. },
  92. {
  93. label: "1年以内",
  94. value: "1年以内"
  95. },
  96. {
  97. label: "1-3年",
  98. value: "1-3年"
  99. },
  100. {
  101. label: "3-5年",
  102. value: "3-5年"
  103. },
  104. {
  105. label: "5-8年",
  106. value: "5-8年"
  107. },
  108. {
  109. label: "8年以上",
  110. value: "8年以上"
  111. },
  112. ],
  113. // 学历选择数据源
  114. listLevel: [{
  115. label: "不限",
  116. value: "不限"
  117. },
  118. {
  119. label: "专科",
  120. value: "专科"
  121. },
  122. {
  123. label: "本科",
  124. value: "本科"
  125. },
  126. {
  127. label: "硕士",
  128. value: "硕士"
  129. },
  130. {
  131. label: "博士",
  132. value: "博士"
  133. },
  134. ],
  135. // 薪资选择数据源(修正格式)
  136. listMoney: [
  137. [{
  138. value: "3k",
  139. label: "3k"
  140. },
  141. {
  142. value: "4k",
  143. label: "4k"
  144. },
  145. {
  146. value: "5k",
  147. label: "5k"
  148. },
  149. {
  150. value: "6k",
  151. label: "6k"
  152. },
  153. {
  154. value: "8k",
  155. label: "8k"
  156. },
  157. {
  158. value: "10k",
  159. label: "10k"
  160. },
  161. {
  162. value: "12k",
  163. label: "12k"
  164. },
  165. {
  166. value: "15k",
  167. label: "15k"
  168. },
  169. {
  170. value: "18k",
  171. label: "18k"
  172. },
  173. {
  174. value: "20k",
  175. label: "20k"
  176. },
  177. {
  178. value: "30k",
  179. label: "30k"
  180. },
  181. {
  182. value: "50k",
  183. label: "50k"
  184. },
  185. ],
  186. [{
  187. value: "3k",
  188. label: "3k"
  189. },
  190. {
  191. value: "4k",
  192. label: "4k"
  193. },
  194. {
  195. value: "5k",
  196. label: "5k"
  197. },
  198. {
  199. value: "6k",
  200. label: "6k"
  201. },
  202. {
  203. value: "8k",
  204. label: "8k"
  205. },
  206. {
  207. value: "10k",
  208. label: "10k"
  209. },
  210. {
  211. value: "12k",
  212. label: "12k"
  213. },
  214. {
  215. value: "15k",
  216. label: "15k"
  217. },
  218. {
  219. value: "18k",
  220. label: "18k"
  221. },
  222. {
  223. value: "20k",
  224. label: "20k"
  225. },
  226. {
  227. value: "30k",
  228. label: "30k"
  229. },
  230. {
  231. value: "50k",
  232. label: "50k"
  233. },
  234. ],
  235. [
  236. {
  237. "value": "12薪",
  238. "label": "12薪"
  239. },
  240. {
  241. "value": "13薪",
  242. "label": "13薪"
  243. },
  244. {
  245. "value": "14薪",
  246. "label": "14薪"
  247. },
  248. {
  249. "value": "15薪",
  250. "label": "15薪"
  251. },
  252. {
  253. "value": "16薪",
  254. "label": "16薪"
  255. },
  256. {
  257. "value": "17薪",
  258. "label": "17薪"
  259. },
  260. {
  261. "value": "18薪",
  262. "label": "18薪"
  263. },
  264. {
  265. "value": "19薪",
  266. "label": "19薪"
  267. },
  268. {
  269. "value": "20薪",
  270. "label": "20薪"
  271. },
  272. {
  273. "value": "21薪",
  274. "label": "21薪"
  275. },
  276. {
  277. "value": "22薪",
  278. "label": "22薪"
  279. },
  280. {
  281. "value": "23薪",
  282. "label": "23薪"
  283. }
  284. ]
  285. ],
  286. numList: [{
  287. name: "填写基本信息"
  288. },
  289. {
  290. name: "选择职位要求"
  291. },
  292. ],
  293. type:''
  294. };
  295. },
  296. components: {
  297. navBar,
  298. },
  299. onLoad(options) {
  300. // 接收上个页面传递的公司名称参数
  301. if (options.companyName) {
  302. this.companyName = decodeURIComponent(options.companyName);
  303. console.log('接收的公司名称:', this.companyName);
  304. }
  305. if (options.status) {
  306. this.status = decodeURIComponent(options.status);
  307. console.log('接收的公司状态:', this.status);
  308. }else{
  309. //this.status = uni.getStorageSync('companyStatus')
  310. this.getcompanystatus()
  311. }
  312. this.fundListener = uni.$on("fundData", (data) => {
  313. console.log("接收到的福利数据:", data);
  314. this.welfareTag = data; // 赋值给当前页面变量
  315. });
  316. this.fundListener = uni.$on("skillsUpdated", (data) => {
  317. console.log("接收到的职位技能数据:", data);
  318. this.positionTag = data.selectedTags; // 赋值给当前页面变量
  319. });
  320. this.fundListener = uni.$on("addressData", (data) => {
  321. console.log("接收到的地址数据:", data);
  322. this.stationName = data; // 赋值给当前页面变量
  323. });
  324. if (options.companyId) {
  325. this.companyId = options.companyId;
  326. console.log('接收的公司ID:', this.companyId);
  327. } else {
  328. this.companyId = uni.getStorageSync('companyId') || ""
  329. }
  330. if (options.pid) {
  331. this.pid = options.pid;
  332. this.type = options.type;
  333. if(options.type && options.type=='updata'){
  334. this.getInfo()
  335. }
  336. console.log('接收PID:', this.pid);
  337. } else {
  338. uni.navigateTo({
  339. url: '/pages/my/jobPosting?companyId=' + this.companyId + '&status=' + this.status +
  340. '&companyName=' + this.companyName
  341. })
  342. }
  343. },
  344. onUnload() {
  345. // 页面关闭时移除监听,避免内存泄漏
  346. if (this.fundListener) {
  347. uni.$off("fundData", this.fundListener);
  348. }
  349. },
  350. methods: {
  351. // 处理经验选择(核心修复:直接接收选中的label)
  352. onExperConfirm(selectedItem) {
  353. // 不同版本u-select返回格式可能是对象或数组,这里兼容处理
  354. if (Array.isArray(selectedItem)) {
  355. this.selectedExper = selectedItem[0]?.label || "";
  356. } else {
  357. this.selectedExper = selectedItem?.label || "";
  358. }
  359. this.showExper = false; // 关闭选择器
  360. },
  361. // 处理学历选择(核心修复)
  362. onLevelConfirm(selectedItem) {
  363. if (Array.isArray(selectedItem)) {
  364. this.selectedLevel = selectedItem[0]?.label || "";
  365. } else {
  366. this.selectedLevel = selectedItem?.label || "";
  367. }
  368. this.showLevel = false;
  369. },
  370. /**
  371. * 获取岗位详情
  372. */
  373. getInfo(){
  374. this.$Request.getT("/app/postPush/selectPostPushDetails",{
  375. // userId:uni.getStorageSync('userId'),
  376. postPushId:this.pid
  377. }).then(res => {
  378. if(res.code==0){
  379. this.selectedExper=res.data.experience
  380. this.selectedLevel=res.data.education
  381. this.selectedSalary=res.data.salaryRange
  382. this.welfareTag=res.data.welfareTag
  383. this.positionTag=res.data.positionTag
  384. this.address=res.data.address
  385. this.stationName.fullText=res.data.address
  386. this.stationName.latitude=res.data.lat
  387. this.stationName.longitude=res.data.lng
  388. this.stationName.province=res.data.province
  389. this.stationName.city=res.data.city
  390. this.stationName.district=res.data.county
  391. this.salaryTimes=res.data.salaryTimes
  392. console.log(this.stationName)
  393. }else{
  394. uni.showToast({
  395. title: '数据有误',
  396. icon: 'none', // 注意这里需要加引号
  397. duration: 2000, // 可选:设置提示框显示时长
  398. complete() { // 正确的回调函数写法
  399. uni.navigateBack();
  400. }
  401. });
  402. }
  403. })
  404. },
  405. // 查询用户企业状态
  406. getcompanystatus() {
  407. this.$Request.get("/app/company/selectCompanyByUserId", "")
  408. .then((res) => {
  409. if (res.code != 0) {
  410. uni.showToast({
  411. title: res.msg || "查询状态失败",
  412. icon: "none"
  413. });
  414. return;
  415. }
  416. this.status = res.data.companyinfo || "";
  417. this.$queue.setData('companyId', res.data.companyId);
  418. this.$queue.setData('companyStatus', res.data.companyStatus);
  419. console.log("查询用户企业状态", this.companyinfo)
  420. })
  421. .catch((err) => {
  422. console.error("查询失败:", err);
  423. uni.showToast({
  424. title: "网络异常",
  425. icon: "none"
  426. });
  427. });
  428. },
  429. // 处理薪资范围选择(核心修复)
  430. onMoneyConfirm(selectedItems) {
  431. // 多列选择器返回数组,取每列选中的label拼接
  432. console.log(selectedItems)
  433. if (Array.isArray(selectedItems) && selectedItems.length >= 2) {
  434. const min = selectedItems[0]?.label || "";
  435. const max = selectedItems[1]?.label || "";
  436. const xin = selectedItems[2]?.label || "";
  437. this.selectedSalary = `${min}-${max}`;
  438. this.salaryTimes=`${xin}`
  439. }
  440. this.showMoney = false;
  441. },
  442. // 跳转页面并接收参数(福利待遇)
  443. goFund() {
  444. uni.navigateTo({
  445. url: "/package/jobIntention/fund",
  446. events: {
  447. // 监听子页面发送的福利数据
  448. fundData: (data) => {
  449. this.welfareTag = data;
  450. },
  451. },
  452. });
  453. },
  454. // 跳转页面并接收参数(职位关键词)
  455. goJobSkill() {
  456. uni.navigateTo({
  457. url: "/package/jobIntention/jobSkills",
  458. events: {
  459. skillsUpdated: (data) => {
  460. this.positionTag = data.selectedTags;
  461. },
  462. },
  463. });
  464. },
  465. // 跳转页面并接收参数(工作地址)
  466. goAddAddress() {
  467. uni.navigateTo({
  468. url: "/package/jobIntention/addAddress",
  469. events: {
  470. addressData: (data) => {
  471. this.stationName = data;
  472. },
  473. },
  474. });
  475. },
  476. // 提交表单
  477. submitPost() {
  478. // 验证必填项
  479. if (!this.selectedExper) {
  480. return uni.showToast({
  481. title: "请选择经验要求",
  482. icon: "none"
  483. });
  484. }
  485. if (!this.selectedLevel) {
  486. return uni.showToast({
  487. title: "请选择最低学历",
  488. icon: "none"
  489. });
  490. }
  491. if (!this.selectedSalary) {
  492. return uni.showToast({
  493. title: "请选择薪资范围",
  494. icon: "none"
  495. });
  496. }
  497. if (!this.stationName.fullText && !this.address) {
  498. return uni.showToast({
  499. title: "请填写工作地址",
  500. icon: "none"
  501. });
  502. }
  503. if (this.type && this.type=='updata' && !this.stationName.longitude) {
  504. return uni.showToast({
  505. title: "请选择位置",
  506. icon: "none"
  507. });
  508. }
  509. if (!this.positionTag) {
  510. return uni.showToast({
  511. title: "请选择职位标签",
  512. icon: "none"
  513. });
  514. }
  515. var positionTag = this.positionTag
  516. const str = positionTag.join(',');
  517. // 构造提交数据
  518. const data = {
  519. orderid: 1,
  520. postPushId: this.pid,
  521. experience: this.selectedExper, //工作经验
  522. education: this.selectedLevel, //学历
  523. salaryRange: this.selectedSalary, //薪资范围
  524. welfareTag: this.welfareTag, //福利相关标签
  525. positionTag: str, //职位技能
  526. address: this.stationName.fullText|| this.address, //地址
  527. lat: this.stationName.latitude,
  528. lng: this.stationName.longitude,
  529. province: this.stationName.province,
  530. city: this.stationName.city,
  531. county: this.stationName.district,
  532. companyId:(this.companyId === undefined || this.companyId === 'undefined') ? '' : this.companyId,
  533. salaryTimes:this.salaryTimes
  534. };
  535. // 调用接口提交
  536. uni.showLoading({
  537. title: "提交中..."
  538. });
  539. this.$Request.postJson("/app/postPush/savePostPush", data)
  540. .then((res) => {
  541. uni.hideLoading();
  542. if (res.code === 0) {
  543. uni.showToast({
  544. title: "提交成功",
  545. icon: "success"
  546. });
  547. //这里要选择跳转,第一次是要跳公司页,如果是二次就到职位管理页
  548. if (this.status == 1) { //审核中
  549. uni.navigateTo({
  550. url: "/package/jobIntention/company?companyName=" + this.companyName +
  551. '&companyId=' + this.companyId
  552. });
  553. } else if(this.status == 2){//审核通过
  554. uni.navigateTo({
  555. url: '/pages/jobManagement/jobManagement'
  556. })
  557. }else {
  558. uni.navigateTo({
  559. url: '/my/renzheng/editCompany'
  560. })
  561. }
  562. } else {
  563. uni.showToast({
  564. title: res.msg || "提交失败",
  565. icon: "none"
  566. });
  567. }
  568. })
  569. .catch((err) => {
  570. uni.hideLoading();
  571. console.error("提交失败:", err);
  572. uni.showToast({
  573. title: "网络异常",
  574. icon: "none"
  575. });
  576. });
  577. },
  578. },
  579. };
  580. </script>
  581. <style lang="scss" scoped>
  582. /* 原有样式保持不变 */
  583. .switch-roles {
  584. background-color: #fff;
  585. position: absolute;
  586. left: 0;
  587. right: 0;
  588. top: 0;
  589. bottom: 0;
  590. display: flex;
  591. flex-direction: column;
  592. .roles-content {
  593. width: 100%;
  594. flex: 1;
  595. overflow: auto;
  596. .content {
  597. padding: 40rpx;
  598. .title {
  599. color: #333;
  600. font-size: 40rpx;
  601. font-weight: 600;
  602. margin-bottom: 10rpx;
  603. }
  604. .desc {
  605. color: #666;
  606. font-size: 24rpx;
  607. margin-bottom: 20rpx;
  608. }
  609. .check-title-big {
  610. color: #3a3943;
  611. font-size: 36rpx;
  612. font-weight: 500;
  613. padding: 20rpx 0;
  614. }
  615. .check-select {
  616. width: 100%;
  617. display: flex;
  618. justify-content: space-between;
  619. align-items: center;
  620. padding: 32rpx 47rpx;
  621. border-radius: 12rpx;
  622. box-shadow: 0 16rpx 300rpx rgba(0, 0, 0, 0.06);
  623. background: #fff;
  624. margin-bottom: 20rpx;
  625. .select-txt {
  626. color: #999;
  627. font-size: 28rpx;
  628. }
  629. }
  630. .txt-desc {
  631. color: #666;
  632. font-size: 24rpx;
  633. margin-top: 20rpx;
  634. line-height: 1.5;
  635. }
  636. }
  637. }
  638. .step {
  639. padding: 32rpx 0;
  640. }
  641. .submit-btn {
  642. margin: 60rpx 20rpx;
  643. padding: 16rpx 32rpx;
  644. border-radius: 999px;
  645. background: linear-gradient(90deg, #0d27f7, #13c1ea);
  646. color: #fff;
  647. font-size: 32rpx;
  648. text-align: center;
  649. line-height: 48rpx;
  650. }
  651. }
  652. </style>