jobManagement.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <template>
  2. <view class="job-management-page">
  3. <!-- 固定顶部导航栏和标签页 -->
  4. <view class="fixed-header">
  5. <!-- 自定义导航栏 -->
  6. <view class="custom-navbar">
  7. <view class="navbar-content">
  8. <view class="nav-left" @click="goBack">
  9. <u-icon name="arrow-leftward" color="#333" size="32"></u-icon>
  10. </view>
  11. <view class="nav-title">职位管理</view>
  12. <view class="nav-right"></view>
  13. </view>
  14. </view>
  15. <!-- 标签页导航 - 使用uview的u-tabs组件 -->
  16. <view class="sticky-tabs">
  17. <u-tabs
  18. :list="tabs"
  19. :current="tabIndex"
  20. @change="tabChange"
  21. :is-scroll="false"
  22. :height="88"
  23. :font-size="24"
  24. active-color="rgba(1, 107, 246, 1)"
  25. inactive-color="rgba(102, 102, 102, 1)"
  26. :bar-width="60"
  27. :bar-height="4"
  28. :gutter="0"
  29. bg-color="#ffffff"
  30. ></u-tabs>
  31. </view>
  32. </view>
  33. <!-- 职位列表 -->
  34. <view class="job-list">
  35. <!-- 有数据时显示列表 -->
  36. <scroll-view
  37. scroll-y="true"
  38. style="width: 100%;height: 70vh;"
  39. v-if="jobList.length > 0"
  40. @scrolltolower="loadMore"
  41. lower-threshold="50"
  42. >
  43. <view
  44. class="job-card"
  45. :class="getJobStatusClass(job)"
  46. v-for="(job, index) in jobList"
  47. :key="index"
  48. @click="goNav('/my/order/pay?postPushId='+job.postPushId)"
  49. >
  50. <view class="job-card-content">
  51. <view class="job-header">
  52. <view class="job-title-section">
  53. <text class="job-title">{{job.stationName || job.ruleClassifyName}}</text>
  54. <view class="urgent-tag" v-if="job.isDue">
  55. <text class="urgent-text">急聘</text>
  56. </view>
  57. </view>
  58. <view class="job-status" :class="getJobStatusClass(job)">
  59. <text class="status-text">{{job.statusName || job.status}}</text>
  60. </view>
  61. </view>
  62. <view class="job-info">
  63. <text class="job-details">{{job.city}}-{{job.county}} {{job.education}} {{job.experience}} {{job.salaryRange}} {{job.postType}}</text>
  64. </view>
  65. </view>
  66. </view>
  67. </scroll-view>
  68. <!-- 空状态显示 -->
  69. <view class="empty-state" v-else>
  70. <view class="empty-illustration">
  71. <image src="../../static/images/index/Hrempty.svg" class="empty-image" mode="aspectFit" />
  72. </view>
  73. </view>
  74. </view>
  75. <!-- 底部发布按钮 -->
  76. <view class="bottom-action">
  77. <view class="publish-btn" @click="publishNewJob">
  78. <text class="publish-text">发布新职位</text>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import empty from '@/components/empty.vue'
  85. export default {
  86. data() {
  87. return {
  88. tabIndex: 0,
  89. tabs: [
  90. { name: '全部', status: 0 },
  91. { name: '待审核', status: 1 },
  92. { name: '招聘中', status: 2 },
  93. { name: '已拒绝', status: 3 },
  94. { name: '已取消', status: 4 },
  95. { name: '已关闭', status: 5 },
  96. { name: '已拒绝', status: 6 }
  97. ],
  98. jobList: [],
  99. page: 1, // 当前页码
  100. limit: 10, // 每页条数
  101. count: 0, // 总条数
  102. companyId: '',
  103. isLoading: false, // 防止重复请求标记
  104. }
  105. },
  106. onLoad() {
  107. this.companyId = uni.getStorageSync('companyId');
  108. this.getJobList();
  109. this.setBodyHeight();
  110. },
  111. methods: {
  112. // 获取职位列表(新增分页逻辑)
  113. getJobList() {
  114. if (this.isLoading) return; // 正在加载时,阻止重复请求
  115. this.isLoading = true;
  116. let data = {
  117. status: this.tabIndex == 0 ? '' : this.tabIndex,
  118. page: this.page,
  119. limit: this.limit,
  120. companyId: this.companyId
  121. }
  122. this.$Request.getT('/app/postPush/getMyPostPush', data).then(res => {
  123. if (res.code == 0) {
  124. if (this.page == 1) {
  125. this.jobList = []; // 第一页清空原有列表
  126. }
  127. // 拼接新数据
  128. res.data.records.forEach(ret => {
  129. ret.showpeop = false
  130. if (ret.status == 1) {
  131. ret.statusName = '待审核'
  132. } else if (ret.status == 2) {
  133. ret.statusName = '招聘中'
  134. } else if (ret.status == 3) {
  135. ret.statusName = '已拒绝'
  136. } else if (ret.status == 4) {
  137. ret.statusName = '已取消'
  138. } else if (ret.status == 5) {
  139. ret.statusName = '已关闭'
  140. }
  141. this.jobList.push(ret)
  142. })
  143. this.count = res.data.total; // 更新总条数
  144. }
  145. this.isLoading = false;
  146. uni.stopPullDownRefresh();
  147. }).catch(err => {
  148. this.isLoading = false;
  149. uni.hideLoading();
  150. uni.stopPullDownRefresh();
  151. })
  152. },
  153. // 触底加载下一页
  154. loadMore() {
  155. if (this.jobList.length >= this.count) {
  156. uni.showToast({ title: '已加载全部数据', icon: 'none' });
  157. return;
  158. }
  159. this.page++; // 页码+1
  160. this.getJobList(); // 请求下一页
  161. },
  162. // 切换标签页(重置分页)
  163. tabChange(e) {
  164. const index = typeof e === 'number' ? e : e.index
  165. this.tabIndex = index
  166. this.page = 1; // 切换标签时重置为第1页
  167. this.jobList = [];
  168. this.getJobList();
  169. },
  170. // 下拉刷新(可选,若需要下拉刷新可添加)
  171. onPullDownRefresh() {
  172. this.page = 1;
  173. this.getJobList();
  174. },
  175. // 原有方法保持不变...
  176. goBack() { uni.navigateBack(); },
  177. goNav(url) { uni.navigateTo({ url }); },
  178. publishNewJob() { uni.navigateTo({ url: '/package/addJob/addJob' }); },
  179. getJobStatusClass(job) { /* 原有逻辑不变 */ },
  180. setBodyHeight() { /* 原有逻辑不变 */ },
  181. }
  182. }
  183. </script>
  184. <style lang="scss" scoped>
  185. /*
  186. sticky生效条件:
  187. 1、父元素不能overflow:hidden或者overflow:auto属性。(mescroll-body设置:sticky="true"即可, mescroll-uni本身没有设置overflow)
  188. 2、必须指定top、bottom、left、right4个值之一,否则只会处于相对定位
  189. 3、父元素的高度不能低于sticky元素的高度
  190. 4、sticky元素仅在其父元素内生效,所以父元素必须是 mescroll
  191. */
  192. .sticky-tabs {
  193. z-index: 990;
  194. position: sticky;
  195. top: var(--window-top);
  196. background-color: #fff;
  197. }
  198. page {
  199. background-color: #ffffff;
  200. }
  201. .job-management-page {
  202. background-color: #ffffff;
  203. }
  204. .fixed-header {
  205. position: fixed;
  206. top: 0;
  207. left: 0;
  208. right: 0;
  209. z-index: 9999;
  210. background-color: #ffffff;
  211. }
  212. .custom-navbar {
  213. padding-top: 80rpx;
  214. background-color: #ffffff;
  215. box-sizing: border-box;
  216. .navbar-content {
  217. display: flex;
  218. align-items: center;
  219. justify-content: space-between;
  220. height: 88rpx;
  221. padding: 0 40rpx;
  222. .nav-left, .nav-right {
  223. width: 60rpx;
  224. height: 60rpx;
  225. display: flex;
  226. align-items: center;
  227. justify-content: center;
  228. }
  229. .nav-title {
  230. color: rgba(51, 51, 51, 1);
  231. font-family: DM Sans;
  232. font-size: 30rpx;
  233. font-weight: 700;
  234. line-height: 52px;
  235. letter-spacing: 0.5%;
  236. text-align: center;
  237. }
  238. }
  239. }
  240. .job-list {
  241. padding: 0 40rpx;
  242. margin-top: 280rpx;
  243. .job-card {
  244. background: #ffffff;
  245. border-radius: 12rpx;
  246. margin-bottom: 20rpx;
  247. padding: 32rpx;
  248. border: 0.5px solid rgba(227, 231, 236, 1);
  249. // box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
  250. .job-card-content {
  251. .job-header {
  252. display: flex;
  253. justify-content: space-between;
  254. align-items: flex-start;
  255. margin-bottom: 16rpx;
  256. .job-title-section {
  257. display: flex;
  258. align-items: center;
  259. flex: 1;
  260. gap: 28rpx;
  261. .job-title {
  262. color: rgba(23, 23, 37, 1);
  263. font-family: DM Sans;
  264. font-size: 28rpx;
  265. font-weight: 400;
  266. line-height: 44rpx;
  267. letter-spacing: 0.5%;
  268. text-align: left;
  269. }
  270. .urgent-tag {
  271. border-radius: 8rpx;
  272. background: rgba(252, 233, 220, 1);
  273. padding: 4rpx 8rpx;
  274. .urgent-text {
  275. color: rgba(1, 107, 246, 1);
  276. font-family: DM Sans;
  277. font-size: 16rpx;
  278. font-weight: 400;
  279. // line-height: 20rpx;
  280. // letter-spacing: -0.5px;
  281. text-align: left;
  282. }
  283. }
  284. }
  285. .job-status {
  286. &.status-trial {
  287. color: rgba(1, 107, 246, 1);
  288. }
  289. &.status-review {
  290. color: rgba(1, 107, 246, 1);
  291. }
  292. &.status-failed {
  293. color: rgba(153, 153, 153, 1);
  294. .status-text {
  295. color: rgba(153, 153, 153, 1) !important;
  296. background: none !important;
  297. -webkit-background-clip: unset !important;
  298. -webkit-text-fill-color: rgba(153, 153, 153, 1) !important;
  299. background-clip: unset !important;
  300. text-fill-color: rgba(153, 153, 153, 1) !important;
  301. }
  302. }
  303. &.status-closed {
  304. color: rgba(153, 153, 153, 1);
  305. .status-text {
  306. color: rgba(153, 153, 153, 1) !important;
  307. background: none !important;
  308. -webkit-background-clip: unset !important;
  309. -webkit-text-fill-color: rgba(153, 153, 153, 1) !important;
  310. background-clip: unset !important;
  311. text-fill-color: rgba(153, 153, 153, 1) !important;
  312. }
  313. }
  314. .status-text {
  315. background: linear-gradient(132.53deg, rgba(106.94185638427734, 84.63434600830078, 214.0178680419922, 0.96),rgba(144.87640380859375, 87.8011474609375, 191.25, 1) 95%);
  316. -webkit-background-clip: text;
  317. -webkit-text-fill-color: transparent;
  318. background-clip: text;
  319. text-fill-color: transparent;
  320. font-family: DM Sans;
  321. font-size: 18rpx;
  322. font-weight: 400;
  323. line-height: 20rpx;
  324. letter-spacing: -0.5px;
  325. text-align: right;
  326. }
  327. }
  328. }
  329. .job-info {
  330. .job-details {
  331. color: rgba(120, 130, 138, 1);
  332. font-family: DM Sans;
  333. font-size: 28rpx;
  334. font-weight: 400;
  335. line-height: 36rpx;
  336. letter-spacing: 0.5%;
  337. text-align: left;
  338. }
  339. }
  340. }
  341. &.status-failed {
  342. .job-title {
  343. color: rgba(153, 153, 153, 1) !important;
  344. }
  345. .job-details {
  346. color: rgba(153, 153, 153, 1) !important;
  347. }
  348. }
  349. &.status-closed {
  350. .job-title {
  351. color: rgba(153, 153, 153, 1) !important;
  352. }
  353. .job-details {
  354. color: rgba(153, 153, 153, 1) !important;
  355. }
  356. }
  357. }
  358. }
  359. .empty-state {
  360. display: flex;
  361. // flex-direction: column;
  362. align-items: center;
  363. justify-content: center;
  364. padding: 40rpx;
  365. .empty-illustration {
  366. margin-bottom: 40rpx;
  367. .empty-image {
  368. width: 700rpx;
  369. height: 800rpx;
  370. }
  371. }
  372. .empty-text {
  373. color: rgba(120, 130, 138, 1);
  374. font-family: DM Sans;
  375. font-size: 28rpx;
  376. font-weight: 400;
  377. line-height: 36rpx;
  378. letter-spacing: 0.5%;
  379. text-align: center;
  380. }
  381. }
  382. .bottom-action {
  383. position: fixed;
  384. bottom: 0;
  385. left: 0;
  386. right: 0;
  387. padding: 30rpx 40rpx;
  388. background: #ffffff;
  389. z-index: 9999;
  390. .publish-btn {
  391. width: 100%;
  392. height: 88rpx;
  393. background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
  394. border-radius: 44rpx;
  395. display: flex;
  396. align-items: center;
  397. justify-content: center;
  398. .publish-text {
  399. color: rgba(255, 255, 255, 1);
  400. font-family: DM Sans;
  401. font-size: 32rpx;
  402. font-weight: 400;
  403. line-height: 48rpx;
  404. letter-spacing: 0%;
  405. text-align: center;
  406. }
  407. }
  408. }
  409. </style>