jinx пре 2 месеци
родитељ
комит
596c09b1e3

+ 7 - 3
src/components/FileReader/pdf.vue

@@ -10,17 +10,17 @@
       @rendering-failed="handleRenderFailed"
     />
   </div>
-  
 </template>
 
 <script setup>
 import { computed, ref } from "vue";
 import VuePdfEmbed from "vue-pdf-embed";
 import { getThumb } from "@/utils/file";
-
+import { RecycleScroller } from "vue-virtual-scroller";
+import "vue-virtual-scroller/dist/vue-virtual-scroller.css";
 import "vue-pdf-embed/dist/styles/annotationLayer.css";
 import "vue-pdf-embed/dist/styles/textLayer.css";
-
+const currentPage = ref(1);
 const props = defineProps({
   url: {
     type: String,
@@ -32,6 +32,7 @@ const props = defineProps({
   },
 });
 
+
 const emit = defineEmits(["ready", "error"]);
 const pdfError = ref("");
 
@@ -78,4 +79,7 @@ const handleRenderFailed = (error) => {
 .pdf-embed {
   width: 100%;
 }
+.scroller {
+  height: 500px;
+}
 </style>

+ 18 - 17
src/views/mobile/Mhome.vue

@@ -177,27 +177,28 @@
         <div v-else class="empty-box">暂无推荐数据</div>
       </section>
     </div>
-
-    <div v-if="showScanner" class="scanner-overlay">
-      <div class="scanner-dialog">
-        <div class="scanner-head">
-          <h3>扫码</h3>
-          <button type="button" class="scanner-close" @click="closeScanner">
-            关闭
-          </button>
-        </div>
-
-        <div class="scanner-body">
-          <div :id="scannerRegionId" class="scanner-region"></div>
-          <div v-if="isScannerLoading" class="scanner-state">
-            正在启动摄像头...
+    <teleport to="body">
+      <div v-if="showScanner" class="scanner-overlay">
+        <div class="scanner-dialog">
+          <div class="scanner-head">
+            <h3>扫码</h3>
+            <button type="button" class="scanner-close" @click="closeScanner">
+              关闭
+            </button>
           </div>
-          <div v-else-if="scannerError" class="scanner-state error">
-            {{ scannerError }}
+
+          <div class="scanner-body">
+            <div :id="scannerRegionId" class="scanner-region"></div>
+            <div v-if="isScannerLoading" class="scanner-state">
+              正在启动摄像头...
+            </div>
+            <div v-else-if="scannerError" class="scanner-state error">
+              {{ scannerError }}
+            </div>
           </div>
         </div>
       </div>
-    </div>
+    </teleport>
   </div>
 </template>
 

+ 24 - 26
src/views/mobile/MhomeSearch.vue

@@ -97,27 +97,28 @@
         </div>
       </section>
     </div>
-
-    <div v-if="showScanner" class="scanner-overlay">
-      <div class="scanner-dialog">
-        <div class="scanner-head">
-          <h3>扫码</h3>
-          <button type="button" class="scanner-close" @click="closeScanner">
-            关闭
-          </button>
-        </div>
-
-        <div class="scanner-body">
-          <div :id="scannerRegionId" class="scanner-region"></div>
-          <div v-if="isScannerLoading" class="scanner-state">
-            正在启动摄像头...
+    <teleport to="body">
+      <div v-if="showScanner" class="scanner-overlay">
+        <div class="scanner-dialog">
+          <div class="scanner-head">
+            <h3>扫码</h3>
+            <button type="button" class="scanner-close" @click="closeScanner">
+              关闭
+            </button>
           </div>
-          <div v-else-if="scannerError" class="scanner-state error">
-            {{ scannerError }}
+
+          <div class="scanner-body">
+            <div :id="scannerRegionId" class="scanner-region"></div>
+            <div v-if="isScannerLoading" class="scanner-state">
+              正在启动摄像头...
+            </div>
+            <div v-else-if="scannerError" class="scanner-state error">
+              {{ scannerError }}
+            </div>
           </div>
         </div>
       </div>
-    </div>
+    </teleport>
   </div>
 </template>
 
@@ -192,19 +193,16 @@ const getFirstValue = (item, keys, fallback = "") => {
 const normalizeRecord = (item, index) => ({
   ...item,
   id: getFirstValue(item, ["id"], index),
-  formDefId: getFirstValue(item, ["formDefId", "form_def_id", "defId"], ""),
-  formDataId: getFirstValue(item, ["formDataId", "form_data_id", "id"], index),
-  title: getFirstValue(item, ["name", "title"], ""),
-  author: getFirstValue(item, ["create_by", "author"], ""),
+  formDefId: getFirstValue(item, ["form_def_id"], ""),
+  formDataId: getFirstValue(item, ["form_data_id"], index),
+  title: getFirstValue(item, ["name"], ""),
+  author: getFirstValue(item, ["create_by"], ""),
   thumb: getFirstValue(item, ["thumb"], ""),
-  favorite: Boolean(
-    getFirstValue(item, ["favorite", "isCollect", "collect"], false),
-  ),
+  favorite: Boolean(getFirstValue(item, ["isCollect"], false)),
 });
 
 const resolveCover = (thumb) => {
- 
-  return getThumb(thumb) || '';
+  return getThumb(thumb) || "";
 };
 
 const openDetail = (item) => {

+ 12 - 12
src/views/mobile/Mmine.vue

@@ -272,7 +272,7 @@ const normalizeCollectItem = (item, index) => ({
   formDataId: getFirstValue(item, ["formDataId", "form_data_id", "id"], index),
   title: getFirstValue(item, ["name", "title"], ""),
   author: getFirstValue(item, ["create_by", "author"], ""),
-  cover: item?.thumb ? getThumb(item.thumb) : '',
+  cover: item?.thumb ? getThumb(item.thumb) : "",
   isCollect: true,
 });
 
@@ -287,7 +287,7 @@ const normalizeHistoryItem = (item, index) => ({
     ["create_time", "update_time", "visitTime", "readTime"],
     "",
   ),
-  cover: item?.thumb ? getThumb(item.thumb) : '',
+  cover: item?.thumb ? getThumb(item.thumb) : "",
 });
 
 const getAvatarPreviewSrc = () =>
@@ -544,7 +544,7 @@ onMounted(() => {
   min-height: 100%;
   width: 100%;
   overflow-x: hidden;
-// 
+  //
 }
 
 .page-body {
@@ -618,7 +618,7 @@ onMounted(() => {
 
 .logout-btn {
   border: 0;
-  background: #842C1D;
+  background: #842c1d;
   color: #f3d89f;
   font-size: 27px;
   padding: 13px 17px;
@@ -642,7 +642,7 @@ onMounted(() => {
   font-weight: 400;
 
   &.active {
-    color: #842C1D;
+    color: #842c1d;
     font-weight: 700;
 
     &::after {
@@ -652,7 +652,7 @@ onMounted(() => {
       bottom: 0;
       width: 100%;
       height: 5px;
-      background: #842C1D;
+      background: #842c1d;
     }
   }
 }
@@ -672,7 +672,7 @@ onMounted(() => {
     top: 50%;
     width: 16px;
     height: 2px;
-    background: #842C1D;
+    background: #842c1d;
     transform: translate(-50%, -50%);
 
     &:last-child {
@@ -775,8 +775,8 @@ onMounted(() => {
 }
 
 .collect-btn {
-  width: 28px;
-  height: 28px;
+  width: 40px;
+  height: 40px;
   border: 0;
   background: transparent;
   padding: 0;
@@ -879,7 +879,7 @@ onMounted(() => {
   padding: 0;
   border: 0;
   background: transparent;
-  color: #842C1D;
+  color: #842c1d;
   font-size: clamp(18px, 3.2vw, 24px);
   font-weight: 700;
   text-align: center;
@@ -949,8 +949,8 @@ onMounted(() => {
 }
 
 .confirm-btn {
-  border-color: #842C1D;
-  background: #842C1D;
+  border-color: #842c1d;
+  background: #842c1d;
   color: #f3d89f;
 }
 

+ 17 - 35
src/views/mobile/MresourceDetailView.vue

@@ -141,20 +141,26 @@ const handleBack = () => {
 const fileTypes = ref([
   {
     type: 1,
-    label: "阅读文档",
-    format: ["epub", "pdf"],
+    label: "阅读电子书",
+    format: ["epub"],
+    show: false,
+  },
+  {
+    type: 2,
+    label: "查看pdf",
+    format: ["pdf"],
     show: false,
   },
   {
     type: 3,
     label: "查看图片",
-    format: ["png", "jpg", "jpeg", "gif", "webp", "bmp"],
+    format: ["png", "jpg", "jpeg"],
     show: false,
   },
   {
     type: 4,
-    label: "查看视频",
-    format: ["mp4", "avi", "mov", "m4v", "webm", "ogg"],
+    label: "查看视频",
+    format: ["mp4", "avi"],
     show: false,
   },
 ]);
@@ -181,8 +187,7 @@ const getFileExt = (file = "") =>
   String(file).split("?")[0].split("#")[0].split(".").pop().toLowerCase();
 
 const resolveCover = (thumb) => {
- 
-  return getThumb(thumb) || '';
+  return getThumb(thumb) || "";
 };
 
 const relatedList = computed(() =>
@@ -225,22 +230,11 @@ const getDictName = (list = {}) => {
 
 const updateFileTypes = (files = []) => {
   const suffixSet = new Set(files.map((item) => getFileExt(item)));
-  const hasPdf = suffixSet.has("pdf");
-  const hasEpub = suffixSet.has("epub");
-
-  fileTypes.value = fileTypes.value.map((item) => {
-    if (item.type === 1) {
-      return {
-        ...item,
-        show: hasPdf || hasEpub,
-      };
-    }
 
-    return {
-      ...item,
-      show: item.format.some((suffix) => suffixSet.has(suffix)),
-    };
-  });
+  fileTypes.value = fileTypes.value.map((item) => ({
+    ...item,
+    show: item.format.some((suffix) => suffixSet.has(suffix)),
+  }));
 };
 
 const getSelectList = async () => {
@@ -281,20 +275,8 @@ const getDetails = async () => {
   }
 };
 
-const getReadingRouteType = (type) => {
-  if (type === 1) {
-    const files = Array.isArray(info.value?.files) ? info.value.files : [];
-    const hasEpub = files.some((item) => getFileExt(item) === "epub");
-    return hasEpub ? 1 : 2;
-  }
-
-  return type;
-};
-
 const openReading = (type) => {
-  router.push(
-    `/reading/${formDefId}/${formDataId}/${getReadingRouteType(type)}`,
-  );
+  router.push(`/reading/${formDefId}/${formDataId}/${type}`);
 };
 
 const goRelatedDetail = (item) => {

+ 1 - 1
src/views/pc/HomeSearch.vue

@@ -169,7 +169,7 @@ const normalizeRecord = (item, index) => ({
   formDataId: getFirstValue(item, ["formDataId", "form_data_id", "id"], index),
   title: getFirstValue(item, ["name", "title"], ""),
   author: getFirstValue(item, ["create_by", "author"], ""),
-  favorite: Boolean(getFirstValue(item, ["favorite", "collect"], false)),
+  favorite: Boolean(getFirstValue(item, ["favorite", "isCollect"], false)),
 });
 
 const openDetail = (item) => {