jeawin-astro 3.0.55 → 3.0.57
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 +106 -65
- package/src/components/pdfjs.astro +92 -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/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"
|
|
@@ -32,12 +32,31 @@ interface Props {
|
|
|
32
32
|
nodepics?: any[]; // 产品图片
|
|
33
33
|
video?: JWVIDEO; // 产品视频
|
|
34
34
|
view360?: any; // 360 view
|
|
35
|
-
thumbs_position?: any;
|
|
36
35
|
}
|
|
37
|
-
const { node_title, nodepics = [], video, view360
|
|
36
|
+
const { node_title, nodepics = [], video, view360 } = Astro.props;
|
|
37
|
+
|
|
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
|
+
}
|
|
38
57
|
---
|
|
39
58
|
|
|
40
|
-
<custom-detail-images data-nodepics={nodepics} data-video={video} data-view360={view360}>
|
|
59
|
+
<custom-detail-images data-nodepics={nodepics} data-video={video} data-view360={view360} data-thumbs_position={thumbs_position}>
|
|
41
60
|
<div
|
|
42
61
|
x-data={`{
|
|
43
62
|
isVideoPoppedUp:false,
|
|
@@ -56,54 +75,64 @@ const { node_title, nodepics = [], video, view360, thumbs_position = 'left' } =
|
|
|
56
75
|
}`}
|
|
57
76
|
>
|
|
58
77
|
<div class:list={["flex flex-col", {"lg:flex-row":thumbs_position=='left'}, "gap-5"]}>
|
|
59
|
-
|
|
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
|
-
|
|
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
|
+
}
|
|
94
135
|
|
|
95
|
-
{
|
|
96
|
-
view360 ? (
|
|
97
|
-
<swiper-slide lazy="true" class="swiper-slide lg:flex-1 lg:h-[60px] lg:w-[60px] hidden">
|
|
98
|
-
<div class="content-wrapper border border-white p-1 cursor-pointer">
|
|
99
|
-
<img src={view360img.src} alt="360° viewer" />
|
|
100
|
-
</div>
|
|
101
|
-
</swiper-slide>
|
|
102
|
-
) : null
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
</swiper-container>
|
|
106
|
-
</div>
|
|
107
136
|
<div class:list={["order-1", {"lg:order-2":thumbs_position=='left'}, "w-full", {"lg:w-10/12":thumbs_position=='left'}]}>
|
|
108
137
|
<!-- main swiper, pass thumbs swiper as CSS selector -->
|
|
109
138
|
<swiper-container
|
|
@@ -111,9 +140,9 @@ const { node_title, nodepics = [], video, view360, thumbs_position = 'left' } =
|
|
|
111
140
|
id="galleryID"
|
|
112
141
|
class="mainSwiper"
|
|
113
142
|
slides-per-view="1"
|
|
114
|
-
thumbs-swiper=".thumbSwiper"
|
|
143
|
+
thumbs-swiper={show_thumbs ? ".thumbSwiper" : null}
|
|
115
144
|
navigation="false"
|
|
116
|
-
pagination="true"
|
|
145
|
+
pagination="true" auto-height="true"
|
|
117
146
|
>
|
|
118
147
|
{
|
|
119
148
|
nodepics.map((pic: any, idx: number) => (
|
|
@@ -125,7 +154,7 @@ const { node_title, nodepics = [], video, view360, thumbs_position = 'left' } =
|
|
|
125
154
|
|
|
126
155
|
{
|
|
127
156
|
video ? (
|
|
128
|
-
<swiper-slide
|
|
157
|
+
<swiper-slide class="swiper-slide hidden">
|
|
129
158
|
<div class="flex min-h-[343px] xl:min-h-[605px] w-full">
|
|
130
159
|
<img src={video.poster} alt={video.title ? video.title : node_title} />
|
|
131
160
|
<button
|
|
@@ -148,7 +177,7 @@ const { node_title, nodepics = [], video, view360, thumbs_position = 'left' } =
|
|
|
148
177
|
|
|
149
178
|
{
|
|
150
179
|
view360 ? (
|
|
151
|
-
<swiper-slide
|
|
180
|
+
<swiper-slide class="swiper-slide hidden">
|
|
152
181
|
<div class="cloudimage-360 swiper-no-swiping" data-image-list-x={`${JSON.stringify(view360)}`} data-magnifier="2" data-fullscreen>
|
|
153
182
|
</div>
|
|
154
183
|
</swiper-slide>
|
|
@@ -160,7 +189,7 @@ const { node_title, nodepics = [], video, view360, thumbs_position = 'left' } =
|
|
|
160
189
|
video ? (
|
|
161
190
|
<div x-ref="video"
|
|
162
191
|
x-bind:class="{ 'flex': isVideoPoppedUp, 'hidden': !isVideoPoppedUp }"
|
|
163
|
-
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]"
|
|
164
193
|
>
|
|
165
194
|
<div
|
|
166
195
|
class="absolute inset-0 w-full h-full bg-black/50"
|
|
@@ -217,10 +246,9 @@ const { node_title, nodepics = [], video, view360, thumbs_position = 'left' } =
|
|
|
217
246
|
</div>
|
|
218
247
|
</div>
|
|
219
248
|
</custom-detail-images>
|
|
220
|
-
|
|
221
249
|
<script
|
|
222
250
|
is:inline
|
|
223
|
-
src="
|
|
251
|
+
src="/js-cloudimage-360-view/build/js-cloudimage-360-view.min.js" async defer
|
|
224
252
|
></script>
|
|
225
253
|
{
|
|
226
254
|
view360 ? (
|
|
@@ -233,14 +261,18 @@ src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/latest/js-cloudimag
|
|
|
233
261
|
) : null
|
|
234
262
|
}
|
|
235
263
|
<style is:inline>
|
|
236
|
-
|
|
264
|
+
|
|
237
265
|
.thumbSwiper {
|
|
238
|
-
height:
|
|
266
|
+
max-height: 300px;
|
|
267
|
+
max-width:300px;
|
|
268
|
+
min-width:300px;
|
|
269
|
+
overflow: hidden;
|
|
239
270
|
}
|
|
240
|
-
|
|
271
|
+
|
|
241
272
|
|
|
242
273
|
.thumbSwiper .swiper-slide img {
|
|
243
|
-
|
|
274
|
+
object-fit: contain;
|
|
275
|
+
max-height: 100%;
|
|
244
276
|
}
|
|
245
277
|
|
|
246
278
|
/* .thumbSwiper .swiper-slide {
|
|
@@ -278,6 +310,10 @@ src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/latest/js-cloudimag
|
|
|
278
310
|
.pswp img {
|
|
279
311
|
object-fit: contain;
|
|
280
312
|
}
|
|
313
|
+
|
|
314
|
+
.cloudimage-360-fullscreen-modal{
|
|
315
|
+
z-index:100000!important;
|
|
316
|
+
}
|
|
281
317
|
</style>
|
|
282
318
|
|
|
283
319
|
<script>
|
|
@@ -322,6 +358,7 @@ src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/latest/js-cloudimag
|
|
|
322
358
|
if(!this.glass) return;
|
|
323
359
|
|
|
324
360
|
this.container.style.overflow = 'visible';
|
|
361
|
+
this.container.style.zIndex = 100000;
|
|
325
362
|
this.container.removeChild(this.glass);
|
|
326
363
|
|
|
327
364
|
this.glass = null;
|
|
@@ -343,10 +380,14 @@ src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/latest/js-cloudimag
|
|
|
343
380
|
|
|
344
381
|
initSwiper(".mainSwiper");
|
|
345
382
|
initSwiper(".thumbSwiper", {
|
|
346
|
-
direction: "horizontal
|
|
383
|
+
direction: this.dataset.thumbs_position=='left' ? "vertical" : 'horizontal',
|
|
384
|
+
navigation: {
|
|
385
|
+
prevEl: '.thumbSwiper-prev-btn',
|
|
386
|
+
nextEl: '.thumbSwiper-next-btn'
|
|
387
|
+
},
|
|
347
388
|
breakpoints: {
|
|
348
|
-
|
|
349
|
-
direction: "vertical",
|
|
389
|
+
768: {
|
|
390
|
+
direction: this.dataset.thumbs_position == 'left' ? "vertical" : 'horizontal',
|
|
350
391
|
},
|
|
351
392
|
},
|
|
352
393
|
on:{
|
|
@@ -402,7 +443,7 @@ src="https://cdn.scaleflex.it/plugins/js-cloudimage-360-view/latest/js-cloudimag
|
|
|
402
443
|
direction: "horizontal",
|
|
403
444
|
breakpoints: {
|
|
404
445
|
1024: {
|
|
405
|
-
direction: "vertical",
|
|
446
|
+
direction: this.dataset.thumbs_position == 'left' ? "vertical" : 'horizontal',
|
|
406
447
|
},
|
|
407
448
|
},
|
|
408
449
|
on:{
|
|
@@ -3,15 +3,23 @@ const { pdf_path } = Astro.props;
|
|
|
3
3
|
const WORKER_PATH = "/pdfjs-4.9.124-dist/build/pdf.worker.mjs";
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
<pdf-viewer data-
|
|
6
|
+
<pdf-viewer data-pdf_path={pdf_path} data-worker_path={WORKER_PATH}>
|
|
7
|
+
<div>
|
|
8
|
+
<button class="pdf_prev border border-gray-200 cursor-pointer p-2 rounded-lg" type="button">Previous</button>
|
|
9
|
+
<button class="pdf_next border border-gray-200 cursor-pointer p-2 rounded-lg" type="button">Next</button>
|
|
10
|
+
|
|
11
|
+
<span>Page: <span class="page_num"></span> / <span class="page_count"></span></span>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="mt-4">
|
|
14
|
+
<canvas class="pdf-canvas" style="border:1px solid black;direction:ltr;margin:0 auto;"></canvas>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
7
17
|
</pdf-viewer>
|
|
8
18
|
|
|
9
19
|
<script is:inline src="/pdfjs-4.9.124-dist/build/pdf.mjs" type="module"
|
|
10
20
|
></script>
|
|
11
21
|
|
|
12
22
|
<script>
|
|
13
|
-
import type { PDFDocumentLoadingTask } from "pdfjs-dist";
|
|
14
|
-
|
|
15
23
|
declare global {
|
|
16
24
|
interface Window {
|
|
17
25
|
pdfjsLib?: any;
|
|
@@ -19,71 +27,104 @@ const WORKER_PATH = "/pdfjs-4.9.124-dist/build/pdf.worker.mjs";
|
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
class PDFViewer extends HTMLElement {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
pdfDoc: any = null;
|
|
31
|
+
pageNum = 1;
|
|
32
|
+
pageRendering = false;
|
|
33
|
+
pageNumPending = null;
|
|
34
|
+
scale: number = 0.8;
|
|
35
|
+
canvas: any = null;
|
|
36
|
+
ctx: any = null;
|
|
37
|
+
|
|
38
|
+
constructor(){
|
|
28
39
|
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);
|
|
40
|
+
|
|
41
|
+
this.onPrevPage = this.onPrevPage.bind(this);
|
|
42
|
+
this.onNextPage = this.onNextPage.bind(this);
|
|
38
43
|
}
|
|
44
|
+
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
if (!this.loadingTask) return;
|
|
46
|
+
connectedCallback() {
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
// Request a first page
|
|
45
|
-
const pdfPage = await pdfDocument.getPage(1);
|
|
48
|
+
this.canvas = document.querySelector('.pdf-canvas');
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
const numPages = pdfDocument.numPages;
|
|
49
|
-
console.log(`Number of Pages: ${numPages}`);
|
|
50
|
+
this.ctx = this.canvas.getContext('2d');
|
|
50
51
|
|
|
51
|
-
//
|
|
52
|
-
const viewport = pdfPage.getViewport({ scale: 1.0 });
|
|
53
|
-
const ctx = this.canvas.getContext("2d");
|
|
52
|
+
// console.log(this.dataset);
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
window.pdfjsLib.GlobalWorkerOptions.workerSrc = this.dataset.worker_path;
|
|
55
|
+
|
|
56
|
+
window.pdfjsLib.getDocument(this.dataset.pdf_path).promise.then((pdfDoc_: any) => {
|
|
57
|
+
// console.log(pdfDoc_);
|
|
58
|
+
this.pdfDoc = pdfDoc_;
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
const pageCountEl: any = this.querySelector('.page_count');
|
|
61
|
+
if(pageCountEl){
|
|
62
|
+
pageCountEl.textContent = this.pdfDoc.numPages;
|
|
63
|
+
}
|
|
61
64
|
|
|
62
|
-
|
|
63
|
-
const renderTask = pdfPage.render({
|
|
64
|
-
canvasContext: ctx,
|
|
65
|
-
viewport,
|
|
65
|
+
this.renderPage(this.pageNum);
|
|
66
66
|
});
|
|
67
|
-
|
|
67
|
+
|
|
68
|
+
this.querySelector('.pdf_prev')?.addEventListener('click', this.onPrevPage);
|
|
69
|
+
|
|
70
|
+
this.querySelector('.pdf_next')?.addEventListener('click', this.onNextPage);
|
|
71
|
+
|
|
68
72
|
}
|
|
69
73
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.
|
|
74
|
+
renderPage(num: number){
|
|
75
|
+
this.pageRendering = true;
|
|
76
|
+
|
|
77
|
+
this.pdfDoc.getPage(num).then((page: any) => {
|
|
78
|
+
const viewport = page.getViewport({scale: this.scale});
|
|
79
|
+
this.canvas.height = viewport.height;
|
|
80
|
+
this.canvas.width = viewport.width;
|
|
81
|
+
|
|
82
|
+
const renderContext = {
|
|
83
|
+
canvasContext: this.ctx,
|
|
84
|
+
viewport: viewport
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const renderTask = page.render(renderContext);
|
|
88
|
+
|
|
89
|
+
renderTask.promise.then(() => {
|
|
90
|
+
this.pageRendering = false;
|
|
91
|
+
if(this.pageNumPending !== null){
|
|
92
|
+
this.renderPage(this.pageNumPending);
|
|
93
|
+
this.pageNumPending = null;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const pageNumEl: any = this.querySelector('.page_num');
|
|
99
|
+
if(pageNumEl){
|
|
100
|
+
pageNumEl.textContent = num;
|
|
101
|
+
}
|
|
102
|
+
|
|
74
103
|
}
|
|
75
104
|
|
|
76
|
-
|
|
77
|
-
if
|
|
105
|
+
queueRenderPage(num: any){
|
|
106
|
+
if(this.pageRendering){
|
|
107
|
+
this.pageNumPending = num;
|
|
108
|
+
}else{
|
|
109
|
+
this.renderPage(num);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
78
112
|
|
|
79
|
-
|
|
113
|
+
onPrevPage(){
|
|
114
|
+
if(this.pageNum <= 1){
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this.pageNum--;
|
|
118
|
+
this.queueRenderPage(this.pageNum);
|
|
80
119
|
}
|
|
81
120
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
121
|
+
onNextPage(){
|
|
122
|
+
// console.log(this.pdfDoc.numPages);
|
|
123
|
+
if(this.pageNum >= this.pdfDoc.numPages){
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
this.pageNum++;
|
|
127
|
+
this.queueRenderPage(this.pageNum);
|
|
87
128
|
}
|
|
88
129
|
}
|
|
89
130
|
|
|
@@ -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
|