jobManagement.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  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 data = {
  203. status: this.tabIndex == 0 ? '' : this.tabIndex,
  204. page: this.page,
  205. limit: this.limit,
  206. companyId: this.companyId
  207. }
  208. this.$Request.getT('/app/postPush/getMyPostPush', data).then(res => {
  209. if (res.code == 0) {
  210. if (this.page == 1) {
  211. this.jobList = []; // 第一页清空原有列表
  212. }
  213. // 拼接新数据
  214. res.data.records.forEach(ret => {
  215. ret.showpeop = false
  216. if (ret.status == 1) {
  217. ret.statusName = '待审核'
  218. } else if (ret.status == 2) {
  219. ret.statusName = '招聘中'
  220. } else if (ret.status == 3) {
  221. ret.statusName = '已拒绝'
  222. } else if (ret.status == 4) {
  223. ret.statusName = '已取消'
  224. } else if (ret.status == 5) {
  225. ret.statusName = '已关闭'
  226. }
  227. ret.positionTags = ret.positionTag.split(',')
  228. this.jobList.push(ret)
  229. })
  230. this.count = res.data.total; // 更新总条数
  231. }
  232. this.isLoading = false;
  233. uni.stopPullDownRefresh();
  234. }).catch(err => {
  235. this.isLoading = false;
  236. uni.hideLoading();
  237. uni.stopPullDownRefresh();
  238. })
  239. },
  240. // 触底加载下一页
  241. loadMore() {
  242. if (this.jobList.length >= this.count) {
  243. uni.showToast({ title: '已加载全部数据', icon: 'none' });
  244. return;
  245. }
  246. this.page++; // 页码+1
  247. this.getJobList(); // 请求下一页
  248. },
  249. // 切换标签页(重置分页)
  250. tabChange(e) {
  251. const index = typeof e === 'number' ? e : e.index
  252. this.tabIndex = index
  253. this.page = 1; // 切换标签时重置为第1页
  254. this.jobList = [];
  255. this.getJobList();
  256. },
  257. // 下拉刷新(可选,若需要下拉刷新可添加)
  258. onPullDownRefresh() {
  259. this.page = 1;
  260. this.getJobList();
  261. },
  262. // 原有方法保持不变...
  263. goBack() {
  264. uni.switchTab({
  265. url: '/pages/my/index'
  266. });
  267. },
  268. goNav(url) { uni.navigateTo({ url }); },
  269. // publishNewJob() { uni.navigateTo({ url: '/package/addJob/addJob' }); },
  270. // 发布新岗位
  271. publishNewJob() {
  272. // 1. 非管理员,申请加入企业,但是未审核通过
  273. // 2. 管理员,企业申请了,但是未审核通过
  274. // 3. 管理员,企业审核通过了,但是未完善资料(营业执照数据未上传)
  275. // 4. 发布岗位正在审核中(非VIP只能发布一个岗位,后端设置)
  276. if (this.companyInfo?.companyUser?.isAdmin != 1 && this.companyInfo?.companyUser?.status == 1) {
  277. this.tipType = 1
  278. this.showTipModal = true
  279. return
  280. } else if (this.companyInfo?.companyUser?.isAdmin == 1 && this.companyInfo?.status != 2) {
  281. this.tipType = 2
  282. this.showTipModal = true
  283. return
  284. } else if (this.companyInfo?.companyUser?.isAdmin == 1 && !this.companyInfo?.companyDutyParagraph) {
  285. this.tipType = 3
  286. this.showTipModal = true
  287. return
  288. } else if (this.positionCount == 0) {
  289. this.tipType = 4
  290. this.showTipModal = true
  291. return
  292. }
  293. uni.navigateTo({ url: `/pages/my/jobPosting?status=${this.status}&companyId=${this.companyId}` });
  294. },
  295. setBodyHeight() { /* 原有逻辑不变 */ },
  296. // 跳转至首页
  297. handleToIndex() {
  298. uni.reLaunch({
  299. url: '/pages/index/index'
  300. })
  301. },
  302. // 开启职位
  303. handleOpenPosition(type, item) {
  304. uni.showModal({
  305. title: '提示',
  306. content: type == 'close' ? '关闭岗位后,该岗位不会再推荐给用户,是否关闭?' : '开启岗位后,该岗位会重新推荐给用户,是否开启?',
  307. complete: (ret) => {
  308. if (ret.confirm) {
  309. this.closePosition(item)
  310. }
  311. }
  312. })
  313. },
  314. // 开启关闭岗位
  315. closePosition(item, callback) {
  316. if (this.loading) return
  317. this.loading = true
  318. uni.showLoading({
  319. title: '处理中'
  320. })
  321. this.$Request.getT('/app/postPush/closeOrOpen', {
  322. postPushId: item.postPushId
  323. }).then(res => {
  324. if (res.code == 0) {
  325. uni.showToast({
  326. title: '操作成功',
  327. duration: 1500,
  328. complete: () => {
  329. this.page = 1
  330. this.getJobList()
  331. if (typeof callback == 'function') {
  332. callback()
  333. }
  334. }
  335. })
  336. } else {
  337. uni.showToast({
  338. title: res.msg,
  339. icon: 'none'
  340. })
  341. }
  342. }).finally(() => {
  343. uni.hideLoading()
  344. this.loading = false
  345. })
  346. },
  347. // 编辑职位
  348. handleEditPosition(item) {
  349. // 如果是招聘中,则是下架并编辑,需要先下架再编辑
  350. if (item.status == 2) {
  351. uni.showModal({
  352. content: '确认下架并编辑该岗位?',
  353. title: '提示',
  354. confirmColor: '#016BF6',
  355. success: (it) => {
  356. if (it.confirm) {
  357. this.closePosition(item, () => {
  358. uni.navigateTo({
  359. url: `/pages/my/jobPosting?postPushId=${item.postPushId}&type=update`
  360. })
  361. })
  362. }
  363. }
  364. })
  365. } else {
  366. uni.navigateTo({
  367. url: `/pages/my/jobPosting?postPushId=${item.postPushId}&type=update`
  368. })
  369. }
  370. },
  371. // 删除职位
  372. handleDeletePosition(item) {
  373. uni.showModal({
  374. content: '确认删除该岗位吗?',
  375. title: '提示',
  376. confirmColor: '#016BF6',
  377. success: (iet) => {
  378. if (iet.confirm) {
  379. this.deletePosition(item)
  380. }
  381. }
  382. })
  383. },
  384. // 删除职位
  385. deletePosition(item) {
  386. if (this.loading) return
  387. this.loading = true
  388. uni.showLoading({
  389. title: '处理中'
  390. })
  391. this.$Request.post('/app/postPush/deletePostPush', {
  392. postPushId: item.postPushId,
  393. }).then(res => {
  394. if (res.code == 0) {
  395. uni.showToast({
  396. title: '删除成功',
  397. duration: 1500
  398. })
  399. this.page = 1
  400. this.getJobList()
  401. } else {
  402. uni.showToast({
  403. title: res.msg,
  404. icon: 'none'
  405. })
  406. }
  407. }).finally(() => {
  408. uni.hideLoading()
  409. this.loading = false
  410. })
  411. },
  412. // 获取公司状态
  413. getCompanyInfo() {
  414. this.$Request.get('/app/company/selectCompanyByUserId')
  415. .then((res) => {
  416. if (res.code == 0) {
  417. this.companyInfo = res.data
  418. }
  419. })
  420. },
  421. // 获取岗位数量
  422. getVipData(){
  423. this.$Request.get("/app/user/vipData").then((res) => {
  424. if (res.code == 0) {
  425. this.positionCount = Number(res.data.lastDueTimes || 0) + Number(res.data.lastPostTimes || 0)
  426. }
  427. })
  428. },
  429. handleConfirm() {
  430. if (this.tipType == 3) {
  431. uni.navigateTo({
  432. url: '/pages/my/businessLicense',
  433. success: () => {
  434. this.showTipModal = false
  435. }
  436. })
  437. } else {
  438. this.showTipModal = false
  439. }
  440. }
  441. }
  442. }
  443. </script>
  444. <style lang="scss" scoped>
  445. /*
  446. sticky生效条件:
  447. 1、父元素不能overflow:hidden或者overflow:auto属性。(mescroll-body设置:sticky="true"即可, mescroll-uni本身没有设置overflow)
  448. 2、必须指定top、bottom、left、right4个值之一,否则只会处于相对定位
  449. 3、父元素的高度不能低于sticky元素的高度
  450. 4、sticky元素仅在其父元素内生效,所以父元素必须是 mescroll
  451. */
  452. .sticky-tabs {
  453. z-index: 990;
  454. // position: sticky;
  455. // top: var(--window-top);
  456. background-color: #fff;
  457. }
  458. page {
  459. background-color: #ffffff;
  460. }
  461. .job-management-page {
  462. background-color: #ffffff;
  463. display: flex;
  464. flex-direction: column;
  465. height: 100vh;
  466. font-family: DM Sans;
  467. box-sizing: border-box;
  468. }
  469. .fixed-header {
  470. background-color: #ffffff;
  471. }
  472. .job-list {
  473. padding: 20rpx 40rpx 0;
  474. flex: 1;
  475. display: flex;
  476. flex-direction: column;
  477. overflow: auto;
  478. .list {
  479. padding-bottom: 30rpx;
  480. }
  481. .job-card {
  482. background: #ffffff;
  483. border-radius: 12rpx;
  484. margin-bottom: 20rpx;
  485. padding: 16rpx 36rpx;
  486. border: 0.5px solid rgba(227, 231, 236, 1);
  487. .job-card-content {
  488. .job-header {
  489. display: flex;
  490. justify-content: space-between;
  491. align-items: flex-start;
  492. margin-bottom: 8rpx;
  493. .job-title-section {
  494. display: flex;
  495. align-items: center;
  496. flex: 1;
  497. .job-title {
  498. color: rgba(23, 23, 37, 1);
  499. font-family: DM Sans;
  500. font-size: 28rpx;
  501. font-weight: 400;
  502. line-height: 44rpx;
  503. letter-spacing: 0.5%;
  504. text-align: left;
  505. }
  506. .urgent-tag {
  507. border-radius: 8rpx;
  508. padding: 8rpx;
  509. margin-left: 20rpx;
  510. background: radial-gradient(87.28% 72.40% at 49% 66%,rgba(255, 160, 162, 0.2),rgba(255, 246, 247, 1));
  511. font-size: 20rpx;
  512. line-height: 1;
  513. color: rgba(237, 66, 69, 1);
  514. }
  515. }
  516. .job-status {
  517. color: rgba(1, 107, 246, 1);
  518. padding: 8rpx;
  519. font-size: 20rpx;
  520. line-height: 1;
  521. border-radius: 4px;
  522. &.primary {
  523. color: rgba(1, 107, 246, 1);
  524. background: rgba(1, 107, 246, 0.1);
  525. }
  526. &.info {
  527. color: rgba(153, 153, 153, 1);
  528. }
  529. &.error {
  530. color: rgba(144.88, 87.8, 191.25, 1);
  531. }
  532. }
  533. }
  534. .base-info {
  535. display: flex;
  536. flex-wrap: wrap;
  537. margin-bottom: 8rpx;
  538. .info-item {
  539. margin-right: 12rpx;
  540. }
  541. .color-clip {
  542. background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
  543. -webkit-background-clip: text;
  544. -webkit-text-fill-color: transparent;
  545. background-clip: text;
  546. text-fill-color: transparent;
  547. font-size: 28rpx;
  548. font-weight: 400;
  549. line-height: 36rpx;
  550. }
  551. }
  552. .tags {
  553. display: flex;
  554. flex-wrap: wrap;
  555. .tag {
  556. padding: 8rpx;
  557. border-radius: 8rpx;
  558. background: rgba(153, 153, 153, 0.1);
  559. margin-right: 4px;
  560. margin-bottom: 4px;
  561. color: rgba(102, 102, 102, 1);
  562. font-size: 20rpx;
  563. font-weight: 400;
  564. line-height: 1;
  565. }
  566. }
  567. .company-info {
  568. .logo {
  569. display: block;
  570. width: 30rpx;
  571. height: 30rpx;
  572. border: 1px solid rgba(240, 240, 240, 1);
  573. border-radius: 28rpx;
  574. margin-right: 8rpx;
  575. }
  576. .company-name {
  577. flex: 1;
  578. width: 0;
  579. color: rgba(156, 164, 171, 1);
  580. font-size: 20rpx;
  581. font-weight: 400;
  582. line-height: 40rpx;
  583. overflow: hidden;
  584. text-overflow: ellipsis;
  585. white-space: nowrap;
  586. }
  587. }
  588. .buttons {
  589. margin-top: 12rpx;
  590. .button {
  591. height: 60rpx;
  592. padding: 16rpx 32rpx;
  593. box-sizing: border-box;
  594. border-radius: 60rpx;
  595. border: 1px solid #fff;
  596. font-size: 24rpx;
  597. font-weight: 500;
  598. line-height: 24rpx;
  599. margin-right: 16rpx;
  600. &.primary {
  601. color: #fff;
  602. background: rgba(1, 107, 246, 1);
  603. border-color: rgba(1, 107, 246, 1);
  604. }
  605. &.plain {
  606. color: rgba(1, 107, 246, 1);
  607. background-color: rgba(1, 107, 246, 0.1);
  608. border-color: rgba(1, 107, 246, 0.1);
  609. }
  610. &.info {
  611. color: #999;
  612. border-color: #E8E8E8;
  613. }
  614. }
  615. }
  616. }
  617. }
  618. }
  619. .empty-state {
  620. display: flex;
  621. // flex-direction: column;
  622. align-items: center;
  623. justify-content: center;
  624. padding: 40rpx;
  625. .empty-illustration {
  626. margin-bottom: 40rpx;
  627. .empty-image {
  628. width: 700rpx;
  629. height: 800rpx;
  630. }
  631. }
  632. .empty-text {
  633. color: rgba(120, 130, 138, 1);
  634. font-family: DM Sans;
  635. font-size: 28rpx;
  636. font-weight: 400;
  637. line-height: 36rpx;
  638. letter-spacing: 0.5%;
  639. text-align: center;
  640. }
  641. }
  642. .button-section {
  643. padding: 28rpx 40rpx;
  644. box-shadow: 0px -4px 16px 0px rgba(0, 0, 0, 0.04);
  645. }
  646. .submit-btn {
  647. flex-shrink: 0;
  648. border-radius: 999px;
  649. box-shadow: 0px -4px 16px 0px rgba(0, 0, 0, 0.04);
  650. background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
  651. color: rgba(255, 255, 255, 1);
  652. font-family: DM Sans;
  653. font-size: 32rpx;
  654. font-weight: 400;
  655. line-height: 48rpx;
  656. display: flex;
  657. justify-content: center;
  658. align-items: center;
  659. padding: 16rpx 32rpx;
  660. box-sizing: border-box;
  661. }
  662. </style>