jobFair.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <!-- 招聘会 -->
  2. <template>
  3. <view>
  4. <Navbar title="招聘会" />
  5. <view class="box defaultBgc" :style="{'padding-top': navbarHeight + 'px'}" style="padding-bottom: 100px;">
  6. <view v-if="items.length">
  7. <view class="commonBackground"></view>
  8. <view v-for="val in items" :key="val.id" @tap="handleToJobFairEnterprises(val)" class="list-item defaultBgc default-border">
  9. <image v-if="val?.previewImg" class="ss-m-t-10" :src="val.previewImg" mode="widthFix" style="width: 100%; height: auto; border-radius: 6px;"></image>
  10. <view class="ss-m-t-20 MiSans-Normal">活动时间:{{ timesTampChange(val.startTime, 'Y-M-D') }}至{{ timesTampChange(val.endTime, 'Y-M-D') }}</view>
  11. <button class="ss-m-t-20 ss-m-b-10 MiSans-Medium" style="background-color: #00B760; color: #fff;" type="primary">查看详情</button>
  12. </view>
  13. </view>
  14. <view v-else class="nodata-img-parent">
  15. <image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script setup>
  21. import { onShow, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  22. import { ref } from 'vue'
  23. import { getJobFairList } from '@/api/jobFair'
  24. import { timesTampChange } from '@/utils/date'
  25. import Navbar from '@/components/Navbar'
  26. const navbarHeight = ref(uni.getStorageSync('navbarHeight'))
  27. // 设置自定义tabbar选中值
  28. onShow(() => {
  29. const currentPage = getCurrentPages()[0]; // 获取当前页面实例
  30. const currentTabBar = currentPage?.getTabBar?.();
  31. // 设置当前tab页的下标index
  32. currentTabBar?.setData({ selected: 3 });
  33. })
  34. const items = ref([])
  35. // 获得招聘会列表
  36. const getList = async () => {
  37. const res = await getJobFairList()
  38. items.value = res?.data || []
  39. }
  40. getList()
  41. //招聘会
  42. const handleToJobFairEnterprises = (val) => {
  43. if (!val?.id) {
  44. uni.showToast({ title: '进去招聘会失败!', icon: 'none' })
  45. }
  46. let url = `/pagesB/jobFair/${Number(val?.category) ? 'positionClassification': 'enterprisesClassification'}?jobFairId=${val.id}`
  47. uni.navigateTo({url})
  48. }
  49. const getShareParams = () => {
  50. return {
  51. title: '门墩儿-招聘会',
  52. path: '/pages/index/jobFair',
  53. }
  54. }
  55. // 转发朋友
  56. onShareAppMessage(() => {
  57. return getShareParams()
  58. })
  59. // 转发朋圈
  60. onShareTimeline(() => {
  61. return getShareParams()
  62. })
  63. </script>
  64. <style lang="scss" scoped>
  65. .list-item {
  66. margin: 0 30rpx 30rpx 30rpx;
  67. border-radius: 20rpx;
  68. padding: 30rpx;
  69. position: relative;
  70. view {
  71. font-size: 28rpx;
  72. color: #666;
  73. }
  74. }
  75. </style>