@blockspoon/cert-badge-renderer 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -13
- package/dist/interface/index.d.ts +1 -3
- package/dist/templates/badges/BadgeType1.js +21 -3
- package/dist/templates/badges/BadgeType15.js +13 -12
- package/dist/templates/badges/BadgeType21.js +41 -39
- package/dist/templates/badges/BadgeType35.js +7 -13
- package/dist/templates/badges/BadgeType63.d.ts +1 -1
- package/dist/templates/badges/BadgeType63.js +33 -42
- package/dist/templates/badges/BadgeType7.js +37 -16
- package/dist/templates/svgTemplate.js +8 -83
- package/dist/utils/generateAchievementHTML.d.ts +1 -1
- package/dist/utils/generateAchievementHTML.js +9 -7
- package/dist/utils/getBindingValue.js +7 -8
- package/package.json +1 -1
- package/src/browser/index.ts +1 -0
- package/src/interface/index.ts +1 -3
- package/src/templates/badges/BadgeType1.ts +22 -4
- package/src/templates/badges/BadgeType15.ts +13 -12
- package/src/templates/badges/BadgeType21.ts +41 -39
- package/src/templates/badges/BadgeType35.ts +7 -13
- package/src/templates/badges/BadgeType63.ts +37 -43
- package/src/templates/badges/BadgeType7.ts +38 -17
- package/src/templates/svgTemplate.ts +8 -102
- package/src/utils/generateAchievementHTML.ts +9 -6
- package/src/utils/generateDesignHTML.ts +12 -44
- package/src/utils/getBindingValue.ts +13 -15
- package/test/certificate.html +294 -236
- package/test/certificate.png +0 -0
- package/test/certificate_base64.png +0 -0
- package/test/test.js +203 -554
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { ISvgProps } from "../../interface";
|
|
1
|
+
import { ISvgProps } from "../../interface";
|
|
2
2
|
|
|
3
3
|
export function createBadgeType63({
|
|
4
4
|
mainColor = "#96A6B4",
|
|
5
5
|
subColor = "#96A6B4",
|
|
6
|
+
extraColor1 = "#96A6B4",
|
|
7
|
+
extraColor2 = "#96A6B4",
|
|
6
8
|
}: ISvgProps): string {
|
|
9
|
+
const clipId0 = `clip0_linear_${Math.random().toString(36).substr(2, 9)}`;
|
|
10
|
+
|
|
7
11
|
return `
|
|
8
12
|
<svg
|
|
9
13
|
width="100%"
|
|
@@ -20,65 +24,55 @@ export function createBadgeType63({
|
|
|
20
24
|
display: block;
|
|
21
25
|
"
|
|
22
26
|
>
|
|
27
|
+
<defs>
|
|
28
|
+
<clipPath id="${clipId0}">
|
|
29
|
+
<path
|
|
30
|
+
d="M23 347.403H514V362.403C514 446.35 445.947 514.403 362 514.403H55C37.3269 514.403 23 500.076 23 482.403V347.403Z"
|
|
31
|
+
fill="${extraColor2}"
|
|
32
|
+
/>
|
|
33
|
+
</clipPath>
|
|
34
|
+
</defs>
|
|
23
35
|
<path
|
|
24
|
-
d="M6
|
|
36
|
+
d="M6 40.403C6 21.6253 21.2223 6.40302 40 6.40302H377C462.052 6.40302 531 75.3512 531 160.403V377.403C531 462.455 462.052 531.403 377 531.403H40C21.2223 531.403 6 516.181 6 497.403V40.403Z"
|
|
25
37
|
fill="${mainColor}"
|
|
26
38
|
stroke="${mainColor}"
|
|
27
|
-
|
|
39
|
+
strokeWidth="12"
|
|
28
40
|
/>
|
|
29
41
|
<path
|
|
30
|
-
d="M15
|
|
31
|
-
stroke="
|
|
32
|
-
|
|
42
|
+
d="M15 53.403C15 32.4162 32.0132 15.403 53 15.403H364C451.261 15.403 522 86.142 522 173.403V364.403C522 451.664 451.261 522.403 364 522.403H53C32.0132 522.403 15 505.39 15 484.403V53.403Z"
|
|
43
|
+
stroke="${extraColor2}"
|
|
44
|
+
strokeWidth="4"
|
|
33
45
|
/>
|
|
34
46
|
<path
|
|
35
|
-
d="M23
|
|
36
|
-
fill="
|
|
47
|
+
d="M23 55.403C23 37.7299 37.3269 23.403 55 23.403H362C445.947 23.403 514 91.4557 514 175.403V362.403C514 446.35 445.947 514.403 362 514.403H55C37.3269 514.403 23 500.076 23 482.403V55.403Z"
|
|
48
|
+
fill="${extraColor2}"
|
|
37
49
|
/>
|
|
38
|
-
<
|
|
39
|
-
id="mask0_2407_494"
|
|
40
|
-
style="mask-type:alpha"
|
|
41
|
-
maskUnits="userSpaceOnUse"
|
|
50
|
+
<rect
|
|
42
51
|
x="23"
|
|
43
|
-
y="
|
|
44
|
-
width="
|
|
45
|
-
height="
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
clip-rule="evenodd"
|
|
50
|
-
d="M514 345.25V362.655C514 446.602 445.947 514.655 362 514.655H55C37.3269 514.655 23 500.328 23 482.655V345.25H514Z"
|
|
51
|
-
fill="#D9D9D9"
|
|
52
|
-
/>
|
|
53
|
-
</mask>
|
|
54
|
-
<g mask="url(#mask0_2407_494)">
|
|
55
|
-
<path
|
|
56
|
-
d="M71.497 455.745C24.4564 461.406 -24.5553 464.305 -74.7495 464.305C-236.501 464.305 -413.364 421.506 -529.389 370.423L-536.09 370.285L-536.09 440.973C-282.096 488.052 -65.8145 474.798 71.497 455.745Z"
|
|
57
|
-
fill="${subColor}"
|
|
58
|
-
fill-opacity="0.1"
|
|
59
|
-
/>
|
|
52
|
+
y="175.65"
|
|
53
|
+
width="439"
|
|
54
|
+
height="3.50499"
|
|
55
|
+
fill="${mainColor}"
|
|
56
|
+
/>
|
|
57
|
+
<g clip-path="url(#${clipId0})">
|
|
60
58
|
<path
|
|
61
|
-
d="
|
|
59
|
+
d="M350.872 379.324C406.16 342.877 482.659 344.955 513.997 350.55V514.403H21.836L21.8388 429.929C22.1044 432.831 32.4456 440.889 68.0071 452.059C113.812 466.446 281.762 424.883 350.872 379.324Z"
|
|
62
60
|
fill="${mainColor}"
|
|
63
61
|
/>
|
|
64
62
|
<path
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
fillRule="evenodd"
|
|
64
|
+
clipRule="evenodd"
|
|
65
|
+
d="M514.104 350.55C482.766 344.955 406.267 342.877 350.979 379.324C290.856 418.959 147.138 502.753 80.619 514.403H80.6172C80.622 514.403 80.619 514.403 80.619 514.403H514.104V350.55Z"
|
|
67
66
|
fill="${subColor}"
|
|
68
67
|
/>
|
|
69
68
|
<path
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
fillRule="evenodd"
|
|
70
|
+
clipRule="evenodd"
|
|
71
|
+
d="M514.101 425.679C479.612 419.218 438.775 419.581 393.111 430.105C380.412 433.506 341.625 445.676 288.07 467.153C225.943 492.068 189.771 503.867 128.328 514.403L514.101 514.403V425.679Z"
|
|
72
|
+
fill="${extraColor1}"
|
|
73
73
|
/>
|
|
74
74
|
</g>
|
|
75
|
-
|
|
76
|
-
x="18"
|
|
77
|
-
y="175.247"
|
|
78
|
-
width="439"
|
|
79
|
-
height="3.50499"
|
|
80
|
-
fill="${mainColor}"
|
|
81
|
-
/>
|
|
75
|
+
|
|
82
76
|
</svg>
|
|
83
77
|
`;
|
|
84
|
-
}
|
|
78
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISvgProps } from "../../interface";
|
|
1
|
+
import { ISvgProps } from "../../interface";
|
|
2
2
|
|
|
3
3
|
export function createBadgeType7({
|
|
4
4
|
mainColor = "#96A6B4",
|
|
@@ -32,7 +32,8 @@ export function createBadgeType7({
|
|
|
32
32
|
/>
|
|
33
33
|
<mask
|
|
34
34
|
id="mask0_2384_132"
|
|
35
|
-
style="mask-type:
|
|
35
|
+
// style="mask-type:alpha"
|
|
36
|
+
style={{ maskType: "alpha" }}
|
|
36
37
|
maskUnits="userSpaceOnUse"
|
|
37
38
|
x="17"
|
|
38
39
|
y="17"
|
|
@@ -54,23 +55,43 @@ export function createBadgeType7({
|
|
|
54
55
|
fill="${mainColor}"
|
|
55
56
|
/>
|
|
56
57
|
<path
|
|
57
|
-
d="
|
|
58
|
-
fill="
|
|
58
|
+
d="M207.237 448.787C207.237 456.661 202.868 458.644 197.479 458.644C192.09 458.644 187.721 455.244 187.721 448.787C187.721 441.358 197.479 430.589 197.479 430.589C197.479 430.589 207.237 441.358 207.237 448.787Z"
|
|
59
|
+
fill="${mainColor}"
|
|
60
|
+
/>
|
|
61
|
+
<path
|
|
62
|
+
d="M328.494 405.693C328.494 417.675 321.668 420.694 313.247 420.694C304.826 420.694 298 415.519 298 405.693C298 394.388 313.247 378.001 313.247 378.001C313.247 378.001 328.494 394.388 328.494 405.693Z"
|
|
63
|
+
fill="${subColor}"
|
|
64
|
+
/>
|
|
65
|
+
<path
|
|
66
|
+
d="M421.717 420.263C421.717 447.705 406.083 454.619 386.798 454.619C367.513 454.619 351.879 442.767 351.879 420.263C351.879 394.374 386.798 356.845 386.798 356.845C386.798 356.845 421.717 394.374 421.717 420.263Z"
|
|
67
|
+
fill="${subColor}"
|
|
68
|
+
/>
|
|
69
|
+
<path
|
|
70
|
+
d="M175.799 439.905C175.799 455.311 167.061 459.192 156.282 459.192C145.503 459.192 136.766 452.539 136.766 439.905C136.766 425.371 156.282 404.302 156.282 404.302C156.282 404.302 175.799 425.371 175.799 439.905Z"
|
|
71
|
+
fill="${subColor}"
|
|
72
|
+
/>
|
|
73
|
+
<path
|
|
74
|
+
d="M311.06 467.351C311.06 482.757 302.322 486.638 291.544 486.638C280.765 486.638 272.027 479.985 272.027 467.351C272.027 452.817 291.544 431.748 291.544 431.748C291.544 431.748 311.06 452.817 311.06 467.351Z"
|
|
75
|
+
fill="${subColor}"
|
|
76
|
+
/>
|
|
77
|
+
<path
|
|
78
|
+
d="M368.894 440.725C368.894 457.671 359.064 461.941 346.938 461.941C334.812 461.941 324.982 454.622 324.982 440.725C324.982 424.737 346.938 401.562 346.938 401.562C346.938 401.562 368.894 424.737 368.894 440.725Z"
|
|
79
|
+
fill="${mainColor}"
|
|
80
|
+
/>
|
|
81
|
+
<path
|
|
82
|
+
d="M420.401 394.96C420.401 402.629 416.146 404.561 410.897 404.561C405.648 404.561 401.393 401.249 401.393 394.96C401.393 387.725 410.897 377.237 410.897 377.237C410.897 377.237 420.401 387.725 420.401 394.96Z"
|
|
83
|
+
fill="${mainColor}"
|
|
59
84
|
/>
|
|
60
85
|
</g>
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<stop stop-color="white" />
|
|
71
|
-
<stop offset="1" stop-color="white" stop-opacity="0" />
|
|
72
|
-
</linearGradient>
|
|
73
|
-
</defs>
|
|
86
|
+
<path
|
|
87
|
+
d="M23 244C23 121.952 121.952 23 244 23H465V244C465 366.048 366.048 465 244 465C121.952 465 23 366.048 23 244Z"
|
|
88
|
+
stroke="${mainColor}"
|
|
89
|
+
strokeWidth="2"
|
|
90
|
+
/>
|
|
91
|
+
<path
|
|
92
|
+
d="M244 471C118.638 471 51.249 381.296 26.7227 314H460.311C443.193 374.213 369.361 471 244 471Z"
|
|
93
|
+
fill="url(#paint0_linear_2384_132)"
|
|
94
|
+
/>
|
|
74
95
|
</svg>
|
|
75
96
|
`;
|
|
76
97
|
}
|
|
@@ -65,10 +65,10 @@ export const badgeTemplates: templateType[] = [
|
|
|
65
65
|
id: "BadgeType14",
|
|
66
66
|
Component: Badges.BadgeType14,
|
|
67
67
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
{
|
|
69
|
+
id: "BadgeType15",
|
|
70
|
+
Component: Badges.BadgeType15,
|
|
71
|
+
},
|
|
72
72
|
{
|
|
73
73
|
id: "BadgeType16",
|
|
74
74
|
Component: Badges.BadgeType16,
|
|
@@ -89,10 +89,10 @@ export const badgeTemplates: templateType[] = [
|
|
|
89
89
|
id: "BadgeType20",
|
|
90
90
|
Component: Badges.BadgeType20,
|
|
91
91
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
{
|
|
93
|
+
id: "BadgeType21",
|
|
94
|
+
Component: Badges.BadgeType21,
|
|
95
|
+
},
|
|
96
96
|
{
|
|
97
97
|
id: "BadgeType22",
|
|
98
98
|
Component: Badges.BadgeType22,
|
|
@@ -631,97 +631,3 @@ export const iconTemplates: templateType[] = [
|
|
|
631
631
|
{ id: "IconWave2", Component: Icons.IconWave2 },
|
|
632
632
|
];
|
|
633
633
|
|
|
634
|
-
// const Icons = {
|
|
635
|
-
// IconArrow: createIconArrow,
|
|
636
|
-
|
|
637
|
-
// IconBg1: createIconBg1,
|
|
638
|
-
// IconBg2: createIconBg2,
|
|
639
|
-
// IconBg3: createIconBg3,
|
|
640
|
-
// IconBg4: createIconBg4,
|
|
641
|
-
// IconBg5: createIconBg5,
|
|
642
|
-
// IconBg6: createIconBg6,
|
|
643
|
-
// IconBg7: createIconBg7,
|
|
644
|
-
// IconBg8: createIconBg8,
|
|
645
|
-
// IconBg9: createIconBg9,
|
|
646
|
-
|
|
647
|
-
// IconBottomLeft1: createIconBottomLeft1,
|
|
648
|
-
// IconBottomLeft2: createIconBottomLeft2,
|
|
649
|
-
// IconBottomRight1: createIconBottomRight1,
|
|
650
|
-
// IconBottomRight2: createIconBottomRight2,
|
|
651
|
-
|
|
652
|
-
// IconContainer1: createIconContainer1,
|
|
653
|
-
// IconContainer2: createIconContainer2,
|
|
654
|
-
// IconContainer3: createIconContainer3,
|
|
655
|
-
// IconContainer4: createIconContainer4,
|
|
656
|
-
// IconContainer5: createIconContainer5,
|
|
657
|
-
|
|
658
|
-
// IconDonut: createIconDonut,
|
|
659
|
-
|
|
660
|
-
// IconEllipse1: createIconEllipse1,
|
|
661
|
-
// IconEllipse2: createIconEllipse2,
|
|
662
|
-
|
|
663
|
-
// IconEtc1: createIconEtc1,
|
|
664
|
-
// IconEtc2: createIconEtc2,
|
|
665
|
-
// IconEtc3: createIconEtc3,
|
|
666
|
-
|
|
667
|
-
// IconFrame1: createIconFrame1,
|
|
668
|
-
// IconFrame2: createIconFrame2,
|
|
669
|
-
// IconFrame3: createIconFrame3,
|
|
670
|
-
// IconFrame4: createIconFrame4,
|
|
671
|
-
|
|
672
|
-
// IconGear: createIconGear,
|
|
673
|
-
// IconMedal: createIconMedal,
|
|
674
|
-
|
|
675
|
-
// IconMortarboard1: createIconMortarboard1,
|
|
676
|
-
// IconMortarboard2: createIconMortarboard2,
|
|
677
|
-
// IconMortarboard3: createIconMortarboard3,
|
|
678
|
-
// IconMortarboard4: createIconMortarboard4,
|
|
679
|
-
// IconMortarboard5: createIconMortarboard5,
|
|
680
|
-
|
|
681
|
-
// IconPhrase1: createIconPhrase1,
|
|
682
|
-
// IconPhrase2: createIconPhrase2,
|
|
683
|
-
// IconPhrase3: createIconPhrase3,
|
|
684
|
-
// IconPhrase4: createIconPhrase4,
|
|
685
|
-
|
|
686
|
-
// IconPillar1: createIconPillar1,
|
|
687
|
-
// IconPillar2: createIconPillar2,
|
|
688
|
-
|
|
689
|
-
// IconSkewedLeft: createIconSkewedLeft,
|
|
690
|
-
// IconSkewedRight: createIconSkewedRight,
|
|
691
|
-
|
|
692
|
-
// IconSmallType1: createIconSmallType1,
|
|
693
|
-
// IconSmallType2: createIconSmallType2,
|
|
694
|
-
// IconSmallType3: createIconSmallType3,
|
|
695
|
-
// IconSmallType4: createIconSmallType4,
|
|
696
|
-
// IconSmallType5: createIconSmallType5,
|
|
697
|
-
// IconSmallType6: createIconSmallType6,
|
|
698
|
-
// IconSmallType7: createIconSmallType7,
|
|
699
|
-
// IconSmallType8: createIconSmallType8,
|
|
700
|
-
// IconSmallType9: createIconSmallType9,
|
|
701
|
-
// IconSmallType10: createIconSmallType10,
|
|
702
|
-
|
|
703
|
-
// IconSpring1: createIconSpring1,
|
|
704
|
-
// IconSpring2: createIconSpring2,
|
|
705
|
-
|
|
706
|
-
// IconStar: createIconStar1,
|
|
707
|
-
// IconStar2: createIconStar2,
|
|
708
|
-
// IconStar3: createIconStar3,
|
|
709
|
-
// IconStar4: createIconStar4,
|
|
710
|
-
// IconStar5: createIconStar5,
|
|
711
|
-
// IconStar6: createIconStar6,
|
|
712
|
-
|
|
713
|
-
// IconTopLeft1: createIconTopLeft1,
|
|
714
|
-
// IconTopLeft2: createIconTopLeft2,
|
|
715
|
-
// IconTopRight1: createIconTopRight1,
|
|
716
|
-
// IconTopRight2: createIconTopRight2,
|
|
717
|
-
|
|
718
|
-
// IconTrophy1: createIconTrophy1,
|
|
719
|
-
// IconTrophy2: createIconTrophy2,
|
|
720
|
-
// IconTrophy3: createIconTrophy3,
|
|
721
|
-
// IconTrophy4: createIconTrophy4,
|
|
722
|
-
|
|
723
|
-
// IconType47: createIconType47,
|
|
724
|
-
|
|
725
|
-
// IconWave1: createIconWave1,
|
|
726
|
-
// IconWave2: createIconWave2,
|
|
727
|
-
// };
|
|
@@ -15,17 +15,20 @@ import Certificates from "../templates/certificates";
|
|
|
15
15
|
import { portraitComponents } from "../constants/componentsDirection";
|
|
16
16
|
|
|
17
17
|
export async function generateAchievementHTML(
|
|
18
|
-
|
|
18
|
+
achievementInfo: CertificateData,
|
|
19
19
|
options: CertificateOptions = {}
|
|
20
20
|
): Promise<string> {
|
|
21
21
|
const { type = "certificate", size = 600, noSpace = false } = options;
|
|
22
22
|
|
|
23
|
+
console.log("achievementInfo");
|
|
24
|
+
console.log(achievementInfo);
|
|
25
|
+
|
|
23
26
|
let achievementForm;
|
|
24
27
|
|
|
25
|
-
if (
|
|
26
|
-
achievementForm =
|
|
28
|
+
if (achievementInfo.achievementForm) {
|
|
29
|
+
achievementForm = achievementInfo.achievementForm;
|
|
27
30
|
} else {
|
|
28
|
-
achievementForm =
|
|
31
|
+
achievementForm = achievementInfo;
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
// type에 따라 적절한 layout_json 선택
|
|
@@ -139,7 +142,7 @@ export async function generateAchievementHTML(
|
|
|
139
142
|
|
|
140
143
|
let bindingValue: any = null;
|
|
141
144
|
if (element.designType === CERTIFICATE_DESIGN_TYPE.PROPS) {
|
|
142
|
-
bindingValue = getBindingValue(element.type, element.bindingKey,
|
|
145
|
+
bindingValue = getBindingValue(element.type, element.bindingKey, achievementInfo);
|
|
143
146
|
|
|
144
147
|
if (element.controlType === "text") {
|
|
145
148
|
element.text = bindingValue;
|
|
@@ -255,7 +258,7 @@ export async function generateAchievementHTML(
|
|
|
255
258
|
">
|
|
256
259
|
${
|
|
257
260
|
badgeElements
|
|
258
|
-
? await generateAchievementHTML(
|
|
261
|
+
? await generateAchievementHTML(achievementInfo, {
|
|
259
262
|
type: "badge",
|
|
260
263
|
noSpace: true,
|
|
261
264
|
})
|
|
@@ -14,38 +14,6 @@ import {
|
|
|
14
14
|
import Certificates from "../templates/certificates";
|
|
15
15
|
import { portraitComponents } from "../constants/componentsDirection";
|
|
16
16
|
|
|
17
|
-
async function convertImageToBase64(url: string): Promise<string> {
|
|
18
|
-
try {
|
|
19
|
-
// URL이 이미 baseUrl을 포함하고 있는지 확인
|
|
20
|
-
let finalUrls = [];
|
|
21
|
-
finalUrls = url.split("https://");
|
|
22
|
-
const finalUrl = "https://" + finalUrls.pop();
|
|
23
|
-
|
|
24
|
-
const response = await fetch(finalUrl, {
|
|
25
|
-
credentials: "include",
|
|
26
|
-
headers: {
|
|
27
|
-
Accept: "image/*",
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if (!response.ok) {
|
|
32
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const contentType = response.headers.get("content-type");
|
|
36
|
-
if (!contentType?.startsWith("image/")) {
|
|
37
|
-
throw new Error(`Not an image! content-type: ${contentType}`);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const buffer = await response.arrayBuffer();
|
|
41
|
-
const base64 = Buffer.from(buffer).toString("base64");
|
|
42
|
-
return `data:${contentType};base64,${base64}`;
|
|
43
|
-
} catch (error) {
|
|
44
|
-
console.error(`이미지 변환 실패: ${url}`, error);
|
|
45
|
-
return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
17
|
export async function generateDesignHTML(
|
|
50
18
|
data: IAchievementDesignItem,
|
|
51
19
|
options: DesignOptions = {}
|
|
@@ -283,19 +251,19 @@ export async function generateDesignHTML(
|
|
|
283
251
|
}
|
|
284
252
|
} else if (element.src) {
|
|
285
253
|
// 이미지를 base64로 변환
|
|
286
|
-
const base64Image = await convertImageToBase64(element.src);
|
|
254
|
+
// const base64Image = await convertImageToBase64(element.src);
|
|
287
255
|
html += `<img
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
256
|
+
src="${element.src}"
|
|
257
|
+
alt="Uploaded"
|
|
258
|
+
style="
|
|
259
|
+
width: 100%;
|
|
260
|
+
height: 100%;
|
|
261
|
+
max-width: 100%;
|
|
262
|
+
max-height: 100%;
|
|
263
|
+
object-fit: contain;
|
|
264
|
+
align-self: center;
|
|
265
|
+
"
|
|
266
|
+
/>`;
|
|
299
267
|
}
|
|
300
268
|
html += `</div>`;
|
|
301
269
|
}
|
|
@@ -68,9 +68,7 @@ const getClubValue = (
|
|
|
68
68
|
|
|
69
69
|
if (bindingKey.startsWith("name_")) {
|
|
70
70
|
const index = Number(bindingKey.split("_")[1]) - 1;
|
|
71
|
-
return
|
|
72
|
-
achievementForm?.clubInstitutions?.[index]?.name || ""
|
|
73
|
-
);
|
|
71
|
+
return achievementForm?.clubInstitutions?.[index]?.name || "";
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
if (
|
|
@@ -84,9 +82,9 @@ const getClubValue = (
|
|
|
84
82
|
: "club_symbol";
|
|
85
83
|
|
|
86
84
|
return achievementForm.clubInstitutions?.[index]?.images
|
|
87
|
-
? groupByType(
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
? groupByType(achievementForm.clubInstitutions[index].images)[
|
|
86
|
+
imageKey
|
|
87
|
+
]?.[0]?.path
|
|
90
88
|
: null;
|
|
91
89
|
}
|
|
92
90
|
|
|
@@ -109,10 +107,7 @@ const getClubValue = (
|
|
|
109
107
|
);
|
|
110
108
|
}
|
|
111
109
|
|
|
112
|
-
if (
|
|
113
|
-
bindingKey === "name" &&
|
|
114
|
-
achievementForm.representativeInstitution
|
|
115
|
-
) {
|
|
110
|
+
if (bindingKey === "name" && achievementForm.representativeInstitution) {
|
|
116
111
|
return achievementForm.representativeInstitution?.name;
|
|
117
112
|
}
|
|
118
113
|
|
|
@@ -136,17 +131,20 @@ export const getBindingValue = (
|
|
|
136
131
|
bindingKey: string,
|
|
137
132
|
data: any
|
|
138
133
|
) => {
|
|
139
|
-
const { achievementInfo, user, kollegeInfo } = data;
|
|
140
134
|
|
|
141
135
|
switch (type) {
|
|
142
136
|
case "achievement":
|
|
143
|
-
return getAchievementValue(bindingKey,
|
|
137
|
+
return getAchievementValue(bindingKey, data);
|
|
144
138
|
case "user":
|
|
145
|
-
return getUserValue(bindingKey, user);
|
|
139
|
+
return getUserValue(bindingKey, data.user);
|
|
146
140
|
case "club":
|
|
147
|
-
return getClubValue(
|
|
141
|
+
return getClubValue(
|
|
142
|
+
bindingKey,
|
|
143
|
+
data?.achievementForm?.club || data?.club,
|
|
144
|
+
data
|
|
145
|
+
);
|
|
148
146
|
case "custom":
|
|
149
|
-
return getCustomValue(bindingKey,
|
|
147
|
+
return getCustomValue(bindingKey, data);
|
|
150
148
|
default:
|
|
151
149
|
return null;
|
|
152
150
|
}
|