jobFair.vue 4.0 KB

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