jobFair.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!-- 招聘会 -->
  2. <template>
  3. <view style="padding-bottom: 30px; ">
  4. <view v-if="items.length">
  5. <uni-card v-for="val in items" :key="val.id" @tap="handleToJobFairEnterprises(val)">
  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">活动时间:{{ timesTampChange(val.startTime, 'Y-M-D') }}至{{ timesTampChange(val.endTime, 'Y-M-D') }}</view>
  8. <button class="ss-m-t-20 ss-m-b-10" style="background-color: #00B760; color: #fff;" type="primary">查看详情</button>
  9. </uni-card>
  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. .line {
  60. border-top: 1px solid #ccc;
  61. }
  62. </style>