@tbox.cn/app-card-assets 0.0.0-stage → 0.1.0

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.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +8 -2
  3. package/SOURCE.md +5 -0
  4. package/assets.json +239 -0
  5. package/components/Banner/index.module.less +11 -0
  6. package/components/Banner/index.tsx +36 -0
  7. package/components/BlockAnimal/LottiePlayer/index.module.less +11 -0
  8. package/components/BlockAnimal/LottiePlayer/index.tsx +24 -0
  9. package/components/BlockAnimal/LottiePlayer/utils.ts +72 -0
  10. package/components/BlockAnimal/index.module.less +78 -0
  11. package/components/BlockAnimal/index.tsx +120 -0
  12. package/components/BlockBarrage/index.module.less +101 -0
  13. package/components/BlockBarrage/index.tsx +98 -0
  14. package/components/BlockFanSwiper/index.module.less +89 -0
  15. package/components/BlockFanSwiper/index.tsx +56 -0
  16. package/components/BlockIntro/index.module.less +31 -0
  17. package/components/BlockIntro/index.tsx +21 -0
  18. package/components/BlockIntroCenter/index.module.less +30 -0
  19. package/components/BlockIntroCenter/index.tsx +22 -0
  20. package/components/BlockNowList/index.module.less +72 -0
  21. package/components/BlockNowList/index.tsx +54 -0
  22. package/components/BlockQuestionList/index.module.less +113 -0
  23. package/components/BlockQuestionList/index.tsx +107 -0
  24. package/components/BlockServiceIconList/index.module.less +62 -0
  25. package/components/BlockServiceIconList/index.tsx +83 -0
  26. package/components/BlockServiceList/index.module.less +89 -0
  27. package/components/BlockServiceList/index.tsx +88 -0
  28. package/components/BlockTravelCarousel/index.module.less +125 -0
  29. package/components/BlockTravelCarousel/index.tsx +101 -0
  30. package/components/BlockTravelCarousel/tags/Tags.module.less +20 -0
  31. package/components/BlockTravelCarousel/tags/Tags.tsx +20 -0
  32. package/components/OneCol/index.module.less +158 -0
  33. package/components/OneCol/index.tsx +83 -0
  34. package/components/TwoCol/index.module.less +191 -0
  35. package/components/TwoCol/index.tsx +82 -0
  36. package/docs/Banner.md +17 -0
  37. package/docs/BlockAnimal.md +17 -0
  38. package/docs/BlockBarrage.md +17 -0
  39. package/docs/BlockFanSwiper.md +17 -0
  40. package/docs/BlockIntro.md +17 -0
  41. package/docs/BlockIntroCenter.md +17 -0
  42. package/docs/BlockNowList.md +17 -0
  43. package/docs/BlockQuestionList.md +17 -0
  44. package/docs/BlockServiceIconList.md +17 -0
  45. package/docs/BlockServiceList.md +17 -0
  46. package/docs/BlockTravelCarousel.md +17 -0
  47. package/docs/OneCol.md +17 -0
  48. package/docs/TwoCol.md +17 -0
  49. package/examples/Banner.json +5 -0
  50. package/examples/BlockAnimal.json +22 -0
  51. package/examples/BlockBarrage.json +26 -0
  52. package/examples/BlockFanSwiper.json +23 -0
  53. package/examples/BlockIntro.json +4 -0
  54. package/examples/BlockIntroCenter.json +4 -0
  55. package/examples/BlockNowList.json +36 -0
  56. package/examples/BlockQuestionList.json +25 -0
  57. package/examples/BlockServiceIconList.json +36 -0
  58. package/examples/BlockServiceList.json +36 -0
  59. package/examples/BlockTravelCarousel.json +37 -0
  60. package/examples/OneCol.json +49 -0
  61. package/examples/TwoCol.json +49 -0
  62. package/package.json +39 -3
  63. package/shared/actions.ts +38 -0
  64. package/shared/home-integration.md +47 -0
  65. package/shared/types.ts +10 -0
