hookehuyr

fix(PdfPreview): 添加自定义PDF配置以解决字体加载错误

在PdfPreview组件中添加了customPdfOption配置,包括cMapPacked和cMapUrl,以解决PDF字体加载错误的问题。具体配置参考了pdfjs的官方文档。

refactor(StudyDetailPage): 调整条件渲染和高度计算逻辑

将v-else改为v-if以更清晰地控制渲染逻辑,并调整了topWrapper的高度计算,增加了30px的额外空间。
...@@ -67,7 +67,12 @@ const initPdfViewer = () => { ...@@ -67,7 +67,12 @@ const initPdfViewer = () => {
67 fileName: props.title, 67 fileName: props.title,
68 lang: "en", 68 lang: "en",
69 print: false, 69 print: false,
70 - watermarkOptions: undefined 70 + watermarkOptions: undefined,
71 + customPdfOption: {
72 + // customPdfOption是 pdfjs getDocument 函数中一些配置参数 具体可参考 https://mozilla.github.io/pdf.js/api/draft/module-pdfjsLib.html#~DocumentInitParameters
73 + cMapPacked: true, //指定 CMap 是否是二进制打包的
74 + cMapUrl: "https://cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/", //预定义 Adob​​e CMaps 所在的 URL。可解决字体加载错误
75 + },
71 } 76 }
72 }); 77 });
73 }); 78 });
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
66 </div> 66 </div>
67 67
68 <!-- 默认展示区 --> 68 <!-- 默认展示区 -->
69 - <div v-else class="relative" style="border-bottom: 1px solid #e5e7eb;"> 69 + <div v-if="!course.course_type" class="relative" style="border-bottom: 1px solid #e5e7eb;">
70 <div class="h-24 bg-white flex items-center justify-center px-4"> 70 <div class="h-24 bg-white flex items-center justify-center px-4">
71 <h3 class="text-lg font-medium text-gray-900 truncate">{{ course.title }}</h3> 71 <h3 class="text-lg font-medium text-gray-900 truncate">{{ course.title }}</h3>
72 </div> 72 </div>
...@@ -385,7 +385,7 @@ onMounted(async () => { ...@@ -385,7 +385,7 @@ onMounted(async () => {
385 const topWrapper = document.querySelector('.top-wrapper'); 385 const topWrapper = document.querySelector('.top-wrapper');
386 const bottomWrapper = document.querySelector('.bottom-wrapper'); 386 const bottomWrapper = document.querySelector('.bottom-wrapper');
387 if (topWrapper) { 387 if (topWrapper) {
388 - topWrapperHeight.value = topWrapper.clientHeight + 'px'; 388 + topWrapperHeight.value = topWrapper.clientHeight + 30 + 'px';
389 } 389 }
390 if (bottomWrapper) { 390 if (bottomWrapper) {
391 bottomWrapperHeight.value = bottomWrapper.clientHeight + 'px'; 391 bottomWrapperHeight.value = bottomWrapper.clientHeight + 'px';
......