positions.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <!-- 招聘会/企业详情 -->
  2. <template>
  3. <view class="box">
  4. <scroll-view class="scrollBox" :scroll-y="true" :scroll-top="scrollTop" @scrolltolower="loadingMore" @scroll="onScroll" style="position:relative;">
  5. <view>
  6. <!-- 轮播图 -->
  7. <SwiperAd v-if="swiperAdList.length" :list="swiperAdList" imgUrlKey="img" margin="0" borderRadius="0" :strType="false" @click="handleToDetails"></SwiperAd>
  8. <view class="stick">
  9. <view class="titleBox">
  10. <view class="entName">{{ entName }}</view>
  11. </view>
  12. </view>
  13. <view v-if="listData?.length" class="listDataBox">
  14. <PositionList
  15. :list="listData"
  16. :noMore="false"
  17. :showEntInfo="false"
  18. :jobFairId="query.jobFairId"
  19. updateTimeAlign="left"
  20. noDataTextColor="#fff"
  21. ></PositionList>
  22. <uni-load-more :status="more" />
  23. </view>
  24. <view v-else class="nodata-img-parent">
  25. <image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image>
  26. </view>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. </template>
  31. <script setup>
  32. import { onLoad } from '@dcloudio/uni-app'
  33. import { ref, reactive } from 'vue'
  34. import { dealDictObjData } from '@/utils/position'
  35. import { getJobFairEntJobPage } from '@/api/jobFair'
  36. import PositionList from '@/components/PositionList'
  37. import { getWebContent } from '@/api/common'
  38. import SwiperAd from '@/components/SwiperAd'
  39. const more = ref('more')
  40. const listData = ref([])
  41. const query = reactive({
  42. pageSize: 20,
  43. pageNo: 1,
  44. jobFairId: undefined,
  45. enterpriseId: undefined,
  46. })
  47. const entName = ref('')
  48. onLoad(async (options) => {
  49. entName.value = options.entName
  50. if (options?.jobFairId) {
  51. query.jobFairId = options.jobFairId
  52. query.enterpriseId = options.enterpriseId
  53. getData()
  54. }
  55. })
  56. // 获取轮播图
  57. const swiperAdList = ref([])
  58. const getSystemWebContent = async () => {
  59. const { data } = await getWebContent()
  60. swiperAdList.value = data?.appHomeCarousel || []
  61. }
  62. getSystemWebContent()
  63. const getData = async () => {
  64. if (!query.jobFairId) {
  65. uni.showToast({ title: '获取企业岗位失败,请重试!', icon: 'none', duration: 2000 })
  66. return
  67. }
  68. try {
  69. const res = await getJobFairEntJobPage(query)
  70. const list = res?.data?.list || []
  71. list.forEach(e => {
  72. e.job = dealDictObjData({}, e)
  73. })
  74. listData.value = listData.value.concat(list)
  75. if (listData.value?.length === +res?.data?.total) {
  76. more.value = 'noMore'
  77. return
  78. }
  79. } catch (error) {
  80. query.pageNo--
  81. more.value = 'more'
  82. }
  83. }
  84. const scrollTop = ref(0)
  85. const old = ref({
  86. scrollTop: 0
  87. })
  88. const onScroll = (e) =>{
  89. old.value.scrollTop = e.detail.scrollTop
  90. }
  91. // 加载更多
  92. const loadingMore = () => {
  93. more.value = 'loading'
  94. query.pageNo++
  95. getData()
  96. }
  97. // const goBack = () => {
  98. // uni.navigateTo({
  99. // url: '/pagesB/jobFair/index'
  100. // })
  101. // }
  102. </script>
  103. <style scoped lang="scss">
  104. .stick {
  105. z-index: 1;
  106. position: sticky;
  107. top: 0;
  108. background-color: #7ec04c;
  109. }
  110. .box {
  111. height: 100vh;
  112. overflow: hidden;
  113. // padding-bottom: 120rpx;
  114. box-sizing: border-box;
  115. display: flex;
  116. flex-direction: column;
  117. background-color: #7ec04c;
  118. }
  119. .listDataBox {
  120. // padding: 1px 0 120rpx;
  121. padding-bottom: 120rpx;
  122. margin: 0 5rpx;
  123. }
  124. .scrollBox{
  125. flex: 1;
  126. height: 0 !important;
  127. padding-bottom: 24rpx;
  128. box-sizing: border-box;
  129. }
  130. :deep(.uni-load-more__text) {
  131. color: #fff !important;
  132. }
  133. :deep(.uni-card) {
  134. padding: 0 !important;
  135. .uni-card__content {
  136. padding: 0 !important;
  137. }
  138. }
  139. .titleBox {
  140. text-align: center;
  141. padding: 15px 20rpx;
  142. .title {
  143. font-size: 20px;
  144. font-weight: 600;
  145. margin-bottom: 12px;
  146. }
  147. .entName {
  148. color: #fff;
  149. }
  150. }
  151. </style>