km-card-layout-component-miniprogram 0.1.9 → 0.1.11

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 (41) hide show
  1. package/example/pages/home/index.js +338 -63
  2. package/miniprogram_dist/components/card-layout/elements/custom-element/index.js +4 -0
  3. package/miniprogram_dist/components/card-layout/elements/icon-element/index.js +4 -0
  4. package/miniprogram_dist/components/card-layout/elements/image-element/index.js +6 -1
  5. package/miniprogram_dist/components/card-layout/elements/text-element/index.js +6 -1
  6. package/miniprogram_dist/components/card-layout/index.js +25 -2
  7. package/miniprogram_dist/components/card-layout/index.wxml +6 -6
  8. package/miniprogram_dist/vendor/km-card-layout-core/bindings.js +1 -11
  9. package/miniprogram_dist/vendor/km-card-layout-core/data.js +1 -1
  10. package/miniprogram_dist/vendor/km-card-layout-core/index.js +9 -18
  11. package/miniprogram_dist/vendor/km-card-layout-core/interface/index.js +0 -1
  12. package/miniprogram_dist/vendor/km-card-layout-core/layout.js +1 -17
  13. package/miniprogram_dist/vendor/km-card-layout-core/ops/changeBackground.js +46 -97
  14. package/miniprogram_dist/vendor/km-card-layout-core/render/helpers.js +36 -19
  15. package/miniprogram_dist/vendor/km-card-layout-core/render/init.js +82 -0
  16. package/package.json +1 -1
  17. package/script/sync-core.js +0 -1
  18. package/src/components/card-layout/elements/custom-element/index.ts +4 -0
  19. package/src/components/card-layout/elements/icon-element/index.ts +4 -0
  20. package/src/components/card-layout/elements/image-element/index.ts +6 -1
  21. package/src/components/card-layout/elements/text-element/index.ts +6 -1
  22. package/src/components/card-layout/index.ts +33 -5
  23. package/src/components/card-layout/index.wxml +6 -6
  24. package/src/vendor/km-card-layout-core/bindings.ts +1 -17
  25. package/src/vendor/km-card-layout-core/data.ts +1 -3
  26. package/src/vendor/km-card-layout-core/index.ts +7 -26
  27. package/src/vendor/km-card-layout-core/interface/data/payload.ts +3 -3
  28. package/src/vendor/km-card-layout-core/interface/elements.ts +1 -0
  29. package/src/vendor/km-card-layout-core/interface/index.ts +0 -1
  30. package/src/vendor/km-card-layout-core/interface/layout.ts +0 -1
  31. package/src/vendor/km-card-layout-core/layout.ts +0 -18
  32. package/src/vendor/km-card-layout-core/ops/changeBackground.ts +47 -130
  33. package/src/vendor/km-card-layout-core/render/helpers.ts +64 -26
  34. package/src/vendor/km-card-layout-core/render/init.ts +107 -0
  35. package/src/vendor/km-card-layout-core/types.d.ts +35 -98
  36. package/miniprogram_dist/vendor/km-card-layout-core/interface/context.js +0 -2
  37. package/miniprogram_dist/vendor/km-card-layout-core/render/tool.js +0 -16
  38. package/miniprogram_dist/vendor/km-card-layout-core/utils.js +0 -25
  39. package/src/vendor/km-card-layout-core/interface/context.ts +0 -6
  40. package/src/vendor/km-card-layout-core/render/tool.ts +0 -21
  41. package/src/vendor/km-card-layout-core/utils.ts +0 -13
