jobManagement.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. <template>
  2. <view class="job-management-page">
  3. <view class="fixed-header">
  4. <nav-bar title="职位管理" :backUrl="backUrl" goMy="/pages/my/index">
  5. <view slot="left" v-if="canClose" @click="handleToIndex">
  6. <u-icon name="close" color="#333"></u-icon>
  7. </view>
  8. </nav-bar>
  9. <!-- 标签页导航 - 使用uview的u-tabs组件 -->
  10. <view class="sticky-tabs">
  11. <u-tabs
  12. :list="tabs"
  13. :current="tabIndex"
  14. @change="tabChange"
  15. :is-scroll="false"
  16. :height="88"
  17. :font-size="24"
  18. active-color="rgba(1, 107, 246, 1)"
  19. inactive-color="rgba(102, 102, 102, 1)"
  20. :bar-width="60"
  21. :bar-height="4"
  22. :gutter="0"
  23. bg-color="#ffffff"
  24. ></u-tabs>
  25. </view>
  26. </view>
  27. <!-- 职位列表 -->
  28. <view class="job-list">
  29. <!-- 有数据时显示列表 -->
  30. <scroll-view
  31. scroll-y="true"
  32. style="width: 100%;height: 100%;"
  33. v-if="jobList.length > 0"
  34. @scrolltolower="loadMore"
  35. lower-threshold="50"
  36. >
  37. <view class="list">
  38. <view
  39. class="job-card"
  40. v-for="(job, index) in jobList"
  41. :key="index"
  42. @click="goNav(`/pages/index/game/order?postPushId=${job.postPushId}&hideBottomBtn=true`)"
  43. >
  44. <view class="job-card-content">
  45. <view class="job-header">
  46. <view class="job-title-section">
  47. <text class="job-title">{{job.stationName || job.ruleClassifyName}}</text>
  48. <view class="urgent-tag" v-if="job.isDue">急聘</view>
  49. </view>
  50. <view class="job-status" :class="job.status | statusClassName">
  51. {{job.status | statusText}}
  52. </view>
  53. </view>
  54. <view class="base-info">
  55. <text class="info-item color-clip">{{ job.city }}</text>
  56. <text class="info-item color-clip">{{ job.education }}</text>
  57. <text class="info-item color-clip">{{ job.experience }}</text>
  58. <text class="info-item color-clip">{{ job.salaryRange }}·{{ job.salaryTimes }}</text>
  59. </view>
  60. <view class="tags">
  61. <view class="tag" v-for="(tag, i) in job.positionTags" :key="i">{{ tag }}</view>
  62. </view>
  63. <view class="company-info flex align-center">
  64. <image :src="job.company.companyLogo || '/static/logo.png'" class="logo"></image>
  65. <text class="company-name">{{ job.company.companyName }}</text>
  66. </view>
  67. <view class="buttons flex align-center">
  68. <view class="button primary" v-if="job.status == 5" @click.stop="handleOpenPosition('open', job)">开启岗位</view>
  69. <view class="button plain" v-if="job.status != 1" @click.stop="handleEditPosition(job)">{{ job.status == 2 ? '下架并编辑' : '编辑修改' }}</view>
  70. <view class="button info" v-if="job.status == 2" @click.stop="handleOpenPosition('close', job)">关闭职位</view>
  71. <view class="button info" v-else @click.stop="handleDeletePosition(job)">删除</view>
  72. </view>
  73. </view>
  74. </view>
  75. </view>
  76. </scroll-view>
  77. <!-- 空状态显示 -->
  78. <view class="empty-state" v-else>
  79. <view class="empty-illustration">
  80. <image src="../../static/images/index/Hrempty.svg" class="empty-image" mode="aspectFit" />
  81. </view>
  82. </view>
  83. </view>
  84. <c-modal
  85. :value="showTipModal"
  86. title="温馨提示"
  87. :show-cancel-button="false"
  88. :confirm-button-text="tipType == 3 ? '立即认证' : '我知道了'"
  89. @confirm="handleConfirm"
  90. >
  91. <!-- 关联已有企业,等待审核通过 -->
  92. <template v-if="tipType == 1">
  93. <view>请您等待企业审核通知</view>
  94. <view>审核通过后即可立即发布岗位拉!</view>
  95. </template>
  96. <!-- 新企业待审核 -->
  97. <template v-else-if="tipType == 2">
  98. <view>企业入住提交后需要提示1-3个工作日审核</view>
  99. <view>审核通过后即可立即发布岗位!</view>
  100. </template>
  101. <!-- 新企业,没有填写资料 -->
  102. <template v-else-if="tipType == 3">
  103. <view>没有进行企业认证,请立即认证!</view>
  104. <view>认证后可发布岗位招聘拉!</view>
  105. </template>
  106. <!-- 发布岗位待审核 -->
  107. <template v-else-if="tipType == 4">
  108. <view>发布提交后需要提示1-3个工作日审核</view>
  109. </template>
  110. </c-modal>
  111. <!-- 底部发布按钮 -->
  112. <view class="button-section">
  113. <view class="submit-btn" @click="publishNewJob">发布新职位</view>
  114. </view>
  115. </view>
  116. </template>
  117. <script>
  118. import navBar from "@/components/nav-bar/index.vue";
  119. import empty from '@/components/empty.vue'
  120. import cModal from '@/components/c-modal.vue'
  121. export default {
  122. components: {
  123. navBar,
  124. cModal
  125. },
  126. data() {
  127. return {
  128. tabIndex: 0,
  129. tabs: [
  130. { name: '全部', status: 0 },
  131. { name: '待审核', status: 1 },
  132. { name: '招聘中', status: 2 },
  133. { name: '已拒绝', status: 3 },
  134. // { name: '已取消', status: 4 },
  135. { name: '已关闭', status: 5 },
  136. // { name: '已拒绝', status: 6 }
  137. ],
  138. jobList: [],
  139. page: 1, // 当前页码
  140. limit: 10, // 每页条数
  141. count: 0, // 总条数
  142. companyId: '',
  143. isLoading: false, // 防止重复请求标记
  144. backUrl:'',
  145. status:'',
  146. canClose: false, // 判断页面是否是关闭,如果是从“完善招聘名片”页面进入,则是可以关闭,反之则不可以
  147. loading: false,
  148. showTipModal: false,
  149. companyInfo: {},
  150. tipType: 1,
  151. positionCount: 0, // 剩余可发布岗位数量
  152. }
  153. },
  154. filters: {
  155. statusText(value) {
  156. switch (value) {
  157. case 1: return '待审核'
  158. case 2: return '招聘中'
  159. case 3: return '已拒绝'
  160. case 4: return '已取消'
  161. case 5: return '已关闭'
  162. case 6: return '暂存'
  163. default: return '暂无数据'
  164. }
  165. },
  166. statusClassName(value) {
  167. switch (value) {
  168. case 1: return ''
  169. case 2: return 'primary'
  170. case 3: return 'info'
  171. case 4: return 'error'
  172. case 5: return 'error'
  173. default: return ''
  174. }
  175. }
  176. },
  177. onLoad(options) {
  178. if (options.type && options.type == 'canClose') {
  179. this.canClose = true
  180. }
  181. if(options.status){
  182. this.status=options.status
  183. }
  184. this.backUrl = options.backUrl;
  185. if(options.companyId){
  186. this.companyId=options.companyId;
  187. }
  188. // this.companyId = uni.getStorageSync('companyId');
  189. this.getJobList();
  190. this.setBodyHeight();
  191. },
  192. onShow() {
  193. this.getCompanyInfo()
  194. this.getJobList();
  195. this.getVipData();
  196. },
  197. methods: {
  198. // 获取职位列表(新增分页逻辑)
  199. getJobList() {
  200. if (this.isLoading) return; // 正在加载时,阻止重复请求
  201. this.isLoading = true;
  202. let status = this.tabIndex == 0 ? '' : this.tabs[this.tabIndex].status
  203. let data = {
  204. status,
  205. page: this.page,
  206. limit: this.limit,
  207. companyId: this.companyId
  208. }
  209. this.$Request.getT('/app/postPush/getMyPostPush', data).then(res => {
  210. if (res.code == 0) {
  211. if (this.page == 1) {
  212. this.jobList = []; // 第一页清空原有列表
  213. }
  214. // 拼接新数据
  215. res.data.records.forEach(ret => {
  216. ret.showpeop = false
  217. if (ret.status == 1) {
  218. ret.statusName = '待审核'
  219. } else if (ret.status == 2) {
  220. ret.statusName = '招聘中'
  221. } else if (ret.status == 3) {
  222. ret.statusName = '已拒绝'
  223. } else if (ret.status == 4) {
  224. ret.statusName = '已取消'
  225. } else if (ret.status == 5) {
  226. ret.statusName = '已关闭'
  227. }
  228. ret.positionTags = ret.positionTag?.split(',')
  229. this.jobList.push(ret)
  230. })
  231. this.count = res.data.total; // 更新总条数
  232. }
  233. this.isLoading = false;
  234. uni.stopPullDownRefresh();
  235. }).catch(err => {
  236. this.isLoading = false;
  237. uni.hideLoading();
  238. uni.stopPullDownRefresh();
  239. })
  240. },
  241. // 触底加载下一页
  242. loadMore() {
  243. if (this.jobList.length >= this.count) {
  244. uni.showToast({ title: '已加载全部数据', icon: 'none' });
  245. return;
  246. }
  247. this.page++; // 页码+1
  248. this.getJobList(); // 请求下一页
  249. },
  250. // 切换标签页(重置分页)
  251. tabChange(e) {
  252. const index = typeof e === 'number' ? e : e.index
  253. this.tabIndex = index
  254. this.page = 1; // 切换标签时重置为第1页
  255. this.jobList = [];
  256. this.getJobList();
  257. },
  258. // 下拉刷新(可选,若需要下拉刷新可添加)
  259. onPullDownRefresh() {
  260. this.page = 1;
  261. this.getJobList();
  262. },
  263. // 原有方法保持不变...
  264. goBack() {
  265. uni.switchTab({
  266. url: '/pages/my/index'
  267. });
  268. },
  269. goNav(url) { uni.navigateTo({ url }); },
  270. // publishNewJob() { uni.navigateTo({ url: '/package/addJob/addJob' }); },
  271. // 发布新岗位
  272. publishNewJob() {
  273. // 1. 非管理员,申请加入企业,但是未审核通过
  274. // 2. 管理员,企业申请了,但是未审核通过
  275. // 3. 管理员,企业审核通过了,但是未完善资料(营业执照数据未上传)
  276. // 4. 发布岗位正在审核中(非VIP只能发布一个岗位,后端设置)
  277. if (this.companyInfo?.companyUser?.isAdmin != 1 && this.companyInfo?.companyUser?.status == 1) {
  278. this.tipType = 1
  279. this.showTipModal = true
  280. return
  281. } else if (this.companyInfo?.companyUser?.isAdmin == 1 && this.companyInfo?.status != 2) {
  282. this.tipType = 2
  283. this.showTipModal = true
  284. return
  285. } else if (this.companyInfo?.companyUser?.isAdmin == 1 && !this.companyInfo?.companyDutyParagraph) {
  286. this.tipType = 3
  287. this.showTipModal = true
  288. return
  289. } else if (this.positionCount == 0) {
  290. this.tipType = 4
  291. this.showTipModal = true
  292. return
  293. }
  294. uni.navigateTo({ url: `/pages/my/jobPosting?status=${this.status}&companyId=${this.companyId}` });
  295. },
  296. setBodyHeight() { /* 原有逻辑不变 */ },
  297. // 跳转至首页
  298. handleToIndex() {
  299. uni.reLaunch({
  300. url: '/pages/index/index'
  301. })
  302. },
  303. // 开启职位
  304. handleOpenPosition(type, item) {
  305. uni.showModal({
  306. title: '提示',
  307. content: type == 'close' ? '关闭岗位后,该岗位不会再推荐给用户,是否关闭?' : '开启岗位后,该岗位会重新推荐给用户,是否开启?',
  308. complete: (ret) => {
  309. if (ret.confirm) {
  310. this.closePosition(item)
  311. }
  312. }
  313. })
  314. },
  315. // 开启关闭岗位
  316. closePosition(item, callback) {
  317. if (this.loading) return
  318. this.loading = true
  319. uni.showLoading({
  320. title: '处理中'
  321. })
  322. this.$Request.getT('/app/postPush/closeOrOpen', {
  323. postPushId: item.postPushId
  324. }).then(res => {
  325. if (res.code == 0) {
  326. uni.showToast({
  327. title: '操作成功',
  328. duration: 1500,
  329. complete: () => {
  330. this.page = 1
  331. this.getJobList()
  332. if (typeof callback == 'function') {
  333. callback()
  334. }
  335. }
  336. })
  337. } else {
  338. uni.showToast({
  339. title: res.msg,
  340. icon: 'none'
  341. })
  342. }
  343. }).finally(() => {
  344. uni.hideLoading()
  345. this.loading = false
  346. })
  347. },
  348. // 编辑职位
  349. handleEditPosition(item) {
  350. // 如果是招聘中,则是下架并编辑,需要先下架再编辑
  351. if (item.status == 2) {
  352. uni.showModal({
  353. content: '确认下架并编辑该岗位?',
  354. title: '提示',
  355. confirmColor: '#016BF6',
  356. success: (it) => {
  357. if (it.confirm) {
  358. this.closePosition(item, () => {
  359. uni.navigateTo({
  360. url: `/pages/my/jobPosting?postPushId=${item.postPushId}&type=update`
  361. })
  362. })
  363. }
  364. }
  365. })
  366. } else {
  367. uni.navigateTo({
  368. url: `/pages/my/jobPosting?postPushId=${item.postPushId}&type=update`
  369. })
  370. }
  371. },
  372. // 删除职位
  373. handleDeletePosition(item) {
  374. uni.showModal({
  375. content: '确认删除该岗位吗?',
  376. title: '提示',
  377. confirmColor: '#016BF6',
  378. success: (iet) => {
  379. if (iet.confirm) {
  380. this.deletePosition(item)
  381. }
  382. }
  383. })
  384. },
  385. // 删除职位
  386. deletePosition(item) {
  387. if (this.loading) return
  388. this.loading = true
  389. uni.showLoading({
  390. title: '处理中'
  391. })
  392. this.$Request.post('/app/postPush/deletePostPush', {
  393. postPushId: item.postPushId,
  394. }).then(res => {
  395. if (res.code == 0) {
  396. uni.showToast({
  397. title: '删除成功',
  398. duration: 1500
  399. })
  400. this.page = 1
  401. this.getJobList()
  402. } else {
  403. uni.showToast({
  404. title: res.msg,
  405. icon: 'none'
  406. })
  407. }
  408. }).finally(() => {
  409. uni.hideLoading()
  410. this.loading = false
  411. })
  412. },
  413. // 获取公司状态
  414. getCompanyInfo() {
  415. this.$Request.get('/app/company/selectCompanyByUserId')
  416. .then((res) => {
  417. if (res.code == 0) {
  418. this.companyInfo = res.data
  419. }
  420. })
  421. },
  422. // 获取岗位数量
  423. getVipData(){
  424. this.$Request.get("/app/user/vipData").then((res) => {
  425. if (res.code == 0) {
  426. this.positionCount = Number(res.data.lastDueTimes || 0) + Number(res.data.lastPostTimes || 0)
  427. }
  428. })
  429. },
  430. handleConfirm() {
  431. if (this.tipType == 3) {
  432. const companyId = this.companyInfo?.companyId
  433. const companyName = this.companyInfo?.companyAllName
  434. uni.navigateTo({
  435. url: `/package/jobIntention/companyImg?companyId=${companyId}&companyName=${encodeURIComponent(companyName)}`,
  436. success: () => {
  437. this.showTipModal = false
  438. }
  439. })
  440. } else {
  441. this.showTipModal = false
  442. }
  443. }
  444. }
  445. }
  446. </script>
  447. <style lang="scss" scoped>
  448. /*
  449. sticky生效条件:
  450. 1、父元素不能overflow:hidden或者overflow:auto属性。(mescroll-body设置:sticky="true"即可, mescroll-uni本身没有设置overflow)
  451. 2、必须指定top、bottom、left、right4个值之一,否则只会处于相对定位
  452. 3、父元素的高度不能低于sticky元素的高度
  453. 4、sticky元素仅在其父元素内生效,所以父元素必须是 mescroll
  454. */
  455. .sticky-tabs {
  456. z-index: 990;
  457. // position: sticky;
  458. // top: var(--window-top);
  459. background-color: #fff;
  460. }
  461. page {
  462. background-color: #ffffff;
  463. }
  464. .job-management-page {
  465. background-color: #ffffff;
  466. display: flex;
  467. flex-direction: column;
  468. height: 100vh;
  469. font-family: DM Sans;
  470. box-sizing: border-box;
  471. }
  472. .fixed-header {
  473. background-color: #ffffff;
  474. }
  475. .job-list {
  476. padding: 20rpx 40rpx 0;
  477. flex: 1;
  478. display: flex;
  479. flex-direction: column;
  480. overflow: auto;
  481. .list {
  482. padding-bottom: 30rpx;
  483. }
  484. .job-card {
  485. background: #ffffff;
  486. border-radius: 12rpx;
  487. margin-bottom: 20rpx;
  488. padding: 16rpx 36rpx;
  489. border: 0.5px solid rgba(227, 231, 236, 1);
  490. .job-card-content {
  491. .job-header {
  492. display: flex;
  493. justify-content: space-between;
  494. align-items: flex-start;
  495. margin-bottom: 8rpx;
  496. .job-title-section {
  497. display: flex;
  498. align-items: center;
  499. flex: 1;
  500. .job-title {
  501. color: rgba(23, 23, 37, 1);
  502. font-family: DM Sans;
  503. font-size: 28rpx;
  504. font-weight: 400;
  505. line-height: 44rpx;
  506. letter-spacing: 0.5%;
  507. text-align: left;
  508. }
  509. .urgent-tag {
  510. border-radius: 8rpx;
  511. padding: 8rpx;
  512. margin-left: 20rpx;
  513. background: radial-gradient(87.28% 72.40% at 49% 66%,rgba(255, 160, 162, 0.2),rgba(255, 246, 247, 1));
  514. font-size: 20rpx;
  515. line-height: 1;
  516. color: rgba(237, 66, 69, 1);
  517. }
  518. }
  519. .job-status {
  520. color: rgba(1, 107, 246, 1);
  521. padding: 8rpx;
  522. font-size: 20rpx;
  523. line-height: 1;
  524. border-radius: 4px;
  525. &.primary {
  526. color: rgba(1, 107, 246, 1);
  527. background: rgba(1, 107, 246, 0.1);
  528. }
  529. &.info {
  530. color: rgba(153, 153, 153, 1);
  531. }
  532. &.error {
  533. color: rgba(144.88, 87.8, 191.25, 1);
  534. }
  535. }
  536. }
  537. .base-info {
  538. display: flex;
  539. flex-wrap: wrap;
  540. margin-bottom: 8rpx;
  541. .info-item {
  542. margin-right: 12rpx;
  543. }
  544. .color-clip {
  545. background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
  546. -webkit-background-clip: text;
  547. -webkit-text-fill-color: transparent;
  548. background-clip: text;
  549. text-fill-color: transparent;
  550. font-size: 28rpx;
  551. font-weight: 400;
  552. line-height: 36rpx;
  553. }
  554. }
  555. .tags {
  556. display: flex;
  557. flex-wrap: wrap;
  558. .tag {
  559. padding: 8rpx;
  560. border-radius: 8rpx;
  561. background: rgba(153, 153, 153, 0.1);
  562. margin-right: 4px;
  563. margin-bottom: 4px;
  564. color: rgba(102, 102, 102, 1);
  565. font-size: 20rpx;
  566. font-weight: 400;
  567. line-height: 1;
  568. }
  569. }
  570. .company-info {
  571. .logo {
  572. display: block;
  573. width: 30rpx;
  574. height: 30rpx;
  575. border: 1px solid rgba(240, 240, 240, 1);
  576. border-radius: 28rpx;
  577. margin-right: 8rpx;
  578. }
  579. .company-name {
  580. flex: 1;
  581. width: 0;
  582. color: rgba(156, 164, 171, 1);
  583. font-size: 20rpx;
  584. font-weight: 400;
  585. line-height: 40rpx;
  586. overflow: hidden;
  587. text-overflow: ellipsis;
  588. white-space: nowrap;
  589. }
  590. }
  591. .buttons {
  592. margin-top: 12rpx;
  593. .button {
  594. height: 60rpx;
  595. padding: 16rpx 32rpx;
  596. box-sizing: border-box;
  597. border-radius: 60rpx;
  598. border: 1px solid #fff;
  599. font-size: 24rpx;
  600. font-weight: 500;
  601. line-height: 24rpx;
  602. margin-right: 16rpx;
  603. &.primary {
  604. color: #fff;
  605. background: rgba(1, 107, 246, 1);
  606. border-color: rgba(1, 107, 246, 1);
  607. }
  608. &.plain {
  609. color: rgba(1, 107, 246, 1);
  610. background-color: rgba(1, 107, 246, 0.1);
  611. border-color: rgba(1, 107, 246, 0.1);
  612. }
  613. &.info {
  614. color: #999;
  615. border-color: #E8E8E8;
  616. }
  617. }
  618. }
  619. }
  620. }
  621. }
  622. .empty-state {
  623. display: flex;
  624. // flex-direction: column;
  625. align-items: center;
  626. justify-content: center;
  627. padding: 40rpx;
  628. .empty-illustration {
  629. margin-bottom: 40rpx;
  630. .empty-image {
  631. width: 700rpx;
  632. height: 800rpx;
  633. }
  634. }
  635. .empty-text {
  636. color: rgba(120, 130, 138, 1);
  637. font-family: DM Sans;
  638. font-size: 28rpx;
  639. font-weight: 400;
  640. line-height: 36rpx;
  641. letter-spacing: 0.5%;
  642. text-align: center;
  643. }
  644. }
  645. .button-section {
  646. padding: 28rpx 40rpx;
  647. box-shadow: 0px -4px 16px 0px rgba(0, 0, 0, 0.04);
  648. }
  649. .submit-btn {
  650. flex-shrink: 0;
  651. border-radius: 999px;
  652. box-shadow: 0px -4px 16px 0px rgba(0, 0, 0, 0.04);
  653. background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
  654. color: rgba(255, 255, 255, 1);
  655. font-family: DM Sans;
  656. font-size: 32rpx;
  657. font-weight: 400;
  658. line-height: 48rpx;
  659. display: flex;
  660. justify-content: center;
  661. align-items: center;
  662. padding: 16rpx 32rpx;
  663. box-sizing: border-box;
  664. }
  665. </style>