ts-glitter 21.9.2 → 21.9.6
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/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-product.js +1 -1
- package/lowcode/backend-manager/bg-product.ts +2 -1
- package/lowcode/cms-plugin/app-market-install.js +97 -0
- package/lowcode/cms-plugin/app-market-install.ts +123 -0
- package/lowcode/cms-plugin/app-market-published.js +42 -0
- package/lowcode/cms-plugin/app-market-published.ts +70 -0
- package/lowcode/cms-plugin/app-market.js +286 -0
- package/lowcode/cms-plugin/app-market.ts +343 -0
- package/lowcode/cms-plugin/filter-options.js +7 -0
- package/lowcode/cms-plugin/filter-options.ts +10 -0
- package/lowcode/cms-plugin/shopping-information.js +19 -463
- package/lowcode/cms-plugin/shopping-information.ts +50 -582
- package/lowcode/css/editor.css +13 -0
- package/lowcode/glitter-base/global/language.js +6 -0
- package/lowcode/glitter-base/global/language.ts +6 -0
- package/lowcode/glitter-base/route/market.js +43 -0
- package/lowcode/glitter-base/route/market.ts +47 -0
- package/lowcode/glitter-base/route/shopping.js +15 -0
- package/lowcode/glitter-base/route/shopping.ts +24 -5
- package/lowcode/glitterBundle/dialog/dialog.js +2 -2
- package/lowcode/glitterBundle/dialog/dialog.ts +5 -5
- package/lowcode/jspage/function-page/main_editor.js +2 -2
- package/lowcode/jspage/function-page/main_editor.ts +2 -2
- package/lowcode/jspage/function-page/setting_editor.js +27 -0
- package/lowcode/jspage/function-page/setting_editor.ts +27 -0
- package/lowcode/public-components/user-manager/um-order.js +158 -60
- package/lowcode/public-components/user-manager/um-order.ts +229 -73
- package/package.json +1 -1
- package/src/api-public/controllers/app-market.d.ts +3 -0
- package/src/api-public/controllers/app-market.js +51 -0
- package/src/api-public/controllers/app-market.js.map +1 -0
- package/src/api-public/controllers/app-market.ts +59 -0
- package/src/api-public/controllers/index.js +3 -0
- package/src/api-public/controllers/index.js.map +1 -1
- package/src/api-public/controllers/index.ts +3 -0
- package/src/api-public/controllers/shop.js +38 -6
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +94 -61
- package/src/api-public/controllers/user.js +2 -2
- package/src/api-public/controllers/user.js.map +1 -1
- package/src/api-public/controllers/user.ts +2 -3
- package/src/api-public/services/app-market.d.ts +26 -0
- package/src/api-public/services/app-market.js +385 -0
- package/src/api-public/services/app-market.js.map +1 -0
- package/src/api-public/services/app-market.ts +412 -0
- package/src/api-public/services/auto-send-email.js +4 -3
- package/src/api-public/services/auto-send-email.js.map +1 -1
- package/src/api-public/services/auto-send-email.ts +3 -2
- package/src/api-public/services/checkout-event.js +7 -26
- package/src/api-public/services/checkout-event.js.map +1 -1
- package/src/api-public/services/checkout-event.ts +18 -43
- package/src/api-public/services/model/handlePaymentTransaction.js +0 -1
- package/src/api-public/services/model/handlePaymentTransaction.js.map +1 -1
- package/src/api-public/services/model/handlePaymentTransaction.ts +3 -81
- package/src/api-public/services/shopping.d.ts +1 -0
- package/src/api-public/services/shopping.js +7 -7
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +15 -59
- package/src/api-public/services/user.js +2 -2
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +2 -2
- package/src/config.d.ts +1 -0
- package/src/config.js +1 -0
- package/src/config.js.map +1 -1
- package/src/config.ts +1 -0
- package/src/public-config-initial/auto-fcm.d.ts +1 -0
- package/src/public-config-initial/auto-fcm.js +6 -4
- package/src/public-config-initial/auto-fcm.js.map +1 -1
- package/src/public-config-initial/auto-fcm.ts +14 -9
- package/src/services/app.js +7 -17
- package/src/services/app.js.map +1 -1
- package/src/services/backend-service.js +7 -17
- package/src/services/backend-service.js.map +1 -1
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { GVC } from '../glitterBundle/GVController.js';
|
|
2
|
+
import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
|
|
3
|
+
import { BgWidget } from '../backend-manager/bg-widget.js';
|
|
4
|
+
import { EditorElem } from '../glitterBundle/plugins/editor-elem.js';
|
|
5
|
+
import { ApiWallet } from '../glitter-base/route/wallet.js';
|
|
6
|
+
import { UserList } from './user-list.js';
|
|
7
|
+
import { Tool } from '../modules/tool.js';
|
|
8
|
+
import { FilterOptions } from '../cms-plugin/filter-options.js';
|
|
9
|
+
import { ApiUser } from '../glitter-base/route/user.js';
|
|
10
|
+
import { ApiMarket } from '../glitter-base/route/market.js';
|
|
11
|
+
|
|
12
|
+
const html = String.raw;
|
|
13
|
+
const css = String.raw;
|
|
14
|
+
|
|
15
|
+
interface Banner {
|
|
16
|
+
image: string;
|
|
17
|
+
link: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface App {
|
|
21
|
+
name: string;
|
|
22
|
+
image: string;
|
|
23
|
+
link: string;
|
|
24
|
+
rate: number;
|
|
25
|
+
rate_count: number;
|
|
26
|
+
description: string;
|
|
27
|
+
tag: string[];
|
|
28
|
+
price: number;
|
|
29
|
+
download_count: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class AppMarket {
|
|
33
|
+
public static main(gvc: GVC) {
|
|
34
|
+
const glitter = gvc.glitter;
|
|
35
|
+
const vm: {
|
|
36
|
+
orderString: any;
|
|
37
|
+
query: any;
|
|
38
|
+
id: string;
|
|
39
|
+
card_list_id: string;
|
|
40
|
+
tag_list_id: string;
|
|
41
|
+
type: 'landing' | 'detail';
|
|
42
|
+
banner: Banner;
|
|
43
|
+
app_list: App[];
|
|
44
|
+
show_app_list: App[];
|
|
45
|
+
tag_list: string[];
|
|
46
|
+
show_tag: string;
|
|
47
|
+
} = {
|
|
48
|
+
id: glitter.getUUID(),
|
|
49
|
+
card_list_id: glitter.getUUID(),
|
|
50
|
+
tag_list_id: glitter.getUUID(),
|
|
51
|
+
type: 'landing',
|
|
52
|
+
banner: {
|
|
53
|
+
image:
|
|
54
|
+
'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/size1440_s*px$_ses9s7s5sbs5sbse_%E5%AE%B6%E5%85%B7banner2.png',
|
|
55
|
+
link: '',
|
|
56
|
+
},
|
|
57
|
+
app_list: [],
|
|
58
|
+
show_app_list: [],
|
|
59
|
+
tag_list: [],
|
|
60
|
+
show_tag: '',
|
|
61
|
+
query: '',
|
|
62
|
+
orderString: 'name',
|
|
63
|
+
};
|
|
64
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
65
|
+
|
|
66
|
+
// { key: 'default', value: '預設' },
|
|
67
|
+
// { key: 'popularity_desc', value: '熱門程度高>低' },
|
|
68
|
+
// { key: 'popularity_asc', value: '熱門程度低>高' },
|
|
69
|
+
// { key: 'price_desc', value: '定價高>低' },
|
|
70
|
+
// { key: 'price_asc', value: '定價高>低' },
|
|
71
|
+
const sortByName = () => {
|
|
72
|
+
return vm.show_app_list.sort((a, b) => a.name.localeCompare(b.name));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const sortByPopularDesc = () => {
|
|
76
|
+
return vm.show_app_list.sort((a, b) => b.download_count - a.download_count);
|
|
77
|
+
};
|
|
78
|
+
const sortByPopularAsc = () => {
|
|
79
|
+
return sortByPopularDesc().reverse();
|
|
80
|
+
};
|
|
81
|
+
const sortByPriceDesc = () => {
|
|
82
|
+
return vm.show_app_list.sort((a, b) => b.price - a.price);
|
|
83
|
+
};
|
|
84
|
+
const sortByPriceAsc = () => {
|
|
85
|
+
return sortByPriceDesc().reverse();
|
|
86
|
+
};
|
|
87
|
+
const sortFun: Record<string, () => App[]> = {
|
|
88
|
+
name: sortByName,
|
|
89
|
+
popularity_desc: sortByPopularDesc,
|
|
90
|
+
popularity_asc: sortByPopularAsc,
|
|
91
|
+
price_desc: sortByPriceDesc,
|
|
92
|
+
price_asc: sortByPriceAsc,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
function drawBanner() {
|
|
96
|
+
gvc.addStyle(css`
|
|
97
|
+
.banner {
|
|
98
|
+
background-image: url('${vm.banner.image}');
|
|
99
|
+
background-position: center;
|
|
100
|
+
background-size: cover;
|
|
101
|
+
background-repeat: no-repeat;
|
|
102
|
+
height: 250px;
|
|
103
|
+
width: 100%;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.banner h1 {
|
|
107
|
+
font-size: 24px;
|
|
108
|
+
margin-bottom: 10px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.banner p {
|
|
112
|
+
font-size: 16px;
|
|
113
|
+
margin-bottom: 20px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.btn {
|
|
117
|
+
background-color: #fff;
|
|
118
|
+
color: #4caf50;
|
|
119
|
+
padding: 10px 20px;
|
|
120
|
+
font-size: 16px;
|
|
121
|
+
text-decoration: none;
|
|
122
|
+
border-radius: 5px;
|
|
123
|
+
transition: background-color 0.3s ease;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.btn:hover {
|
|
127
|
+
background-color: #45a049; /* Darker green on hover */
|
|
128
|
+
color: white;
|
|
129
|
+
}
|
|
130
|
+
`);
|
|
131
|
+
return html`<!-- Banner Section -->
|
|
132
|
+
<div class="banner"></div> `;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function getAppList() {
|
|
136
|
+
ApiMarket.getAppList().then((dd: any) => {
|
|
137
|
+
vm.app_list = dd.response;
|
|
138
|
+
filterAppTag();
|
|
139
|
+
gvc.notifyDataChange(vm.id);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function drawCard(app: App) {
|
|
144
|
+
gvc.addStyle(css`
|
|
145
|
+
.app-card {
|
|
146
|
+
border-radius: 10px;
|
|
147
|
+
border: 1px solid #ddd;
|
|
148
|
+
background: #fff;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.card-image {
|
|
152
|
+
padding-top: 50%;
|
|
153
|
+
width: 100%;
|
|
154
|
+
background-size: cover;
|
|
155
|
+
background-position: center;
|
|
156
|
+
background-repeat: no-repeat;
|
|
157
|
+
}
|
|
158
|
+
.app-card .tag{
|
|
159
|
+
height: 22px;
|
|
160
|
+
padding: 2px 8px;
|
|
161
|
+
border-radius: 5px;
|
|
162
|
+
background: #EAEAEA;
|
|
163
|
+
letter-spacing: 0.28px;
|
|
164
|
+
font-size: 14px;
|
|
165
|
+
font-weight: 400;
|
|
166
|
+
}
|
|
167
|
+
`);
|
|
168
|
+
function drawTag(tag : string) {
|
|
169
|
+
return html`<div class="tag d-flex align-items-center">${tag}</div>
|
|
170
|
+
`
|
|
171
|
+
}
|
|
172
|
+
return html`
|
|
173
|
+
<div class="col-6 col-xl-3 px-3 pb-4" style="">
|
|
174
|
+
<div class="d-flex flex-column app-card">
|
|
175
|
+
<div class="card-image" style="background-image:url('${app.image}') "></div>
|
|
176
|
+
<div class="d-flex flex-column " style="gap:10px;padding: 12px;">
|
|
177
|
+
<div class="d-flex flex-column" style="gap: 6px;">
|
|
178
|
+
<div class="d-flex flex-column" style="gap: 2px">
|
|
179
|
+
<div class="tx_700 tx_normal">${app.name}</div>
|
|
180
|
+
<div class="d-flex" style="gap:4px">
|
|
181
|
+
<div class="d-flex flex-fill align-items-center" style="gap: 4px;">
|
|
182
|
+
<i class="fa-solid fa-star" style="color: #FFB21C;"></i>
|
|
183
|
+
<div class="tx_yellow_12">${app.rate}</div>
|
|
184
|
+
<div class="tx_gray_12">(${app.rate_count})</div>
|
|
185
|
+
</div>
|
|
186
|
+
<div class="tx_gray_14" style="letter-spacing: 0.28px;">${app.price == 0 ? '免費' : app.price}</div>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
<div class="tx_normal_14 text-break" style="letter-spacing: 0.28px;">
|
|
190
|
+
${Tool.truncateString(app.description, 12)}
|
|
191
|
+
</div>
|
|
192
|
+
</div>
|
|
193
|
+
<div class="d-flex" style="gap: 6px">
|
|
194
|
+
${app.tag.map(tag => {
|
|
195
|
+
return drawTag(tag)
|
|
196
|
+
}).join('')}
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
`;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function filterAppTag() {
|
|
205
|
+
vm.app_list.forEach(app => {
|
|
206
|
+
app.tag.forEach(tag => {
|
|
207
|
+
if (vm.tag_list.indexOf(tag) == -1) {
|
|
208
|
+
vm.tag_list.push(tag);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function drawTag(tag: string) {
|
|
215
|
+
gvc.addStyle(css`
|
|
216
|
+
.app-tag {
|
|
217
|
+
display: flex;
|
|
218
|
+
height: 40px;
|
|
219
|
+
padding: 6px 18px;
|
|
220
|
+
justify-content: center;
|
|
221
|
+
align-items: center;
|
|
222
|
+
border-radius: 10px;
|
|
223
|
+
border: 1px solid #ddd;
|
|
224
|
+
background: #fff;
|
|
225
|
+
white-space: nowrap;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.app-tag-active {
|
|
229
|
+
background-color: #dddddd;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.app-tag:hover {
|
|
233
|
+
background-color: #dddddd;
|
|
234
|
+
}
|
|
235
|
+
`);
|
|
236
|
+
return html`
|
|
237
|
+
<div
|
|
238
|
+
class="app-tag ${vm.show_tag == tag ? 'app-tag-active' : ''}"
|
|
239
|
+
onclick="${gvc.event(() => {
|
|
240
|
+
vm.show_tag = vm.show_tag === tag ? '' : tag;
|
|
241
|
+
gvc.notifyDataChange(vm.id);
|
|
242
|
+
})}"
|
|
243
|
+
>
|
|
244
|
+
${tag}
|
|
245
|
+
</div>
|
|
246
|
+
`;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function drawSearchBar() {
|
|
250
|
+
return html` <div class="d-flex w-100" style="gap:14px;margin-bottom: 18px;">
|
|
251
|
+
${BgWidget.searchFilter(
|
|
252
|
+
gvc.event(e => {
|
|
253
|
+
vm.query = e.value;
|
|
254
|
+
gvc.notifyDataChange(vm.id);
|
|
255
|
+
}),
|
|
256
|
+
vm.query || '',
|
|
257
|
+
'搜尋APP'
|
|
258
|
+
)}
|
|
259
|
+
${BgWidget.updownFilter({
|
|
260
|
+
gvc,
|
|
261
|
+
callback: (value: any) => {
|
|
262
|
+
vm.orderString = value;
|
|
263
|
+
gvc.notifyDataChange(vm.id);
|
|
264
|
+
},
|
|
265
|
+
default: vm.orderString || 'default',
|
|
266
|
+
options: FilterOptions.appMarketOrderBy,
|
|
267
|
+
})}
|
|
268
|
+
</div>`;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return gvc.bindView(() => {
|
|
272
|
+
return {
|
|
273
|
+
bind: vm.id,
|
|
274
|
+
dataList: [{ obj: vm, key: 'type' }],
|
|
275
|
+
view: () => {
|
|
276
|
+
if (vm.type === 'landing') {
|
|
277
|
+
if (vm.app_list.length === 0) {
|
|
278
|
+
getAppList();
|
|
279
|
+
}
|
|
280
|
+
vm.show_app_list = vm.show_app_list.length ? vm.show_app_list : vm.app_list;
|
|
281
|
+
return html`
|
|
282
|
+
${drawBanner()}
|
|
283
|
+
<div class="px-4">
|
|
284
|
+
${BgWidget.mainCard(
|
|
285
|
+
gvc.bindView({
|
|
286
|
+
bind: vm.tag_list_id,
|
|
287
|
+
view: () => {
|
|
288
|
+
return vm.tag_list
|
|
289
|
+
.map(tag => {
|
|
290
|
+
return drawTag(tag);
|
|
291
|
+
})
|
|
292
|
+
.join('');
|
|
293
|
+
},
|
|
294
|
+
divCreate: {
|
|
295
|
+
class: 'd-flex w-100 overflow-scroll',
|
|
296
|
+
style: 'gap:10px;margin-bottom:10px',
|
|
297
|
+
},
|
|
298
|
+
}) +
|
|
299
|
+
drawSearchBar() +
|
|
300
|
+
gvc.bindView({
|
|
301
|
+
bind: vm.card_list_id,
|
|
302
|
+
view: () => {
|
|
303
|
+
function filterApp() {
|
|
304
|
+
if (vm.show_tag.length) {
|
|
305
|
+
vm.show_app_list = vm.app_list.filter(app => {
|
|
306
|
+
return app.tag.indexOf(vm.show_tag) != -1;
|
|
307
|
+
});
|
|
308
|
+
} else {
|
|
309
|
+
vm.show_app_list = vm.app_list;
|
|
310
|
+
}
|
|
311
|
+
vm.show_app_list = sortFun[vm.orderString ?? 'name']();
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
filterApp();
|
|
315
|
+
return vm.show_app_list
|
|
316
|
+
.map(app => {
|
|
317
|
+
return drawCard(app);
|
|
318
|
+
})
|
|
319
|
+
.join('');
|
|
320
|
+
},
|
|
321
|
+
divCreate: {
|
|
322
|
+
class: 'd-flex flex-wrap ',
|
|
323
|
+
style: '',
|
|
324
|
+
},
|
|
325
|
+
}),
|
|
326
|
+
'px-3'
|
|
327
|
+
)}
|
|
328
|
+
</div>
|
|
329
|
+
`;
|
|
330
|
+
} else {
|
|
331
|
+
return ``;
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
divCreate: {
|
|
335
|
+
class: 'd-flex flex-column',
|
|
336
|
+
style: 'gap: 24px;',
|
|
337
|
+
},
|
|
338
|
+
};
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
(window as any).glitter.setModule(import.meta.url, AppMarket);
|
|
@@ -583,6 +583,13 @@ FilterOptions.imageLibraryOrderBy = [
|
|
|
583
583
|
{ key: 'name_AtoZ', value: '圖片名稱A>Z' },
|
|
584
584
|
{ key: 'name_ZtoA', value: '圖片名稱Z>A' },
|
|
585
585
|
];
|
|
586
|
+
FilterOptions.appMarketOrderBy = [
|
|
587
|
+
{ key: 'default', value: '預設' },
|
|
588
|
+
{ key: 'popularity_desc', value: '熱門程度高>低' },
|
|
589
|
+
{ key: 'popularity_asc', value: '熱門程度低>高' },
|
|
590
|
+
{ key: 'price_desc', value: '定價高>低' },
|
|
591
|
+
{ key: 'price_asc', value: '定價高>低' },
|
|
592
|
+
];
|
|
586
593
|
FilterOptions.productSelect = [
|
|
587
594
|
{ key: 'title', value: '商品名稱' },
|
|
588
595
|
{ key: 'sku', value: '庫存單位(SKU)' },
|
|
@@ -615,6 +615,16 @@ export class FilterOptions {
|
|
|
615
615
|
// { key: 'stock_asc', value: '庫存數量少 > 多' },
|
|
616
616
|
];
|
|
617
617
|
|
|
618
|
+
static appMarketOrderBy = [
|
|
619
|
+
{ key: 'default', value: '預設' },
|
|
620
|
+
{ key: 'popularity_desc', value: '熱門程度高>低' },
|
|
621
|
+
{ key: 'popularity_asc', value: '熱門程度低>高' },
|
|
622
|
+
{ key: 'price_desc', value: '定價高>低' },
|
|
623
|
+
{ key: 'price_asc', value: '定價高>低' },
|
|
624
|
+
// { key: 'stock_desc', value: '庫存數量多 > 少' },
|
|
625
|
+
// { key: 'stock_asc', value: '庫存數量少 > 多' },
|
|
626
|
+
];
|
|
627
|
+
|
|
618
628
|
static productSelect = [
|
|
619
629
|
{ key: 'title', value: '商品名稱' },
|
|
620
630
|
{ key: 'sku', value: '庫存單位(SKU)' },
|