enterprisesClassification.vue 8.1 KB

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