positions.vue 5.2 KB

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