detail.uvue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <script setup lang='ts'>
  2. import Back from '@/components/back.uvue'
  3. import Loading from '@/components/loading.uvue'
  4. import { ref, onMounted, watchEffect, nextTick, onUnmounted } from 'vue'
  5. import { type SubjectCourseResult, fetchSubjectCourseApp, updateSubjectProgress } from '@/services/subject/course'
  6. import { router } from '@/.cool'
  7. const isLoading = ref(true)
  8. const showProgress = ref(true)
  9. const showControls = ref(true)
  10. const showVideo = ref(true)
  11. const data = ref({
  12. videoSrc: '',
  13. })
  14. //当前进度
  15. const course = ref<SubjectCourseResult>()
  16. //通过路由参数获取课程id
  17. async function fetchCatalog() {
  18. course.value = await fetchSubjectCourseApp({ id: router.query().id })
  19. if (!course.value?.videoPath) {
  20. return
  21. }
  22. data.value.videoSrc = course.value?.videoPath.includes('http') ? course.value?.videoPath : ('https://oss.xiaoxiongcode.com' + course.value?.videoPath)
  23. }
  24. onMounted(async () => {
  25. await fetchCatalog()
  26. isLoading.value = false
  27. setTimeout(() => {
  28. isLoading.value = false
  29. }, 1000)
  30. })
  31. async function handleEnded() {
  32. }
  33. function handleControlsToggle(e) {
  34. showControls.value = e.detail.show
  35. }
  36. </script>
  37. <template>
  38. <Loading v-show="isLoading" />
  39. <cl-page v-show="!isLoading">
  40. <view class="w-full h-full">
  41. <web-view :src="data.videoSrc + '?' + Math.random()" class="w-full h-full"></web-view>
  42. </view>
  43. </cl-page>
  44. </template>
  45. <style lang="scss" scoped>
  46. .translate50 {
  47. transform: translateY(-50%);
  48. }
  49. .course-detail-page {
  50. @apply flex flex-row items-center;
  51. background-color: #3498DB;
  52. height: 100vh;
  53. color: black;
  54. transition: all 1s ease-in-out;
  55. }
  56. .video-container {
  57. width: 100vw;
  58. height: 100vh;
  59. top: 0;
  60. left: 0;
  61. transform: translate(0, 0);
  62. animation: spin 2s linear 1;
  63. transition: all 2s ease-in-out;
  64. }
  65. @keyframes spin {
  66. 0% {
  67. opacity: 50%;
  68. }
  69. 100% {
  70. opacity: 1;
  71. }
  72. }
  73. .hidden {
  74. opacity: 0;
  75. transition: all 3s ease-in-out;
  76. }
  77. .video-fullscreen_title {
  78. @apply absolute top-3 left-0 pl-[80px] w-[100vw] z-10 flex items-center justify-between flex-row;
  79. color: #fff;
  80. .control-progress {
  81. @apply flex flex-row gap-[3px] relative justify-end;
  82. flex: 1;
  83. .before {
  84. @apply absolute top-1/2 right-0 w-[340px] h-[40px] bg-[#2BA0F3] rounded-l-full;
  85. transform: translateY(-30%);
  86. }
  87. }
  88. }
  89. video::-webkit-media-controls-fullscreen-button,
  90. video::-webkit-media-controls-enter-fullscreen-button,
  91. video::-webkit-media-controls-rotate-button,
  92. video::-webkit-media-controls-seek-back-button,
  93. video::-webkit-media-controls-seek-forward-button {
  94. display: none !important;
  95. }
  96. .mic {
  97. @apply absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2;
  98. }
  99. </style>