jobManagement.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. <template>
  2. <view class="job-management-page">
  3. <view class="fixed-header">
  4. <navBar title="职位管理" color="#000" :backUrl="backUrl" goMy="/pages/my/index"/>
  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. status:'',
  100. }
  101. },
  102. filters: {
  103. statusText(value) {
  104. switch (value) {
  105. case 1: return '待审核'
  106. case 2: return '审核通过'
  107. case 3: return '审核不通过'
  108. case 4: return '已取消'
  109. case 5: return '已关闭'
  110. case 6: return '暂存'
  111. default: return '暂无数据'
  112. }
  113. }
  114. },
  115. onLoad(options) {
  116. if(options.status){
  117. this.status=options.status
  118. }
  119. this.backUrl = options.backUrl;
  120. this.companyId = uni.getStorageSync('companyId');
  121. this.getJobList();
  122. this.setBodyHeight();
  123. },
  124. onShow() {
  125. this.getJobList();
  126. },
  127. methods: {
  128. // 获取职位列表(新增分页逻辑)
  129. getJobList() {
  130. if (this.isLoading) return; // 正在加载时,阻止重复请求
  131. this.isLoading = true;
  132. let data = {
  133. status: this.tabIndex == 0 ? '' : this.tabIndex,
  134. page: this.page,
  135. limit: this.limit,
  136. companyId: this.companyId
  137. }
  138. this.$Request.getT('/app/postPush/getMyPostPush', data).then(res => {
  139. if (res.code == 0) {
  140. if (this.page == 1) {
  141. this.jobList = []; // 第一页清空原有列表
  142. }
  143. // 拼接新数据
  144. res.data.records.forEach(ret => {
  145. ret.showpeop = false
  146. if (ret.status == 1) {
  147. ret.statusName = '待审核'
  148. } else if (ret.status == 2) {
  149. ret.statusName = '招聘中'
  150. } else if (ret.status == 3) {
  151. ret.statusName = '已拒绝'
  152. } else if (ret.status == 4) {
  153. ret.statusName = '已取消'
  154. } else if (ret.status == 5) {
  155. ret.statusName = '已关闭'
  156. }
  157. this.jobList.push(ret)
  158. })
  159. this.count = res.data.total; // 更新总条数
  160. }
  161. this.isLoading = false;
  162. uni.stopPullDownRefresh();
  163. }).catch(err => {
  164. this.isLoading = false;
  165. uni.hideLoading();
  166. uni.stopPullDownRefresh();
  167. })
  168. },
  169. // 触底加载下一页
  170. loadMore() {
  171. if (this.jobList.length >= this.count) {
  172. uni.showToast({ title: '已加载全部数据', icon: 'none' });
  173. return;
  174. }
  175. this.page++; // 页码+1
  176. this.getJobList(); // 请求下一页
  177. },
  178. // 切换标签页(重置分页)
  179. tabChange(e) {
  180. const index = typeof e === 'number' ? e : e.index
  181. this.tabIndex = index
  182. this.page = 1; // 切换标签时重置为第1页
  183. this.jobList = [];
  184. this.getJobList();
  185. },
  186. // 下拉刷新(可选,若需要下拉刷新可添加)
  187. onPullDownRefresh() {
  188. this.page = 1;
  189. this.getJobList();
  190. },
  191. // 原有方法保持不变...
  192. goBack() {
  193. uni.switchTab({
  194. url: '/pages/my/index'
  195. });
  196. },
  197. goNav(url) { uni.navigateTo({ url }); },
  198. // publishNewJob() { uni.navigateTo({ url: '/package/addJob/addJob' }); },
  199. publishNewJob() { uni.navigateTo({ url: `/pages/my/jobPosting?status=${this.status}` }); },
  200. getJobStatusClass(job) { /* 原有逻辑不变 */ },
  201. setBodyHeight() { /* 原有逻辑不变 */ },
  202. }
  203. }
  204. </script>
  205. <style lang="scss" scoped>
  206. /*
  207. sticky生效条件:
  208. 1、父元素不能overflow:hidden或者overflow:auto属性。(mescroll-body设置:sticky="true"即可, mescroll-uni本身没有设置overflow)
  209. 2、必须指定top、bottom、left、right4个值之一,否则只会处于相对定位
  210. 3、父元素的高度不能低于sticky元素的高度
  211. 4、sticky元素仅在其父元素内生效,所以父元素必须是 mescroll
  212. */
  213. .sticky-tabs {
  214. z-index: 990;
  215. // position: sticky;
  216. // top: var(--window-top);
  217. background-color: #fff;
  218. }
  219. page {
  220. background-color: #ffffff;
  221. }
  222. .job-management-page {
  223. background-color: #ffffff;
  224. display: flex;
  225. flex-direction: column;
  226. height: 100vh;
  227. }
  228. .fixed-header {
  229. background-color: #ffffff;
  230. }
  231. .job-list {
  232. padding: 20rpx 40rpx 0;
  233. flex: 1;
  234. display: flex;
  235. flex-direction: column;
  236. .job-card {
  237. background: #ffffff;
  238. border-radius: 12rpx;
  239. margin-bottom: 20rpx;
  240. padding: 32rpx;
  241. border: 0.5px solid rgba(227, 231, 236, 1);
  242. // box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.05);
  243. .job-card-content {
  244. .job-header {
  245. display: flex;
  246. justify-content: space-between;
  247. align-items: flex-start;
  248. margin-bottom: 16rpx;
  249. .job-title-section {
  250. display: flex;
  251. align-items: center;
  252. flex: 1;
  253. gap: 28rpx;
  254. .job-title {
  255. color: rgba(23, 23, 37, 1);
  256. font-family: DM Sans;
  257. font-size: 28rpx;
  258. font-weight: 400;
  259. line-height: 44rpx;
  260. letter-spacing: 0.5%;
  261. text-align: left;
  262. }
  263. .urgent-tag {
  264. border-radius: 8rpx;
  265. background: rgba(252, 233, 220, 1);
  266. padding: 4rpx 8rpx;
  267. .urgent-text {
  268. color: rgba(1, 107, 246, 1);
  269. font-family: DM Sans;
  270. font-size: 16rpx;
  271. font-weight: 400;
  272. // line-height: 20rpx;
  273. // letter-spacing: -0.5px;
  274. text-align: left;
  275. }
  276. }
  277. }
  278. .job-status {
  279. &.status-trial {
  280. color: rgba(1, 107, 246, 1);
  281. }
  282. &.status-review {
  283. color: rgba(1, 107, 246, 1);
  284. }
  285. &.status-failed {
  286. color: rgba(153, 153, 153, 1);
  287. .status-text {
  288. color: rgba(153, 153, 153, 1) !important;
  289. background: none !important;
  290. -webkit-background-clip: unset !important;
  291. -webkit-text-fill-color: rgba(153, 153, 153, 1) !important;
  292. background-clip: unset !important;
  293. text-fill-color: rgba(153, 153, 153, 1) !important;
  294. }
  295. }
  296. &.status-closed {
  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-text {
  308. background: linear-gradient(132.53deg, rgba(106.94185638427734, 84.63434600830078, 214.0178680419922, 0.96),rgba(144.87640380859375, 87.8011474609375, 191.25, 1) 95%);
  309. -webkit-background-clip: text;
  310. -webkit-text-fill-color: transparent;
  311. background-clip: text;
  312. text-fill-color: transparent;
  313. font-family: DM Sans;
  314. font-size: 18rpx;
  315. font-weight: 400;
  316. line-height: 20rpx;
  317. letter-spacing: -0.5px;
  318. text-align: right;
  319. }
  320. }
  321. }
  322. .job-info {
  323. .job-details {
  324. color: rgba(120, 130, 138, 1);
  325. font-family: DM Sans;
  326. font-size: 28rpx;
  327. font-weight: 400;
  328. line-height: 36rpx;
  329. letter-spacing: 0.5%;
  330. text-align: left;
  331. }
  332. }
  333. }
  334. &.status-failed {
  335. .job-title {
  336. color: rgba(153, 153, 153, 1) !important;
  337. }
  338. .job-details {
  339. color: rgba(153, 153, 153, 1) !important;
  340. }
  341. }
  342. &.status-closed {
  343. .job-title {
  344. color: rgba(153, 153, 153, 1) !important;
  345. }
  346. .job-details {
  347. color: rgba(153, 153, 153, 1) !important;
  348. }
  349. }
  350. }
  351. }
  352. .empty-state {
  353. display: flex;
  354. // flex-direction: column;
  355. align-items: center;
  356. justify-content: center;
  357. padding: 40rpx;
  358. .empty-illustration {
  359. margin-bottom: 40rpx;
  360. .empty-image {
  361. width: 700rpx;
  362. height: 800rpx;
  363. }
  364. }
  365. .empty-text {
  366. color: rgba(120, 130, 138, 1);
  367. font-family: DM Sans;
  368. font-size: 28rpx;
  369. font-weight: 400;
  370. line-height: 36rpx;
  371. letter-spacing: 0.5%;
  372. text-align: center;
  373. }
  374. }
  375. .bottom-action {
  376. padding: 30rpx 40rpx;
  377. background: #ffffff;
  378. .publish-btn {
  379. width: 100%;
  380. height: 88rpx;
  381. background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
  382. border-radius: 44rpx;
  383. display: flex;
  384. align-items: center;
  385. justify-content: center;
  386. .publish-text {
  387. color: rgba(255, 255, 255, 1);
  388. font-family: DM Sans;
  389. font-size: 32rpx;
  390. font-weight: 400;
  391. line-height: 48rpx;
  392. letter-spacing: 0%;
  393. text-align: center;
  394. }
  395. }
  396. }
  397. </style>