enterprisesClassification.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <!-- 招聘会/企业详情 -->
  2. <template>
  3. <view class="box" :style="`background-color: ${backgroundColor}`">
  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" margin="0" borderRadius="0" @click="handleToDetails"></SwiperAd>
  8. <view class="stick" :style="`background-color: ${backgroundColor}`">
  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" :color="textColor" />
  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" :color="textColor" :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, computed } from 'vue'
  64. import { dealDictArrayData } from '@/utils/position'
  65. import { getJobFairEnterprisePage, getJobFair } from '@/api/jobFair'
  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 tabIndex = ref(-1)
  85. const tabList = ref([])
  86. const swiperAdList = ref([])
  87. const backgroundColor = ref('#fff')
  88. const textColor = computed(() => {
  89. return backgroundColor.value === '#fff' ? '#777' : '#fff'
  90. })
  91. const getJobFairDetail = async () => {
  92. if (!query.jobFairId) return
  93. const { data } = await getJobFair(query.jobFairId)
  94. // tab
  95. if (data?.tag?.length) {
  96. tabList.value = data.tag
  97. tabIndex.value = 0
  98. }
  99. // 轮播图
  100. if (data?.headImg?.length) {
  101. swiperAdList.value = data.headImg
  102. }
  103. // 背景色
  104. if (data?.backgroundColour) {
  105. backgroundColor.value = data.backgroundColour || '#fff'
  106. }
  107. getData()
  108. }
  109. getJobFairDetail()
  110. // 切换类型
  111. const handClickTab = (index) => {
  112. tabIndex.value = index
  113. query.pageNo = 1
  114. listData.value = []
  115. getData()
  116. }
  117. const getData = async () => {
  118. if (!query.jobFairId) return
  119. try {
  120. const params = { ...query }
  121. const positionIdValue = tabIndex.value !== -1 ? tabList.value[tabIndex.value]?.value : []
  122. positionIdValue?.length && positionIdValue.forEach((value, index) => {
  123. params[`industryId[${index}]`] = value
  124. })
  125. const res = await getJobFairEnterprisePage(params)
  126. const list = res?.data?.list || []
  127. listData.value = listData.value.concat(dealDictArrayData([], list))
  128. if (listData.value?.length === +res?.data?.total) {
  129. more.value = 'noMore'
  130. return
  131. }
  132. } catch (error) {
  133. query.pageNo--
  134. more.value = 'more'
  135. }
  136. }
  137. const scrollTop = ref(0)
  138. const old = ref({
  139. scrollTop: 0
  140. })
  141. const onScroll = (e) =>{
  142. old.value.scrollTop = e.detail.scrollTop
  143. }
  144. // 加载更多
  145. const loadingMore = () => {
  146. more.value = 'loading'
  147. query.pageNo++
  148. getData()
  149. }
  150. const toDetail = (item) =>{
  151. if (!item?.id || !(item?.jobFairId ?? query.jobFairId)) return
  152. let url = `/pagesB/jobFair/positionClassification?jobFairId=${query.jobFairId || item.jobFairId}&enterpriseId=${item.id}&entName=${item.anotherName}`
  153. url = url + `&backgroundColor=${backgroundColor.value}`
  154. uni.navigateTo({ url })
  155. }
  156. // const goBack = () => {
  157. // uni.navigateTo({
  158. // url: '/pagesB/jobFair/index'
  159. // })
  160. // }
  161. </script>
  162. <style scoped lang="scss">
  163. .stick {
  164. z-index: 1;
  165. position: sticky;
  166. top: 0;
  167. }
  168. .box {
  169. height: 100vh;
  170. overflow: hidden;
  171. // padding-bottom: 120rpx;
  172. box-sizing: border-box;
  173. display: flex;
  174. flex-direction: column;
  175. }
  176. .listDataBox {
  177. // padding: 1px 0 120rpx;
  178. padding-bottom: 120rpx;
  179. margin: 0 5rpx;
  180. .enterpriseName {
  181. color: #404040;
  182. font-weight: 700;
  183. }
  184. .enterAvatar {
  185. width: 60px;
  186. height: 60px;
  187. // border-radius: 50%;
  188. margin: auto;
  189. }
  190. .jobCount {
  191. height: 40px;
  192. line-height: 40px;
  193. color: #00897B;
  194. text-align: center;
  195. // padding: 0 50rpx;
  196. font-size: 15px;
  197. // background: linear-gradient(to right, #12ebb0, #7ec04c);
  198. background: #F5F5F5;
  199. }
  200. }
  201. .scrollBox{
  202. flex: 1;
  203. height: 0 !important;
  204. padding-bottom: 24rpx;
  205. box-sizing: border-box;
  206. }
  207. // :deep(.uni-load-more__text) {
  208. // color: #fff !important;
  209. // }
  210. :deep(.uni-card) {
  211. padding: 0 !important;
  212. .uni-card__content {
  213. padding: 0 !important;
  214. }
  215. }
  216. .scroll-container {
  217. width: calc(100vw - 20px);
  218. padding: 0 20rpx;
  219. white-space: nowrap; /* 确保子元素在一行内排列 */
  220. .scroll-item {
  221. display: inline-block; /* 子元素内联块显示 */
  222. color: #fff;
  223. font-size: 17px;
  224. font-weight: 500;
  225. .text {
  226. padding: 20px 2px 0;
  227. }
  228. .choose {
  229. width: 28px;
  230. height: 2px;
  231. border-radius: 8px;
  232. margin: 8px auto;
  233. }
  234. }
  235. }
  236. .titleBox {
  237. text-align: center;
  238. padding: 0 20rpx 15px;
  239. .title {
  240. font-size: 20px;
  241. font-weight: 600;
  242. margin-bottom: 12px;
  243. }
  244. .entName {
  245. color: #fff;
  246. }
  247. }
  248. </style>