@@ -1,108 +1,383 @@
1
1
  const layouts = [
2
2
  {
3
- name: "内置布局-右侧logo",
4
- container: { mode: "absolute" },
3
+ name: "双面布局",
5
4
  width: 343,
6
5
  height: 210,
7
- backgroundImage:
8
- "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/0a7331e2e1a9a4cbc828afe6c338aaae.png",
9
- backgroundZIndex: 1,
10
- fontColor: "#333333",
11
6
  children: [
12
7
  {
13
- id: "f2dd3515-2147-460a-b788-3f58dd5f858b",
14
- type: "custom",
15
- style: { borderRadius: 0, backgroundColor: "currentColor" },
16
- layout: { x: 20, y: 104, mode: "absolute", width: 12, height: 1, zIndex: 8 },
8
+ id: "3",
9
+ key: "mobile",
10
+ icon: { name: "mobile", size: 10, style: "fill", enable: true },
11
+ type: "text",
12
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
13
+ layout: { x: 204, y: 157, mode: "absolute", width: 120, height: 13, zIndex: 1 },
14
+ binding: "user.mobile",
17
15
  },
18
16
  {
19
- id: "7fd4c8cd-6bea-42d0-9a80-b1ba27f4abd3",
20
- type: "custom",
21
- style: { borderRadius: 0, backgroundColor: "currentColor" },
22
- layout: { x: 37, y: 104, mode: "absolute", width: 105, height: 1, zIndex: 9 },
17
+ id: "4",
18
+ key: "duty",
19
+ type: "text",
20
+ style: { fontSize: 10, textAlign: "left", fontWeight: "normal", lineHeight: 14 },
21
+ layout: { x: 40, y: 96, mode: "absolute", width: 120, height: 14, zIndex: 2 },
22
+ binding: "user.duty",
23
23
  },
24
24
  {
25
25
  id: "1",
26
26
  key: "name",
27
27
  type: "text",
28
- style: { color: "", fontSize: 16, textAlign: "left", fontWeight: "bold", lineHeight: 22 },
29
- layout: { x: 20, y: 45, mode: "absolute", width: 210, height: 22, zIndex: 1 },
28
+ style: { fontSize: 16, textAlign: "left", fontWeight: "bold", lineHeight: 22 },
29
+ layout: { x: 40, y: 70, mode: "absolute", width: 120, height: 22, zIndex: 3 },
30
30
  binding: "user.name",
31
- defaultValue: "名片君",
32
31
  },
33
32
  {
34
33
  id: "2",
35
34
  key: "company",
35
+ icon: { name: "company", size: 10, style: "fill", enable: true },
36
36
  type: "text",
37
- style: { color: "", fontSize: 11, textAlign: "left", fontWeight: "normal", lineHeight: 15 },
38
- layout: { x: 20, y: 74, mode: "absolute", width: 210, height: 15, zIndex: 3 },
37
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
38
+ layout: { x: 15, y: 157, mode: "absolute", width: 162, height: 13, zIndex: 4 },
39
39
  binding: "user.company",
40
- defaultValue: "合肥魅客网络有限公司",
41
- icon: { name: "company" },
42
40
  },
43
41
  {
44
- id: "4",
45
- key: "duty",
42
+ id: "5",
43
+ key: "email",
44
+ icon: { name: "email", size: 10, style: "fill", enable: true },
46
45
  type: "text",
47
- style: { color: "", fontSize: 10, textAlign: "left", fontWeight: "normal", lineHeight: 15 },
48
- layout: { x: 20, y: 21, mode: "absolute", width: 210, height: 15, zIndex: 2 },
49
- binding: "user.duty",
50
- defaultValue: "销售经理",
46
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
47
+ layout: { x: 204, y: 181, mode: "absolute", width: 120, height: 13, zIndex: 9 },
48
+ binding: "user.email",
51
49
  },
52
50
  {
53
- id: "3",
54
- key: "mobile",
55
- icon: { style: "fill", enable: true, name: "mobile" },
51
+ id: "9",
52
+ key: "address",
53
+ icon: { name: "address", size: 10, style: "fill", enable: true },
56
54
  type: "text",
57
- style: { color: "", fontSize: 10, textAlign: "left", fontWeight: "normal", lineHeight: 15 },
58
- layout: { x: 20, y: 123, mode: "absolute", width: 280, height: 15, zIndex: 5 },
59
- binding: "user.mobile",
60
- defaultValue: "18888888888",
55
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
56
+ layout: { x: 15, y: 181, mode: "absolute", width: 162, height: 26, zIndex: 10 },
57
+ binding: "user.addressName",
58
+ },
59
+ ],
60
+ container: { mode: "absolute" },
61
+ fontColor: "#ffffff",
62
+ backgroundImage:
63
+ "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4045e1c401d5ecf186409c98f54a4aaf.png",
64
+ backgroundZIndex: 0,
65
+ },
66
+ {
67
+ name: "双面布局-反面",
68
+ width: 343,
69
+ height: 210,
70
+ children: [
71
+ {
72
+ id: "12",
73
+ key: "en_name",
74
+ type: "text",
75
+ style: { fontSize: 16, textAlign: "left", fontWeight: "bold", lineHeight: 22 },
76
+ layout: { x: 40, y: 70, mode: "absolute", width: 180, height: 22, zIndex: 1 },
77
+ binding: "user.moreCardInfo.extInfo.name",
78
+ },
79
+ {
80
+ id: "13",
81
+ key: "en_duty",
82
+ type: "text",
83
+ style: { fontSize: 10, textAlign: "left", fontWeight: "normal", lineHeight: 14 },
84
+ layout: { x: 40, y: 96, mode: "absolute", width: 180, height: 14, zIndex: 2 },
85
+ binding: "user.moreCardInfo.extInfo.duty",
86
+ },
87
+ {
88
+ id: "14",
89
+ key: "en_company",
90
+ icon: { name: "company", style: "fill", enable: true },
91
+ type: "text",
92
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
93
+ layout: { x: 16, y: 157, mode: "absolute", width: 173, height: 13, zIndex: 3 },
94
+ binding: "user.moreCardInfo.extInfo.company",
95
+ },
96
+ {
97
+ id: "15",
98
+ key: "en_address",
99
+ icon: { name: "address", style: "fill", enable: true },
100
+ type: "text",
101
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
102
+ layout: { x: 16, y: 181, mode: "absolute", width: 173, height: 26, zIndex: 4 },
103
+ binding: "user.moreCardInfo.extInfo.address",
61
104
  },
62
105
  {
63
106
  id: "5",
64
107
  key: "email",
65
- icon: { style: "fill", enable: true, name: "email" },
108
+ icon: { name: "email", style: "fill", enable: true },
66
109
  type: "text",
67
- style: { color: "", fontSize: 10, textAlign: "left", fontWeight: "normal", lineHeight: 15 },
68
- layout: { x: 20, y: 145, mode: "absolute", width: 280, height: 15, zIndex: 6 },
110
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
111
+ layout: { x: 206, y: 181, mode: "absolute", width: 130, height: 13, zIndex: 9 },
69
112
  binding: "user.email",
70
- defaultValue: "km@kuanmai.com",
71
113
  },
72
114
  {
73
- id: "8",
74
- key: "logo",
75
- url: "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4c71811adfa51e1e3ab4181a88cebc87.png",
76
- type: "image",
77
- style: { color: "#000000", objectFit: "contain", borderRadius: 0 },
78
- layout: { x: 263, y: 20, mode: "absolute", width: 60, height: 60, zIndex: 4 },
79
- binding: "user.shareStyle.logo",
80
- defaultValue:
81
- "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4c71811adfa51e1e3ab4181a88cebc87.png",
82
- },
83
- {
84
- id: "9",
85
- key: "address",
86
- icon: { style: "fill", enable: true, name: "address" },
115
+ id: "3",
116
+ key: "mobile",
117
+ icon: { name: "mobile", style: "fill", enable: true },
87
118
  type: "text",
88
- style: { color: "", fontSize: 10, textAlign: "left", fontWeight: "normal", lineHeight: 15 },
89
- layout: { x: 20, y: 167, mode: "absolute", width: 280, height: 33, zIndex: 7 },
90
- binding: "user.addressName",
91
- defaultValue: "安徽省合肥市包河区硅谷大厦",
119
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
120
+ layout: { x: 206, y: 157, mode: "absolute", width: 130, height: 13, zIndex: 10 },
121
+ binding: "user.mobile",
92
122
  },
93
123
  ],
124
+ container: { mode: "absolute" },
125
+ fontColor: "#ffffff",
126
+ backgroundImage:
127
+ "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4045e1c401d5ecf186409c98f54a4aaf.png",
128
+ backgroundZIndex: 0,
94
129
  },
95
130
  ];
