jobManagement.vue 11 KB

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