jobPostingSecond.vue 19 KB

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