enterprisesClassification.vue 7.9 KB

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