enterprisesClassification.vue 7.2 KB

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