positionClassification.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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.title }}</view>
  19. <view v-if="index === tabIndex" 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 white-bgc ss-m-30">
  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, getJobFair } 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. })
  58. const entName = ref('')
  59. onLoad(async (options) => {
  60. entName.value = options.entName
  61. if (options?.jobFairId) {
  62. query.jobFairId = options.jobFairId
  63. query.enterpriseId = options.enterpriseId
  64. getJobFairDetail()
  65. }
  66. })
  67. // 获取轮播图
  68. const swiperAdList = ref([])
  69. const getSystemWebContent = async () => {
  70. const { data } = await getWebContent()
  71. swiperAdList.value = data?.appHomeCarousel || []
  72. }
  73. getSystemWebContent()
  74. // 招聘会详情
  75. const tabIndex = ref(-1)
  76. const tabList = ref([])
  77. const getJobFairDetail = async () => {
  78. if (!query.jobFairId) return
  79. const { data } = await getJobFair(query.jobFairId)
  80. if (data?.tag?.length) {
  81. tabList.value = data.tag
  82. tabIndex.value = 0
  83. }
  84. getData()
  85. }
  86. getJobFairDetail()
  87. // 切换类型
  88. const handClickTab = (index) => {
  89. tabIndex.value = index
  90. query.pageNo = 1
  91. listData.value = []
  92. getData()
  93. }
  94. const getData = async () => {
  95. if (!query.jobFairId) {
  96. uni.showToast({ title: '获取企业岗位失败,请重试!', icon: 'none', duration: 2000 })
  97. return
  98. }
  99. try {
  100. const params = { ...query }
  101. const positionIdValue = tabIndex.value !== -1 ? tabList.value[tabIndex.value]?.value : []
  102. positionIdValue?.length && positionIdValue.forEach((value, index) => {
  103. params[`positionId[${index}]`] = value
  104. })
  105. const res = await getJobFairEntJobPage(params)
  106. const list = res?.data?.list || []
  107. list.forEach(e => {
  108. e.job = dealDictObjData({}, e)
  109. })
  110. listData.value = listData.value.concat(list)
  111. if (listData.value?.length === +res?.data?.total) {
  112. more.value = 'noMore'
  113. return
  114. }
  115. } catch (error) {
  116. query.pageNo--
  117. more.value = 'more'
  118. }
  119. }
  120. const scrollTop = ref(0)
  121. const old = ref({
  122. scrollTop: 0
  123. })
  124. const onScroll = (e) =>{
  125. old.value.scrollTop = e.detail.scrollTop
  126. }
  127. // 加载更多
  128. const loadingMore = () => {
  129. more.value = 'loading'
  130. query.pageNo++
  131. getData()
  132. }
  133. // const goBack = () => {
  134. // uni.navigateTo({
  135. // url: '/pagesB/jobFair/index'
  136. // })
  137. // }
  138. </script>
  139. <style scoped lang="scss">
  140. .stick {
  141. z-index: 1;
  142. position: sticky;
  143. top: 0;
  144. background-color: #7ec04c;
  145. }
  146. .box {
  147. height: 100vh;
  148. overflow: hidden;
  149. // padding-bottom: 120rpx;
  150. box-sizing: border-box;
  151. display: flex;
  152. flex-direction: column;
  153. background-color: #7ec04c;
  154. }
  155. .listDataBox {
  156. // padding: 1px 0 120rpx;
  157. padding-bottom: 120rpx;
  158. margin: 0 5rpx;
  159. }
  160. .scrollBox{
  161. flex: 1;
  162. height: 0 !important;
  163. padding-bottom: 24rpx;
  164. box-sizing: border-box;
  165. }
  166. :deep(.uni-load-more__text) {
  167. color: #fff !important;
  168. }
  169. :deep(.uni-card) {
  170. padding: 0 !important;
  171. .uni-card__content {
  172. padding: 0 !important;
  173. }
  174. }
  175. .scroll-container {
  176. width: calc(100vw - 20px);
  177. padding: 0 20rpx;
  178. white-space: nowrap; /* 确保子元素在一行内排列 */
  179. .scroll-item {
  180. display: inline-block; /* 子元素内联块显示 */
  181. color: #fff;
  182. font-size: 17px;
  183. font-weight: 500;
  184. .text {
  185. padding: 20px 2px 0;
  186. }
  187. .choose {
  188. width: 28px;
  189. height: 2px;
  190. border-radius: 8px;
  191. margin: 8px auto;
  192. }
  193. }
  194. }
  195. .titleBox {
  196. text-align: center;
  197. padding: 0 20rpx 15px;
  198. .title {
  199. font-size: 20px;
  200. font-weight: 600;
  201. margin-bottom: 12px;
  202. }
  203. .entName {
  204. color: #fff;
  205. }
  206. }
  207. </style>