jobFair.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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>
  15. <view class="commonBackground"></view>
  16. <view class="nodata-img-parent" :style="{'height': `calc(100vh - ${(navbarHeight + 100)}px)`}">
  17. <image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" style="width: 100vw;height: 100vh;"></image>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script setup>
  24. import { onShow, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  25. import { ref } from 'vue'
  26. import { getJobFairList } from '@/api/jobFair'
  27. import { timesTampChange } from '@/utils/date'
  28. import Navbar from '@/components/Navbar'
  29. const navbarHeight = ref(uni.getStorageSync('navbarHeight'))
  30. // 设置自定义tabbar选中值
  31. onShow(() => {
  32. const currentPage = getCurrentPages()[0]; // 获取当前页面实例
  33. const currentTabBar = currentPage?.getTabBar?.();
  34. // 设置当前tab页的下标index
  35. currentTabBar?.setData({ selected: 3 });
  36. })
  37. const items = ref([])
  38. // 获得招聘会列表
  39. const getList = async () => {
  40. const res = await getJobFairList()
  41. items.value = res?.data || []
  42. }
  43. getList()
  44. //招聘会
  45. const handleToJobFairEnterprises = (val) => {
  46. if (!val?.id) {
  47. uni.showToast({ title: '进去招聘会失败!', icon: 'none' })
  48. }
  49. let url = `/pagesB/jobFair/${Number(val?.category) ? 'positionClassification': 'enterprisesClassification'}?jobFairId=${val.id}`
  50. uni.navigateTo({url})
  51. }
  52. const getShareParams = () => {
  53. return {
  54. title: '门墩儿-招聘会',
  55. path: '/pages/index/jobFair',
  56. }
  57. }
  58. // 转发朋友
  59. onShareAppMessage(() => {
  60. return getShareParams()
  61. })
  62. // 转发朋圈
  63. onShareTimeline(() => {
  64. return getShareParams()
  65. })
  66. </script>
  67. <style lang="scss" scoped>
  68. .list-item {
  69. margin: 0 30rpx 30rpx 30rpx;
  70. border-radius: 20rpx;
  71. padding: 30rpx;
  72. position: relative;
  73. box-shadow: 1px 2px 12px rgba(0, 0, 0, 0.17);
  74. view {
  75. font-size: 28rpx;
  76. color: #666;
  77. }
  78. }
  79. </style>