96
131
 
97
132
  const cardData = {
98
133
  user: {
99
- company: "Kuanmai Networks",
100
- name: "Ada Lovelace",
101
- duty: "Product Lead",
102
- phone: "+86 188-0000-0000",
103
- email: "ada@kuanmai.com",
104
- address: "1 Infinite Loop, Shenzhen",
105
- avatar: "https://picsum.photos/200/200?random=12",
134
+ companyRole: 0,
135
+ shareCardCode: "5fd4621ecd08cde75b915ffea91452b9",
136
+ vip: 20,
137
+ vipDays: 913,
138
+ vipLogo:
139
+ "https://km-1257079185.cos.ap-chengdu.myqcloud.com/static/wechat/icon/user-vip-advanced-v2.png",
140
+ shareStyle: {
141
+ templateId: 7,
142
+ backgroundId: 33,
143
+ coverStyleId: 1,
144
+ hasAvatar: true,
145
+ hasLogo: true,
146
+ logo: "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202505/bf307d891024818150d955f6e5ebcd89.png",
147
+ bgMix: false,
148
+ person:
149
+ "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202512/c49bb25859bc7d4d62e7117d6e5093bc.png",
150
+ styleId: 9,
151
+ template: 2,
152
+ background:
153
+ "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/21dd21c0d693a1eb44e53bad64b9b94a.png",
154
+ colorStyle: 2,
155
+ coverStyle: 3,
156
+ backgroundConfig: {
157
+ id: 33,
158
+ name: "双面1",
159
+ fileId: 4834,
160
+ fontColor: "#ffffff",
161
+ fontColorExtra: [],
162
+ createAt: "2025-11-28 13:41:50",
163
+ updateAt: "2025-11-28 13:41:50",
164
+ file: {
165
+ id: 4834,
166
+ type: "image",
167
+ contentType: "image/png",
168
+ ext: "png",
169
+ hash: "4045e1c401d5ecf186409c98f54a4aaf",
170
+ url: "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4045e1c401d5ecf186409c98f54a4aaf.png",
171
+ src: "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4045e1c401d5ecf186409c98f54a4aaf.png",
172
+ imageThumb:
173
+ "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4045e1c401d5ecf186409c98f54a4aaf_thumb.jpg",
174
+ imageWidth: 1029,
175
+ imageHeight: 630,
176
+ mediaLong: 0,
177
+ size: 56139,
178
+ sensitiveStatus: 1,
179
+ sensitiveAt: 0,
180
+ sensitiveTraceId: "",
181
+ sensitiveResult: null,
182
+ sensitiveEndAt: 0,
183
+ checkStatus: 0,
184
+ checkAuid: 0,
185
+ checkMark: "",
186
+ checkAt: 0,
187
+ createAt: "2025-11-28 13:41:06",
188
+ updateAt: "2025-11-28 13:41:06",
189
+ deleteAt: 0,
190
+ },
191
+ },
192
+ templateConfig: {
193
+ id: 7,
194
+ name: "双面布局",
195
+ previewImg:
196
+ "https://km-1257079185.cos.ap-chengdu.myqcloud.com/static/cardstyleV3/preview_01.png",
197
+ height: 210,
198
+ width: 343,
199
+ isBgCustomize: 0,
200
+ enableBgIds: "33,34",
201
+ enableItemIds: "1,2,3,4,5,9,12,13,14,15",
202
+ content: [
203
+ {
204
+ name: "双面布局",
205
+ width: 343,
206
+ height: 210,
207
+ children: [
208
+ {
209
+ id: "3",
210
+ key: "mobile",
211
+ icon: { name: "mobile", size: 10, style: "fill", enable: true },
212
+ type: "text",
213
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
214
+ layout: { x: 204, y: 157, mode: "absolute", width: 120, height: 13, zIndex: 1 },
215
+ binding: "user.mobile",
216
+ },
217
+ {
218
+ id: "4",
219
+ key: "duty",
220
+ type: "text",
221
+ style: { fontSize: 10, textAlign: "left", fontWeight: "normal", lineHeight: 14 },
222
+ layout: { x: 40, y: 96, mode: "absolute", width: 120, height: 14, zIndex: 2 },
223
+ binding: "user.duty",
224
+ },
225
+ {
226
+ id: "1",
227
+ key: "name",
228
+ type: "text",
229
+ style: { fontSize: 16, textAlign: "left", fontWeight: "bold", lineHeight: 22 },
230
+ layout: { x: 40, y: 70, mode: "absolute", width: 120, height: 22, zIndex: 3 },
231
+ binding: "user.name",
232
+ },
233
+ {
234
+ id: "2",
235
+ key: "company",
236
+ icon: { name: "company", size: 10, style: "fill", enable: true },
237
+ type: "text",
238
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
239
+ layout: { x: 15, y: 157, mode: "absolute", width: 162, height: 13, zIndex: 4 },
240
+ binding: "user.company",
241
+ },
242
+ {
243
+ id: "5",
244
+ key: "email",
245
+ icon: { name: "email", size: 10, style: "fill", enable: true },
246
+ type: "text",
247
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
248
+ layout: { x: 204, y: 181, mode: "absolute", width: 120, height: 13, zIndex: 9 },
249
+ binding: "user.email",
250
+ },
251
+ {
252
+ id: "9",
253
+ key: "address",
254
+ icon: { name: "address", size: 10, style: "fill", enable: true },
255
+ type: "text",
256
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
257
+ layout: { x: 15, y: 181, mode: "absolute", width: 162, height: 26, zIndex: 10 },
258
+ binding: "user.addressName",
259
+ },
260
+ ],
261
+ container: { mode: "absolute" },
262
+ fontColor: "#ffffff",
263
+ backgroundImage:
264
+ "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4045e1c401d5ecf186409c98f54a4aaf.png",
265
+ backgroundZIndex: 0,
266
+ },
267
+ {
268
+ name: "双面布局-反面",
269
+ width: 343,
270
+ height: 210,
271
+ children: [
272
+ {
273
+ id: "12",
274
+ key: "en_name",
275
+ type: "text",
276
+ style: { fontSize: 16, textAlign: "left", fontWeight: "bold", lineHeight: 22 },
277
+ layout: { x: 40, y: 70, mode: "absolute", width: 180, height: 22, zIndex: 1 },
278
+ binding: "user.moreCardInfo.extInfo.name",
279
+ },
280
+ {
281
+ id: "13",
282
+ key: "en_duty",
283
+ type: "text",
284
+ style: { fontSize: 10, textAlign: "left", fontWeight: "normal", lineHeight: 14 },
285
+ layout: { x: 40, y: 96, mode: "absolute", width: 180, height: 14, zIndex: 2 },
286
+ binding: "user.moreCardInfo.extInfo.duty",
287
+ },
288
+ {
289
+ id: "14",
290
+ key: "en_company",
291
+ icon: { name: "company", style: "fill", enable: true },
292
+ type: "text",
293
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
294
+ layout: { x: 16, y: 157, mode: "absolute", width: 173, height: 13, zIndex: 3 },
295
+ binding: "user.moreCardInfo.extInfo.company",
296
+ },
297
+ {
298
+ id: "15",
299
+ key: "en_address",
300
+ icon: { name: "address", style: "fill", enable: true },
301
+ type: "text",
302
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
303
+ layout: { x: 16, y: 181, mode: "absolute", width: 173, height: 26, zIndex: 4 },
304
+ binding: "user.moreCardInfo.extInfo.address",
305
+ },
306
+ {
307
+ id: "5",
308
+ key: "email",
309
+ icon: { name: "email", style: "fill", enable: true },
310
+ type: "text",
311
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
312
+ layout: { x: 206, y: 181, mode: "absolute", width: 130, height: 13, zIndex: 9 },
313
+ binding: "user.email",
314
+ },
315
+ {
316
+ id: "3",
317
+ key: "mobile",
318
+ icon: { name: "mobile", style: "fill", enable: true },
319
+ type: "text",
320
+ style: { fontSize: 9, textAlign: "left", fontWeight: "normal", lineHeight: 13 },
321
+ layout: { x: 206, y: 157, mode: "absolute", width: 130, height: 13, zIndex: 10 },
322
+ binding: "user.mobile",
323
+ },
324
+ ],
325
+ container: { mode: "absolute" },
326
+ fontColor: "#ffffff",
327
+ backgroundImage:
328
+ "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/image/202511/4045e1c401d5ecf186409c98f54a4aaf.png",
329
+ backgroundZIndex: 0,
330
+ },
331
+ ],
332
+ isDefault: 0,
333
+ isMoreCompany: 0,
334
+ isDouble: 1,
335
+ isVip: 1,
336
+ createAt: "2025-11-28 13:40:51",
337
+ updateAt: "2025-12-12 17:04:26",
338
+ },
339
+ },
340
+ shareImage:
341
+ "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/share/share_card_my_10094.png?key=1765607846",
342
+ moreCardInfo: {
343
+ duty: ["大大", "啊大大", "啊大大", "阿达啊", "啊大大"],
344
+ enInfo: { duty: "Kim", name: "Kayer", company: "kim" },
345
+ company: [],
346
+ extInfo: {
347
+ tel: "18454785698",
348
+ duty: "yingwenzhiwei",
349
+ name: "yingwenname",
350
+ domain: "www.baidu.com",
351
+ address: "yingwendizhi",
352
+ company: "yingwengongsi",
353
+ stockCode: "12121",
354
+ },
355
+ },
356
+ verifyAt: 1745910103,
357
+ jobCertifyAt: 0,
358
+ companyVerifyAt: 0,
359
+ spm: "u10094",
360
+ userId: 10094,
361
+ name: "灌灌灌灌",
362
+ image:
363
+ "https://km-1257079185.cos.ap-chengdu.myqcloud.com/local/avatar/202510/b60765d80e1f1af725988a97116b06d9.jpg",
364
+ imageId: 3687,
365
+ mobile: "18451976582",
366
+ duty: "嘎嘎嘎花城",
367
+ company: "嘎嘎嘎超小号",
368
+ companyId: 0,
369
+ email: "youxiang@qq.com",
370
+ wechat: "qeqe33小舅自己",
371
+ wechatQrcode: "",
372
+ address: "安徽省合肥市蜀山区望江ad啊大大阿达大大啊哒哒哒哒哒哒阿达大大阿达大大多大西路",
373
+ addressName: "蜀山区合力大厦A座(望江西路南100米)",
374
+ latitude: "31.829139",
375
+ longitude: "117.258776",
376
+ industry: "IT/互联网",
377
+ finishAt: 1742201476,
378
+ coin: 38,
379
+ showVisitor: 0,
380
+ showExperience: 1,
106
381
  },
107
382
  };
