enterprisesClassification.vue 10 KB

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