@@ -0,0 +1,17 @@
1
+ # BlockServiceList
2
+
3
+ 可复制的卡片源码。入口 `components/BlockServiceList/index.tsx`;数据示例见 `../examples/BlockServiceList.json`。
4
+
5
+ ## 数据与交互
6
+
7
+ cardData 字段:title、list(imageUrl/title/tags/clickAction/query/jumpUrl)。交互适配见 `../shared/home-integration.md`:query 复用 home 槽 onSend,跳转复用现有 store 的 openLink 动作。数据可由应用改写,不要求后端卡片 ID。
8
+
9
+ ## 使用
10
+
11
+ ```tsx
12
+ import BlockServiceList from '@/components/home/components/BlockServiceList';
13
+
14
+ <BlockServiceList cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
+ ```
16
+
17
+ CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
@@ -0,0 +1,17 @@
1
+ # BlockTravelCarousel
2
+
3
+ 可复制的卡片源码。入口 `components/BlockTravelCarousel/index.tsx`;数据示例见 `../examples/BlockTravelCarousel.json`。
4
+
5
+ ## 数据与交互
6
+
7
+ cardData 字段:hotTitle、list(imageUrl/title/tags/desc/clickAction/query/jumpUrl)。交互适配见 `../shared/home-integration.md`:query 复用 home 槽 onSend,跳转复用现有 store 的 openLink 动作。数据可由应用改写,不要求后端卡片 ID。
8
+
9
+ ## 使用
10
+
11
+ ```tsx
12
+ import BlockTravelCarousel from '@/components/home/components/BlockTravelCarousel';
13
+
14
+ <BlockTravelCarousel cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
+ ```
16
+
17
+ CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
package/docs/OneCol.md ADDED
@@ -0,0 +1,17 @@
1
+ # OneCol
2
+
3
+ 可复制的卡片源码。入口 `components/OneCol/index.tsx`;数据示例见 `../examples/OneCol.json`。
4
+
5
+ ## 数据与交互
6
+
7
+ cardData 字段:logo、welcome、desc、button(title/description(兼容 desc)/icon/query/jumpUrl);单列入口。交互适配见 `../shared/home-integration.md`:query 复用 home 槽 onSend,跳转复用现有 store 的 openLink 动作。数据可由应用改写,不要求后端卡片 ID。
8
+
9
+ ## 使用
10
+
11
+ ```tsx
12
+ import OneCol from '@/components/home/components/OneCol';
13
+
14
+ <OneCol cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
+ ```
16
+
17
+ CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
package/docs/TwoCol.md ADDED
@@ -0,0 +1,17 @@
1
+ # TwoCol
2
+
3
+ 可复制的卡片源码。入口 `components/TwoCol/index.tsx`;数据示例见 `../examples/TwoCol.json`。
4
+
5
+ ## 数据与交互
6
+
7
+ cardData 字段:logo、welcome、desc、button(title/desc/class/query/jumpUrl);双列入口。交互适配见 `../shared/home-integration.md`:query 复用 home 槽 onSend,跳转复用现有 store 的 openLink 动作。数据可由应用改写,不要求后端卡片 ID。
8
+
9
+ ## 使用
10
+
11
+ ```tsx
12
+ import TwoCol from '@/components/home/components/TwoCol';
13
+
14
+ <TwoCol cardData={/* 按示例填写 */} bridgeAPI={bridge} />
15
+ ```
16
+
17
+ CSS Modules 使用 index.module.less,尺寸沿宿主 750 设计稿 / rootValue=100 的 rem 链。组合父容器建议 width:100%、max-width:750px(由宿主转换)、min-width:0;可直接改本地源码、顺序、样式和数据。图片 URL 仅为示例,生产使用部署者素材;没有请求真实业务数据。依赖声明以 assets.json 为准。
@@ -0,0 +1,5 @@
1
+ {
2
+ "bannerImage": "https://mdn.alipayobjects.com/huamei_kjivwt/afts/img/A*CmZWQpau9jkAAAAAQRAAAAgAegyGAQ/original",
3
+ "bannerJumpUrl": "alipays://platformapi/startapp?appId=2021003136672118&page=pages/order/order?id=923462021335220224",
4
+ "screenHeight": 100
5
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "button": [
3
+ {
4
+ "location": {
5
+ "left": "30%",
6
+ "top": "20%"
7
+ },
8
+ "clickAction": "query",
9
+ "jumpUrl": "",
10
+ "title": "MP4",
11
+ "query": "aa",
12
+ "djangoId": "https://gw.alipayobjects.com/v/huamei_b00jk5/afts/video/l8rNQbJf8rsAAAAAgMAAAAgAfoeUAQBr?fileType=mp4"
13
+ }
14
+ ],
15
+ "djangoId": "https://mdn.alipayobjects.com/agt_content/afts/img/fLqhTKCGlrMAAAAAQDAAAAgAegs9AQFr/original?fileType=zip",
16
+ "placeholder": "https://mdn.alipayobjects.com/agt_content/afts/img/pWvkTLvPpmUAAAAAQuAAAAgAegs9AQFr/original",
17
+ "desc": "aaaaa",
18
+ "guessQuestionList": [
19
+ "追问1",
20
+ "11心联动 \"善爱吾心·青春共绽\"心理素质拓展游园会11心联动 \"善爱吾心·青春共绽\"心理素质拓展游园会"
21
+ ]
22
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "lineNum": 4,
3
+ "list": [
4
+ {
5
+ "query": "推荐都江堰2日游的最佳路线和景点安排",
6
+ "title": "都江堰2日游最佳路线1"
7
+ },
8
+ {
9
+ "query": "详细介绍都江堰3日游的行程安排和必打卡景点",
10
+ "title": "都江堰3日游完美攻略2"
11
+ },
12
+ {
13
+ "query": "都江堰一日游必去景点和时间安排建议",
14
+ "title": "都江堰一日游精华线路3"
15
+ },
16
+ {
17
+ "query": "适合带孩子游玩的都江堰景点和行程规划",
18
+ "title": "都江堰亲子游攻略4"
19
+ },
20
+ {
21
+ "query": "两天周末游玩都江堰的最佳路线和景点组合",
22
+ "title": "都江堰周末游路线推荐5"
23
+ }
24
+ ],
25
+ "title": "试试这样问"
26
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "list": [
3
+ {
4
+ "imageUrl": "https://mdn.alipayobjects.com/huamei_b00jk5/afts/img/A*YYYuSpWyr7IAAAAAVmAAAAgAegitAQ/original",
5
+ "query": "各个展厅人流情况查询",
6
+ "jumpUrl": "https://example.com/exhibition",
7
+ "title": "各个展厅人流情况查询",
8
+ "clickAction": "jump"
9
+ },
10
+ {
11
+ "imageUrl": "https://mdn.alipayobjects.com/huamei_frp8ut/afts/img/A*Whp6S7ZbUAsAAAAAAAAAAAAAet-KAQ/original",
12
+ "query": "文物考古,探一下",
13
+ "clickAction": "query",
14
+ "title": "文物考古,探一下"
15
+ },
16
+ {
17
+ "imageUrl": "https://mdn.alipayobjects.com/huamei_frp8ut/afts/img/A*_5sxRoRWL50AAAAAAAAAAAAAet-KAQ/original",
18
+ "query": "路线推荐指引",
19
+ "clickAction": "query",
20
+ "title": "路线推荐指引"
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "title": "欢迎来到万岁山",
3
+ "desc": "🌿您好呀!我是您的智能向导,我可以带您高品质的游玩万岁山,有什么问题都可以找我沟通,快来和我一起解锁美妙的万岁山之旅吧"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "title": "欢迎来到杭州",
3
+ "desc": "人间天堂,最忆杭州!🥰我是您的城市AI旅行助理杭小忆,需要旅行建议或者帮助都可以找我"
4
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "list": [
3
+ {
4
+ "btnText": "去看看",
5
+ "bg": "https://mdn.alipayobjects.com/huamei_frp8ut/afts/img/A*nAJqTrOJFu0AAAAAAAAAAAAAet-KAQ/original",
6
+ "query": "",
7
+ "title": "桐小乌",
8
+ "jumpUrl": "https://render.alipay.com/p/c/180020570000123273/index.html?caprMode=sync",
9
+ "desc": "带你畅游乌镇风景区"
10
+ },
11
+ {
12
+ "btnText": "立即体验",
13
+ "bg": "https://mdn.alipayobjects.com/huamei_osy38d/afts/img/aS55SY6l81kAAAAAAAAAAAAADgoDAQFr/original",
14
+ "query": "",
15
+ "title": "西湖导游",
16
+ "jumpUrl": "alipays://platformapi/startapp?appId=2021003125685383",
17
+ "desc": "探索杭州西湖美景"
18
+ },
19
+ {
20
+ "btnText": "了解更多",
21
+ "bg": "https://mdn.alipayobjects.com/huamei_frp8ut/afts/img/A*nAJqTrOJFu0AAAAAAAAAAAAAet-KAQ/original",
22
+ "query": "苏州园林游玩攻略",
23
+ "title": "苏州印象",
24
+ "jumpUrl": "",
25
+ "desc": "漫步苏州园林小径"
26
+ },
27
+ {
28
+ "btnText": "查看详情",
29
+ "bg": "https://mdn.alipayobjects.com/huamei_frp8ut/afts/img/A*nAJqTrOJFu0AAAAAAAAAAAAAet-KAQ/original",
30
+ "query": "周庄一日游路线推荐",
31
+ "title": "周庄水乡",
32
+ "jumpUrl": "",
33
+ "desc": "感受江南水乡魅力"
34
+ }
35
+ ]
36
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "list": [
3
+ {
4
+ "query": "万岁山有哪些爆款节目",
5
+ "icon": "",
6
+ "content": "万岁山有哪些爆款节目"
7
+ },
8
+ {
9
+ "query": "如何赚银票",
10
+ "icon": "",
11
+ "content": "如何赚银票"
12
+ },
13
+ {
14
+ "query": "推荐下附近的美食",
15
+ "icon": "",
16
+ "content": "推荐下附近的美食"
17
+ },
18
+ {
19
+ "query": "万岁山景区游玩攻略",
20
+ "content": "万岁山景区游玩攻略"
21
+ }
22
+ ],
23
+ "title": "猜你想问",
24
+ "defaultNum": 3
25
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "list": [
3
+ {
4
+ "query": "极速打车",
5
+ "icon": "",
6
+ "title": "极速打车",
7
+ "clickAction": "query"
8
+ },
9
+ {
10
+ "query": "查询网约车",
11
+ "icon": "https://mdn.alipayobjects.com/huamei_osy38d/afts/img/14UWQaOxOTIAAAAAAAAAAAAAegoDAQFr/original",
12
+ "title": "网约车查询",
13
+ "clickAction": "query"
14
+ },
15
+ {
16
+ "query": "查询网约车客流",
17
+ "icon": "https://mdn.alipayobjects.com/huamei_osy38d/afts/img/zVHwRZWjaTIAAAAAAAAAAAAAegoDAQFr/original",
18
+ "title": "网约车客流",
19
+ "clickAction": "query"
20
+ },
21
+ {
22
+ "query": "查询出租车客流",
23
+ "icon": "https://mdn.alipayobjects.com/huamei_osy38d/afts/img/HBYMQLpre8IAAAAAAAAAAAAAegoDAQFr/original",
24
+ "title": "出租车客流",
25
+ "clickAction": "query"
26
+ },
27
+ {
28
+ "query": "",
29
+ "icon": "https://mdn.alipayobjects.com/huamei_osy38d/afts/img/HBYMQLpre8IAAAAAAAAAAAAAegoDAQFr/original",
30
+ "title": "游戏中心",
31
+ "jumpUrl": "alipays://platformapi/startapp?appId=2021003125685383",
32
+ "clickAction": "jump"
33
+ }
34
+ ],
35
+ "title": "配套服务"
36
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "list": [
3
+ {
4
+ "imageUrl": "https://mdn.alipayobjects.com/huamei_nzq4hr/afts/img/A*BacVS63yRQUAAAAAAAAAAAAAel-hAQ/original",
5
+ "query": "介绍一下万岁山武侠城",
6
+ "title": "畅游万岁山-景区攻略",
7
+ "clickAction": "query",
8
+ "tags": [
9
+ "热点玩法",
10
+ "不容错过"
11
+ ]
12
+ },
13
+ {
14
+ "imageUrl": "https://mdn.alipayobjects.com/huamei_nzq4hr/afts/img/A*H0wXSpODJbwAAAAAAAAAAAAAel-hAQ/original",
15
+ "query": "节目信息",
16
+ "title": "节目单",
17
+ "jumpUrl": "alipays://platformapi/startapp?appId=2021003121601608",
18
+ "clickAction": "jump",
19
+ "tags": [
20
+ "必看节目",
21
+ "一览无余"
22
+ ]
23
+ },
24
+ {
25
+ "imageUrl": "https://mdn.alipayobjects.com/huamei_nzq4hr/afts/img/A*vWxaSYiL7hgAAAAAAAAAAAAAel-hAQ/original",
26
+ "query": "万岁山有哪些经典路线",
27
+ "title": "热门路线",
28
+ "clickAction": "query",
29
+ "tags": [
30
+ "美食夜游",
31
+ "情侣带娃"
32
+ ]
33
+ }
34
+ ],
35
+ "title": "热门节目"
36
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "hotTitle": "热门",
3
+ "list": [
4
+ {
5
+ "imageUrl": "https://mdn.alipayobjects.com/huamei_b00jk5/afts/img/A*YYYuSpWyr7IAAAAAVmAAAAgAegitAQ/original",
6
+ "title": "曲院风荷1",
7
+ "clickAction": "jump",
8
+ "jumpUrl": "h5/miniprogram/query",
9
+ "tags": [
10
+ "城市漫游",
11
+ "亲子游"
12
+ ],
13
+ "desc": "净慈寺 - 太子湾公园 - 花港观鱼 - 浴鹄湾 - 于谦祠 - 慧因高丽寺 - 清河坊街"
14
+ },
15
+ {
16
+ "imageUrl": "https://img1.baidu.com/it/u=1708673474,2160415315&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
17
+ "clickAction": "query",
18
+ "title": "曲院风荷2",
19
+ "query": "h5/miniprogram/query",
20
+ "tags": [
21
+ "城市漫游",
22
+ "亲子游"
23
+ ],
24
+ "desc": "净慈寺 - 太子湾公园 - 花港观鱼 - 浴鹄湾 - 于谦祠 - 慧因高丽寺 - 清河坊街"
25
+ },
26
+ {
27
+ "imageUrl": "https://img1.baidu.com/it/u=1708673474,2160415315&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=800",
28
+ "title": "曲院风荷3",
29
+ "clickAction": "h5/miniprogram/query",
30
+ "tags": [
31
+ "城市漫游",
32
+ "亲子游"
33
+ ],
34
+ "desc": "净慈寺 - 太子湾公园 - 花港观鱼 - 浴鹄湾 - 于谦祠 - 慧因高丽寺 - 清河坊街"
35
+ }
36
+ ]
37
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "button": [
3
+ {
4
+ "title": "DeepSeek",
5
+ "desc": "开启DeepSeek使用",
6
+ "imageUrl": null,
7
+ "clickAction": "link",
8
+ "jumpUrl": "alipays://platformapi/startapp?appId=2021004143649370&page=pages/home/index&query=agent_id=202502APhujd00287995&chInfo=1011miniapp_qrcode&nbprefer=YES"
9
+ },
10
+ {
11
+ "title": "智能体广场",
12
+ "desc": "多种多样的的智能体",
13
+ "imageUrl": null,
14
+ "clickAction": "query",
15
+ "query": "智能体广场"
16
+ },
17
+ {
18
+ "title": "我的课表",
19
+ "desc": "查询个人课表",
20
+ "imageUrl": null,
21
+ "clickAction": "query",
22
+ "query": "我的课表"
23
+ },
24
+ {
25
+ "title": "学生请假",
26
+ "desc": "学生事假、病假申请入口",
27
+ "imageUrl": null,
28
+ "clickAction": "query",
29
+ "query": "学生请假"
30
+ },
31
+ {
32
+ "title": "自习室预约",
33
+ "desc": "预约图书馆自习室",
34
+ "imageUrl": null,
35
+ "clickAction": "query",
36
+ "query": "自习室预约"
37
+ },
38
+ {
39
+ "title": "校园福利",
40
+ "desc": "支付宝校园权益、兼职信息",
41
+ "imageUrl": null,
42
+ "clickAction": "query",
43
+ "query": "校园福利"
44
+ }
45
+ ],
46
+ "logo": "https://mass.alipay.com/aiopmng/afts/file/V_mPRbRybZYAAAAAAAAAAAAAeqnbAQBr",
47
+ "welcome": "hello~我是江小科",
48
+ "desc": "我是江西科技学院的校园智能体江小科,需要任何校园服务指引、学校规章制度答疑,学习和生活攻略,都可以找我!"
49
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "button": [
3
+ {
4
+ "title": "DeepSeekDeepSeekDeepSeek",
5
+ "desc": "开启DeepSeek使用开启DeepSeek使用开启DeepSeek使用",
6
+ "imageUrl": null,
7
+ "clickAction": "link",
8
+ "jumpUrl": "alipays://platformapi/startapp?appId=2021004143649370&page=pages/home/index&query=agent_id=202502APhujd00287995&chInfo=1011miniapp_qrcode&nbprefer=YES"
9
+ },
10
+ {
11
+ "title": "智能体广场",
12
+ "desc": "多种多样的的智能体",
13
+ "imageUrl": null,
14
+ "clickAction": "query",
15
+ "query": "智能体广场"
16
+ },
17
+ {
18
+ "title": "我的课表",
19
+ "desc": "查询个人课表",
20
+ "imageUrl": null,
21
+ "clickAction": "query",
22
+ "query": "我的课表"
23
+ },
24
+ {
25
+ "title": "学生请假",
26
+ "desc": "学生事假、病假申请入口",
27
+ "imageUrl": null,
28
+ "clickAction": "query",
29
+ "query": "学生请假"
30
+ },
31
+ {
32
+ "title": "自习室预约",
33
+ "desc": "预约图书馆自习室",
34
+ "imageUrl": null,
35
+ "clickAction": "query",
36
+ "query": "自习室预约"
37
+ },
38
+ {
39
+ "title": "校园福利",
40
+ "desc": "支付宝校园权益、兼职信息",
41
+ "imageUrl": null,
42
+ "clickAction": "query",
43
+ "query": "校园福利"
44
+ }
45
+ ],
46
+ "logo": "https://mass.alipay.com/aiopmng/afts/file/V_mPRbRybZYAAAAAAAAAAAAAeqnbAQBr",
47
+ "welcome": "hello~我是江小科",
48
+ "desc": "我是江西科技学院的校园智能体江小科,需要任何校园服务指引、学校规章制度答疑,学习和生活攻略,都可以找我!"
49
+ }
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-card-assets",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "可复制、可编辑的卡片源码资源",
6
+ "files": [
7
+ "assets.json",
8
+ "components",
9
+ "shared",
10
+ "docs",
11
+ "examples",
12
+ "SOURCE.md",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "exports": {
17
+ "./assets.json": "./assets.json",
18
+ "./package.json": "./package.json"
19
+ },
20
+ "devDependencies": {
21
+ "typescript": "5.9.3",
22
+ "@types/react": "18.3.31",
23
+ "@types/node": "24.13.3",
24
+ "react": "18.3.1",
25
+ "antd-mobile-icons": "0.3.0",
26
+ "antd-mobile": "5.39.0",
27
+ "lottie-web": "5.13.0",
28
+ "jszip": "3.10.1",
29
+ "vitest": "4.1.10",
30
+ "happy-dom": "20.11.2",
31
+ "react-dom": "18.3.1"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "license": "MIT",
37
+ "scripts": {
38
+ "typecheck": "tsc --noEmit",
39
+ "test": "node --test tests/*.test.mjs && vitest run",
40
+ "build": "node --test tests/*.test.mjs"
41
+ }
6
42
  }
@@ -0,0 +1,38 @@
1
+ import type { CardAssetBridge } from './types';
2
+
3
+ /** Application supplies the existing home onSend and store openLink channel. */
4
+ export function createCardAssetBridge(
5
+ onSend: (text: string) => void,
6
+ openLink: (url: string) => void,
7
+ ): CardAssetBridge {
8
+ return {
9
+ sendQuery: ({ question_content }) => {
10
+ if (typeof question_content === 'string' && question_content.trim()) onSend(question_content);
11
+ },
12
+ openScheme: ({ scheme }) => {
13
+ if (typeof scheme !== 'string' || !scheme.trim()) return;
14
+ const url = scheme.trim();
15
+ if (!/^(https?:\/\/|alipays?:\/\/|alipayrisk:\/\/|tel:)/i.test(url) || /[\u0000-\u0020\u007f]/.test(url)) return;
16
+ openLink(url);
17
+ },
18
+ };
19
+ }
20
+
21
+ export interface CardClickData {
22
+ clickAction?: string;
23
+ query?: string;
24
+ jumpUrl?: string;
25
+ }
26
+
27
+ /** Explicit actions win; legacy items without an action retain URL-first fallback. */
28
+ export function runCardClick(bridge: CardAssetBridge | undefined, item?: CardClickData): void {
29
+ if (!bridge || !item) return;
30
+ if (item.clickAction === 'query') {
31
+ bridge.sendQuery({ question_content: item.query || '' });
32
+ } else if (item.clickAction === 'jump' || item.clickAction === 'link') {
33
+ bridge.openScheme({ scheme: item.jumpUrl || '' });
34
+ } else if (!item.clickAction) {
35
+ if (item.jumpUrl) bridge.openScheme({ scheme: item.jumpUrl });
36
+ else if (item.query) bridge.sendQuery({ question_content: item.query });
37
+ }
38
+ }
@@ -0,0 +1,47 @@
1
+ # 接入本地首页
2
+
3
+ 复制的 components/、shared/、docs/、examples/ 属于应用源码,可直接改写。home add 只复制素材与声明运行依赖,不注册槽位。先 pnpm install,再按此文组合。
4
+
5
+ ## 入口与保护
6
+
7
+ 在 apps/client/src/business/home/Home.tsx 组合所选组件与数据,直接按路径导入,不创建全量卡片 registry。用法与 JSON 示例在复制目录的 docs/ 和 examples/。
8
+
9
+ 在 apps/client/src/cards/registry.ts 的 registerAll(ctx) 之后,先检查 ctx.slots.has('home')。已有 home(尤其 mall-core)时停止自动接线,确认是否替换及门禁等业务副作用如何保留,不能直接覆盖。无 home 时导入本地 Home 并注册;该文件扩展名为 .ts,使用 createElement:
10
+
11
+ ```ts
12
+ import { createElement } from 'react';
13
+ import Home from '../business/home/Home';
14
+
15
+ // registerAll(ctx) 之后;保持原有 cards/filter/slots 导出。
16
+ if (ctx.slots.has('home')) throw new Error('已有首页,请确认替换方案');
17
+ ctx.slots.register('home', (props) => createElement(Home, props));
18
+ ```
19
+
20
+ Home 的 props 使用 @tbox.cn/app-contracts 的 HomeSlotRenderProps。不要在 slot 回调里直接运行 Hooks;由 Home 组件处理状态。模板 ChatPage 已按 historyMessages、messages、inlineOrphanCards 判断首页显隐,无需再创建一套显隐逻辑。首页收起时子组件卸载,轮播、弹幕等按自身清理函数停止动画。
21
+
22
+ ## 点击与资源
23
+
24
+ 局部 CardAssetBridge 由 shared/actions.ts 的 createCardAssetBridge 创建。query 通过 home 槽传入的 onSend,复用 ChatPage 的滚动处理、生成中门控和现有 SEND_MESSAGE 链路;不要新建 WS、调用模型接口或把 query 改成 UI_ACTION。
25
+
26
+ 跳转复用应用 useChatStore 的 sendUiAction,以 openLink 本地动作进入 SDK 现有导航逻辑:浏览器 window.open,支付宝壳按深链解析结果走 navigateTo/navigateToMiniProgram,其余链接走 ap.openURL,tel 使用既有电话入口。不要另写 location.assign、window.open 或独立容器桥,也不要在失败后再补一次跳转。
27
+
28
+ ```tsx
29
+ import { createCardAssetBridge } from '@/components/home/shared/actions';
30
+ import { useChatStore } from '@/store/chat';
31
+ import type { HomeSlotRenderProps } from '@tbox.cn/app-contracts';
32
+
33
+ function Home({ onSend }: HomeSlotRenderProps) {
34
+ const sendUiAction = useChatStore((state) => state.sendUiAction);
35
+ const bridge = createCardAssetBridge(onSend, (url) => {
36
+ sendUiAction('home', { type: 'openLink', url });
37
+ });
38
+ // 将 bridge 传给本地卡片的 bridgeAPI prop。
39
+ // return <BlockServiceList cardData={data} bridgeAPI={bridge} />;
40
+ }
41
+ ```
42
+
43
+ home 是本地导航动作的来源标识,不需要创建服务端卡片实例。不要使用 sendMessage 类型的 UI_ACTION 或臆造卡片 ID 发起首页 query。
44
+
45
+ 适配器过滤空 query 和空链接;链接允许 http/https、alipay/alipays/alipayrisk 深链及 tel,拦截脚本与数据 URL。clickAction=query 时只发送 query;jump/link 时只跳转。缺少 clickAction 的旧示例以 jumpUrl 优先、query 次之;未知动作不执行。Banner 的 screenHeight 不提供半屏能力,所有跳转由现有导航链处理。
46
+
47
+ 对业务数据接入、链接与图片按用户材料实现,不把素材示例描述成真实查询结果。首屏宽度、背景、间距在应用组合层维护,视觉遵循用户选定风格。
@@ -0,0 +1,10 @@
1
+ /** Minimal host actions for copied card source. */
2
+ export interface CardAssetBridge {
3
+ sendQuery(params: { question_content: string }): void;
4
+ openScheme(params: { scheme: string }): void;
5
+ }
6
+
7
+ export interface CardAssetProps {
8
+ bridgeAPI: CardAssetBridge;
9
+ cardData?: { userId?: string; appId?: string };
10
+ }