108
383
 
@@ -10,6 +10,10 @@ Component({
10
10
  type: Object,
11
11
  value: {},
12
12
  },
13
+ rootData: {
14
+ type: Object,
15
+ value: {},
16
+ },
13
17
  },
14
18
  data: {
15
19
  wrapperStyle: '',
@@ -19,6 +19,10 @@ Component({
19
19
  type: Object,
20
20
  value: {},
21
21
  },
22
+ rootData: {
23
+ type: Object,
24
+ value: {},
25
+ },
22
26
  },
23
27
  data: {
24
28
  wrapperStyle: '',
@@ -10,6 +10,10 @@ Component({
10
10
  type: Object,
11
11
  value: {},
12
12
  },
13
+ rootData: {
14
+ type: Object,
15
+ value: {},
16
+ },
13
17
  },
14
18
  data: {
15
19
  wrapperStyle: '',
@@ -21,9 +25,10 @@ Component({
21
25
  element(el) {
22
26
  if (!el)
23
27
  return;
28
+ const data = this.data.rootData || {};
24
29
  const wrapperStyle = (0, index_1.styleObjectToString)((0, index_1.buildWrapperStyle)(el, 'rpx'), 'rpx');
25
30
  const contentStyle = (0, index_1.styleObjectToString)((0, index_1.buildImageContentStyle)(el), 'rpx');
26
- const imageSrc = (0, index_1.getImageSrc)(el);
31
+ const imageSrc = (0, index_1.getImageSrc)(el, data);
27
32
  const mode = el.fit === 'contain' ? 'aspectFit' : 'aspectFill';
28
33
  this.setData({ wrapperStyle, contentStyle, imageSrc, mode });
29
34
  },
@@ -19,6 +19,10 @@ Component({
19
19
  type: Object,
20
20
  value: {},
21
21
  },
22
+ rootData: {
23
+ type: Object,
24
+ value: {},
25
+ },
22
26
  },
23
27
  data: {
24
28
  wrapperStyle: '',
@@ -30,9 +34,10 @@ Component({
30
34
  element(el) {
31
35
  if (!el)
32
36
  return;
37
+ const data = this.data.rootData || {};
33
38
  const wrapperStyle = (0, index_1.styleObjectToString)((0, index_1.buildWrapperStyle)(el, 'rpx'), 'rpx');
34
39
  const contentStyle = (0, index_1.styleObjectToString)((0, index_1.buildTextContentStyle)(el, 'rpx'), 'rpx');
35
- const textValue = (0, index_1.getTextValue)(el);
40
+ const textValue = (0, index_1.getTextValue)(el, data);
36
41
  const iconRaw = (0, index_1.buildTextIconMeta)(el, 'rpx');
37
42
  const iconMeta = iconRaw && iconRaw.name
38
43
  ? {
@@ -1,6 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const index_1 = require("../../vendor/km-card-layout-core/index");
4
+ const handleSpecialFields = (data) => {
5
+ var _a;
6
+ const user = (_a = data.user) !== null && _a !== void 0 ? _a : {};
7
+ return {
8
+ ...data,
9
+ user: {
10
+ ...user,
11
+ baseCompanyDuty: user.company && user.duty
12
+ ? `${user.company} ${user.duty}`
13
+ : user.baseCompanyDuty,
14
+ moreCardInfo: user.moreCardInfo
15
+ ? {
16
+ ...user.moreCardInfo,
17
+ company: Array.isArray(user.moreCardInfo.company)
18
+ ? user.moreCardInfo.company.map(item => `${item.company} ${item.duty}`)
19
+ : user.moreCardInfo.company,
20
+ }
21
+ : user.moreCardInfo,
22
+ },
23
+ };
24
+ };
4
25
  const ensureArray = (input) => {
5
26
  if (!input)
6
27
  return [];
@@ -51,6 +72,7 @@ Component({
51
72
  },
52
73
  data: {
53
74
  cards: [],
75
+ rootData: {},
54
76
  },
55
77
  observers: {
56
78
  layout() {
@@ -68,13 +90,14 @@ Component({
68
90
  methods: {
69
91
  rebuild() {
70
92
  const layoutInput = ensureArray(this.data.layout);
93
+ const rootData = handleSpecialFields(this.data.data);
71
94
  if (!layoutInput.length) {
72
- this.setData({ cards: [] });
95
+ this.setData({ cards: [], rootData });
73
96
  return;
74
97
  }
75
98
  const normalizedLayouts = (0, index_1.normalizeLayout)(layoutInput);
76
99
  const cards = buildCards(normalizedLayouts);
77
- this.setData({ cards });
100
+ this.setData({ cards, rootData });
78
101
  },
79
102
  },
80
103
  });
@@ -10,7 +10,7 @@
10
10
  mode="aspectFill"
11
11
  />
12
12
  <block wx:for="{{item.elements}}" wx:key="id">
13
- <template is="render-element" data="{{el:item}}" />
13
+ <template is="render-element" data="{{el:item, rootData: rootData}}" />
14
14
  </block>
15
15
  </view>
16
16
  </view>
@@ -19,24 +19,24 @@
19
19
 
20
20
  <template name="render-element">
21
21
  <block wx:if="{{el.type === 'image'}}">
22
- <image-element element="{{el}}" />
22
+ <image-element element="{{el}}" rootData="{{rootData}}" />
23
23
  </block>
24
24
  <block wx:elif="{{el.type === 'icon'}}">
25
- <icon-element element="{{el}}" />
25
+ <icon-element element="{{el}}" rootData="{{rootData}}" />
26
26
  </block>
27
27
  <block wx:elif="{{el.type === 'layout-panel'}}">
28
28
  <view class="km-node" style="{{el.wrapperStyle}}">
29
29
  <view class="km-node__panel" style="{{el.contentStyle}}">
30
30
  <block wx:for="{{el.children}}" wx:key="id">
31
- <template is="render-element" data="{{el:item}}" />
31
+ <template is="render-element" data="{{el:item, rootData: rootData}}" />
32
32
  </block>
33
33
  </view>
34
34
  </view>
35
35
  </block>
36
36
  <block wx:elif="{{el.type === 'custom'}}">
37
- <custom-element element="{{el}}" />
37
+ <custom-element element="{{el}}" rootData="{{rootData}}" />
38
38
  </block>
39
39
  <block wx:else>
40
- <text-element element="{{el}}" />
40
+ <text-element element="{{el}}" rootData="{{rootData}}" />
41
41
  </block>
42
42
  </template>
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTemplateBackgrounds = exports.getTemplateItems = exports.applyItemCollectBindings = exports.stripLayoutBindings = void 0;
3
+ exports.applyItemCollectBindings = exports.stripLayoutBindings = void 0;
4
4
  function stripLayoutBindings(layouts = []) {
5
5
  const targetLayouts = Array.isArray(layouts) ? layouts : [];
6
6
  const stripElement = (el) => {
@@ -66,13 +66,3 @@ function applyItemCollectBindings(layouts = [], items = []) {
66
66
  }));
67
67
  }
68
68
  exports.applyItemCollectBindings = applyItemCollectBindings;
69
- function getTemplateItems(ids, items) {
70
- const idArray = ids.split(',').map(id => id.trim());
71
- return items.filter(item => idArray.includes(String(item.id)));
72
- }
73
- exports.getTemplateItems = getTemplateItems;
74
- function getTemplateBackgrounds(ids, items) {
75
- const idArray = ids.split(',').map(id => id.trim());
76
- return items.filter(item => idArray.includes(String(item.id)));
77
- }
78
- exports.getTemplateBackgrounds = getTemplateBackgrounds;
@@ -29,7 +29,7 @@ const readByPath = (data, path) => {
29
29
  }
30
30
  return cursor;
31
31
  };
32
- const resolveBindingValue = (binding, rootData, context) => {
32
+ const resolveBindingValue = (binding, rootData) => {
33
33
  if (!binding)
34
34
  return undefined;
35
35
  const value = readByPath(rootData, binding);