jobManagement.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  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() {
  177. uni.switchTab({
  178. url: '/pages/my/index'
  179. });
  180. },
  181. goNav(url) { uni.navigateTo({ url }); },
  182. publishNewJob() { uni.navigateTo({ url: '/package/addJob/addJob' }); },
  183. getJobStatusClass(job) { /* 原有逻辑不变 */ },
  184. setBodyHeight() { /* 原有逻辑不变 */ },
  185. }
  186. }
  187. </script>
  188. <style lang="scss" scoped>
  189. /*
  190. sticky生效条件:
  191. 1、父元素不能overflow:hidden或者overflow:auto属性。(mescroll-body设置:sticky="true"即可, mescroll-uni本身没有设置overflow)
  192. 2、必须指定top、bottom、left、right4个值之一,否则只会处于相对定位
  193. 3、父元素的高度不能低于sticky元素的高度
  194. 4、sticky元素仅在其父元素内生效,所以父元素必须是 mescroll
  195. */
  196. .sticky-tabs {
  197. z-index: 990;
  198. position: sticky;
  199. top: var(--window-top);
  200. background-color: #fff;
  201. }
  202. page {
  203. background-color: #ffffff;
  204. }
  205. .job-management-page {
  206. background-color: #ffffff;
  207. }
  208. .fixed-header {
  209. position: fixed;
  210. top: 0;
  211. left: 0;
  212. right: 0;
  213. z-index: 9999;
  214. background-color: #ffffff;
  215. }
  216. .custom-navbar {
  217. padding-top: 80rpx;
  218. background-color: #ffffff;
  219. box-sizing: border-box;
  220. .navbar-content {
  221. display: flex;
  222. align-items: center;
  223. justify-content: space-between;
  224. height: 88rpx;
  225. padding: 0 40rpx;
  226. .nav-left, .nav-right {
  227. width: 60rpx;
  228. height: 60rpx;
  229. display: flex;
  230. align-items: center;
  231. justify-content: center;
  232. }
  233. .nav-title {
  234. color: rgba(51, 51, 51, 1);
  235. font-family: DM Sans;
  236. font-size: 30rpx;
  237. font-weight: 700;
  238. line-height: 52px;
  239. letter-spacing: 0.5%;
  240. text-align: center;
  241. }
  242. }
  243. }
  244. .job-list {
  245. padding: 0 40rpx;
  246. margin-top: 280rpx;
  247. .job-card {
  248. background: #ffffff;
  249. border-radius: 12rpx;
  250. margin-bottom: 20rpx;
  251. padding: 32rpx;
  252. border: 0.5px solid rgba(227, 231, 236, 1);
  253. // box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
  254. .job-card-content {
  255. .job-header {
  256. display: flex;
  257. justify-content: space-between;
  258. align-items: flex-start;
  259. margin-bottom: 16rpx;
  260. .job-title-section {
  261. display: flex;
  262. align-items: center;
  263. flex: 1;
  264. gap: 28rpx;
  265. .job-title {
  266. color: rgba(23, 23, 37, 1);
  267. font-family: DM Sans;
  268. font-size: 28rpx;
  269. font-weight: 400;
  270. line-height: 44rpx;
  271. letter-spacing: 0.5%;
  272. text-align: left;
  273. }
  274. .urgent-tag {
  275. border-radius: 8rpx;
  276. background: rgba(252, 233, 220, 1);
  277. padding: 4rpx 8rpx;
  278. .urgent-text {
  279. color: rgba(1, 107, 246, 1);
  280. font-family: DM Sans;
  281. font-size: 16rpx;
  282. font-weight: 400;
  283. // line-height: 20rpx;
  284. // letter-spacing: -0.5px;
  285. text-align: left;
  286. }
  287. }
  288. }
  289. .job-status {
  290. &.status-trial {
  291. color: rgba(1, 107, 246, 1);
  292. }
  293. &.status-review {
  294. color: rgba(1, 107, 246, 1);
  295. }
  296. &.status-failed {
  297. color: rgba(153, 153, 153, 1);
  298. .status-text {
  299. color: rgba(153, 153, 153, 1) !important;
  300. background: none !important;
  301. -webkit-background-clip: unset !important;
  302. -webkit-text-fill-color: rgba(153, 153, 153, 1) !important;
  303. background-clip: unset !important;
  304. text-fill-color: rgba(153, 153, 153, 1) !important;
  305. }
  306. }
  307. &.status-closed {
  308. color: rgba(153, 153, 153, 1);
  309. .status-text {
  310. color: rgba(153, 153, 153, 1) !important;
  311. background: none !important;
  312. -webkit-background-clip: unset !important;
  313. -webkit-text-fill-color: rgba(153, 153, 153, 1) !important;
  314. background-clip: unset !important;
  315. text-fill-color: rgba(153, 153, 153, 1) !important;
  316. }
  317. }
  318. .status-text {
  319. background: linear-gradient(132.53deg, rgba(106.94185638427734, 84.63434600830078, 214.0178680419922, 0.96),rgba(144.87640380859375, 87.8011474609375, 191.25, 1) 95%);
  320. -webkit-background-clip: text;
  321. -webkit-text-fill-color: transparent;
  322. background-clip: text;
  323. text-fill-color: transparent;
  324. font-family: DM Sans;
  325. font-size: 18rpx;
  326. font-weight: 400;
  327. line-height: 20rpx;
  328. letter-spacing: -0.5px;
  329. text-align: right;
  330. }
  331. }
  332. }
  333. .job-info {
  334. .job-details {
  335. color: rgba(120, 130, 138, 1);
  336. font-family: DM Sans;
  337. font-size: 28rpx;
  338. font-weight: 400;
  339. line-height: 36rpx;
  340. letter-spacing: 0.5%;
  341. text-align: left;
  342. }
  343. }
  344. }
  345. &.status-failed {
  346. .job-title {
  347. color: rgba(153, 153, 153, 1) !important;
  348. }
  349. .job-details {
  350. color: rgba(153, 153, 153, 1) !important;
  351. }
  352. }
  353. &.status-closed {
  354. .job-title {
  355. color: rgba(153, 153, 153, 1) !important;
  356. }
  357. .job-details {
  358. color: rgba(153, 153, 153, 1) !important;
  359. }
  360. }
  361. }
  362. }
  363. .empty-state {
  364. display: flex;
  365. // flex-direction: column;
  366. align-items: center;
  367. justify-content: center;
  368. padding: 40rpx;
  369. .empty-illustration {
  370. margin-bottom: 40rpx;
  371. .empty-image {
  372. width: 700rpx;
  373. height: 800rpx;
  374. }
  375. }
  376. .empty-text {
  377. color: rgba(120, 130, 138, 1);
  378. font-family: DM Sans;
  379. font-size: 28rpx;
  380. font-weight: 400;
  381. line-height: 36rpx;
  382. letter-spacing: 0.5%;
  383. text-align: center;
  384. }
  385. }
  386. .bottom-action {
  387. position: fixed;
  388. bottom: 0;
  389. left: 0;
  390. right: 0;
  391. padding: 30rpx 40rpx;
  392. background: #ffffff;
  393. z-index: 9999;
  394. .publish-btn {
  395. width: 100%;
  396. height: 88rpx;
  397. background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
  398. border-radius: 44rpx;
  399. display: flex;
  400. align-items: center;
  401. justify-content: center;
  402. .publish-text {
  403. color: rgba(255, 255, 255, 1);
  404. font-family: DM Sans;
  405. font-size: 32rpx;
  406. font-weight: 400;
  407. line-height: 48rpx;
  408. letter-spacing: 0%;
  409. text-align: center;
  410. }
  411. }
  412. }
  413. </style>