Keine Beschreibung

CourseMat.vue 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <ion-card :router-link="'/tabs/mat_detail/'+obj.id">
  3. <ion-img alt="Silhouette of mountains" :src="thmb" v-if="thmb" class="img_16_9"/>
  4. <ion-card-header>
  5. <ion-card-title>{{ name }}</ion-card-title>
  6. </ion-card-header>
  7. <ion-card-content class='ion-text-wrap'>
  8. {{ dt }}
  9. </ion-card-content>
  10. </ion-card>
  11. </template>
  12. <script setup lang="ts">
  13. import { IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonIcon, onIonViewWillEnter, IonCard, IonCardHeader, IonCardTitle, IonCardSubtitle, IonCardContent, IonImg } from '@ionic/vue';
  14. import moment from 'moment'
  15. import { getTrainers, listCourses } from '@/composable/settings';
  16. import { ref, onMounted } from 'vue'
  17. const props = defineProps({
  18. obj: Object,
  19. courseName: String,
  20. })
  21. const dt = ref()
  22. const thmb = ref()
  23. const name = ref()
  24. onMounted(() => {
  25. console.log("--- onmounted ---")
  26. console.log("name === ", props.obj)
  27. const obj = props.obj
  28. let temp = obj.display_datetime || obj.vimeo_created || obj.created_at
  29. dt.value = moment(temp).format('LLL');
  30. if( obj.gifs && obj.gifs.length > 0 ) {
  31. console.log(obj.gifs)
  32. if(obj.gifs[0].sizes.length > 2 ) {
  33. thmb.value = obj.gifs[0].sizes[2].link
  34. }else {
  35. thmb.value = obj.gifs[0].sizes[0].link
  36. }
  37. }else {
  38. thmb.value = obj.course_image
  39. }
  40. name.value = obj.vimeo_name || props.courseName
  41. })
  42. </script>
  43. <style scoped>
  44. #container {
  45. background-color:#f00;
  46. }
  47. ion-card-title {
  48. font-size:1.5em;
  49. }
  50. .img_16_9 {
  51. width:480px;
  52. height:270px;
  53. object-fit:cover;
  54. }
  55. </style>