enterprisesClassification.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  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 style="position: relative;">
  6. <!-- 轮播图 -->
  7. <SwiperAd v-if="swiperAdList.length" :list="swiperAdList" margin="0" borderRadius="0" @click="handleToDetails"></SwiperAd>
  8. <view class="stick ss-p-y-30" :style="`background-color: ${backgroundColor}`">
  9. <view style="position: relative;">
  10. <uni-search-bar
  11. v-model="query.keyword"
  12. placeholder="输入关键字"
  13. cancelButton="none"
  14. :focus="false"
  15. bgColor="#fff"
  16. @confirm="onSearch($event.value)"
  17. @clear="query.keyword = ''; onSearch()"
  18. >
  19. </uni-search-bar>
  20. <button class="search-btn" @tap.stop="onSearch">搜索</button>
  21. </view>
  22. <!-- tab页签 -->
  23. <scroll-view v-if="tabList?.length" scroll-x="true" class="scroll-container">
  24. <view
  25. class="scroll-item"
  26. :style="`margin-left: ${index ? '24px' : ''};`"
  27. v-for="(val, index) in tabList" :key="val.key"
  28. @tap="handClickTab(index)"
  29. >
  30. <view>
  31. <view class="text">{{ val.title }}</view>
  32. <view v-if="index === tabIndex" class="choose" style="background-color: #fff;"></view>
  33. <view v-else class="choose" style="background-color: #ffffff00;"></view>
  34. </view>
  35. </view>
  36. </scroll-view>
  37. </view>
  38. <view v-if="listData?.length" class="listDataBox">
  39. <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)">
  40. <view class="d-flex align-center ss-m-30" @click="null">
  41. <image class="enterAvatar" :src="val.logoUrl ? val.logoUrl : 'https://minio.citupro.com/dev/menduner/company-avatar.png'"></image>
  42. <view class="ss-m-l-20" style="flex: 1;">
  43. <view class="font-size-16 enterpriseName">{{ formatName(val.anotherName || val.name) }}</view>
  44. <view class="ss-m-t-5">
  45. <span class="color-999">{{ val?.industryName || '' }}</span>
  46. <span class="divider tag-gap1" v-if="val?.industryName && val?.scaleName"> | </span>
  47. <span class="color-999">{{ val?.scaleName || '' }}</span>
  48. </view>
  49. <view class="ss-m-t-10">
  50. <uni-tag
  51. v-for="(tag,i) in val?.lastJobTop5 || []"
  52. :key="i"
  53. class="ss-m-r-5"
  54. :text="formatName(tag.name)"
  55. inverted="false"
  56. size="default"
  57. custom-style="background-color: #00B760; color: #fff; border-color: #00B760; display: inline-block;border-radius: 15px; margin: 0 5px 5px 0;"
  58. />
  59. </view>
  60. </view>
  61. </view>
  62. <view class="jobCount">{{ val.jobCount }}个在线职位招聘中 >>></view>
  63. </uni-card>
  64. <uni-load-more :status="more" :color="textColor" />
  65. </view>
  66. <view v-else class="nodata-img-parent">
  67. <uni-load-more class="ss-m-t-50" :color="textColor" status="noMore" :content-text="{'contentnomore': loading ? '加载中. . .' : tabList?.length ? '暂无数据,请切换类型查看~': '暂无数据'}" />
  68. </view>
  69. <!-- 招聘会分享按钮 -->
  70. <view v-if="showShareBtn" class="shareButtonBox" @tap="handleShare">
  71. <uni-icons type="redo-filled" size="30" color="#00B760" />
  72. </view>
  73. </view>
  74. </scroll-view>
  75. </view>
  76. </template>
  77. <script setup>
  78. import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  79. import { ref, reactive, computed } from 'vue'
  80. import { dealDictArrayData } from '@/utils/position'
  81. import { getJobFairEnterprisePage, getJobFair } from '@/api/jobFair'
  82. import SwiperAd from '@/components/SwiperAd'
  83. import { formatName } from '@/utils/getText'
  84. import { getShareQueryById } from '@/api/jobFair.js'
  85. const loading = ref(true)
  86. const more = ref('more')
  87. const listData = ref([])
  88. const query = reactive({
  89. pageSize: 20,
  90. pageNo: 1,
  91. keyword: '',
  92. jobFairId: undefined,
  93. })
  94. const showShareBtn = ref(false)
  95. onLoad(async (options) => {
  96. // 网站二维码分享
  97. if (options.scene) {
  98. const scene = decodeURIComponent(options.scene)
  99. const key = scene.split('=')[1]
  100. if (!key) return
  101. const res = await getShareQueryById({key})
  102. options.jobFairId = res?.data?.jobFairId
  103. }
  104. if (options?.jobFairId) {
  105. query.jobFairId = options.jobFairId
  106. getJobFairDetail()
  107. }
  108. // 转发朋友
  109. onShareAppMessage(() => {
  110. if(!jobFairTitle.value){
  111. setTimeout(() => {}, 1000)
  112. }
  113. return {
  114. title: jobFairTitle.value,
  115. path: `/pagesB/jobFair/enterprisesClassification?jobFairId=${options?.jobFairId}`
  116. }
  117. })
  118. // 转发朋圈
  119. onShareTimeline(() => {
  120. if(!jobFairTitle.value){
  121. setTimeout(() => {}, 1000)
  122. }
  123. return {
  124. title: jobFairTitle.value || '门墩儿 专注顶尖招聘',
  125. path: `/pagesB/jobFair/enterprisesClassification?jobFairId=${options?.jobFairId}`
  126. }
  127. })
  128. })
  129. // 招聘会详情
  130. const tabIndex = ref(-1)
  131. const tabList = ref([])
  132. const swiperAdList = ref([])
  133. const backgroundColor = ref('#fff')
  134. const jobFairTitle = ref('')
  135. const textColor = computed(() => {
  136. return backgroundColor.value === '#fff' ? '#777' : '#fff'
  137. })
  138. const getJobFairDetail = async () => {
  139. if (!query.jobFairId) return
  140. const { data } = await getJobFair(query.jobFairId)
  141. // 类型 -1为不传tag参数
  142. tabList.value = data?.tag || []
  143. handClickTab(tabList.value?.length ? 0 : -1)
  144. // 轮播图
  145. if (data?.headImg?.length) {
  146. swiperAdList.value = data.headImg
  147. }
  148. // 背景色
  149. if (data?.backgroundColour) {
  150. backgroundColor.value = data.backgroundColour || '#fff'
  151. }
  152. if (data?.title) {
  153. jobFairTitle.value = data.title
  154. }
  155. showShareBtn.value = Boolean(data?.shareImg)
  156. }
  157. getJobFairDetail()
  158. // 切换类型
  159. const handClickTab = (index) => {
  160. tabIndex.value = index
  161. query.pageNo = 1
  162. listData.value = []
  163. getEnterpriseList()
  164. }
  165. const onSearch = () => {
  166. query.pageNo = 1
  167. listData.value = []
  168. getEnterpriseList()
  169. }
  170. const getEnterpriseList = async () => {
  171. if (!query.jobFairId) return
  172. try {
  173. const params = { ...query }
  174. // tab对应的职位类型id列表
  175. const idList = tabIndex.value !== -1 ? tabList.value[tabIndex.value]?.content : []
  176. idList?.length && idList.forEach((value, index) => { params[`enterpriseId[${index}]`] = value.value })
  177. const res = await getJobFairEnterprisePage(params)
  178. const list = res?.data?.list || []
  179. listData.value = listData.value.concat(dealDictArrayData([], list))
  180. loading.value = false
  181. if (listData.value?.length === +res?.data?.total) {
  182. more.value = 'noMore'
  183. return
  184. }
  185. } catch (error) {
  186. query.pageNo--
  187. more.value = 'more'
  188. }
  189. }
  190. const scrollTop = ref(0)
  191. const old = ref({
  192. scrollTop: 0
  193. })
  194. const onScroll = (e) =>{
  195. old.value.scrollTop = e.detail.scrollTop
  196. }
  197. // 加载更多
  198. const loadingMore = () => {
  199. more.value = 'loading'
  200. query.pageNo++
  201. getEnterpriseList()
  202. }
  203. const toDetail = (item) =>{
  204. if (!item?.id || !(item?.jobFairId ?? query.jobFairId)) return
  205. let url = `/pagesB/jobFair/positionClassification?jobFairId=${query.jobFairId || item.jobFairId}&enterpriseId=${item.id}&entName=${item.anotherName}`
  206. url = url + `&backgroundColor=${backgroundColor.value}`
  207. uni.navigateTo({ url })
  208. }
  209. // const goBack = () => {
  210. // uni.navigateTo({
  211. // url: '/pages/index/jobFair'
  212. // })
  213. // }
  214. // 分享招聘会
  215. const handleShare = () => {
  216. uni.navigateTo({
  217. url: `/pagesB/jobFair/jobFairShare?jobFairId=${query.jobFairId}`
  218. })
  219. }
  220. </script>
  221. <style scoped lang="scss">
  222. .stick {
  223. z-index: 1;
  224. position: sticky;
  225. top: 0;
  226. }
  227. .shareButtonBox {
  228. z-index: 1;
  229. position: absolute;
  230. right: 20px;
  231. top: 16px;
  232. border-radius: 8px;
  233. padding: 7px 9px;
  234. background-color: #fff;
  235. }
  236. .box {
  237. height: 100vh;
  238. overflow: hidden;
  239. // padding-bottom: 120rpx;
  240. box-sizing: border-box;
  241. display: flex;
  242. flex-direction: column;
  243. }
  244. .listDataBox {
  245. // padding: 1px 0 120rpx;
  246. padding-bottom: 120rpx;
  247. margin: 0 5rpx;
  248. margin-top: -10px;
  249. .enterpriseName {
  250. color: #404040;
  251. font-weight: 700;
  252. }
  253. .enterAvatar {
  254. width: 60px;
  255. height: 60px;
  256. // border-radius: 50%;
  257. margin: auto;
  258. }
  259. .jobCount {
  260. height: 40px;
  261. line-height: 40px;
  262. color: #00B760;
  263. text-align: center;
  264. // padding: 0 50rpx;
  265. font-size: 15px;
  266. // background: linear-gradient(to right, #12ebb0, #7ec04c);
  267. background: #F5F5F5;
  268. }
  269. }
  270. .scrollBox{
  271. flex: 1;
  272. height: 0 !important;
  273. padding-bottom: 24rpx;
  274. box-sizing: border-box;
  275. }
  276. // :deep(.uni-load-more__text) {
  277. // color: #fff !important;
  278. // }
  279. :deep(.uni-card) {
  280. padding: 0 !important;
  281. .uni-card__content {
  282. padding: 0 !important;
  283. }
  284. }
  285. .scroll-container {
  286. width: calc(100vw - 20px);
  287. padding: 0 20rpx;
  288. white-space: nowrap; /* 确保子元素在一行内排列 */
  289. .scroll-item {
  290. display: inline-block; /* 子元素内联块显示 */
  291. color: #fff;
  292. font-size: 17px;
  293. font-weight: 500;
  294. .text {
  295. padding: 20px 2px 0;
  296. }
  297. .choose {
  298. width: 28px;
  299. height: 2px;
  300. border-radius: 8px;
  301. margin: 8px auto;
  302. }
  303. }
  304. }
  305. :deep(.uni-searchbar) {
  306. // background-color: #fff !important;
  307. padding: 0;
  308. margin: 0 10px;
  309. border-radius: 5px;
  310. }
  311. :deep(.uni-searchbar__box) {
  312. width: calc(100% - 100px);
  313. height: 40px !important;
  314. // border: 1px solid #00B760;
  315. padding-right: 20px;
  316. flex: none;
  317. background-color: #fff;
  318. }
  319. .search-btn {
  320. position: absolute;
  321. right: 13px;
  322. top: 3px;
  323. width: 106px;
  324. height: 34px;
  325. line-height: 34px;
  326. font-size: 16px;
  327. // margin: 4px 4px 4px 0;
  328. background-color: #00B760;
  329. color: #fff;
  330. border-radius: 5px;
  331. z-index: 9;
  332. }
  333. </style>