index.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  18. import { ref } from 'vue'
  19. import { getJobFairList } from '@/api/jobFair'
  20. import { timesTampChange } from '@/utils/date'
  21. const items = ref([])
  22. // 获得招聘会列表
  23. const getList = async () => {
  24. const res = await getJobFairList()
  25. items.value = res?.data || []
  26. }
  27. getList()
  28. //招聘会
  29. const handleToJobFairEnterprises = (val) => {
  30. if (!val?.id) {
  31. uni.showToast({ title: '进去招聘会失败!', icon: 'none' })
  32. }
  33. let url = `/pagesB/jobFair/${Number(val?.category) ? 'positionClassification': 'enterprisesClassification'}?jobFairId=${val.id}`
  34. uni.navigateTo({url})
  35. }
  36. const getShareParams = () => {
  37. return {
  38. title: '门墩儿-招聘会',
  39. path: '/pagesB/jobFair/index',
  40. }
  41. }
  42. // 转发朋友
  43. onShareAppMessage(() => {
  44. return getShareParams()
  45. })
  46. // 转发朋圈
  47. onShareTimeline(() => {
  48. return getShareParams()
  49. })
  50. </script>
  51. <style lang="scss" scoped>
  52. .line {
  53. border-top: 1px solid #ccc;
  54. }
  55. </style>