VideoView.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <script setup lang="ts">
  2. import { ref } from 'vue';
  3. import { useSimpleDataLoader } from '@/composeable/SimpleDataLoader';
  4. import type { GetContentListItem } from '@/api/CommonContent';
  5. import HuliApi from '@/api/huli/HuliApi';
  6. import PageLeftTitleRightContent from '@/components/parts/PageLeftTitleRightContent.vue';
  7. import SimplePopup from '@/components/SimplePopup.vue';
  8. import HoriontalLargeList from '@/components/small/HoriontalLargeList.vue';
  9. import SimplePageContentLoader from '@/components/SimplePageContentLoader.vue';
  10. const newsData = useSimpleDataLoader(async (params) => {
  11. return (await HuliApi.getVideoList(1, 30)).map(p => {
  12. return {
  13. ...p,
  14. tag: '非物质文化遗产',
  15. }
  16. });
  17. });
  18. const showDialog = ref(false);
  19. const currentItem = ref<GetContentListItem>();
  20. function goDetail(item: GetContentListItem, index: number) {
  21. currentItem.value = item;
  22. showDialog.value = true;
  23. }
  24. </script>
  25. <template>
  26. <PageLeftTitleRightContent title-after-text="科普·系列片" :box="false">
  27. <template #content>
  28. <SimplePageContentLoader :loader="newsData">
  29. <HoriontalLargeList :list="newsData.content.value!" @item-click="goDetail" />
  30. </SimplePageContentLoader>
  31. </template>
  32. </PageLeftTitleRightContent>
  33. <SimplePopup v-model:show="showDialog">
  34. <div class="dialog bg-light p-4 d-flex flex-col">
  35. <div class="d-flex flex-row align-center ">
  36. <img class="main-image-button" src="@/assets/images/IconBack.png" @click="showDialog = false"></img>
  37. <h2 class="mb-0 ml-3">{{ currentItem?.title }}</h2>
  38. </div>
  39. <video v-if="showDialog" class="w-100" :src="(currentItem?.video as string)" controls autoplay></video>
  40. </div>
  41. </SimplePopup>
  42. </template>
  43. <style lang="scss" scoped>
  44. .dialog {
  45. position: relative;
  46. width: 60vw;
  47. height: 70vh;
  48. video {
  49. margin-top: 10px;
  50. height: calc(70vh - 60px - 3rem);
  51. }
  52. }
  53. </style>