jeawin-astro 1.0.78 → 1.0.80
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 +73 -73
- package/src/components/author_info.astro +3 -3
- package/src/components/baidumap.astro +65 -61
- package/src/components/banner_swiper.astro +119 -119
- package/src/components/blocks/block1.astro +126 -41
- package/src/components/blocks/block2.astro +2 -2
- package/src/components/blocks/block3.astro +1 -1
- package/src/components/blocks/block4.astro +6 -2
- package/src/components/blocks/block5.astro +1 -1
- package/src/components/blocks/block7.astro +1 -1
- package/src/components/blocks/block8.astro +6 -4
- package/src/components/cards/news_grid_card1.astro +47 -22
- package/src/components/cards/news_grid_card2.astro +5 -9
- package/src/components/cards/news_grid_card3.astro +10 -12
- package/src/components/cards/news_grid_card4.astro +5 -3
- package/src/components/cards/news_grid_card5.astro +35 -13
- package/src/components/cards/news_grid_card5.css +3 -3
- package/src/components/cards/news_list_card.astro +2 -2
- package/src/components/cards/news_list_card1.astro +3 -8
- package/src/components/category_list.astro +5 -5
- package/src/components/children_categories_list.astro +17 -1
- package/src/components/common_card.astro +1 -1
- package/src/components/cta/cta10.astro +1 -1
- package/src/components/downloads/download1.astro +75 -0
- package/src/components/downloads/download2.astro +56 -0
- package/src/components/faq/faq10.astro +1 -1
- package/src/components/faq/faq12.astro +1 -1
- package/src/components/features/feature10.astro +1 -1
- package/src/components/features/feature11.astro +1 -1
- package/src/components/footer/footer1.astro +1 -1
- package/src/components/form.astro +47 -43
- package/src/components/googlemap.astro +56 -0
- package/src/components/header/header1.astro +34 -24
- package/src/components/heading/heading1.astro +1 -1
- package/src/components/hero/hero9.astro +1 -1
- package/src/components/news_card.astro +3 -1
- package/src/components/news_category_list.astro +7 -5
- package/src/components/news_category_list1.astro +206 -0
- package/src/components/news_category_list2.astro +195 -0
- package/src/components/pagination.astro +6 -1
- package/src/components/pdfjs.astro +91 -0
- package/src/components/prevnext.astro +1 -1
- package/src/components/pricings/pricing1.astro +1 -1
- package/src/components/pricings/pricing2.astro +1 -1
- package/src/components/pricings/pricing4.astro +1 -1
- package/src/components/pricings/pricing6.astro +1 -1
- package/src/components/pricings/pricing8.astro +1 -1
- package/src/components/product_card.astro +3 -1
- package/src/components/product_category_list.astro +44 -7
- package/src/components/share_button.astro +30 -27
- package/src/components/stats/stat2.astro +1 -1
- package/src/components/stats/stat3.astro +2 -2
- package/src/components/swiper.astro +6 -2
- package/src/components/tags_category_list.astro +4 -4
- package/src/components/teams/team1.astro +1 -1
- package/src/components/teams/team10.astro +1 -1
- package/src/components/teams/team11.astro +2 -2
- package/src/components/teams/team12.astro +1 -1
- package/src/components/teams/team13.astro +1 -1
- package/src/components/teams/team14.astro +62 -56
- package/src/components/teams/team15.astro +36 -34
- package/src/components/teams/team16.astro +1 -1
- package/src/components/teams/team17.astro +1 -1
- package/src/components/teams/team18.astro +1 -1
- package/src/components/teams/team2.astro +1 -1
- package/src/components/teams/team3.astro +1 -1
- package/src/components/teams/team4.astro +1 -1
- package/src/components/teams/team5.astro +1 -1
- package/src/components/teams/team6.astro +1 -1
- package/src/components/teams/team7.astro +1 -1
- package/src/components/teams/team8.astro +1 -1
- package/src/components/teams/team9.astro +1 -1
- package/src/components/testimonials/testimonial1.astro +12 -10
- package/src/components/testimonials/testimonial10.astro +1 -1
- package/src/components/testimonials/testimonial2.astro +13 -11
- package/src/components/testimonials/testimonial6.astro +12 -10
- package/src/components/testimonials/testimonial9.astro +1 -1
- package/src/components/timelines/timeline1.astro +30 -0
- package/src/layouts/InnerHeader.astro +32 -0
- package/src/layouts/category.astro +30 -32
- package/src/layouts/channel.astro +30 -32
- package/src/layouts/page.astro +31 -25
- package/src/scripts/consts.js +4 -2
package/package.json
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "jeawin-astro",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"author": "chaegumi <chaegumi@qq.com>",
|
|
5
|
-
"description": "",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/chaegumi/jeawin-astro.git"
|
|
10
|
-
},
|
|
11
|
-
"homepage": "https://www.jeawin.com/",
|
|
12
|
-
"type": "module",
|
|
13
|
-
"types": "index.d.ts",
|
|
14
|
-
"main": "index.ts",
|
|
15
|
-
"scripts": {
|
|
16
|
-
"test": "mocha test"
|
|
17
|
-
},
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"@babel/core": "^7.26.0",
|
|
20
|
-
"@babel/preset-env": "^7.26.0",
|
|
21
|
-
"@rollup/plugin-babel": "^6.0.4",
|
|
22
|
-
"@rollup/plugin-commonjs": "^28.0.1",
|
|
23
|
-
"@rollup/plugin-json": "^6.1.0",
|
|
24
|
-
"@rollup/plugin-multi-entry": "^6.0.1",
|
|
25
|
-
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
26
|
-
"@rollup/plugin-strip": "^3.0.4",
|
|
27
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
28
|
-
"@rollup/plugin-typescript": "^12.1.1",
|
|
29
|
-
"@types/lodash": "^4.17.13",
|
|
30
|
-
"@types/sprintf-js": "^1.1.4",
|
|
31
|
-
"autoprefixer": "^10.4.20",
|
|
32
|
-
"chai": "^5.1.2",
|
|
33
|
-
"mocha": "^10.8.2",
|
|
34
|
-
"postcss": "^8.4.49",
|
|
35
|
-
"rollup": "^4.
|
|
36
|
-
"rollup-plugin-node-externals": "^7.1.3",
|
|
37
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
38
|
-
"typescript": "^5.7.2"
|
|
39
|
-
},
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"@astrojs/alpinejs": "^0.4.0",
|
|
42
|
-
"@astrojs/check": "^0.9.4",
|
|
43
|
-
"@astrojs/cloudflare": "^11.2.0",
|
|
44
|
-
"@astrojs/rss": "4.0.9",
|
|
45
|
-
"@astrojs/sitemap": "3.2.1",
|
|
46
|
-
"@astrojs/tailwind": "5.1.2",
|
|
47
|
-
"@astrojs/ts-plugin": "^1.10.4",
|
|
48
|
-
"@astrojs/vue": "4.5.2",
|
|
49
|
-
"@iconify-json/fa6-brands": "^1.2.3",
|
|
50
|
-
"@iconify-json/fa6-solid": "^1.2.2",
|
|
51
|
-
"@iconify/tools": "^4.0.7",
|
|
52
|
-
"@keyv/compress-brotli": "^2.0.2",
|
|
53
|
-
"@types/alpinejs": "^3.13.11",
|
|
54
|
-
"alpinejs": "^3.14.
|
|
55
|
-
"aos": "3.0.0-beta.6",
|
|
56
|
-
"astro": "^4.16.
|
|
57
|
-
"astro-icon": "^1.1.4",
|
|
58
|
-
"astro-integration-kit": "^0.16.1",
|
|
59
|
-
"cheerio": "^1.0.0",
|
|
60
|
-
"dayjs": "^1.11.13",
|
|
61
|
-
"fetch-jsonp": "^1.3.0",
|
|
62
|
-
"glob": "^11.0.0",
|
|
63
|
-
"keyv": "^5.2.1",
|
|
64
|
-
"keyv-lru": "^3.0.4",
|
|
65
|
-
"lodash": "^4.17.21",
|
|
66
|
-
"photoswipe": "^5.4.4",
|
|
67
|
-
"smartmenus": "2.0.0-alpha.1",
|
|
68
|
-
"sprintf-js": "^1.1.3",
|
|
69
|
-
"string-strip-html": "^13.4.8",
|
|
70
|
-
"swiper": "^11.1.15",
|
|
71
|
-
"tslib": "^2.8.1"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "jeawin-astro",
|
|
3
|
+
"version": "1.0.80",
|
|
4
|
+
"author": "chaegumi <chaegumi@qq.com>",
|
|
5
|
+
"description": "",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/chaegumi/jeawin-astro.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://www.jeawin.com/",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"types": "index.d.ts",
|
|
14
|
+
"main": "index.ts",
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "mocha test"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@babel/core": "^7.26.0",
|
|
20
|
+
"@babel/preset-env": "^7.26.0",
|
|
21
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
22
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
|
23
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
24
|
+
"@rollup/plugin-multi-entry": "^6.0.1",
|
|
25
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
26
|
+
"@rollup/plugin-strip": "^3.0.4",
|
|
27
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
28
|
+
"@rollup/plugin-typescript": "^12.1.1",
|
|
29
|
+
"@types/lodash": "^4.17.13",
|
|
30
|
+
"@types/sprintf-js": "^1.1.4",
|
|
31
|
+
"autoprefixer": "^10.4.20",
|
|
32
|
+
"chai": "^5.1.2",
|
|
33
|
+
"mocha": "^10.8.2",
|
|
34
|
+
"postcss": "^8.4.49",
|
|
35
|
+
"rollup": "^4.28.0",
|
|
36
|
+
"rollup-plugin-node-externals": "^7.1.3",
|
|
37
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
38
|
+
"typescript": "^5.7.2"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@astrojs/alpinejs": "^0.4.0",
|
|
42
|
+
"@astrojs/check": "^0.9.4",
|
|
43
|
+
"@astrojs/cloudflare": "^11.2.0",
|
|
44
|
+
"@astrojs/rss": "4.0.9",
|
|
45
|
+
"@astrojs/sitemap": "3.2.1",
|
|
46
|
+
"@astrojs/tailwind": "5.1.2",
|
|
47
|
+
"@astrojs/ts-plugin": "^1.10.4",
|
|
48
|
+
"@astrojs/vue": "4.5.2",
|
|
49
|
+
"@iconify-json/fa6-brands": "^1.2.3",
|
|
50
|
+
"@iconify-json/fa6-solid": "^1.2.2",
|
|
51
|
+
"@iconify/tools": "^4.0.7",
|
|
52
|
+
"@keyv/compress-brotli": "^2.0.2",
|
|
53
|
+
"@types/alpinejs": "^3.13.11",
|
|
54
|
+
"alpinejs": "^3.14.6",
|
|
55
|
+
"aos": "3.0.0-beta.6",
|
|
56
|
+
"astro": "^4.16.16",
|
|
57
|
+
"astro-icon": "^1.1.4",
|
|
58
|
+
"astro-integration-kit": "^0.16.1",
|
|
59
|
+
"cheerio": "^1.0.0",
|
|
60
|
+
"dayjs": "^1.11.13",
|
|
61
|
+
"fetch-jsonp": "^1.3.0",
|
|
62
|
+
"glob": "^11.0.0",
|
|
63
|
+
"keyv": "^5.2.1",
|
|
64
|
+
"keyv-lru": "^3.0.4",
|
|
65
|
+
"lodash": "^4.17.21",
|
|
66
|
+
"photoswipe": "^5.4.4",
|
|
67
|
+
"smartmenus": "2.0.0-alpha.1",
|
|
68
|
+
"sprintf-js": "^1.1.3",
|
|
69
|
+
"string-strip-html": "^13.4.8",
|
|
70
|
+
"swiper": "^11.1.15",
|
|
71
|
+
"tslib": "^2.8.1"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -22,8 +22,8 @@ const jeawinapi = new JeawinApi({
|
|
|
22
22
|
api_path: jeawin_api_path,
|
|
23
23
|
});
|
|
24
24
|
const author_info_html = await jeawinapi.get_author_info({ node_id });
|
|
25
|
-
|
|
26
|
-
const html = await Astro.slots.render("default", [author_info_html]);
|
|
25
|
+
// console.log(author_info_html);
|
|
26
|
+
// const html = await Astro.slots.render("default", [author_info_html]);
|
|
27
27
|
---
|
|
28
28
|
|
|
29
|
-
<Fragment set:html={
|
|
29
|
+
<Fragment set:html={author_info_html} />
|
|
@@ -24,15 +24,14 @@ const {
|
|
|
24
24
|
} = Astro.props;
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<div id="map" class="map"></div>
|
|
27
|
+
<custom-baidumap
|
|
28
|
+
data-longitude={longitude}
|
|
29
|
+
data-latitude={latitude}
|
|
30
|
+
data-address={address}
|
|
31
|
+
data-search_info_window_title={search_info_window_title}
|
|
32
|
+
>
|
|
33
|
+
<div class="map w-full h-[350px]"></div>
|
|
34
|
+
</custom-baidumap>
|
|
36
35
|
<script
|
|
37
36
|
is:inline
|
|
38
37
|
src="https://api.map.baidu.com/api?v=2.0&ak=525d1fe8987ae7254b080b2c62d1c098"
|
|
@@ -45,62 +44,67 @@ const {
|
|
|
45
44
|
rel="stylesheet"
|
|
46
45
|
href="https://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.css"
|
|
47
46
|
/>
|
|
48
|
-
<script
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
<script>
|
|
48
|
+
import _ from "lodash";
|
|
49
|
+
class CustomBaidumap extends HTMLElement {
|
|
50
|
+
constructor() {
|
|
51
|
+
super();
|
|
52
|
+
|
|
53
|
+
// @ts-ignore
|
|
54
|
+
if (!_.isUndefined(window.BMap)) {
|
|
55
|
+
// 百度地图API功能
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
const map = new window.BMap.Map(this.querySelector(".map"));
|
|
58
|
+
const longitude = this.dataset.longitude;
|
|
59
|
+
const latitude = this.dataset.latitude;
|
|
60
|
+
const address = this.dataset.address;
|
|
61
|
+
const search_info_window_title = this.dataset.search_info_window_title;
|
|
62
|
+
// @ts-ignore
|
|
63
|
+
const point = new window.BMap.Point(longitude, latitude);
|
|
64
|
+
map.centerAndZoom(point, 16);
|
|
61
65
|
|
|
62
|
-
|
|
66
|
+
map.enableScrollWheelZoom();
|
|
63
67
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
const content =
|
|
69
|
+
'<div style="margin:0;line-height:20px;padding:2px;">' +
|
|
70
|
+
"" +
|
|
71
|
+
address +
|
|
72
|
+
"</div>";
|
|
69
73
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
74
|
+
//创建检索信息窗口对象
|
|
75
|
+
let searchInfoWindow = null;
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
searchInfoWindow = new window.BMapLib.SearchInfoWindow(map, content, {
|
|
78
|
+
title: search_info_window_title, //标题
|
|
79
|
+
width: 290, //宽度
|
|
80
|
+
height: 65, //高度
|
|
81
|
+
panel: "panel", //检索结果面板
|
|
82
|
+
enableAutoPan: true, //自动平移
|
|
83
|
+
searchTypes: [
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
window.BMAPLIB_TAB_SEARCH, //周边检索
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
window.BMAPLIB_TAB_TO_HERE, //到这里去
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
window.BMAPLIB_TAB_FROM_HERE, //从这里出发
|
|
90
|
+
],
|
|
91
|
+
});
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
const marker = new window.BMap.Marker(point); //创建marker对象
|
|
94
|
+
marker.enableDragging(); //marker可拖拽
|
|
95
|
+
marker.addEventListener("click", function () {
|
|
96
|
+
searchInfoWindow.open(marker);
|
|
97
|
+
});
|
|
87
98
|
searchInfoWindow.open(marker);
|
|
88
|
-
|
|
89
|
-
searchInfoWindow.open(marker);
|
|
90
|
-
map.addOverlay(marker); //在地图中添加marker
|
|
99
|
+
map.addOverlay(marker); //在地图中添加marker
|
|
91
100
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
101
|
+
// var marker = new BMap.Marker(point);
|
|
102
|
+
// map.addOverlay(marker);
|
|
103
|
+
// var infoWindow = new BMap.InfoWindow("地址:厦禾路879号美新广场17楼 <br>电话:(0592)2203787,4009188880 <br>坐标:118.115775,24.473813"); // 创建信息窗口对象
|
|
104
|
+
// map.openInfoWindow(infoWindow,point); //开启信息窗口
|
|
105
|
+
}
|
|
96
106
|
}
|
|
97
|
-
});
|
|
98
|
-
</script>
|
|
99
|
-
<style is:inline>
|
|
100
|
-
.map {
|
|
101
|
-
width: 100%;
|
|
102
|
-
height: 350px;
|
|
103
|
-
border-top: solid 1px #eee;
|
|
104
|
-
border-bottom: solid 1px #eee;
|
|
105
107
|
}
|
|
106
|
-
|
|
108
|
+
|
|
109
|
+
customElements.define("custom-baidumap", CustomBaidumap);
|
|
110
|
+
</script>
|
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
---
|
|
2
|
-
/**
|
|
3
|
-
* banner切换组件
|
|
4
|
-
*
|
|
5
|
-
* jeawin-astro/src/components/banner_swiper.astro
|
|
6
|
-
*
|
|
7
|
-
* @package jeawin-astro
|
|
8
|
-
* @author Chaegumi
|
|
9
|
-
* @copyright Copyright (c) 2024-2099 jeawin.com
|
|
10
|
-
* @email chaegumi@jeawin.com
|
|
11
|
-
* @filesource
|
|
12
|
-
*/
|
|
13
|
-
import _ from "lodash";
|
|
14
|
-
import { img_change_attrs, render_value } from "../scripts/util.js";
|
|
15
|
-
import JeawinApi from "../scripts/cms.js";
|
|
16
|
-
|
|
17
|
-
interface Props {
|
|
18
|
-
tag_name?: string;
|
|
19
|
-
style_class?: any;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const { tag_name, style_class } = Astro.props;
|
|
23
|
-
|
|
24
|
-
const TagName = tag_name || "section";
|
|
25
|
-
let StyleClass: any = [];
|
|
26
|
-
if (style_class) {
|
|
27
|
-
if (_.isArray(style_class)) {
|
|
28
|
-
StyleClass = style_class;
|
|
29
|
-
} else if (_.isString(style_class)) {
|
|
30
|
-
StyleClass = _.split(style_class, " ");
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path } = Astro.locals;
|
|
35
|
-
const jeawinapi = new JeawinApi({
|
|
36
|
-
apikey: jeawin_apikey,
|
|
37
|
-
api_domain: jeawin_api_domain,
|
|
38
|
-
api_path: jeawin_api_path,
|
|
39
|
-
});
|
|
40
|
-
const banners = await jeawinapi.get_nodes({ channel_id: 5 });
|
|
41
|
-
// console.log(banners);
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
<custom-banner-swiper>
|
|
45
|
-
{
|
|
46
|
-
banners && banners.nodes && banners.nodes.length > 0 ? (
|
|
47
|
-
<TagName class:list={StyleClass}>
|
|
48
|
-
<swiper-container
|
|
49
|
-
class="banner_swiper"
|
|
50
|
-
init="false"
|
|
51
|
-
autoplay="true"
|
|
52
|
-
slides-per-view="1"
|
|
53
|
-
mousewheel-force-to-axis="true"
|
|
54
|
-
navigation="true"
|
|
55
|
-
pagination="true"
|
|
56
|
-
>
|
|
57
|
-
{banners.nodes &&
|
|
58
|
-
banners.nodes.map((banner: any, idx: number) => (
|
|
59
|
-
<swiper-slide class:list={["swiper-slide", { hidden: idx > 0 }]}>
|
|
60
|
-
<a
|
|
61
|
-
href={render_value(banner, "linkurl")}
|
|
62
|
-
title={banner.node_title}
|
|
63
|
-
>
|
|
64
|
-
{idx > 0 ? (
|
|
65
|
-
<Fragment
|
|
66
|
-
set:html={img_change_attrs(
|
|
67
|
-
banner.node_picurl_html,
|
|
68
|
-
{
|
|
69
|
-
width: "100%",
|
|
70
|
-
fetchpriority: "high",
|
|
71
|
-
},
|
|
72
|
-
["class", "loading"]
|
|
73
|
-
)}
|
|
74
|
-
/>
|
|
75
|
-
) : (
|
|
76
|
-
<Fragment
|
|
77
|
-
set:html={img_change_attrs(
|
|
78
|
-
banner.node_picurl_html,
|
|
79
|
-
{
|
|
80
|
-
width: "100%",
|
|
81
|
-
class: "",
|
|
82
|
-
loading: "",
|
|
83
|
-
fetchpriority: "high",
|
|
84
|
-
},
|
|
85
|
-
["class", "loading"]
|
|
86
|
-
)}
|
|
87
|
-
/>
|
|
88
|
-
)}
|
|
89
|
-
</a>
|
|
90
|
-
</swiper-slide>
|
|
91
|
-
))}
|
|
92
|
-
</swiper-container>
|
|
93
|
-
</TagName>
|
|
94
|
-
) : null
|
|
95
|
-
}
|
|
96
|
-
</custom-banner-swiper>
|
|
97
|
-
<style>
|
|
98
|
-
.swiper-slide img {
|
|
99
|
-
object-fit: contain;
|
|
100
|
-
width: 100%;
|
|
101
|
-
}
|
|
102
|
-
</style>
|
|
103
|
-
<script>
|
|
104
|
-
import { initSwiper } from "../scripts/swiper.js";
|
|
105
|
-
|
|
106
|
-
class CustomBannerSwiper extends HTMLElement {
|
|
107
|
-
constructor() {
|
|
108
|
-
super();
|
|
109
|
-
|
|
110
|
-
initSwiper(".banner_swiper");
|
|
111
|
-
|
|
112
|
-
document.addEventListener("astro:after-swap", function () {
|
|
113
|
-
initSwiper(".banner_swiper");
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
customElements.define("custom-banner-swiper", CustomBannerSwiper);
|
|
119
|
-
</script>
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* banner切换组件
|
|
4
|
+
*
|
|
5
|
+
* jeawin-astro/src/components/banner_swiper.astro
|
|
6
|
+
*
|
|
7
|
+
* @package jeawin-astro
|
|
8
|
+
* @author Chaegumi
|
|
9
|
+
* @copyright Copyright (c) 2024-2099 jeawin.com
|
|
10
|
+
* @email chaegumi@jeawin.com
|
|
11
|
+
* @filesource
|
|
12
|
+
*/
|
|
13
|
+
import _ from "lodash";
|
|
14
|
+
import { img_change_attrs, render_value } from "../scripts/util.js";
|
|
15
|
+
import JeawinApi from "../scripts/cms.js";
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
tag_name?: string;
|
|
19
|
+
style_class?: any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const { tag_name, style_class } = Astro.props;
|
|
23
|
+
|
|
24
|
+
const TagName = tag_name || "section";
|
|
25
|
+
let StyleClass: any = [];
|
|
26
|
+
if (style_class) {
|
|
27
|
+
if (_.isArray(style_class)) {
|
|
28
|
+
StyleClass = style_class;
|
|
29
|
+
} else if (_.isString(style_class)) {
|
|
30
|
+
StyleClass = _.split(style_class, " ");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const { jeawin_apikey, jeawin_api_domain, jeawin_api_path } = Astro.locals;
|
|
35
|
+
const jeawinapi = new JeawinApi({
|
|
36
|
+
apikey: jeawin_apikey,
|
|
37
|
+
api_domain: jeawin_api_domain,
|
|
38
|
+
api_path: jeawin_api_path,
|
|
39
|
+
});
|
|
40
|
+
const banners = await jeawinapi.get_nodes({ channel_id: 5 });
|
|
41
|
+
// console.log(banners);
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
<custom-banner-swiper>
|
|
45
|
+
{
|
|
46
|
+
banners && banners.nodes && banners.nodes.length > 0 ? (
|
|
47
|
+
<TagName class:list={StyleClass}>
|
|
48
|
+
<swiper-container
|
|
49
|
+
class="banner_swiper"
|
|
50
|
+
init="false"
|
|
51
|
+
autoplay="true"
|
|
52
|
+
slides-per-view="1"
|
|
53
|
+
mousewheel-force-to-axis="true"
|
|
54
|
+
navigation="true"
|
|
55
|
+
pagination="true"
|
|
56
|
+
>
|
|
57
|
+
{banners.nodes &&
|
|
58
|
+
banners.nodes.map((banner: any, idx: number) => (
|
|
59
|
+
<swiper-slide class:list={["swiper-slide", { hidden: idx > 0 }]}>
|
|
60
|
+
<a
|
|
61
|
+
href={render_value(banner, "linkurl")}
|
|
62
|
+
title={banner.node_title}
|
|
63
|
+
>
|
|
64
|
+
{idx > 0 ? (
|
|
65
|
+
<Fragment
|
|
66
|
+
set:html={img_change_attrs(
|
|
67
|
+
banner.node_picurl_html,
|
|
68
|
+
{
|
|
69
|
+
width: "100%",
|
|
70
|
+
fetchpriority: "high",
|
|
71
|
+
},
|
|
72
|
+
["class", "loading"]
|
|
73
|
+
)}
|
|
74
|
+
/>
|
|
75
|
+
) : (
|
|
76
|
+
<Fragment
|
|
77
|
+
set:html={img_change_attrs(
|
|
78
|
+
banner.node_picurl_html,
|
|
79
|
+
{
|
|
80
|
+
width: "100%",
|
|
81
|
+
class: "",
|
|
82
|
+
loading: "",
|
|
83
|
+
fetchpriority: "high",
|
|
84
|
+
},
|
|
85
|
+
["class", "loading"]
|
|
86
|
+
)}
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
89
|
+
</a>
|
|
90
|
+
</swiper-slide>
|
|
91
|
+
))}
|
|
92
|
+
</swiper-container>
|
|
93
|
+
</TagName>
|
|
94
|
+
) : null
|
|
95
|
+
}
|
|
96
|
+
</custom-banner-swiper>
|
|
97
|
+
<style>
|
|
98
|
+
.swiper-slide img {
|
|
99
|
+
object-fit: contain;
|
|
100
|
+
width: 100%;
|
|
101
|
+
}
|
|
102
|
+
</style>
|
|
103
|
+
<script>
|
|
104
|
+
import { initSwiper } from "../scripts/swiper.js";
|
|
105
|
+
|
|
106
|
+
class CustomBannerSwiper extends HTMLElement {
|
|
107
|
+
constructor() {
|
|
108
|
+
super();
|
|
109
|
+
|
|
110
|
+
initSwiper(".banner_swiper");
|
|
111
|
+
|
|
112
|
+
document.addEventListener("astro:after-swap", function () {
|
|
113
|
+
initSwiper(".banner_swiper");
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
customElements.define("custom-banner-swiper", CustomBannerSwiper);
|
|
119
|
+
</script>
|