index.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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">
  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" @tap="handleToJobFairEnterprises(val)">查看详情</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 { ref } from 'vue'
  18. import { getJobFairList } from '@/api/jobFair'
  19. import { timesTampChange } from '@/utils/date'
  20. const items = ref([])
  21. // 获得招聘会列表
  22. const getList = async () => {
  23. const res = await getJobFairList()
  24. items.value = res?.data || []
  25. }
  26. getList()
  27. //招聘会
  28. const handleToJobFairEnterprises = (val) => {
  29. if (!val?.id) {
  30. uni.showToast({ title: '进去招聘会失败!', icon: 'none' })
  31. }
  32. let url = `/pagesB/jobFair/${Number(val?.category) ? 'positionClassification': 'enterprisesClassification'}?jobFairId=${val.id}`
  33. // const tagData = val?.tag?.length ? JSON.stringify(val.tag) : null
  34. // if (tagData) url = url + `&tagData=${tagData}`
  35. console.log('url:', url)
  36. uni.navigateTo({url})
  37. // let text = val.title ? val.title.replace(/<[^>]+>/g, ' ') : '' // 去掉所有 HTML 标签
  38. // text = text ? text.replace(/\s+/g, ' ').trim() : '' // 去掉多余的空格
  39. // uni.navigateTo({
  40. // url: `/pagesB/jobFair/enterprises?jobFairId=${val.id}&jobFairName=${text}`
  41. // })
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .line {
  46. border-top: 1px solid #ccc;
  47. }
  48. </style>