jinx 1 месяц назад
Родитель
Сommit
ff0dfaf8fc

+ 10 - 2
src/views/mobile/MreadingDetailView.vue

@@ -139,7 +139,10 @@ const currentPage = computed(
   () =>
     fileTypes.find((item) => item.type === currentType.value) || fileTypes[0],
 );
-const isLoading = computed(() => detailLoading.value || readerLoading.value);
+const isVideoPage = computed(() => currentPage.value.type === 4);
+const isLoading = computed(
+  () => !isVideoPage.value && (detailLoading.value || readerLoading.value),
+);
 
 const getFileExt = (file = "") =>
   String(file).split("?")[0].split("#")[0].split(".").pop().toLowerCase();
@@ -269,6 +272,11 @@ const handlePageHide = () => {
 };
 
 const handleReaderLoading = () => {
+  if (isVideoPage.value) {
+    readerLoading.value = false;
+    return;
+  }
+
   readerLoading.value = true;
 };
 
@@ -309,7 +317,7 @@ const getDetails = async () => {
     filesList.value = sourceFiles.filter((item) =>
       currentPage.value.format.includes(getFileExt(item)),
     );
-    readerLoading.value = filesList.value.length > 0;
+    readerLoading.value = !isVideoPage.value && filesList.value.length > 0;
   } catch {
     detailInfo.value = null;
     filesList.value = [];

+ 4 - 7
src/views/mobile/components/FileReader/video.vue

@@ -6,8 +6,6 @@
         preload="auto"
         class="video-player"
         :src="sourceUrl"
-        @loadstart="handleVideoLoading"
-        @waiting="handleVideoLoading"
         @loadedmetadata="handleVideoReady"
         @loadeddata="handleVideoReady"
         @canplay="handleVideoReady"
@@ -39,7 +37,7 @@ const props = defineProps({
   },
 });
 
-const emit = defineEmits(["loading", "ready", "error"]);
+const emit = defineEmits(["ready", "error"]);
 const isVideoLoading = ref(false);
 
 const sourceUrl = computed(() => {
@@ -48,8 +46,7 @@ const sourceUrl = computed(() => {
 });
 
 const handleVideoLoading = () => {
-  isVideoLoading.value = true;
-  emit("loading");
+  isVideoLoading.value = false;
 };
 
 const handleVideoReady = () => {
@@ -65,9 +62,9 @@ const handleVideoError = (event) => {
 watch(
   sourceUrl,
   (url) => {
-    isVideoLoading.value = Boolean(url);
+    isVideoLoading.value = false;
     if (url) {
-      emit("loading");
+      emit("ready");
     }
   },
   { immediate: true },