jobPostingSecond.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  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 || "请选择合理的薪资范围" }}</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">{{ 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. // 选择器显示控制
  81. showExper: false,
  82. showLevel: false,
  83. showMoney: false,
  84. // 经验选择数据源
  85. listExper: [{
  86. label: "不限",
  87. value: "不限"
  88. },
  89. {
  90. label: "1年以内",
  91. value: "1年以内"
  92. },
  93. {
  94. label: "1-3年",
  95. value: "1-3年"
  96. },
  97. {
  98. label: "3-5年",
  99. value: "3-5年"
  100. },
  101. {
  102. label: "5-10年",
  103. value: "5-10年"
  104. },
  105. {
  106. label: "10年以上",
  107. value: "10年以上"
  108. },
  109. ],
  110. // 学历选择数据源
  111. listLevel: [{
  112. label: "不限",
  113. value: "不限"
  114. },
  115. {
  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. // 薪资选择数据源(修正格式)
  133. listMoney: [
  134. [{
  135. value: "3k",
  136. label: "3k"
  137. },
  138. {
  139. value: "4k",
  140. label: "4k"
  141. },
  142. {
  143. value: "5k",
  144. label: "5k"
  145. },
  146. {
  147. value: "6k",
  148. label: "6k"
  149. },
  150. {
  151. value: "10k",
  152. label: "10k"
  153. },
  154. {
  155. value: "15k",
  156. label: "15k"
  157. },
  158. {
  159. value: "20k",
  160. label: "20k"
  161. },
  162. ],
  163. [{
  164. value: "10k",
  165. label: "10k"
  166. },
  167. {
  168. value: "15k",
  169. label: "15k"
  170. },
  171. {
  172. value: "20k",
  173. label: "20k"
  174. },
  175. {
  176. value: "30k",
  177. label: "30k"
  178. },
  179. {
  180. value: "50k",
  181. label: "50k"
  182. },
  183. {
  184. value: "100k",
  185. label: "100k"
  186. },
  187. ],
  188. ],
  189. numList: [{
  190. name: "填写基本信息"
  191. },
  192. {
  193. name: "选择职位要求"
  194. },
  195. ],
  196. };
  197. },
  198. components: {
  199. navBar,
  200. },
  201. onLoad(options) {
  202. // 接收上个页面传递的公司名称参数
  203. if (options.companyName) {
  204. this.companyName = decodeURIComponent(options.companyName);
  205. console.log('接收的公司名称:', this.companyName);
  206. }
  207. if (options.status) {
  208. this.status = decodeURIComponent(options.status);
  209. console.log('接收的公司状态:', this.status);
  210. }
  211. this.fundListener = uni.$on("fundData", (data) => {
  212. console.log("接收到的福利数据:", data);
  213. this.welfareTag = data; // 赋值给当前页面变量
  214. });
  215. this.fundListener = uni.$on("skillsUpdated", (data) => {
  216. console.log("接收到的职位技能数据:", data);
  217. this.positionTag = data.selectedTags; // 赋值给当前页面变量
  218. });
  219. this.fundListener = uni.$on("addressData", (data) => {
  220. console.log("接收到的地址数据:", data);
  221. this.stationName = data; // 赋值给当前页面变量
  222. });
  223. if (options.companyId) {
  224. this.companyId = options.companyId;
  225. console.log('接收的公司ID:', this.companyId);
  226. }else{
  227. this.companyId = uni.getStorageSync('companyId') || ""
  228. }
  229. },
  230. onUnload() {
  231. // 页面关闭时移除监听,避免内存泄漏
  232. if (this.fundListener) {
  233. uni.$off("fundData", this.fundListener);
  234. }
  235. },
  236. methods: {
  237. // 处理经验选择(核心修复:直接接收选中的label)
  238. onExperConfirm(selectedItem) {
  239. // 不同版本u-select返回格式可能是对象或数组,这里兼容处理
  240. if (Array.isArray(selectedItem)) {
  241. this.selectedExper = selectedItem[0]?.label || "";
  242. } else {
  243. this.selectedExper = selectedItem?.label || "";
  244. }
  245. this.showExper = false; // 关闭选择器
  246. },
  247. // 处理学历选择(核心修复)
  248. onLevelConfirm(selectedItem) {
  249. if (Array.isArray(selectedItem)) {
  250. this.selectedLevel = selectedItem[0]?.label || "";
  251. } else {
  252. this.selectedLevel = selectedItem?.label || "";
  253. }
  254. this.showLevel = false;
  255. },
  256. // 处理薪资范围选择(核心修复)
  257. onMoneyConfirm(selectedItems) {
  258. // 多列选择器返回数组,取每列选中的label拼接
  259. if (Array.isArray(selectedItems) && selectedItems.length >= 2) {
  260. const min = selectedItems[0]?.label || "";
  261. const max = selectedItems[1]?.label || "";
  262. this.selectedSalary = `${min}-${max}`;
  263. }
  264. this.showMoney = false;
  265. },
  266. // 跳转页面并接收参数(福利待遇)
  267. goFund() {
  268. uni.navigateTo({
  269. url: "/package/jobIntention/fund",
  270. events: {
  271. // 监听子页面发送的福利数据
  272. fundData: (data) => {
  273. this.welfareTag = data;
  274. },
  275. },
  276. });
  277. },
  278. // 跳转页面并接收参数(职位关键词)
  279. goJobSkill() {
  280. uni.navigateTo({
  281. url: "/package/jobIntention/jobSkills",
  282. events: {
  283. skillsUpdated: (data) => {
  284. this.positionTag = data.selectedTags;
  285. },
  286. },
  287. });
  288. },
  289. // 跳转页面并接收参数(工作地址)
  290. goAddAddress() {
  291. uni.navigateTo({
  292. url: "/package/jobIntention/addAddress",
  293. events: {
  294. addressData: (data) => {
  295. this.stationName = data;
  296. },
  297. },
  298. });
  299. },
  300. // 提交表单
  301. submitPost() {
  302. // 验证必填项
  303. if (!this.selectedExper) {
  304. return uni.showToast({
  305. title: "请选择经验要求",
  306. icon: "none"
  307. });
  308. }
  309. if (!this.selectedLevel) {
  310. return uni.showToast({
  311. title: "请选择最低学历",
  312. icon: "none"
  313. });
  314. }
  315. if (!this.selectedSalary) {
  316. return uni.showToast({
  317. title: "请选择薪资范围",
  318. icon: "none"
  319. });
  320. }
  321. if (!this.stationName.fullText) {
  322. return uni.showToast({
  323. title: "请填写工作地址",
  324. icon: "none"
  325. });
  326. }
  327. var positionTag = this.positionTag
  328. const str = positionTag.join(',');
  329. // 构造提交数据
  330. const data = {
  331. experience: this.selectedExper, //工作经验
  332. education: this.selectedLevel, //学历
  333. salaryRange: this.selectedSalary, //薪资范围
  334. welfareTag: this.welfareTag, //福利相关标签
  335. positionTag: str, //职位技能
  336. address: this.stationName.fullText, //地址
  337. lat: this.stationName.latitude,
  338. lng: this.stationName.longitude,
  339. province: this.stationName.province,
  340. city: this.stationName.city,
  341. county: this.stationName.district
  342. };
  343. // 调用接口提交
  344. uni.showLoading({
  345. title: "提交中..."
  346. });
  347. this.$Request.postJson("/app/postPush/savePostPush", data)
  348. .then((res) => {
  349. uni.hideLoading();
  350. if (res.code === 0) {
  351. uni.showToast({
  352. title: "提交成功",
  353. icon: "success"
  354. });
  355. //这里要选择跳转,第一次是要跳公司页,如果是二次就到职位管理页
  356. if (this.status == 1) { //审核中
  357. uni.navigateTo({
  358. url: "/package/jobIntention/company?companyName=" + this.companyName +
  359. '&companyId=' + this.companyId
  360. });
  361. } else {
  362. uni.navigateTo({
  363. url: '/pages/jobManagement/jobManagement'
  364. })
  365. }
  366. } else {
  367. uni.showToast({
  368. title: res.msg || "提交失败",
  369. icon: "none"
  370. });
  371. }
  372. })
  373. .catch((err) => {
  374. uni.hideLoading();
  375. console.error("提交失败:", err);
  376. uni.showToast({
  377. title: "网络异常",
  378. icon: "none"
  379. });
  380. });
  381. },
  382. },
  383. };
  384. </script>
  385. <style lang="scss" scoped>
  386. /* 原有样式保持不变 */
  387. .switch-roles {
  388. background-color: #fff;
  389. position: absolute;
  390. left: 0;
  391. right: 0;
  392. top: 0;
  393. bottom: 0;
  394. display: flex;
  395. flex-direction: column;
  396. .roles-content {
  397. width: 100%;
  398. flex: 1;
  399. overflow: auto;
  400. .content {
  401. padding: 40rpx;
  402. .title {
  403. color: #333;
  404. font-size: 40rpx;
  405. font-weight: 600;
  406. margin-bottom: 10rpx;
  407. }
  408. .desc {
  409. color: #666;
  410. font-size: 24rpx;
  411. margin-bottom: 20rpx;
  412. }
  413. .check-title-big {
  414. color: #3a3943;
  415. font-size: 36rpx;
  416. font-weight: 500;
  417. padding: 20rpx 0;
  418. }
  419. .check-select {
  420. width: 100%;
  421. display: flex;
  422. justify-content: space-between;
  423. align-items: center;
  424. padding: 32rpx 47rpx;
  425. border-radius: 12rpx;
  426. box-shadow: 0 16rpx 300rpx rgba(0, 0, 0, 0.06);
  427. background: #fff;
  428. margin-bottom: 20rpx;
  429. .select-txt {
  430. color: #999;
  431. font-size: 28rpx;
  432. }
  433. }
  434. .txt-desc {
  435. color: #666;
  436. font-size: 24rpx;
  437. margin-top: 20rpx;
  438. line-height: 1.5;
  439. }
  440. }
  441. }
  442. .step {
  443. padding: 32rpx 0;
  444. }
  445. .submit-btn {
  446. margin: 60rpx 20rpx;
  447. padding: 16rpx 32rpx;
  448. border-radius: 999px;
  449. background: linear-gradient(90deg, #0d27f7, #13c1ea);
  450. color: #fff;
  451. font-size: 32rpx;
  452. text-align: center;
  453. line-height: 48rpx;
  454. }
  455. }
  456. </style>