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
package/lowcode/Entry.js
CHANGED
|
@@ -151,7 +151,7 @@ export class Entry {
|
|
|
151
151
|
}
|
|
152
152
|
window.renderClock = (_b = window.renderClock) !== null && _b !== void 0 ? _b : createClock();
|
|
153
153
|
console.log(`Entry-time:`, window.renderClock.stop());
|
|
154
|
-
glitter.share.editerVersion = 'V_21.9.
|
|
154
|
+
glitter.share.editerVersion = 'V_21.9.6';
|
|
155
155
|
glitter.share.start = new Date();
|
|
156
156
|
const vm = { appConfig: [] };
|
|
157
157
|
window.saasConfig = {
|
package/lowcode/Entry.ts
CHANGED
|
@@ -155,7 +155,7 @@ export class Entry {
|
|
|
155
155
|
}
|
|
156
156
|
(window as any).renderClock = (window as any).renderClock ?? createClock();
|
|
157
157
|
console.log(`Entry-time:`, (window as any).renderClock.stop());
|
|
158
|
-
glitter.share.editerVersion = 'V_21.9.
|
|
158
|
+
glitter.share.editerVersion = 'V_21.9.6';
|
|
159
159
|
glitter.share.start = new Date();
|
|
160
160
|
const vm = { appConfig: [] };
|
|
161
161
|
(window as any).saasConfig = {
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
|
|
2
|
+
import { BgWidget } from '../backend-manager/bg-widget.js';
|
|
3
|
+
import { Tool } from '../modules/tool.js';
|
|
4
|
+
import { ApiMarket } from '../glitter-base/route/market.js';
|
|
5
|
+
const html = String.raw;
|
|
6
|
+
const css = String.raw;
|
|
7
|
+
export class AppMarketInstall {
|
|
8
|
+
static drawAppList(gvc, card_list_id, app_list) {
|
|
9
|
+
gvc.addStyle(css `
|
|
10
|
+
.app-card-border{
|
|
11
|
+
border-radius: 10px;
|
|
12
|
+
padding-bottom:18px;
|
|
13
|
+
}
|
|
14
|
+
.app-card{
|
|
15
|
+
display: flex;
|
|
16
|
+
padding: 20px;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
gap: 24px;
|
|
19
|
+
border-radius: 10px;
|
|
20
|
+
background: #FFF;
|
|
21
|
+
}
|
|
22
|
+
`);
|
|
23
|
+
return gvc.bindView({
|
|
24
|
+
bind: card_list_id,
|
|
25
|
+
view: () => {
|
|
26
|
+
return app_list.map(app => {
|
|
27
|
+
return html `
|
|
28
|
+
<div class="app-card-border col-12 col-xl-4 ps-3 ps-xl-0 pe-3">
|
|
29
|
+
<div class="app-card">
|
|
30
|
+
<div class="d-flex" style="gap: 12px;">
|
|
31
|
+
<div class="h-100">
|
|
32
|
+
<img src="${app.image}" style="width: 40px;height: 40px;" alt="logo" />
|
|
33
|
+
</div>
|
|
34
|
+
<div class="d-flex flex-column flex-fill" style="gap: 6px;">
|
|
35
|
+
<div class="tx_700" style="line-height: 100%;">${app.name}</div>
|
|
36
|
+
<div class="d-flex w-100">
|
|
37
|
+
<div class="w-100 tx_yellow_14 d-flex align-items-center" style="gap:4px;">
|
|
38
|
+
<i class="fa-solid fa-star"></i>
|
|
39
|
+
<div class="tx_yellow_14">${app.rate}</div>
|
|
40
|
+
<div class="tx_gray_12 h-100 d-flex align-items-end">(${app.rate_count})</div>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="ms-auto tx_gray_14">${app.price == 0 ? '免費' : app.price}</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="d-flex tx_gray_14">
|
|
45
|
+
${Tool.truncateString(app.description, 21)}
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div class="w-100 d-flex justify-content-end" style="gap:12px;">
|
|
50
|
+
${BgWidget.cancel('', '移除')}
|
|
51
|
+
<button class="btn btn-gray tx_700" style="color:#393939">查看</button>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
`;
|
|
56
|
+
}).join('');
|
|
57
|
+
}, divCreate: {
|
|
58
|
+
class: 'd-flex flex-wrap',
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
static main(gvc) {
|
|
63
|
+
const that = this;
|
|
64
|
+
const glitter = gvc.glitter;
|
|
65
|
+
const vm = {
|
|
66
|
+
id: glitter.getUUID(),
|
|
67
|
+
card_list_id: glitter.getUUID(),
|
|
68
|
+
app_list: [],
|
|
69
|
+
};
|
|
70
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
71
|
+
function getAppList() {
|
|
72
|
+
ApiMarket.getInstallAppList().then((dd) => {
|
|
73
|
+
vm.app_list = dd.response;
|
|
74
|
+
gvc.notifyDataChange(vm.id);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return gvc.bindView(() => {
|
|
78
|
+
return {
|
|
79
|
+
bind: vm.id,
|
|
80
|
+
dataList: [{ obj: vm, key: 'type' }],
|
|
81
|
+
view: () => {
|
|
82
|
+
if (vm.app_list.length === 0) {
|
|
83
|
+
getAppList();
|
|
84
|
+
}
|
|
85
|
+
return BgWidget.container(html `
|
|
86
|
+
<div class="tx_700 ps-3" style="font-size: 24px;margin-bottom: 18px;">已安裝APP</div>
|
|
87
|
+
${that.drawAppList(gvc, vm.card_list_id, vm.app_list)}
|
|
88
|
+
`);
|
|
89
|
+
}, divCreate: {
|
|
90
|
+
class: 'd-flex flex-column',
|
|
91
|
+
style: 'gap: 24px;'
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
window.glitter.setModule(import.meta.url, AppMarketInstall);
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
const html=String.raw;
|
|
12
|
+
const css = String.raw;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
interface App {
|
|
16
|
+
name: string;
|
|
17
|
+
image: string;
|
|
18
|
+
link: string;
|
|
19
|
+
rate: number;
|
|
20
|
+
rate_count: number;
|
|
21
|
+
description: string;
|
|
22
|
+
tag: string[];
|
|
23
|
+
price: number;
|
|
24
|
+
}
|
|
25
|
+
export class AppMarketInstall {
|
|
26
|
+
public static drawAppList(gvc:GVC , card_list_id:string , app_list:App[]){
|
|
27
|
+
gvc.addStyle(css`
|
|
28
|
+
.app-card-border{
|
|
29
|
+
border-radius: 10px;
|
|
30
|
+
padding-bottom:18px;
|
|
31
|
+
}
|
|
32
|
+
.app-card{
|
|
33
|
+
display: flex;
|
|
34
|
+
padding: 20px;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
gap: 24px;
|
|
37
|
+
border-radius: 10px;
|
|
38
|
+
background: #FFF;
|
|
39
|
+
}
|
|
40
|
+
`)
|
|
41
|
+
return gvc.bindView({
|
|
42
|
+
bind:card_list_id,
|
|
43
|
+
view:()=>{
|
|
44
|
+
return app_list.map(app=>{
|
|
45
|
+
return html `
|
|
46
|
+
<div class="app-card-border col-12 col-xl-4 ps-3 ps-xl-0 pe-3">
|
|
47
|
+
<div class="app-card">
|
|
48
|
+
<div class="d-flex" style="gap: 12px;">
|
|
49
|
+
<div class="h-100">
|
|
50
|
+
<img src="${app.image}" style="width: 40px;height: 40px;" alt="logo" />
|
|
51
|
+
</div>
|
|
52
|
+
<div class="d-flex flex-column flex-fill" style="gap: 6px;">
|
|
53
|
+
<div class="tx_700" style="line-height: 100%;">${app.name}</div>
|
|
54
|
+
<div class="d-flex w-100">
|
|
55
|
+
<div class="w-100 tx_yellow_14 d-flex align-items-center" style="gap:4px;">
|
|
56
|
+
<i class="fa-solid fa-star"></i>
|
|
57
|
+
<div class="tx_yellow_14">${app.rate}</div>
|
|
58
|
+
<div class="tx_gray_12 h-100 d-flex align-items-end">(${app.rate_count})</div>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="ms-auto tx_gray_14">${app.price == 0 ? '免費' : app.price}</div>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="d-flex tx_gray_14">
|
|
63
|
+
${Tool.truncateString(app.description, 21)}
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="w-100 d-flex justify-content-end" style="gap:12px;">
|
|
68
|
+
${BgWidget.cancel('','移除')}
|
|
69
|
+
<button class="btn btn-gray tx_700" style="color:#393939">查看</button>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
`
|
|
74
|
+
}).join('')
|
|
75
|
+
},divCreate:{
|
|
76
|
+
class:'d-flex flex-wrap',
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
public static main(gvc: GVC) {
|
|
82
|
+
const that = this;
|
|
83
|
+
const glitter = gvc.glitter;
|
|
84
|
+
const vm: {
|
|
85
|
+
id: string;
|
|
86
|
+
card_list_id: string;
|
|
87
|
+
app_list: App[];
|
|
88
|
+
} = {
|
|
89
|
+
id: glitter.getUUID(),
|
|
90
|
+
card_list_id: glitter.getUUID(),
|
|
91
|
+
app_list: [],
|
|
92
|
+
};
|
|
93
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
94
|
+
function getAppList() {
|
|
95
|
+
ApiMarket.getInstallAppList().then((dd: any) => {
|
|
96
|
+
vm.app_list = dd.response;
|
|
97
|
+
gvc.notifyDataChange(vm.id);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return gvc.bindView(() => {
|
|
101
|
+
return {
|
|
102
|
+
bind: vm.id,
|
|
103
|
+
dataList: [{ obj: vm, key: 'type' }],
|
|
104
|
+
view: () => {
|
|
105
|
+
if (vm.app_list.length === 0) {
|
|
106
|
+
getAppList()
|
|
107
|
+
}
|
|
108
|
+
return BgWidget.container(html`
|
|
109
|
+
<div class="tx_700 ps-3" style="font-size: 24px;margin-bottom: 18px;">已安裝APP</div>
|
|
110
|
+
${that.drawAppList(gvc,vm.card_list_id,vm.app_list)}
|
|
111
|
+
`)
|
|
112
|
+
|
|
113
|
+
},divCreate:{
|
|
114
|
+
class:'d-flex flex-column',
|
|
115
|
+
style:'gap: 24px;'
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
(window as any).glitter.setModule(import.meta.url, AppMarketInstall);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
|
|
2
|
+
import { BgWidget } from '../backend-manager/bg-widget.js';
|
|
3
|
+
import { ApiMarket } from '../glitter-base/route/market.js';
|
|
4
|
+
import { AppMarketInstall } from './app-market-install.js';
|
|
5
|
+
const html = String.raw;
|
|
6
|
+
const css = String.raw;
|
|
7
|
+
export class AppMarketPublished {
|
|
8
|
+
static main(gvc) {
|
|
9
|
+
const glitter = gvc.glitter;
|
|
10
|
+
const vm = {
|
|
11
|
+
id: glitter.getUUID(),
|
|
12
|
+
card_list_id: glitter.getUUID(),
|
|
13
|
+
app_list: [],
|
|
14
|
+
};
|
|
15
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
16
|
+
function getAppList() {
|
|
17
|
+
ApiMarket.getPublishedAppList().then((dd) => {
|
|
18
|
+
vm.app_list = dd.response;
|
|
19
|
+
gvc.notifyDataChange(vm.id);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return gvc.bindView(() => {
|
|
23
|
+
return {
|
|
24
|
+
bind: vm.id,
|
|
25
|
+
dataList: [{ obj: vm, key: 'type' }],
|
|
26
|
+
view: () => {
|
|
27
|
+
if (vm.app_list.length === 0) {
|
|
28
|
+
getAppList();
|
|
29
|
+
}
|
|
30
|
+
return BgWidget.container(html `
|
|
31
|
+
<div class="tx_700 ps-3" style="font-size: 24px;margin-bottom: 18px;">已發佈APP</div>
|
|
32
|
+
${AppMarketInstall.drawAppList(gvc, vm.card_list_id, vm.app_list)}
|
|
33
|
+
`);
|
|
34
|
+
}, divCreate: {
|
|
35
|
+
class: 'd-flex flex-column',
|
|
36
|
+
style: 'gap: 24px;'
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
window.glitter.setModule(import.meta.url, AppMarketPublished);
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
import { AppMarketInstall } from './app-market-install.js';
|
|
12
|
+
|
|
13
|
+
const html=String.raw;
|
|
14
|
+
const css = String.raw;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
interface App {
|
|
18
|
+
name: string;
|
|
19
|
+
image: string;
|
|
20
|
+
link: string;
|
|
21
|
+
rate: number;
|
|
22
|
+
rate_count: number;
|
|
23
|
+
description: string;
|
|
24
|
+
tag: string[];
|
|
25
|
+
price: number;
|
|
26
|
+
}
|
|
27
|
+
export class AppMarketPublished {
|
|
28
|
+
public static main(gvc: GVC) {
|
|
29
|
+
const glitter = gvc.glitter;
|
|
30
|
+
const vm: {
|
|
31
|
+
id: string;
|
|
32
|
+
card_list_id:string;
|
|
33
|
+
app_list: App[];
|
|
34
|
+
} = {
|
|
35
|
+
id: glitter.getUUID(),
|
|
36
|
+
card_list_id:glitter.getUUID(),
|
|
37
|
+
app_list: [],
|
|
38
|
+
};
|
|
39
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
40
|
+
function getAppList() {
|
|
41
|
+
ApiMarket.getPublishedAppList().then((dd: any) => {
|
|
42
|
+
vm.app_list = dd.response;
|
|
43
|
+
gvc.notifyDataChange(vm.id);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return gvc.bindView(() => {
|
|
48
|
+
return {
|
|
49
|
+
bind: vm.id,
|
|
50
|
+
dataList: [{ obj: vm, key: 'type' }],
|
|
51
|
+
view: () => {
|
|
52
|
+
if (vm.app_list.length === 0) {
|
|
53
|
+
getAppList();
|
|
54
|
+
}
|
|
55
|
+
return BgWidget.container(html`
|
|
56
|
+
<div class="tx_700 ps-3" style="font-size: 24px;margin-bottom: 18px;">已發佈APP</div>
|
|
57
|
+
${AppMarketInstall.drawAppList(gvc , vm.card_list_id , vm.app_list)}
|
|
58
|
+
`)
|
|
59
|
+
|
|
60
|
+
},divCreate:{
|
|
61
|
+
class:'d-flex flex-column',
|
|
62
|
+
style:'gap: 24px;'
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
(window as any).glitter.setModule(import.meta.url, AppMarketPublished);
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
|
|
2
|
+
import { BgWidget } from '../backend-manager/bg-widget.js';
|
|
3
|
+
import { Tool } from '../modules/tool.js';
|
|
4
|
+
import { FilterOptions } from '../cms-plugin/filter-options.js';
|
|
5
|
+
import { ApiMarket } from '../glitter-base/route/market.js';
|
|
6
|
+
const html = String.raw;
|
|
7
|
+
const css = String.raw;
|
|
8
|
+
export class AppMarket {
|
|
9
|
+
static main(gvc) {
|
|
10
|
+
const glitter = gvc.glitter;
|
|
11
|
+
const vm = {
|
|
12
|
+
id: glitter.getUUID(),
|
|
13
|
+
card_list_id: glitter.getUUID(),
|
|
14
|
+
tag_list_id: glitter.getUUID(),
|
|
15
|
+
type: 'landing',
|
|
16
|
+
banner: {
|
|
17
|
+
image: 'https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/size1440_s*px$_ses9s7s5sbs5sbse_%E5%AE%B6%E5%85%B7banner2.png',
|
|
18
|
+
link: '',
|
|
19
|
+
},
|
|
20
|
+
app_list: [],
|
|
21
|
+
show_app_list: [],
|
|
22
|
+
tag_list: [],
|
|
23
|
+
show_tag: '',
|
|
24
|
+
query: '',
|
|
25
|
+
orderString: 'name',
|
|
26
|
+
};
|
|
27
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
28
|
+
const sortByName = () => {
|
|
29
|
+
return vm.show_app_list.sort((a, b) => a.name.localeCompare(b.name));
|
|
30
|
+
};
|
|
31
|
+
const sortByPopularDesc = () => {
|
|
32
|
+
return vm.show_app_list.sort((a, b) => b.download_count - a.download_count);
|
|
33
|
+
};
|
|
34
|
+
const sortByPopularAsc = () => {
|
|
35
|
+
return sortByPopularDesc().reverse();
|
|
36
|
+
};
|
|
37
|
+
const sortByPriceDesc = () => {
|
|
38
|
+
return vm.show_app_list.sort((a, b) => b.price - a.price);
|
|
39
|
+
};
|
|
40
|
+
const sortByPriceAsc = () => {
|
|
41
|
+
return sortByPriceDesc().reverse();
|
|
42
|
+
};
|
|
43
|
+
const sortFun = {
|
|
44
|
+
name: sortByName,
|
|
45
|
+
popularity_desc: sortByPopularDesc,
|
|
46
|
+
popularity_asc: sortByPopularAsc,
|
|
47
|
+
price_desc: sortByPriceDesc,
|
|
48
|
+
price_asc: sortByPriceAsc,
|
|
49
|
+
};
|
|
50
|
+
function drawBanner() {
|
|
51
|
+
gvc.addStyle(css `
|
|
52
|
+
.banner {
|
|
53
|
+
background-image: url('${vm.banner.image}');
|
|
54
|
+
background-position: center;
|
|
55
|
+
background-size: cover;
|
|
56
|
+
background-repeat: no-repeat;
|
|
57
|
+
height: 250px;
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.banner h1 {
|
|
62
|
+
font-size: 24px;
|
|
63
|
+
margin-bottom: 10px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.banner p {
|
|
67
|
+
font-size: 16px;
|
|
68
|
+
margin-bottom: 20px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.btn {
|
|
72
|
+
background-color: #fff;
|
|
73
|
+
color: #4caf50;
|
|
74
|
+
padding: 10px 20px;
|
|
75
|
+
font-size: 16px;
|
|
76
|
+
text-decoration: none;
|
|
77
|
+
border-radius: 5px;
|
|
78
|
+
transition: background-color 0.3s ease;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.btn:hover {
|
|
82
|
+
background-color: #45a049; /* Darker green on hover */
|
|
83
|
+
color: white;
|
|
84
|
+
}
|
|
85
|
+
`);
|
|
86
|
+
return html `<!-- Banner Section -->
|
|
87
|
+
<div class="banner"></div> `;
|
|
88
|
+
}
|
|
89
|
+
function getAppList() {
|
|
90
|
+
ApiMarket.getAppList().then((dd) => {
|
|
91
|
+
vm.app_list = dd.response;
|
|
92
|
+
filterAppTag();
|
|
93
|
+
gvc.notifyDataChange(vm.id);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function drawCard(app) {
|
|
97
|
+
gvc.addStyle(css `
|
|
98
|
+
.app-card {
|
|
99
|
+
border-radius: 10px;
|
|
100
|
+
border: 1px solid #ddd;
|
|
101
|
+
background: #fff;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.card-image {
|
|
105
|
+
padding-top: 50%;
|
|
106
|
+
width: 100%;
|
|
107
|
+
background-size: cover;
|
|
108
|
+
background-position: center;
|
|
109
|
+
background-repeat: no-repeat;
|
|
110
|
+
}
|
|
111
|
+
.app-card .tag{
|
|
112
|
+
height: 22px;
|
|
113
|
+
padding: 2px 8px;
|
|
114
|
+
border-radius: 5px;
|
|
115
|
+
background: #EAEAEA;
|
|
116
|
+
letter-spacing: 0.28px;
|
|
117
|
+
font-size: 14px;
|
|
118
|
+
font-weight: 400;
|
|
119
|
+
}
|
|
120
|
+
`);
|
|
121
|
+
function drawTag(tag) {
|
|
122
|
+
return html `<div class="tag d-flex align-items-center">${tag}</div>
|
|
123
|
+
`;
|
|
124
|
+
}
|
|
125
|
+
return html `
|
|
126
|
+
<div class="col-6 col-xl-3 px-3 pb-4" style="">
|
|
127
|
+
<div class="d-flex flex-column app-card">
|
|
128
|
+
<div class="card-image" style="background-image:url('${app.image}') "></div>
|
|
129
|
+
<div class="d-flex flex-column " style="gap:10px;padding: 12px;">
|
|
130
|
+
<div class="d-flex flex-column" style="gap: 6px;">
|
|
131
|
+
<div class="d-flex flex-column" style="gap: 2px">
|
|
132
|
+
<div class="tx_700 tx_normal">${app.name}</div>
|
|
133
|
+
<div class="d-flex" style="gap:4px">
|
|
134
|
+
<div class="d-flex flex-fill align-items-center" style="gap: 4px;">
|
|
135
|
+
<i class="fa-solid fa-star" style="color: #FFB21C;"></i>
|
|
136
|
+
<div class="tx_yellow_12">${app.rate}</div>
|
|
137
|
+
<div class="tx_gray_12">(${app.rate_count})</div>
|
|
138
|
+
</div>
|
|
139
|
+
<div class="tx_gray_14" style="letter-spacing: 0.28px;">${app.price == 0 ? '免費' : app.price}</div>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
<div class="tx_normal_14 text-break" style="letter-spacing: 0.28px;">
|
|
143
|
+
${Tool.truncateString(app.description, 12)}
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
<div class="d-flex" style="gap: 6px">
|
|
147
|
+
${app.tag.map(tag => {
|
|
148
|
+
return drawTag(tag);
|
|
149
|
+
}).join('')}
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
`;
|
|
155
|
+
}
|
|
156
|
+
function filterAppTag() {
|
|
157
|
+
vm.app_list.forEach(app => {
|
|
158
|
+
app.tag.forEach(tag => {
|
|
159
|
+
if (vm.tag_list.indexOf(tag) == -1) {
|
|
160
|
+
vm.tag_list.push(tag);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function drawTag(tag) {
|
|
166
|
+
gvc.addStyle(css `
|
|
167
|
+
.app-tag {
|
|
168
|
+
display: flex;
|
|
169
|
+
height: 40px;
|
|
170
|
+
padding: 6px 18px;
|
|
171
|
+
justify-content: center;
|
|
172
|
+
align-items: center;
|
|
173
|
+
border-radius: 10px;
|
|
174
|
+
border: 1px solid #ddd;
|
|
175
|
+
background: #fff;
|
|
176
|
+
white-space: nowrap;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.app-tag-active {
|
|
180
|
+
background-color: #dddddd;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.app-tag:hover {
|
|
184
|
+
background-color: #dddddd;
|
|
185
|
+
}
|
|
186
|
+
`);
|
|
187
|
+
return html `
|
|
188
|
+
<div
|
|
189
|
+
class="app-tag ${vm.show_tag == tag ? 'app-tag-active' : ''}"
|
|
190
|
+
onclick="${gvc.event(() => {
|
|
191
|
+
vm.show_tag = vm.show_tag === tag ? '' : tag;
|
|
192
|
+
gvc.notifyDataChange(vm.id);
|
|
193
|
+
})}"
|
|
194
|
+
>
|
|
195
|
+
${tag}
|
|
196
|
+
</div>
|
|
197
|
+
`;
|
|
198
|
+
}
|
|
199
|
+
function drawSearchBar() {
|
|
200
|
+
return html ` <div class="d-flex w-100" style="gap:14px;margin-bottom: 18px;">
|
|
201
|
+
${BgWidget.searchFilter(gvc.event(e => {
|
|
202
|
+
vm.query = e.value;
|
|
203
|
+
gvc.notifyDataChange(vm.id);
|
|
204
|
+
}), vm.query || '', '搜尋APP')}
|
|
205
|
+
${BgWidget.updownFilter({
|
|
206
|
+
gvc,
|
|
207
|
+
callback: (value) => {
|
|
208
|
+
vm.orderString = value;
|
|
209
|
+
gvc.notifyDataChange(vm.id);
|
|
210
|
+
},
|
|
211
|
+
default: vm.orderString || 'default',
|
|
212
|
+
options: FilterOptions.appMarketOrderBy,
|
|
213
|
+
})}
|
|
214
|
+
</div>`;
|
|
215
|
+
}
|
|
216
|
+
return gvc.bindView(() => {
|
|
217
|
+
return {
|
|
218
|
+
bind: vm.id,
|
|
219
|
+
dataList: [{ obj: vm, key: 'type' }],
|
|
220
|
+
view: () => {
|
|
221
|
+
if (vm.type === 'landing') {
|
|
222
|
+
if (vm.app_list.length === 0) {
|
|
223
|
+
getAppList();
|
|
224
|
+
}
|
|
225
|
+
vm.show_app_list = vm.show_app_list.length ? vm.show_app_list : vm.app_list;
|
|
226
|
+
return html `
|
|
227
|
+
${drawBanner()}
|
|
228
|
+
<div class="px-4">
|
|
229
|
+
${BgWidget.mainCard(gvc.bindView({
|
|
230
|
+
bind: vm.tag_list_id,
|
|
231
|
+
view: () => {
|
|
232
|
+
return vm.tag_list
|
|
233
|
+
.map(tag => {
|
|
234
|
+
return drawTag(tag);
|
|
235
|
+
})
|
|
236
|
+
.join('');
|
|
237
|
+
},
|
|
238
|
+
divCreate: {
|
|
239
|
+
class: 'd-flex w-100 overflow-scroll',
|
|
240
|
+
style: 'gap:10px;margin-bottom:10px',
|
|
241
|
+
},
|
|
242
|
+
}) +
|
|
243
|
+
drawSearchBar() +
|
|
244
|
+
gvc.bindView({
|
|
245
|
+
bind: vm.card_list_id,
|
|
246
|
+
view: () => {
|
|
247
|
+
function filterApp() {
|
|
248
|
+
var _a;
|
|
249
|
+
if (vm.show_tag.length) {
|
|
250
|
+
vm.show_app_list = vm.app_list.filter(app => {
|
|
251
|
+
return app.tag.indexOf(vm.show_tag) != -1;
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
vm.show_app_list = vm.app_list;
|
|
256
|
+
}
|
|
257
|
+
vm.show_app_list = sortFun[(_a = vm.orderString) !== null && _a !== void 0 ? _a : 'name']();
|
|
258
|
+
}
|
|
259
|
+
filterApp();
|
|
260
|
+
return vm.show_app_list
|
|
261
|
+
.map(app => {
|
|
262
|
+
return drawCard(app);
|
|
263
|
+
})
|
|
264
|
+
.join('');
|
|
265
|
+
},
|
|
266
|
+
divCreate: {
|
|
267
|
+
class: 'd-flex flex-wrap ',
|
|
268
|
+
style: '',
|
|
269
|
+
},
|
|
270
|
+
}), 'px-3')}
|
|
271
|
+
</div>
|
|
272
|
+
`;
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
return ``;
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
divCreate: {
|
|
279
|
+
class: 'd-flex flex-column',
|
|
280
|
+
style: 'gap: 24px;',
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
window.glitter.setModule(import.meta.url, AppMarket);
|