jeawin-astro 3.0.56 → 3.0.58
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/package.json +1 -1
- package/src/components/blocks/block4.astro +3 -4
- package/src/components/blocks/block8.astro +7 -7
- package/src/components/category_list.astro +4 -18
- package/src/components/comment_form.astro +3 -8
- package/src/components/detail_images.astro +89 -56
- package/src/components/pdfjs.astro +106 -51
- package/src/components/prevnext.astro +2 -4
- package/src/components/product_category_list.astro +4 -19
- package/src/components/section_container.astro +10 -9
- package/src/components/share_button.astro +2 -2
- package/src/components/tags_category_list.astro +4 -20
- package/src/scripts/consts.js +1 -1
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ type BlockItemsItem = {
|
|
|
17
17
|
title: any; // 标题
|
|
18
18
|
content: any; // 内容
|
|
19
19
|
};
|
|
20
|
-
interface Props {
|
|
20
|
+
interface Props extends astroHTML.JSX.HTMLAttributes {
|
|
21
21
|
bgcolor?: any;
|
|
22
22
|
max_width_screen?: any;
|
|
23
23
|
has_bg?: boolean;
|
|
@@ -32,6 +32,7 @@ const {
|
|
|
32
32
|
block_title,
|
|
33
33
|
block_subtitle,
|
|
34
34
|
block_items = [],
|
|
35
|
+
...other_props
|
|
35
36
|
} = Astro.props;
|
|
36
37
|
---
|
|
37
38
|
|
|
@@ -41,9 +42,7 @@ const {
|
|
|
41
42
|
</slot>
|
|
42
43
|
|
|
43
44
|
<div
|
|
44
|
-
class="grid md:grid-cols-3 gap-5 z-[10]"
|
|
45
|
-
data-aos="fade-up"
|
|
46
|
-
data-aos-once="false"
|
|
45
|
+
class="grid md:grid-cols-3 gap-5 z-[10]" {...other_props}
|
|
47
46
|
>
|
|
48
47
|
{
|
|
49
48
|
block_items ? (
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import SectionContainer from "../section_container.astro";
|
|
13
13
|
import JeawinImage from "../image.astro";
|
|
14
14
|
import Heading1 from "../heading/heading1.astro";
|
|
15
|
-
interface Props {
|
|
15
|
+
interface Props extends astroHTML.JSX.HTMLAttributes {
|
|
16
16
|
bgcolor?: any;
|
|
17
17
|
max_width_screen?: any;
|
|
18
18
|
block_title?: any;
|
|
@@ -25,6 +25,7 @@ const {
|
|
|
25
25
|
block_title,
|
|
26
26
|
block_subtitle,
|
|
27
27
|
block_items,
|
|
28
|
+
...other_props
|
|
28
29
|
} = Astro.props;
|
|
29
30
|
---
|
|
30
31
|
|
|
@@ -44,12 +45,11 @@ const {
|
|
|
44
45
|
<JeawinImage
|
|
45
46
|
img_html={itm.picurl_html}
|
|
46
47
|
add_classes="h-full"
|
|
47
|
-
|
|
48
|
-
data-aos-once="false"
|
|
48
|
+
{...other_props}
|
|
49
49
|
/>
|
|
50
50
|
</div>
|
|
51
51
|
<div class="md:w-1/2">
|
|
52
|
-
<div class="mb-10"
|
|
52
|
+
<div class="mb-10" {...other_props}>
|
|
53
53
|
<div class="mb-2">
|
|
54
54
|
<div class="w-12 p-3 rounded-full bg-[var(--themeColor)] fill-white">
|
|
55
55
|
<Fragment set:html={itm.sub_item1_icon} />
|
|
@@ -60,7 +60,7 @@ const {
|
|
|
60
60
|
{itm.sub_item1_content}
|
|
61
61
|
</div>
|
|
62
62
|
</div>
|
|
63
|
-
<div
|
|
63
|
+
<div {...other_props}>
|
|
64
64
|
<div class="mb-2">
|
|
65
65
|
<div class="w-12 p-3 rounded-full bg-[var(--themeColor)] fill-white">
|
|
66
66
|
<Fragment set:html={itm.sub_item2_icon} />
|
|
@@ -76,7 +76,7 @@ const {
|
|
|
76
76
|
) : (
|
|
77
77
|
<div class="flex flex-col md:flex-row gap-10 items-center">
|
|
78
78
|
<div class="order-2 md:order-1 md:w-1/2">
|
|
79
|
-
<div class="mb-10"
|
|
79
|
+
<div class="mb-10" {...other_props}>
|
|
80
80
|
<div class="mb-2">
|
|
81
81
|
<div class="w-12 p-3 rounded-full bg-[var(--themeColor)] fill-white">
|
|
82
82
|
<Fragment set:html={itm.sub_item1_icon} />
|
|
@@ -87,7 +87,7 @@ const {
|
|
|
87
87
|
{itm.sub_item1_content}
|
|
88
88
|
</div>
|
|
89
89
|
</div>
|
|
90
|
-
<div
|
|
90
|
+
<div {...other_props}>
|
|
91
91
|
<div class="mb-2">
|
|
92
92
|
<div class="w-12 p-3 rounded-full bg-[var(--themeColor)] fill-white">
|
|
93
93
|
<Fragment set:html={itm.sub_item2_icon} />
|
|
@@ -14,20 +14,6 @@ import _ from "lodash";
|
|
|
14
14
|
import { render_url } from "../scripts/util.js";
|
|
15
15
|
import CommonCard from "./common_card.astro";
|
|
16
16
|
import NodesList from "./nodes_list.astro";
|
|
17
|
-
interface Props {
|
|
18
|
-
channel_id: any;
|
|
19
|
-
category_id?: any;
|
|
20
|
-
uri?: any;
|
|
21
|
-
page?: any;
|
|
22
|
-
limit?: any;
|
|
23
|
-
include_children_category_nodes?: any;
|
|
24
|
-
no_fields?: any;
|
|
25
|
-
show_category_nodes?: boolean;
|
|
26
|
-
has_sider?: boolean;
|
|
27
|
-
layout?: any;
|
|
28
|
-
node_item_component?: any;
|
|
29
|
-
max_width_screen?: any;
|
|
30
|
-
}
|
|
31
17
|
|
|
32
18
|
const {
|
|
33
19
|
channel_id,
|
|
@@ -41,7 +27,8 @@ const {
|
|
|
41
27
|
has_sider = false,
|
|
42
28
|
layout = "grid gap-4 grid-cols-2 md:grid-cols-4",
|
|
43
29
|
node_item_component,
|
|
44
|
-
max_width_screen='max-w-screen-2xl'
|
|
30
|
+
max_width_screen='max-w-screen-2xl',
|
|
31
|
+
...other_props
|
|
45
32
|
} = Astro.props;
|
|
46
33
|
|
|
47
34
|
const { btn_class, all_categories, base, url_suffix } = Astro.locals;
|
|
@@ -69,8 +56,7 @@ switch (node_item_component) {
|
|
|
69
56
|
"py-12",
|
|
70
57
|
{ "bg-[#ffffff]": idx % 2 === 1, "bg-slate-50": idx % 2 === 0 },
|
|
71
58
|
]}
|
|
72
|
-
|
|
73
|
-
data-aos-once="false"
|
|
59
|
+
{...other_props}
|
|
74
60
|
>
|
|
75
61
|
<div class:list={has_sider ? "w-full" : [max_width_screen, "mx-auto"]}>
|
|
76
62
|
<div class="px-4">
|
|
@@ -113,7 +99,7 @@ switch (node_item_component) {
|
|
|
113
99
|
</section>
|
|
114
100
|
))
|
|
115
101
|
) : (
|
|
116
|
-
<section class="py-12 bg-slate-50"
|
|
102
|
+
<section class="py-12 bg-slate-50" {...other_props}>
|
|
117
103
|
<div class:list={has_sider ? "w-full" : [max_width_screen, "mx-auto"]}>
|
|
118
104
|
<div class="px-4">
|
|
119
105
|
<NodesList
|
|
@@ -11,13 +11,8 @@
|
|
|
11
11
|
* @filesource
|
|
12
12
|
*/
|
|
13
13
|
import { render_value, render_lang } from "../scripts/util.js";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
channel_id: string;
|
|
17
|
-
category_id?: string;
|
|
18
|
-
node_id?: string;
|
|
19
|
-
}
|
|
20
|
-
const { canonical, channel_id, category_id, node_id } = Astro.props;
|
|
14
|
+
|
|
15
|
+
const { canonical, channel_id, category_id, node_id, ...other_props } = Astro.props;
|
|
21
16
|
|
|
22
17
|
const { siteinfo, all_langs, jeawin_form_api_domain } = Astro.locals;
|
|
23
18
|
---
|
|
@@ -27,7 +22,7 @@ const { siteinfo, all_langs, jeawin_form_api_domain } = Astro.locals;
|
|
|
27
22
|
color: red;
|
|
28
23
|
}
|
|
29
24
|
</style>
|
|
30
|
-
<div style="padding:10px;clear:both;"
|
|
25
|
+
<div style="padding:10px;clear:both;" {...other_props}>
|
|
31
26
|
<form
|
|
32
27
|
action={`${jeawin_form_api_domain}/api/comment/save_captcha`}
|
|
33
28
|
id="jeawin-comment-form"
|
|
@@ -35,7 +35,25 @@ interface Props {
|
|
|
35
35
|
}
|
|
36
36
|
const { node_title, nodepics = [], video, view360 } = Astro.props;
|
|
37
37
|
|
|
38
|
-
const thumbs_position = 'bottom';
|
|
38
|
+
const thumbs_position: string = 'bottom';
|
|
39
|
+
|
|
40
|
+
let show_thumbs = false;
|
|
41
|
+
|
|
42
|
+
let num = 0;
|
|
43
|
+
|
|
44
|
+
if(nodepics && nodepics.length > 1){
|
|
45
|
+
num=num+nodepics.length;
|
|
46
|
+
}
|
|
47
|
+
if(video){
|
|
48
|
+
num = num + 1;
|
|
49
|
+
}
|
|
50
|
+
if(view360){
|
|
51
|
+
num = num + 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if(num > 1){
|
|
55
|
+
show_thumbs = true;
|
|
56
|
+
}
|
|
39
57
|
---
|
|
40
58
|
|
|
41
59
|
<custom-detail-images data-nodepics={nodepics} data-video={video} data-view360={view360} data-thumbs_position={thumbs_position}>
|
|
@@ -57,56 +75,64 @@ const thumbs_position = 'bottom';
|
|
|
57
75
|
}`}
|
|
58
76
|
>
|
|
59
77
|
<div class:list={["flex flex-col", {"lg:flex-row":thumbs_position=='left'}, "gap-5"]}>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
78
|
+
{
|
|
79
|
+
show_thumbs ? (
|
|
80
|
+
<div class:list={["order-2", {
|
|
81
|
+
"flex flex-row items-center md:order-1 md:w-2/12 md:flex md:flex-col":thumbs_position=='left',
|
|
82
|
+
"flex items-center justify-center":thumbs_position=='bottom'
|
|
83
|
+
}, "gap-3"]}>
|
|
84
|
+
<!-- thumbs swiper -->
|
|
85
|
+
<div class="flex justify-center cursor-pointer thumbSwiper-prev-btn">{thumbs_position == 'left'?<Icon name="fa6-solid:angle-up" /> :<Icon name="fa6-solid:angle-left" />}</div>
|
|
86
|
+
<swiper-container
|
|
87
|
+
init="false"
|
|
88
|
+
class="thumbSwiper"
|
|
89
|
+
watch-slides-progress="true"
|
|
90
|
+
slides-per-view="5"
|
|
91
|
+
space-between="10"
|
|
92
|
+
>
|
|
93
|
+
|
|
94
|
+
{
|
|
95
|
+
nodepics.map((pic: any, idx: number) => (
|
|
96
|
+
<swiper-slide lazy={idx > 0 ? "true" : "false"}
|
|
97
|
+
class:list={[
|
|
98
|
+
"swiper-slide",
|
|
99
|
+
{ hidden: idx > 0 },
|
|
100
|
+
" lg:flex-0 lg:h-[60px] lg:w-[60px]",
|
|
101
|
+
]}
|
|
102
|
+
>
|
|
103
|
+
<div class="content-wrapper border border-white p-1 cursor-pointer overflow-hidden h-[60px] w-[60px] flex items-center justify-center">
|
|
104
|
+
<Fragment set:html={img_change_attrs(pic, {width:'50', height:'50', 'loading':'lazy'}, {})} />
|
|
105
|
+
</div>
|
|
106
|
+
</swiper-slide>
|
|
107
|
+
))
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
{
|
|
111
|
+
video ? (
|
|
112
|
+
<swiper-slide class="swiper-slide lg:flex-0 lg:h-[60px] lg:w-[60px] hidden">
|
|
113
|
+
<div class="content-wrapper border border-white min-h-[100px] lg:min-h-[60px] p-1 cursor-pointer flex items-center justify-center">
|
|
114
|
+
<Icon name="fa6-solid:file-video" class="size-10" />
|
|
115
|
+
</div>
|
|
116
|
+
</swiper-slide>
|
|
117
|
+
) : null
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
{
|
|
121
|
+
view360 ? (
|
|
122
|
+
<swiper-slide class="swiper-slide lg:flex-0 hidden">
|
|
123
|
+
<div class="content-wrapper border border-white p-1 cursor-pointer">
|
|
124
|
+
<img src={view360img.src} alt="360° viewer" class="w-[50px] h-[50px] max-w-[50px]" />
|
|
125
|
+
</div>
|
|
126
|
+
</swiper-slide>
|
|
127
|
+
) : null
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
</swiper-container>
|
|
131
|
+
<div class="flex justify-center cursor-pointer thumbSwiper-next-btn">{thumbs_position =='left'?<Icon name="fa6-solid:angle-down" />:<Icon name="fa6-solid:angle-right" />}</div>
|
|
132
|
+
</div>
|
|
133
|
+
) : null
|
|
134
|
+
}
|
|
96
135
|
|
|
97
|
-
{
|
|
98
|
-
view360 ? (
|
|
99
|
-
<swiper-slide lazy="true" class="swiper-slide lg:flex-0 lg:h-[60px] lg:w-[60px] hidden">
|
|
100
|
-
<div class="content-wrapper border border-white p-1 cursor-pointer">
|
|
101
|
-
<img src={view360img.src} alt="360° viewer" />
|
|
102
|
-
</div>
|
|
103
|
-
</swiper-slide>
|
|
104
|
-
) : null
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
</swiper-container>
|
|
108
|
-
<div class="flex justify-center cursor-pointer thumbSwiper-next-btn">{thumbs_position =='left'?<Icon name="fa6-solid:angle-down" />:<Icon name="fa6-solid:angle-right" />}</div>
|
|
109
|
-
</div>
|
|
110
136
|
<div class:list={["order-1", {"lg:order-2":thumbs_position=='left'}, "w-full", {"lg:w-10/12":thumbs_position=='left'}]}>
|
|
111
137
|
<!-- main swiper, pass thumbs swiper as CSS selector -->
|
|
112
138
|
<swiper-container
|
|
@@ -114,7 +140,7 @@ const thumbs_position = 'bottom';
|
|
|
114
140
|
id="galleryID"
|
|
115
141
|
class="mainSwiper"
|
|
116
142
|
slides-per-view="1"
|
|
117
|
-
thumbs-swiper=".thumbSwiper"
|
|
143
|
+
thumbs-swiper={show_thumbs ? ".thumbSwiper" : null}
|
|
118
144
|
navigation="false"
|
|
119
145
|
pagination="true" auto-height="true"
|
|
120
146
|
>
|
|
@@ -128,7 +154,7 @@ const thumbs_position = 'bottom';
|
|
|
128
154
|
|
|
129
155
|
{
|
|
130
156
|
video ? (
|
|
131
|
-
<swiper-slide
|
|
157
|
+
<swiper-slide class="swiper-slide hidden">
|
|
132
158
|
<div class="flex min-h-[343px] xl:min-h-[605px] w-full">
|
|
133
159
|
<img src={video.poster} alt={video.title ? video.title : node_title} />
|
|
134
160
|
<button
|
|
@@ -151,7 +177,7 @@ const thumbs_position = 'bottom';
|
|
|
151
177
|
|
|
152
178
|
{
|
|
153
179
|
view360 ? (
|
|
154
|
-
<swiper-slide
|
|
180
|
+
<swiper-slide class="swiper-slide hidden">
|
|
155
181
|
<div class="cloudimage-360 swiper-no-swiping" data-image-list-x={`${JSON.stringify(view360)}`} data-magnifier="2" data-fullscreen>
|
|
156
182
|
</div>
|
|
157
183
|
</swiper-slide>
|
|
@@ -163,7 +189,7 @@ const thumbs_position = 'bottom';
|
|
|
163
189
|
video ? (
|
|
164
190
|
<div x-ref="video"
|
|
165
191
|
x-bind:class="{ 'flex': isVideoPoppedUp, 'hidden': !isVideoPoppedUp }"
|
|
166
|
-
class="fixed inset-0 w-full h-full flex items-center justify-center hidden z-
|
|
192
|
+
class="fixed inset-0 w-full h-full flex items-center justify-center hidden z-[100000]"
|
|
167
193
|
>
|
|
168
194
|
<div
|
|
169
195
|
class="absolute inset-0 w-full h-full bg-black/50"
|
|
@@ -222,7 +248,7 @@ const thumbs_position = 'bottom';
|
|
|
222
248
|
</custom-detail-images>
|
|
223
249
|
<script
|
|
224
250
|
is:inline
|
|
225
|
-
src="
|
|
251
|
+
src="/js-cloudimage-360-view/build/js-cloudimage-360-view.min.js" async defer
|
|
226
252
|
></script>
|
|
227
253
|
{
|
|
228
254
|
view360 ? (
|
|
@@ -239,12 +265,14 @@ src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/latest/js-cloudimag
|
|
|
239
265
|
.thumbSwiper {
|
|
240
266
|
max-height: 300px;
|
|
241
267
|
max-width:300px;
|
|
268
|
+
min-width:300px;
|
|
242
269
|
overflow: hidden;
|
|
243
270
|
}
|
|
244
271
|
|
|
245
272
|
|
|
246
273
|
.thumbSwiper .swiper-slide img {
|
|
247
|
-
|
|
274
|
+
object-fit: contain;
|
|
275
|
+
max-height: 100%;
|
|
248
276
|
}
|
|
249
277
|
|
|
250
278
|
/* .thumbSwiper .swiper-slide {
|
|
@@ -282,6 +310,10 @@ src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/latest/js-cloudimag
|
|
|
282
310
|
.pswp img {
|
|
283
311
|
object-fit: contain;
|
|
284
312
|
}
|
|
313
|
+
|
|
314
|
+
.cloudimage-360-fullscreen-modal{
|
|
315
|
+
z-index:100000!important;
|
|
316
|
+
}
|
|
285
317
|
</style>
|
|
286
318
|
|
|
287
319
|
<script>
|
|
@@ -326,6 +358,7 @@ src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/latest/js-cloudimag
|
|
|
326
358
|
if(!this.glass) return;
|
|
327
359
|
|
|
328
360
|
this.container.style.overflow = 'visible';
|
|
361
|
+
this.container.style.zIndex = 100000;
|
|
329
362
|
this.container.removeChild(this.glass);
|
|
330
363
|
|
|
331
364
|
this.glass = null;
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
---
|
|
2
|
+
import { Icon } from "astro-icon/components";
|
|
2
3
|
const { pdf_path } = Astro.props;
|
|
3
4
|
const WORKER_PATH = "/pdfjs-4.9.124-dist/build/pdf.worker.mjs";
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
<pdf-viewer data-
|
|
7
|
+
<pdf-viewer data-pdf_path={pdf_path} data-worker_path={WORKER_PATH}>
|
|
8
|
+
<div>
|
|
9
|
+
<button class="pdf_prev border border-gray-200 cursor-pointer p-2 rounded-lg" type="button">Previous</button>
|
|
10
|
+
<button class="pdf_next border border-gray-200 cursor-pointer p-2 rounded-lg" type="button">Next</button>
|
|
11
|
+
|
|
12
|
+
<span>Page: <span class="page_num"></span> / <span class="page_count"></span></span>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="mt-4 relative flex items-center justify-center">
|
|
15
|
+
<Icon name="fa6-solid:rotate" class="loading-icon size-10 animate-spin absolute inset-0 top-1/2 left-1/2" />
|
|
16
|
+
<canvas class="pdf-canvas max-w-full hidden" style="border:1px solid black;direction:ltr;margin:0 auto;"></canvas>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
7
19
|
</pdf-viewer>
|
|
8
20
|
|
|
9
21
|
<script is:inline src="/pdfjs-4.9.124-dist/build/pdf.mjs" type="module"
|
|
10
22
|
></script>
|
|
11
23
|
|
|
12
24
|
<script>
|
|
13
|
-
import type { PDFDocumentLoadingTask } from "pdfjs-dist";
|
|
14
|
-
|
|
15
25
|
declare global {
|
|
16
26
|
interface Window {
|
|
17
27
|
pdfjsLib?: any;
|
|
@@ -19,71 +29,116 @@ const WORKER_PATH = "/pdfjs-4.9.124-dist/build/pdf.worker.mjs";
|
|
|
19
29
|
}
|
|
20
30
|
|
|
21
31
|
class PDFViewer extends HTMLElement {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
pdfDoc: any = null;
|
|
33
|
+
pageNum = 1;
|
|
34
|
+
pageRendering = false;
|
|
35
|
+
pageNumPending = null;
|
|
36
|
+
scale: number = 1;
|
|
37
|
+
canvas: any = null;
|
|
38
|
+
ctx: any = null;
|
|
39
|
+
|
|
40
|
+
constructor(){
|
|
28
41
|
super();
|
|
29
|
-
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.canvas = document.createElement("canvas");
|
|
33
|
-
this.canvas.setAttribute("id", "pdf-canvas");
|
|
34
|
-
this.canvas.style.border = "1px solid black";
|
|
35
|
-
this.canvas.style.direction = "ltr";
|
|
36
|
-
|
|
37
|
-
this.shadowRoot?.append(this.canvas);
|
|
42
|
+
|
|
43
|
+
this.onPrevPage = this.onPrevPage.bind(this);
|
|
44
|
+
this.onNextPage = this.onNextPage.bind(this);
|
|
38
45
|
}
|
|
46
|
+
|
|
39
47
|
|
|
40
|
-
|
|
41
|
-
if (!this.loadingTask) return;
|
|
48
|
+
connectedCallback() {
|
|
42
49
|
|
|
43
|
-
|
|
44
|
-
// Request a first page
|
|
45
|
-
const pdfPage = await pdfDocument.getPage(1);
|
|
50
|
+
this.canvas = document.querySelector('.pdf-canvas');
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
const numPages = pdfDocument.numPages;
|
|
49
|
-
console.log(`Number of Pages: ${numPages}`);
|
|
52
|
+
this.ctx = this.canvas.getContext('2d');
|
|
50
53
|
|
|
51
|
-
//
|
|
52
|
-
const viewport = pdfPage.getViewport({ scale: 1.0 });
|
|
53
|
-
const ctx = this.canvas.getContext("2d");
|
|
54
|
+
// console.log(this.dataset);
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
56
|
+
window.pdfjsLib.GlobalWorkerOptions.workerSrc = this.dataset.worker_path;
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
window.pdfjsLib.getDocument({
|
|
59
|
+
url:this.dataset.pdf_path,
|
|
60
|
+
disableStream: false,
|
|
61
|
+
disableAutoFetch: true
|
|
62
|
+
}).promise.then((pdfDoc_: any) => {
|
|
63
|
+
// console.log(pdfDoc_);
|
|
64
|
+
this.pdfDoc = pdfDoc_;
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
const pageCountEl: any = this.querySelector('.page_count');
|
|
67
|
+
if(pageCountEl){
|
|
68
|
+
pageCountEl.textContent = this.pdfDoc.numPages;
|
|
69
|
+
}
|
|
70
|
+
return this.pdfDoc.getPage(1);
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
}).then(() => {
|
|
74
|
+
this.renderPage(this.pageNum);
|
|
66
75
|
});
|
|
67
|
-
|
|
76
|
+
|
|
77
|
+
this.querySelector('.pdf_prev')?.addEventListener('click', this.onPrevPage);
|
|
78
|
+
|
|
79
|
+
this.querySelector('.pdf_next')?.addEventListener('click', this.onNextPage);
|
|
80
|
+
|
|
68
81
|
}
|
|
69
82
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
this.
|
|
73
|
-
|
|
83
|
+
renderPage(num: number){
|
|
84
|
+
// console.log('renderPage');
|
|
85
|
+
this.pageRendering = true;
|
|
86
|
+
|
|
87
|
+
this.querySelector('.loading-icon').style.display = 'block';
|
|
88
|
+
|
|
89
|
+
this.pdfDoc.getPage(num).then((page: any) => {
|
|
90
|
+
const viewport = page.getViewport({scale: this.scale});
|
|
91
|
+
this.canvas.height = viewport.height;
|
|
92
|
+
this.canvas.width = viewport.width;
|
|
93
|
+
|
|
94
|
+
const renderContext = {
|
|
95
|
+
canvasContext: this.ctx,
|
|
96
|
+
viewport: viewport
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const renderTask = page.render(renderContext);
|
|
100
|
+
|
|
101
|
+
renderTask.promise.then(() => {
|
|
102
|
+
this.pageRendering = false;
|
|
103
|
+
this.querySelector('.loading-icon').style.display = 'none';
|
|
104
|
+
this.querySelector('.pdf-canvas').style.display = 'block';
|
|
105
|
+
if(this.pageNumPending !== null){
|
|
106
|
+
this.renderPage(this.pageNumPending);
|
|
107
|
+
this.pageNumPending = null;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const pageNumEl: any = this.querySelector('.page_num');
|
|
113
|
+
if(pageNumEl){
|
|
114
|
+
pageNumEl.textContent = num;
|
|
115
|
+
}
|
|
116
|
+
|
|
74
117
|
}
|
|
75
118
|
|
|
76
|
-
|
|
77
|
-
if
|
|
119
|
+
queueRenderPage(num: any){
|
|
120
|
+
if(this.pageRendering){
|
|
121
|
+
this.pageNumPending = num;
|
|
122
|
+
}else{
|
|
123
|
+
this.renderPage(num);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
78
126
|
|
|
79
|
-
|
|
127
|
+
onPrevPage(){
|
|
128
|
+
if(this.pageNum <= 1){
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
this.pageNum--;
|
|
132
|
+
this.queueRenderPage(this.pageNum);
|
|
80
133
|
}
|
|
81
134
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
135
|
+
onNextPage(){
|
|
136
|
+
// console.log(this.pdfDoc.numPages);
|
|
137
|
+
if(this.pageNum >= this.pdfDoc.numPages){
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
this.pageNum++;
|
|
141
|
+
this.queueRenderPage(this.pageNum);
|
|
87
142
|
}
|
|
88
143
|
}
|
|
89
144
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import JeawinApi from "../scripts/cms.js";
|
|
12
12
|
import { render_url, render_value, render_lang } from "../scripts/util.js";
|
|
13
|
-
const { nodeinfo, node_id, channel_id, category_id } = Astro.props;
|
|
13
|
+
const { nodeinfo, node_id, channel_id, category_id, ...other_props } = Astro.props;
|
|
14
14
|
const { all_langs, jeawin_apikey, jeawin_api_domain, jeawin_api_path, sticky_top_height, is_preview, base, url_suffix } =
|
|
15
15
|
Astro.locals;
|
|
16
16
|
const jeawinapi = new JeawinApi({
|
|
@@ -74,9 +74,7 @@ if (Number(nodeinfo.category_id)) {
|
|
|
74
74
|
|
|
75
75
|
<hr class="my-7 border-gray-200" />
|
|
76
76
|
<div
|
|
77
|
-
class="my-7 mx-auto px-4 sm:px-6 lg:px-8 flex items-center flex-nowrap justify-between gap-4"
|
|
78
|
-
data-aos="fade-up"
|
|
79
|
-
data-aos-once="false"
|
|
77
|
+
class="my-7 mx-auto px-4 sm:px-6 lg:px-8 flex items-center flex-nowrap justify-between gap-4" {...other_props}
|
|
80
78
|
>
|
|
81
79
|
<div class="text-center">
|
|
82
80
|
<div class="leading-6 font-semibold text-sky-500">{nodeinfo.channel_name}</div>
|
|
@@ -17,22 +17,6 @@ import ProductCard from "./product_card.astro";
|
|
|
17
17
|
import NodesList from "./nodes_list.astro";
|
|
18
18
|
import ChildrenCategoriesList from "./children_categories_list.astro";
|
|
19
19
|
|
|
20
|
-
interface Props {
|
|
21
|
-
channel_id: any;
|
|
22
|
-
category_id?: any;
|
|
23
|
-
uri?: string;
|
|
24
|
-
page?: any;
|
|
25
|
-
limit?: any;
|
|
26
|
-
no_fields?: any;
|
|
27
|
-
include_children_category_nodes?: any;
|
|
28
|
-
show_children_categories?: boolean;
|
|
29
|
-
show_category_nodes?: boolean;
|
|
30
|
-
has_sider?: boolean;
|
|
31
|
-
layout?: any;
|
|
32
|
-
node_item_component?: any;
|
|
33
|
-
max_width_screen?: any;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
20
|
const {
|
|
37
21
|
channel_id,
|
|
38
22
|
category_id,
|
|
@@ -46,7 +30,8 @@ const {
|
|
|
46
30
|
has_sider = false,
|
|
47
31
|
layout = "grid gap-4 grid-cols-2 xl:grid-cols-4",
|
|
48
32
|
node_item_component,
|
|
49
|
-
max_width_screen= 'max-w-screen-2xl'
|
|
33
|
+
max_width_screen= 'max-w-screen-2xl',
|
|
34
|
+
...other_props
|
|
50
35
|
} = Astro.props;
|
|
51
36
|
|
|
52
37
|
const { btn_class, all_categories, base, url_suffix } = Astro.locals;
|
|
@@ -72,7 +57,7 @@ switch (node_item_component) {
|
|
|
72
57
|
class:list={[
|
|
73
58
|
"py-12",
|
|
74
59
|
{ "bg-[#ffffff]": idx % 2 === 1, "bg-slate-50": idx % 2 === 0 },
|
|
75
|
-
]}
|
|
60
|
+
]} {...other_props}
|
|
76
61
|
>
|
|
77
62
|
<div class:list={has_sider ? "w-full" : [max_width_screen, "mx-auto"]} x-data="{expanded: false}">
|
|
78
63
|
<div class="px-4">
|
|
@@ -162,7 +147,7 @@ switch (node_item_component) {
|
|
|
162
147
|
</section>
|
|
163
148
|
))
|
|
164
149
|
) : (
|
|
165
|
-
<section class="py-12 bg-slate-50"
|
|
150
|
+
<section class="py-12 bg-slate-50" {...other_props}>
|
|
166
151
|
<div class:list={has_sider ? "w-full" : [max_width_screen, "mx-auto"]}>
|
|
167
152
|
<div class="px-4">
|
|
168
153
|
<NodesList
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
/**
|
|
3
|
+
* 通用section组件
|
|
4
|
+
*
|
|
5
|
+
* @package jeawin-astro
|
|
6
|
+
* @author Chaegumi
|
|
7
|
+
* @copyright Copyright (c) 2024-2099 jeawin.com
|
|
8
|
+
* @email chaegumi@jeawin.com
|
|
9
|
+
* @filesource
|
|
10
|
+
*/
|
|
10
11
|
const {
|
|
11
12
|
bgcolor = "bg-white",
|
|
12
13
|
max_width_screen = "max-w-screen-2xl",
|
|
@@ -18,7 +19,7 @@ const {
|
|
|
18
19
|
} = Astro.props;
|
|
19
20
|
---
|
|
20
21
|
|
|
21
|
-
<section
|
|
22
|
+
<section class:list={["relative", "z-[2]", bgcolor]} {...other_props}>
|
|
22
23
|
<div
|
|
23
24
|
class:list={[
|
|
24
25
|
"relative",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @filesource
|
|
10
10
|
*/
|
|
11
11
|
import { render_lang, render_value } from "../scripts/util.js";
|
|
12
|
-
const { canonical, seo_title, seo_description } = Astro.props;
|
|
12
|
+
const { canonical, seo_title, seo_description, ...other_props } = Astro.props;
|
|
13
13
|
|
|
14
14
|
const { all_langs } = Astro.locals;
|
|
15
15
|
|
|
@@ -128,7 +128,7 @@ const medias = [
|
|
|
128
128
|
];
|
|
129
129
|
---
|
|
130
130
|
|
|
131
|
-
<div class="flex gap-2"
|
|
131
|
+
<div class="flex gap-2" {...other_props}>
|
|
132
132
|
<div>{render_lang(all_langs, "Share on")}</div>
|
|
133
133
|
<ul class="flex gap-2 flex-wrap m-0 p-0">
|
|
134
134
|
{
|
|
@@ -14,21 +14,6 @@ import { render_url } from "../scripts/util.js";
|
|
|
14
14
|
import _ from "lodash";
|
|
15
15
|
import NodesList from "./nodes_list.astro";
|
|
16
16
|
|
|
17
|
-
interface Props {
|
|
18
|
-
channel_id: any;
|
|
19
|
-
category_id?: any;
|
|
20
|
-
uri?: any;
|
|
21
|
-
page?: any;
|
|
22
|
-
limit?: any;
|
|
23
|
-
include_children_category_nodes?: any;
|
|
24
|
-
no_fields?: any;
|
|
25
|
-
show_category_nodes?: boolean;
|
|
26
|
-
has_sider?: boolean;
|
|
27
|
-
layout?: any;
|
|
28
|
-
node_item_component?: any;
|
|
29
|
-
max_width_screen?: any;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
17
|
const {
|
|
33
18
|
channel_id,
|
|
34
19
|
category_id,
|
|
@@ -41,7 +26,8 @@ const {
|
|
|
41
26
|
has_sider = false,
|
|
42
27
|
layout = "",
|
|
43
28
|
node_item_component,
|
|
44
|
-
max_width_screen = 'max-w-screen-2xl'
|
|
29
|
+
max_width_screen = 'max-w-screen-2xl',
|
|
30
|
+
...other_props
|
|
45
31
|
} = Astro.props;
|
|
46
32
|
|
|
47
33
|
const { btn_class, all_categories, base, url_suffix } = Astro.locals;
|
|
@@ -61,9 +47,7 @@ const categories: any[] = _.filter(all_categories, (o: any) => {
|
|
|
61
47
|
class:list={[
|
|
62
48
|
"py-12",
|
|
63
49
|
{ "bg-[#ffffff]": idx % 2 === 1, "bg-slate-50": idx % 2 === 0 },
|
|
64
|
-
]}
|
|
65
|
-
data-aos="fade-up"
|
|
66
|
-
data-aos-once="false"
|
|
50
|
+
]} {...other_props}
|
|
67
51
|
>
|
|
68
52
|
<div class:list={has_sider ? "w-full" : [max_width_screen, "mx-auto"]}>
|
|
69
53
|
<div class="px-4">
|
|
@@ -112,7 +96,7 @@ const categories: any[] = _.filter(all_categories, (o: any) => {
|
|
|
112
96
|
</section>
|
|
113
97
|
))
|
|
114
98
|
) : (
|
|
115
|
-
<section class="py-12 bg-slate-50"
|
|
99
|
+
<section class="py-12 bg-slate-50" {...other_props}>
|
|
116
100
|
<div class:list={has_sider ? "w-full" : [max_width_screen, "mx-auto"]}>
|
|
117
101
|
<div class="px-4">
|
|
118
102
|
<NodesList
|
package/src/scripts/consts.js
CHANGED
|
@@ -11,7 +11,7 @@ export const ICONS_INCLUDE = {
|
|
|
11
11
|
'house', 'message', 'circle-question', 'xmark', 'video', 'download',
|
|
12
12
|
'file-pdf', 'file-csv', 'file-image', 'file-word', 'file-video', 'file-powerpoint', 'file-excel',
|
|
13
13
|
'file-code', 'file-audio', 'file', 'file-zipper', 'sun', 'moon', 'up-right-from-square',
|
|
14
|
-
'user', 'user-tag', 'tag', 'tags', 'lock', 'lock-open', 'unlock'],
|
|
14
|
+
'user', 'user-tag', 'tag', 'tags', 'lock', 'lock-open', 'unlock', 'rotate'],
|
|
15
15
|
'fa6-brands': ['x-twitter', 'facebook', 'youtube', 'tiktok', 'linkedin',
|
|
16
16
|
'google-plus', 'flickr', 'pinterest', 'whatsapp', 'instagram', 'qq', 'weixin', 'weibo', 'bilibili', 'zhihu']
|
|
17
17
|
};
|