positionClassification.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. <!-- tab页签 -->
  10. <scroll-view scroll-x="true" class="scroll-container">
  11. <view
  12. class="scroll-item"
  13. :style="`margin-left: ${index ? '24px' : ''};`"
  14. v-for="(val, index) in tabList" :key="index+val"
  15. @tap="handClickTab(index)"
  16. >
  17. <view>
  18. <view class="text">{{ val }}</view>
  19. <view v-if="index === tab" class="choose" style="background-color: #fff;"></view>
  20. <view v-else class="choose" style="background-color: #ffffff00;"></view>
  21. </view>
  22. </view>
  23. </scroll-view>
  24. </view>
  25. <view v-if="listData?.length" class="listDataBox">
  26. <PositionList
  27. :list="listData"
  28. :noMore="false"
  29. :showEntInfo="false"
  30. :jobFairId="query.jobFairId"
  31. updateTimeAlign="left"
  32. noDataTextColor="#fff"
  33. ></PositionList>
  34. <uni-load-more :status="more" />
  35. </view>
  36. <view v-else class="nodata-img-parent">
  37. <image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image>
  38. </view>
  39. </view>
  40. </scroll-view>
  41. </view>
  42. </template>
  43. <script setup>
  44. import { onLoad } from '@dcloudio/uni-app'
  45. import { ref, reactive } from 'vue'
  46. import { dealDictObjData } from '@/utils/position'
  47. import { getJobFairEntJobPage } from '@/api/jobFair'
  48. import PositionList from '@/components/PositionList'
  49. import { getWebContent } from '@/api/common'
  50. import SwiperAd from '@/components/SwiperAd'
  51. const more = ref('more')
  52. const listData = ref([])
  53. const query = reactive({
  54. pageSize: 20,
  55. pageNo: 1,
  56. jobFairId: undefined,
  57. enterpriseId: undefined,
  58. })
  59. const entName = ref('')
  60. const tab = ref(0)
  61. const tabList = ref(['餐饮招聘', '美业招聘', '酒店高层', '酒店中层', '酒店基层', '餐饮招聘', '美业招聘', '酒店高层', '酒店中层', '酒店基层1'])
  62. const handClickTab = (index) => {
  63. tab.value = index
  64. }
  65. onLoad(async (options) => {
  66. entName.value = options.entName
  67. if (options?.jobFairId) {
  68. query.jobFairId = options.jobFairId
  69. query.enterpriseId = options.enterpriseId
  70. getData()
  71. }
  72. })
  73. // 获取轮播图
  74. const swiperAdList = ref([])
  75. const getSystemWebContent = async () => {
  76. const { data } = await getWebContent()
  77. swiperAdList.value = data?.appHomeCarousel || []
  78. }
  79. getSystemWebContent()
  80. const getData = async () => {
  81. if (!query.jobFairId) {
  82. uni.showToast({ title: '获取企业岗位失败,请重试!', icon: 'none', duration: 2000 })
  83. return
  84. }
  85. try {
  86. const res = await getJobFairEntJobPage(query)
  87. const list = res?.data?.list || []
  88. list.forEach(e => {
  89. e.job = dealDictObjData({}, e)
  90. })
  91. listData.value = listData.value.concat(list)
  92. if (listData.value?.length === +res?.data?.total) {
  93. more.value = 'noMore'
  94. return
  95. }
  96. } catch (error) {
  97. query.pageNo--
  98. more.value = 'more'
  99. }
  100. }
  101. const scrollTop = ref(0)
  102. const old = ref({
  103. scrollTop: 0
  104. })
  105. const onScroll = (e) =>{
  106. old.value.scrollTop = e.detail.scrollTop
  107. }
  108. // 加载更多
  109. const loadingMore = () => {
  110. more.value = 'loading'
  111. query.pageNo++
  112. getData()
  113. }
  114. // const goBack = () => {
  115. // uni.navigateTo({
  116. // url: '/pagesB/jobFair/index'
  117. // })
  118. // }
  119. </script>
  120. <style scoped lang="scss">
  121. .stick {
  122. z-index: 1;
  123. position: sticky;
  124. top: 0;
  125. background-color: #7ec04c;
  126. }
  127. .box {
  128. height: 100vh;
  129. overflow: hidden;
  130. // padding-bottom: 120rpx;
  131. box-sizing: border-box;
  132. display: flex;
  133. flex-direction: column;
  134. background-color: #7ec04c;
  135. }
  136. .listDataBox {
  137. // padding: 1px 0 120rpx;
  138. padding-bottom: 120rpx;
  139. margin: 0 5rpx;
  140. }
  141. .scrollBox{
  142. flex: 1;
  143. height: 0 !important;
  144. padding-bottom: 24rpx;
  145. box-sizing: border-box;
  146. }
  147. :deep(.uni-load-more__text) {
  148. color: #fff !important;
  149. }
  150. :deep(.uni-card) {
  151. padding: 0 !important;
  152. .uni-card__content {
  153. padding: 0 !important;
  154. }
  155. }
  156. .scroll-container {
  157. width: calc(100vw - 20px);
  158. padding: 0 20rpx;
  159. white-space: nowrap; /* 确保子元素在一行内排列 */
  160. .scroll-item {
  161. display: inline-block; /* 子元素内联块显示 */
  162. color: #fff;
  163. font-size: 17px;
  164. font-weight: 500;
  165. .text {
  166. padding: 20px 2px 0;
  167. }
  168. .choose {
  169. width: 28px;
  170. height: 2px;
  171. border-radius: 8px;
  172. margin: 8px auto;
  173. }
  174. }
  175. }
  176. .titleBox {
  177. text-align: center;
  178. padding: 0 20rpx 15px;
  179. .title {
  180. font-size: 20px;
  181. font-weight: 600;
  182. margin-bottom: 12px;
  183. }
  184. .entName {
  185. color: #fff;
  186. }
  187. }
  188. </style>