chengjie 5 meses atrás
pai
commit
540be8a676
1 arquivos alterados com 27 adições e 8 exclusões
  1. 27 8
      src/api/yjbdc/yjbdcController.js

+ 27 - 8
src/api/yjbdc/yjbdcController.js

@@ -401,14 +401,14 @@ export async function GeneratePDF(ctx) {
401 401
                 words = typeof content.Words === 'string' ? content.Words.split(',') : [];
402 402
             }
403 403
         }
404
-        console.log("Words to display:", words);
404
+        //console.log("Words to display:", words);
405 405
 
406 406
         // 获取问题列表(如果存在)
407 407
         let questions = [];
408 408
         if (content.Question && Array.isArray(content.Question)) {
409 409
             questions = content.Question;
410 410
         }
411
-        console.log("Questions to display:", questions.length);
411
+        //console.log("Questions to display:", questions.length);
412 412
 
413 413
         // 1. 在top:90,left:120像素处写"Story",60像素大小,Semibold粗细
414 414
         doc.font('Helvetica-Bold')  // 使用Helvetica-Bold作为Semibold替代
@@ -429,7 +429,7 @@ export async function GeneratePDF(ctx) {
429 429
 
430 430
         // 记录文章结束位置的y坐标
431 431
         const articleEndY = doc.y;
432
-        console.log("Article end Y position:", articleEndY);
432
+        //console.log("Article end Y position:", articleEndY);
433 433
 
434 434
         // 3. 在top:90,left:1443像素处写"备注",48像素大小,Regular粗细
435 435
         // 使用中文字体显示中文
@@ -458,7 +458,7 @@ export async function GeneratePDF(ctx) {
458 458
         const wordsArray = Array.isArray(words) ? words : 
459 459
                           (typeof words === 'string' ? words.split(',') : []);
460 460
         
461
-        console.log("Words array for display:", wordsArray);
461
+        //console.log("Words array for display:", wordsArray);
462 462
         
463 463
         // 显示单词(最多10个)
464 464
         const maxWords = Math.min(wordsArray.length, 10);
@@ -629,11 +629,11 @@ export async function GeneratePDF(ctx) {
629 629
             }
630 630
         }
631 631
 
632
-        // 13. 下方距离底边330像素,left:120像素处,画一条虚线,1860像素宽,10像素高,颜色为#D2D2D2
632
+        // 13. 下方距离底边330像素,left:120像素处,画一条虚线,1860像素宽,20像素高,颜色为#D2D2D2
633 633
         const dashLineY = doc.page.height - pixelToPt(330);
634 634
         doc.strokeColor('#D2D2D2')
635
-           .dash(pixelToPt(10), { space: pixelToPt(5) }) // 设置虚线样式
636
-           .lineWidth(pixelToPt(10))
635
+           .dash(pixelToPt(20), { space: pixelToPt(20) }) // 设置虚线样式:宽20像素,间隔20像素
636
+           .lineWidth(pixelToPt(10)) // 线高10像素
637 637
            .moveTo(pixelToPt(120), dashLineY)
638 638
            .lineTo(pixelToPt(120) + pixelToPt(1860), dashLineY)
639 639
            .stroke()
@@ -664,6 +664,25 @@ export async function GeneratePDF(ctx) {
664 664
             });
665 665
         }
666 666
         
667
+        // 20. 显示"秒过·语境背单词"
668
+        const appNameY = doc.page.height - pixelToPt(223);
669
+        doc.font('ChineseFont')  // 使用中文字体显示中文
670
+           .fontSize(pixelToPt(48))
671
+           .fillColor('black')
672
+           .text("秒过·语境背单词", pixelToPt(1320), appNameY, {
673
+               width: pixelToPt(400),
674
+               align: 'right'
675
+           });
676
+        
677
+        // 21. 显示"微信小程序"
678
+        const appTypeY = doc.page.height - pixelToPt(163);
679
+        doc.font('ChineseFont')  // 使用中文字体显示中文
680
+           .fontSize(pixelToPt(28))
681
+           .text("微信小程序", pixelToPt(1320), appTypeY, {
682
+               width: pixelToPt(400),
683
+               align: 'right'
684
+           });
685
+
667 686
         // 19. 显示当前时间
668 687
         const currentTime = moment().format('YYYY年MM月DD日 HH:mm');
669 688
         const timeY = doc.page.height - pixelToPt(118);
@@ -677,7 +696,7 @@ export async function GeneratePDF(ctx) {
677 696
            });
678 697
 
679 698
         
680
-        console.log("PDF generation completed, finalizing document...");
699
+        //console.log("PDF generation completed, finalizing document...");
681 700
 
682 701
         // 使用 Promise 等待 PDF 生成完成
683 702
         await new Promise((resolve, reject) => {