enterprisesClassification.vue 9.3 KB

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