enterprisesClassification.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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 v-if="tabList?.length" 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="val.key"
  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. <uni-card v-for="val in listData" :key="val.id" @click="toDetail(val)" :is-shadow="true" :border='false' shadow="0px 0px 3px 1px rgba(0,0,0,0.1)">
  27. <view class="d-flex align-center ss-m-30" @click="null">
  28. <image class="enterAvatar" :src="val.logoUrl ? val.logoUrl : 'https://minio.citupro.com/dev/menduner/company-avatar.png'"></image>
  29. <view class="ss-m-l-20" style="flex: 1;">
  30. <view class="font-size-16 enterpriseName">{{ formatName(val.anotherName || val.name) }}</view>
  31. <view class="ss-m-t-5">
  32. <span class="color-999">{{ val?.industryName || '' }}</span>
  33. <span class="divider tag-gap1" v-if="val?.industryName && val?.scaleName"> | </span>
  34. <span class="color-999">{{ val?.scaleName || '' }}</span>
  35. </view>
  36. <view class="ss-m-t-10" style="overflow: hidden;height: 48px;">
  37. <uni-tag
  38. v-for="(tag,i) in val?.welfareList || []"
  39. :key="i"
  40. class="ss-m-r-5"
  41. :text="tag"
  42. inverted="false"
  43. size="mini"
  44. custom-style="background-color: #ececec; color: #666; border-color: #ececec; display: inline-block;"
  45. />
  46. </view>
  47. </view>
  48. </view>
  49. <view class="jobCount">{{ val.jobCount }}个在线职位招聘中</view>
  50. </uni-card>
  51. <uni-load-more :status="more" />
  52. </view>
  53. <view v-else class="nodata-img-parent white-bgc ss-m-30">
  54. <image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image>
  55. </view>
  56. </view>
  57. </scroll-view>
  58. </view>
  59. </template>
  60. <script setup>
  61. import { onLoad } from '@dcloudio/uni-app'
  62. import { ref, reactive } from 'vue'
  63. import { dealDictArrayData } from '@/utils/position'
  64. import { getJobFairEnterprisePage, getJobFair } from '@/api/jobFair'
  65. import { getWebContent } from '@/api/common'
  66. import SwiperAd from '@/components/SwiperAd'
  67. import { formatName } from '@/utils/getText'
  68. const more = ref('more')
  69. const listData = ref([])
  70. const query = reactive({
  71. pageSize: 20,
  72. pageNo: 1,
  73. jobFairId: undefined,
  74. })
  75. const entName = ref('')
  76. onLoad(async (options) => {
  77. entName.value = options.entName
  78. if (options?.jobFairId) {
  79. query.jobFairId = options.jobFairId
  80. getJobFairDetail()
  81. }
  82. })
  83. // 获取轮播图
  84. const swiperAdList = ref([])
  85. const getSystemWebContent = async () => {
  86. const { data } = await getWebContent()
  87. swiperAdList.value = data?.appHomeCarousel || []
  88. }
  89. getSystemWebContent()
  90. // 招聘会详情
  91. const tabIndex = ref(-1)
  92. const tabList = ref([])
  93. const getJobFairDetail = async () => {
  94. if (!query.jobFairId) return
  95. const { data } = await getJobFair(query.jobFairId)
  96. if (data?.tag?.length) {
  97. tabList.value = data.tag
  98. tabIndex.value = 0
  99. }
  100. getData()
  101. }
  102. getJobFairDetail()
  103. // 切换类型
  104. const handClickTab = (index) => {
  105. tabIndex.value = index
  106. query.pageNo = 1
  107. listData.value = []
  108. getData()
  109. }
  110. const getData = async () => {
  111. if (!query.jobFairId) return
  112. try {
  113. const params = { ...query }
  114. const positionIdValue = tabIndex.value !== -1 ? tabList.value[tabIndex.value]?.value : []
  115. positionIdValue?.length && positionIdValue.forEach((value, index) => {
  116. params[`industryId[${index}]`] = value
  117. })
  118. const res = await getJobFairEnterprisePage(params)
  119. const list = res?.data?.list || []
  120. listData.value = listData.value.concat(dealDictArrayData([], list))
  121. if (listData.value?.length === +res?.data?.total) {
  122. more.value = 'noMore'
  123. return
  124. }
  125. } catch (error) {
  126. query.pageNo--
  127. more.value = 'more'
  128. }
  129. }
  130. const scrollTop = ref(0)
  131. const old = ref({
  132. scrollTop: 0
  133. })
  134. const onScroll = (e) =>{
  135. old.value.scrollTop = e.detail.scrollTop
  136. }
  137. // 加载更多
  138. const loadingMore = () => {
  139. more.value = 'loading'
  140. query.pageNo++
  141. getData()
  142. }
  143. const toDetail = (item) =>{
  144. // if (!item?.id || !(item?.jobFairId ?? query.jobFairId)) return
  145. // const url = `/pagesB/jobFair/positions?jobFairId=${query.jobFairId || item.jobFairId}&enterpriseId=${item.id}&entName=${item.anotherName}`
  146. // uni.navigateTo({ url })
  147. }
  148. // const goBack = () => {
  149. // uni.navigateTo({
  150. // url: '/pagesB/jobFair/index'
  151. // })
  152. // }
  153. </script>
  154. <style scoped lang="scss">
  155. .stick {
  156. z-index: 1;
  157. position: sticky;
  158. top: 0;
  159. background-color: #5985dc;
  160. }
  161. .box {
  162. height: 100vh;
  163. overflow: hidden;
  164. // padding-bottom: 120rpx;
  165. box-sizing: border-box;
  166. display: flex;
  167. flex-direction: column;
  168. background-color: #5985dc;
  169. }
  170. .listDataBox {
  171. // padding: 1px 0 120rpx;
  172. padding-bottom: 120rpx;
  173. margin: 0 5rpx;
  174. .enterpriseName {
  175. color: #404040;
  176. font-weight: 700;
  177. }
  178. .enterAvatar {
  179. width: 60px;
  180. height: 60px;
  181. // border-radius: 50%;
  182. margin: auto;
  183. }
  184. .jobCount {
  185. height: 40px;
  186. line-height: 40px;
  187. color: #5985dc;
  188. text-align: center;
  189. font-size: 15px;
  190. // background: linear-gradient(to right, #12ebb0, #7ec04c);
  191. background: #F5F5F5;
  192. }
  193. }
  194. .scrollBox{
  195. flex: 1;
  196. height: 0 !important;
  197. padding-bottom: 24rpx;
  198. box-sizing: border-box;
  199. }
  200. :deep(.uni-load-more__text) {
  201. color: #fff !important;
  202. }
  203. :deep(.uni-card) {
  204. padding: 0 !important;
  205. .uni-card__content {
  206. padding: 0 !important;
  207. }
  208. }
  209. .scroll-container {
  210. width: calc(100vw - 20px);
  211. padding: 0 20rpx;
  212. white-space: nowrap; /* 确保子元素在一行内排列 */
  213. .scroll-item {
  214. display: inline-block; /* 子元素内联块显示 */
  215. color: #fff;
  216. font-size: 17px;
  217. font-weight: 500;
  218. .text {
  219. padding: 20px 2px 0;
  220. }
  221. .choose {
  222. width: 28px;
  223. height: 2px;
  224. border-radius: 8px;
  225. margin: 8px auto;
  226. }
  227. }
  228. }
  229. .titleBox {
  230. text-align: center;
  231. padding: 0 20rpx 15px;
  232. .title {
  233. font-size: 20px;
  234. font-weight: 600;
  235. margin-bottom: 12px;
  236. }
  237. .entName {
  238. color: #fff;
  239. }
  240. }
  241. </style>