jobPostingSecond.vue 17 KB

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