jobManagement.vue 11 KB

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