jobFair.vue 2.3 KB

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