jobPostingSecond.vue 17 KB

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