jobFair.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <!-- 招聘会 -->
  2. <template>
  3. <view>
  4. <Navbar title="招聘会" />
  5. <view class="box defaultBgc" :style="{'padding-top': navbarHeight + 'px', 'min-height': `calc(100vh - ${(navbarHeight + 100)}px)`}" style="padding-bottom: 100px;">
  6. <view v-if="items.length">
  7. <view class="commonBackground"></view>
  8. <scroll-view class="scrollBox" :scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
  9. <view v-for="val in items" :key="val.id" @tap="handleToJobFairEnterprises(val)" class="list-item defaultBgc default-border">
  10. <image v-if="val?.previewImg" class="ss-m-t-10" :src="val.previewImg" mode="widthFix" style="width: 100%; height: auto; border-radius: 6px;"></image>
  11. <view class="ss-m-t-20 MiSans-Normal">活动时间:{{ timesTampChange(val.startTime, 'Y-M-D') }}至{{ timesTampChange(val.endTime, 'Y-M-D') }}</view>
  12. <button class="ss-m-t-20 ss-m-b-10 MiSans-Medium" style="background-color: #00B760; color: #fff;" type="primary">查看详情</button>
  13. </view>
  14. <uni-load-more :status="more" />
  15. </scroll-view>
  16. </view>
  17. <view v-else>
  18. <view class="commonBackground"></view>
  19. <view class="nodata-img-parent" :style="{'height': `calc(100vh - ${(navbarHeight + 100)}px)`}">
  20. <image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script setup>
  27. import { onShow, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  28. import { ref } from 'vue'
  29. import { getJobFairList } from '@/api/jobFair'
  30. import { timesTampChange } from '@/utils/date'
  31. import Navbar from '@/components/Navbar'
  32. const navbarHeight = ref(uni.getStorageSync('navbarHeight'))
  33. const items = ref([])
  34. const total = ref(0)
  35. const query = ref({
  36. pageNo: 1,
  37. pageSize: 10,
  38. status: '0'
  39. })
  40. const more = ref('more')
  41. // 获得招聘会列表
  42. const getList = async () => {
  43. if (query.value.pageNo < 1) return
  44. if (query.value.pageNo === 1) items.value = []
  45. try {
  46. more.value = 'loading'
  47. uni.showLoading({ title: '加载中...' })
  48. const res = await getJobFairList(query.value)
  49. const list = res?.data?.list || []
  50. if (!list?.length) {
  51. more.value = 'noMore'
  52. return
  53. }
  54. items.value = items.value.concat(...list)
  55. total.value = res.data.total
  56. more.value = 'more'
  57. if (items.value.length === +total.value) {
  58. more.value = 'noMore'
  59. return
  60. }
  61. } catch (error) {
  62. query.value.pageNo--
  63. more.value = 'more'
  64. } finally {
  65. uni.hideLoading()
  66. }
  67. }
  68. // 加载更多
  69. const loadingMore = () => {
  70. if (more.value === 'noMore') return
  71. more.value = 'loading'
  72. query.value.pageNo++
  73. getList()
  74. }
  75. //招聘会
  76. const handleToJobFairEnterprises = (val) => {
  77. if (!val?.id) {
  78. uni.showToast({ title: '进去招聘会失败!', icon: 'none' })
  79. }
  80. let url = `/pagesB/jobFair/${Number(val?.category) ? 'positionClassification': 'enterprisesClassification'}?jobFairId=${val.id}`
  81. uni.navigateTo({url})
  82. }
  83. const getShareParams = () => {
  84. return {
  85. title: '门墩儿-招聘会',
  86. path: '/pages/index/jobFair',
  87. }
  88. }
  89. // 设置自定义tabbar选中值
  90. onShow(() => {
  91. const currentPage = getCurrentPages()[0]; // 获取当前页面实例
  92. const currentTabBar = currentPage?.getTabBar?.();
  93. // 设置当前tab页的下标index
  94. currentTabBar?.setData({ selected: 3 });
  95. getList()
  96. })
  97. // 转发朋友
  98. onShareAppMessage(() => {
  99. return getShareParams()
  100. })
  101. // 转发朋圈
  102. onShareTimeline(() => {
  103. return getShareParams()
  104. })
  105. </script>
  106. <style lang="scss" scoped>
  107. .scrollBox {
  108. height: 100vh;
  109. box-sizing: border-box;
  110. }
  111. .list-item {
  112. margin: 0 30rpx 30rpx 30rpx;
  113. border-radius: 20rpx;
  114. padding: 30rpx;
  115. position: relative;
  116. box-shadow: 1px 2px 12px rgba(0, 0, 0, 0.17);
  117. view {
  118. font-size: 28rpx;
  119. color: #666;
  120. }
  121. }
  122. </style>