positionClassification.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. :jobFairId="query.jobFairId"
  30. :showUpdateTime="false"
  31. noDataTextColor="#fff"
  32. ></PositionList>
  33. <uni-load-more :status="more" />
  34. </view>
  35. <view v-else class="nodata-img-parent">
  36. <!-- <image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image> -->
  37. <uni-load-more class="ss-m-t-50" status="noMore" :content-text="{'contentnomore': '暂无数据,请切换类型查看~'}" />
  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. e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
  110. })
  111. listData.value = listData.value.concat(list)
  112. if (listData.value?.length === +res?.data?.total) {
  113. more.value = 'noMore'
  114. return
  115. }
  116. } catch (error) {
  117. query.pageNo--
  118. more.value = 'more'
  119. }
  120. }
  121. const scrollTop = ref(0)
  122. const old = ref({
  123. scrollTop: 0
  124. })
  125. const onScroll = (e) =>{
  126. old.value.scrollTop = e.detail.scrollTop
  127. }
  128. // 加载更多
  129. const loadingMore = () => {
  130. more.value = 'loading'
  131. query.pageNo++
  132. getData()
  133. }
  134. // const goBack = () => {
  135. // uni.navigateTo({
  136. // url: '/pagesB/jobFair/index'
  137. // })
  138. // }
  139. </script>
  140. <style scoped lang="scss">
  141. .stick {
  142. z-index: 1;
  143. position: sticky;
  144. top: 0;
  145. background-color: #7ec04c;
  146. }
  147. .box {
  148. height: 100vh;
  149. overflow: hidden;
  150. // padding-bottom: 120rpx;
  151. box-sizing: border-box;
  152. display: flex;
  153. flex-direction: column;
  154. background-color: #7ec04c;
  155. }
  156. .listDataBox {
  157. // padding: 1px 0 120rpx;
  158. padding-bottom: 120rpx;
  159. margin: 0 5rpx;
  160. }
  161. .scrollBox{
  162. flex: 1;
  163. height: 0 !important;
  164. padding-bottom: 24rpx;
  165. box-sizing: border-box;
  166. }
  167. :deep(.uni-load-more__text) {
  168. color: #fff !important;
  169. }
  170. :deep(.uni-card) {
  171. padding: 0 !important;
  172. .uni-card__content {
  173. padding: 0 !important;
  174. }
  175. }
  176. .scroll-container {
  177. width: calc(100vw - 20px);
  178. padding: 0 20rpx;
  179. white-space: nowrap; /* 确保子元素在一行内排列 */
  180. .scroll-item {
  181. display: inline-block; /* 子元素内联块显示 */
  182. color: #fff;
  183. font-size: 17px;
  184. font-weight: 500;
  185. .text {
  186. padding: 20px 2px 0;
  187. }
  188. .choose {
  189. width: 28px;
  190. height: 2px;
  191. border-radius: 8px;
  192. margin: 8px auto;
  193. }
  194. }
  195. }
  196. .titleBox {
  197. text-align: center;
  198. padding: 0 20rpx 15px;
  199. .title {
  200. font-size: 20px;
  201. font-weight: 600;
  202. margin-bottom: 12px;
  203. }
  204. .entName {
  205. color: #fff;
  206. }
  207. }
  208. </style>