ts-glitter 21.8.2 → 21.8.4
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-dialog.js +342 -100
- package/lowcode/backend-manager/bg-dialog.ts +432 -145
- package/lowcode/backend-manager/bg-widget.js +4 -4
- package/lowcode/backend-manager/bg-widget.ts +5 -5
- package/lowcode/cms-plugin/shopping-discount-setting.js +148 -92
- package/lowcode/cms-plugin/shopping-discount-setting.ts +162 -111
- package/lowcode/cms-plugin/shopping-product-stock.js +58 -45
- package/lowcode/cms-plugin/shopping-product-stock.ts +66 -49
- package/lowcode/css/editor.css +8 -9
- package/lowcode/editor/basic-component.js +0 -5
- package/lowcode/editor/basic-component.ts +1 -6
- package/lowcode/glitter-base/route/article.js +50 -51
- package/lowcode/glitter-base/route/article.ts +102 -103
- package/lowcode/glitter-base/route/recommend.js +1 -0
- package/lowcode/glitter-base/route/recommend.ts +141 -123
- package/lowcode/modules/image-library-clone.ts +2 -0
- package/lowcode/modules/image-library.js +118 -155
- package/lowcode/modules/image-library.ts +134 -197
- package/lowcode/public-components/layout-plugin/social-links-01.js +23 -44
- package/lowcode/public-components/layout-plugin/social-links-01.ts +23 -48
- package/package.json +1 -1
- package/src/api-public/controllers/article.js +11 -0
- package/src/api-public/controllers/article.js.map +1 -1
- package/src/api-public/controllers/article.ts +13 -0
- package/src/api-public/controllers/recommend.js +1 -0
- package/src/api-public/controllers/recommend.js.map +1 -1
- package/src/api-public/controllers/recommend.ts +99 -89
- package/src/api-public/services/checkout-event.js +4 -3
- package/src/api-public/services/checkout-event.js.map +1 -1
- package/src/api-public/services/checkout-event.ts +11 -7
- package/src/api-public/services/post.js +7 -17
- package/src/api-public/services/post.js.map +1 -1
- package/src/api-public/services/recommend.d.ts +1 -0
- package/src/api-public/services/recommend.js +12 -2
- package/src/api-public/services/recommend.js.map +1 -1
- package/src/api-public/services/recommend.ts +375 -354
- package/src/api-public/services/shopping.d.ts +1 -0
- package/src/api-public/services/shopping.js +4 -2
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +7 -2
|
@@ -42,6 +42,7 @@ type VM = {
|
|
|
42
42
|
replaceData?: any;
|
|
43
43
|
stockStores: StockStore[];
|
|
44
44
|
listLimit: number;
|
|
45
|
+
isEqual: boolean;
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
type ProductType = 'product' | 'addProduct' | 'giveaway' | 'hidden' | 'all';
|
|
@@ -82,8 +83,10 @@ export class StockList {
|
|
|
82
83
|
replaceData: {},
|
|
83
84
|
stockStores: [],
|
|
84
85
|
listLimit: TableStorage.getLimit(),
|
|
86
|
+
isEqual: true,
|
|
85
87
|
};
|
|
86
88
|
|
|
89
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
87
90
|
const ListComp = new BgListComponent(gvc, vm, FilterOptions.stockFilterFrame);
|
|
88
91
|
vm.filter = ListComp.getFilterObject();
|
|
89
92
|
let vmi: any = undefined;
|
|
@@ -102,6 +105,15 @@ export class StockList {
|
|
|
102
105
|
return totalStockCount;
|
|
103
106
|
}
|
|
104
107
|
|
|
108
|
+
function areArraysEqual(arr1: any[], arr2: any[]): boolean {
|
|
109
|
+
if (arr1.length !== arr2.length) return false;
|
|
110
|
+
|
|
111
|
+
return arr1.every((item1, index) => {
|
|
112
|
+
const item2 = arr2[index];
|
|
113
|
+
return JSON.stringify(item1) === JSON.stringify(item2);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
105
117
|
function getDatalist() {
|
|
106
118
|
return vm.dataList.map((dd: any) => {
|
|
107
119
|
if (Array.isArray(dd.variant_content.stockList)) {
|
|
@@ -226,6 +238,7 @@ export class StockList {
|
|
|
226
238
|
}
|
|
227
239
|
});
|
|
228
240
|
|
|
241
|
+
vm.isEqual = areArraysEqual(vm.stockArray, vm.stockOriginArray);
|
|
229
242
|
gvc.notifyDataChange(vm.updateId);
|
|
230
243
|
})}"
|
|
231
244
|
value="${stockData.count ?? 0}"
|
|
@@ -427,17 +440,29 @@ export class StockList {
|
|
|
427
440
|
}
|
|
428
441
|
}
|
|
429
442
|
},
|
|
430
|
-
rowClick: (data, index) => {
|
|
431
|
-
if (option.select_mode) {
|
|
443
|
+
rowClick: (data, index, e, event) => {
|
|
444
|
+
if (option.select_mode || (event.target as HTMLElement).tagName === 'TR') {
|
|
432
445
|
return;
|
|
433
446
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
447
|
+
|
|
448
|
+
function call() {
|
|
449
|
+
const product = vm.dataList[index].product_content;
|
|
450
|
+
const variant = vm.dataList[index].variant_content;
|
|
451
|
+
product.variants.map((dd: any) => {
|
|
452
|
+
dd.editable = JSON.stringify(variant.spec) === JSON.stringify(dd.spec);
|
|
453
|
+
});
|
|
454
|
+
vm.replaceData = product;
|
|
455
|
+
vm.type = 'editSpec';
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
if (vm.isEqual) {
|
|
459
|
+
call();
|
|
460
|
+
} else {
|
|
461
|
+
dialog.checkYesOrNot({
|
|
462
|
+
text: '已修正的資料尚未儲存,確定要進到此規格詳細頁嗎',
|
|
463
|
+
callback: bool => bool && call(),
|
|
464
|
+
});
|
|
465
|
+
}
|
|
441
466
|
},
|
|
442
467
|
filter: option.select_mode
|
|
443
468
|
? [
|
|
@@ -462,46 +487,39 @@ export class StockList {
|
|
|
462
487
|
gvc.bindView({
|
|
463
488
|
bind: vm.updateId,
|
|
464
489
|
view: () => {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
return arr1.every((item1, index) => {
|
|
469
|
-
const item2 = arr2[index];
|
|
470
|
-
return JSON.stringify(item1) === JSON.stringify(item2);
|
|
471
|
-
});
|
|
472
|
-
};
|
|
473
|
-
|
|
474
|
-
if (!areArraysEqual(vm.stockArray, vm.stockOriginArray)) {
|
|
475
|
-
return html` <div class="update-bar-container">
|
|
476
|
-
${BgWidget.cancel(
|
|
477
|
-
gvc.event(() => {
|
|
478
|
-
gvc.notifyDataChange(vm.tableId);
|
|
479
|
-
})
|
|
480
|
-
)}
|
|
481
|
-
${BgWidget.save(
|
|
482
|
-
gvc.event(() => {
|
|
483
|
-
const dialog = new ShareDialog(gvc.glitter);
|
|
484
|
-
dialog.dataLoading({
|
|
485
|
-
text: '更新庫存中',
|
|
486
|
-
visible: true,
|
|
487
|
-
});
|
|
488
|
-
ApiShop.putVariants({
|
|
489
|
-
data: vm.dataList,
|
|
490
|
-
token: (window.parent as any).config.token,
|
|
491
|
-
}).then(re => {
|
|
492
|
-
dialog.dataLoading({ visible: false });
|
|
493
|
-
if (re.result) {
|
|
494
|
-
dialog.successMessage({ text: '更新成功' });
|
|
495
|
-
gvc.notifyDataChange(vm.tableId);
|
|
496
|
-
} else {
|
|
497
|
-
dialog.errorMessage({ text: '更新失敗' });
|
|
498
|
-
}
|
|
499
|
-
});
|
|
500
|
-
})
|
|
501
|
-
)}
|
|
502
|
-
</div>`;
|
|
490
|
+
if (vm.isEqual) {
|
|
491
|
+
return '';
|
|
503
492
|
}
|
|
504
|
-
|
|
493
|
+
|
|
494
|
+
return html` <div class="update-bar-container">
|
|
495
|
+
${BgWidget.cancel(
|
|
496
|
+
gvc.event(() => {
|
|
497
|
+
vm.isEqual = true;
|
|
498
|
+
gvc.notifyDataChange(vm.tableId);
|
|
499
|
+
}),
|
|
500
|
+
'回到初始值'
|
|
501
|
+
)}
|
|
502
|
+
${BgWidget.save(
|
|
503
|
+
gvc.event(() => {
|
|
504
|
+
dialog.dataLoading({
|
|
505
|
+
text: '更新庫存中',
|
|
506
|
+
visible: true,
|
|
507
|
+
});
|
|
508
|
+
ApiShop.putVariants({
|
|
509
|
+
data: vm.dataList,
|
|
510
|
+
token: (window.parent as any).config.token,
|
|
511
|
+
}).then(re => {
|
|
512
|
+
dialog.dataLoading({ visible: false });
|
|
513
|
+
if (re.result) {
|
|
514
|
+
dialog.successMessage({ text: '更新成功' });
|
|
515
|
+
gvc.notifyDataChange(vm.tableId);
|
|
516
|
+
} else {
|
|
517
|
+
dialog.errorMessage({ text: '更新失敗' });
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
})
|
|
521
|
+
)}
|
|
522
|
+
</div>`;
|
|
505
523
|
},
|
|
506
524
|
}),
|
|
507
525
|
].join('')
|
|
@@ -515,7 +533,6 @@ export class StockList {
|
|
|
515
533
|
defData: vm.replaceData,
|
|
516
534
|
goBackEvent: {
|
|
517
535
|
save: postMD => {
|
|
518
|
-
const dialog = new ShareDialog(gvc.glitter);
|
|
519
536
|
dialog.dataLoading({ visible: true });
|
|
520
537
|
ApiShop.putProduct({
|
|
521
538
|
data: postMD,
|
package/lowcode/css/editor.css
CHANGED
|
@@ -629,7 +629,7 @@ h6 {
|
|
|
629
629
|
|
|
630
630
|
.btn-gray-disable {
|
|
631
631
|
display: flex;
|
|
632
|
-
padding:
|
|
632
|
+
padding: 3.25px 18px;
|
|
633
633
|
max-height: 36px;
|
|
634
634
|
justify-content: center;
|
|
635
635
|
align-items: center;
|
|
@@ -646,7 +646,7 @@ h6 {
|
|
|
646
646
|
|
|
647
647
|
.btn-gray {
|
|
648
648
|
display: flex;
|
|
649
|
-
padding:
|
|
649
|
+
padding: 3.25px 18px;
|
|
650
650
|
max-height: 36px;
|
|
651
651
|
justify-content: center;
|
|
652
652
|
align-items: center;
|
|
@@ -663,7 +663,7 @@ h6 {
|
|
|
663
663
|
|
|
664
664
|
.btn-black {
|
|
665
665
|
display: flex;
|
|
666
|
-
padding:
|
|
666
|
+
padding: 3.25px 18px;
|
|
667
667
|
max-height: 36px;
|
|
668
668
|
justify-content: center;
|
|
669
669
|
align-items: center;
|
|
@@ -680,7 +680,7 @@ h6 {
|
|
|
680
680
|
|
|
681
681
|
.btn-orange {
|
|
682
682
|
display: flex;
|
|
683
|
-
padding:
|
|
683
|
+
padding: 3.25px 18px;
|
|
684
684
|
max-height: 36px;
|
|
685
685
|
justify-content: center;
|
|
686
686
|
align-items: center;
|
|
@@ -694,7 +694,7 @@ h6 {
|
|
|
694
694
|
|
|
695
695
|
.btn-red {
|
|
696
696
|
display: flex;
|
|
697
|
-
padding:
|
|
697
|
+
padding: 3.25px 18px;
|
|
698
698
|
max-height: 36px;
|
|
699
699
|
justify-content: center;
|
|
700
700
|
align-items: center;
|
|
@@ -711,7 +711,7 @@ h6 {
|
|
|
711
711
|
|
|
712
712
|
.btn-snow {
|
|
713
713
|
display: flex;
|
|
714
|
-
padding:
|
|
714
|
+
padding: 3.25px 18px;
|
|
715
715
|
max-height: 36px;
|
|
716
716
|
justify-content: center;
|
|
717
717
|
align-items: center;
|
|
@@ -774,7 +774,7 @@ h6 {
|
|
|
774
774
|
padding: 14px 16px;
|
|
775
775
|
background: var(--main-white);
|
|
776
776
|
box-shadow: 0px 1px 10px 0px var(--main-dark-alpha-15);
|
|
777
|
-
gap:
|
|
777
|
+
gap: 12px;
|
|
778
778
|
left: 0;
|
|
779
779
|
bottom: 0;
|
|
780
780
|
width: 100%;
|
|
@@ -1292,7 +1292,7 @@ h6 {
|
|
|
1292
1292
|
.btn-red,
|
|
1293
1293
|
.btn-snow {
|
|
1294
1294
|
max-height: 30px;
|
|
1295
|
-
padding:
|
|
1295
|
+
padding: 4px 18px;
|
|
1296
1296
|
}
|
|
1297
1297
|
|
|
1298
1298
|
.btn .tx_700,
|
|
@@ -1302,7 +1302,6 @@ h6 {
|
|
|
1302
1302
|
|
|
1303
1303
|
.update-bar-container {
|
|
1304
1304
|
padding: 10px 16px;
|
|
1305
|
-
gap: 12px;
|
|
1306
1305
|
}
|
|
1307
1306
|
|
|
1308
1307
|
.main-card {
|
|
@@ -9452,11 +9452,6 @@ BasicComponent.componentList = [
|
|
|
9452
9452
|
"formData": {}
|
|
9453
9453
|
},
|
|
9454
9454
|
image: `https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/size1440_s*px$_scs0sfs1sasbs1sf_Screenshot2024-11-14at2.03.47 AM.jpg`
|
|
9455
|
-
},
|
|
9456
|
-
{
|
|
9457
|
-
title: '社群按鈕',
|
|
9458
|
-
config: { "id": "s6s7sbs4s5s5sasd", "js": "./official_view_component/official.js", "css": { "class": {}, "style": {} }, "data": { "tag": "social_popup", "_gap": "", "attr": [], "elem": "div", "list": [], "inner": "", "_other": {}, "_border": {}, "_margin": {}, "_radius": "", "_padding": {}, "_reverse": "false", "carryData": {}, "refer_app": "shop_template_black_style", "_max_width": "", "_background": "", "_style_refer": "global", "_hor_position": "center", "refer_form_data": { "social_list": [{ "icon": "https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg", "social_type": "fb" }, { "social_type": "ig" }, { "social_type": "line" }] }, "_background_setting": { "type": "none" } }, "list": [], "type": "component", "class": "w-100", "index": 2, "label": "社群彈窗", "style": "", "global": [], "mobile": { "id": "s6s7sbs4s5s5sasd", "js": "./official_view_component/official.js", "css": { "class": {}, "style": {} }, "data": { "refer_app": "shop_template_black_style" }, "list": [], "type": "component", "class": "w-100", "index": 2, "label": "社群彈窗", "style": "", "global": [], "toggle": true, "stylist": [], "version": "v2", "visible": true, "dataType": "static", "style_from": "code", "classDataType": "static", "editor_bridge": {}, "preloadEvenet": {}, "container_fonts": 0, "mobile_editable": [], "desktop_editable": [], "refreshAllParameter": {}, "refreshComponentParameter": {}, "refer": "custom" }, "toggle": true, "desktop": { "data": { "refer_app": "shop_template_black_style", "refer_form_data": {} }, "refer": "custom" }, "stylist": [], "version": "v2", "visible": true, "dataType": "static", "style_from": "code", "classDataType": "static", "editor_bridge": {}, "preloadEvenet": {}, "container_fonts": 0, "mobile_editable": [], "desktop_editable": [], "refreshAllParameter": {}, "refreshComponentParameter": {}, "formData": {} },
|
|
9459
|
-
image: `https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/Screenshot 2025-05-21 at 6.22.03 PM.jpg`
|
|
9460
9455
|
}
|
|
9461
9456
|
];
|
|
9462
9457
|
BasicComponent.productList = [
|
|
@@ -9067,12 +9067,7 @@ export class BasicComponent {
|
|
|
9067
9067
|
"formData": {}
|
|
9068
9068
|
},
|
|
9069
9069
|
image: `https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/size1440_s*px$_scs0sfs1sasbs1sf_Screenshot2024-11-14at2.03.47 AM.jpg`
|
|
9070
|
-
}
|
|
9071
|
-
{
|
|
9072
|
-
title: '社群按鈕',
|
|
9073
|
-
config: {"id":"s6s7sbs4s5s5sasd","js":"./official_view_component/official.js","css":{"class":{},"style":{}},"data":{"tag":"social_popup","_gap":"","attr":[],"elem":"div","list":[],"inner":"","_other":{},"_border":{},"_margin":{},"_radius":"","_padding":{},"_reverse":"false","carryData":{},"refer_app":"shop_template_black_style","_max_width":"","_background":"","_style_refer":"global","_hor_position":"center","refer_form_data":{"social_list":[{"icon":"https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1722936949034-default_image.jpg","social_type":"fb"},{"social_type":"ig"},{"social_type":"line"}]},"_background_setting":{"type":"none"}},"list":[],"type":"component","class":"w-100","index":2,"label":"社群彈窗","style":"","global":[],"mobile":{"id":"s6s7sbs4s5s5sasd","js":"./official_view_component/official.js","css":{"class":{},"style":{}},"data":{"refer_app":"shop_template_black_style"},"list":[],"type":"component","class":"w-100","index":2,"label":"社群彈窗","style":"","global":[],"toggle":true,"stylist":[],"version":"v2","visible":true,"dataType":"static","style_from":"code","classDataType":"static","editor_bridge":{},"preloadEvenet":{},"container_fonts":0,"mobile_editable":[],"desktop_editable":[],"refreshAllParameter":{},"refreshComponentParameter":{},"refer":"custom"},"toggle":true,"desktop":{"data":{"refer_app":"shop_template_black_style","refer_form_data":{}},"refer":"custom"},"stylist":[],"version":"v2","visible":true,"dataType":"static","style_from":"code","classDataType":"static","editor_bridge":{},"preloadEvenet":{},"container_fonts":0,"mobile_editable":[],"desktop_editable":[],"refreshAllParameter":{},"refreshComponentParameter":{},"formData":{}},
|
|
9074
|
-
image: `https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/Screenshot 2025-05-21 at 6.22.03 PM.jpg`
|
|
9075
|
-
}
|
|
9070
|
+
}
|
|
9076
9071
|
]
|
|
9077
9072
|
|
|
9078
9073
|
public static productList = [
|
|
@@ -1,80 +1,79 @@
|
|
|
1
|
-
import { BaseApi } from
|
|
1
|
+
import { BaseApi } from '../../glitterBundle/api/base.js';
|
|
2
2
|
export class Article {
|
|
3
3
|
static get(json) {
|
|
4
4
|
return BaseApi.create({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`limit=${json.limit}`,
|
|
8
|
-
`
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
5
|
+
url: getBaseUrl() +
|
|
6
|
+
`/api-public/v1/article/manager?${(() => {
|
|
7
|
+
let par = [`limit=${json.limit}`, `page=${json.page}`];
|
|
8
|
+
json.search && par.push(`search=${json.search}`);
|
|
9
|
+
json.id && par.push(`id=${json.id}`);
|
|
10
|
+
json.tag && par.push(`tag=${json.tag}`);
|
|
11
|
+
json.label && par.push(`label=${json.label}`);
|
|
12
|
+
json.for_index && par.push(`for_index=${json.for_index}`);
|
|
13
|
+
json.status && par.push(`status=${json.status}`);
|
|
14
|
+
json.page_type && par.push(`page_type=${json.page_type}`);
|
|
15
|
+
json.id_list && par.push(`id_list=${json.id_list}`);
|
|
16
|
+
return par.join('&');
|
|
17
|
+
})()}`,
|
|
18
|
+
type: 'GET',
|
|
19
|
+
headers: {
|
|
20
|
+
'g-app': json.app_name || getConfig().config.appName,
|
|
21
|
+
'Content-Type': 'application/json',
|
|
22
|
+
Authorization: getConfig().config.token,
|
|
23
|
+
},
|
|
25
24
|
});
|
|
26
25
|
}
|
|
27
26
|
static delete(json) {
|
|
28
27
|
return BaseApi.create({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
url: getBaseUrl() + `/api-public/v1/article`,
|
|
29
|
+
type: 'DELETE',
|
|
30
|
+
headers: {
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
'g-app': getConfig().config.appName,
|
|
33
|
+
Authorization: getConfig().config.token,
|
|
35
34
|
},
|
|
36
|
-
data: JSON.stringify(json)
|
|
35
|
+
data: JSON.stringify(json),
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
38
|
static deleteV2(json) {
|
|
40
39
|
return BaseApi.create({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
url: getBaseUrl() + `/api-public/v1/article/manager`,
|
|
41
|
+
type: 'DELETE',
|
|
42
|
+
headers: {
|
|
43
|
+
'Content-Type': 'application/json',
|
|
44
|
+
'g-app': getConfig().config.appName,
|
|
45
|
+
Authorization: getConfig().config.token,
|
|
47
46
|
},
|
|
48
|
-
data: JSON.stringify(json)
|
|
47
|
+
data: JSON.stringify(json),
|
|
49
48
|
});
|
|
50
49
|
}
|
|
51
50
|
static post(tData, status = 1) {
|
|
52
51
|
return BaseApi.create({
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
url: getBaseUrl() + `/api-public/v1/article/manager`,
|
|
53
|
+
type: 'POST',
|
|
54
|
+
headers: {
|
|
55
|
+
'Content-Type': 'application/json',
|
|
56
|
+
'g-app': getConfig().config.appName,
|
|
57
|
+
Authorization: getConfig().config.token,
|
|
59
58
|
},
|
|
60
59
|
data: JSON.stringify({
|
|
61
60
|
status: status,
|
|
62
|
-
|
|
63
|
-
})
|
|
61
|
+
data: tData,
|
|
62
|
+
}),
|
|
64
63
|
});
|
|
65
64
|
}
|
|
66
65
|
static put(tData) {
|
|
67
66
|
return BaseApi.create({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
url: getBaseUrl() + `/api-public/v1/article/manager`,
|
|
68
|
+
type: 'PUT',
|
|
69
|
+
headers: {
|
|
70
|
+
'Content-Type': 'application/json',
|
|
71
|
+
'g-app': getConfig().config.appName,
|
|
72
|
+
Authorization: getConfig().config.token,
|
|
74
73
|
},
|
|
75
74
|
data: JSON.stringify({
|
|
76
|
-
|
|
77
|
-
})
|
|
75
|
+
data: tData,
|
|
76
|
+
}),
|
|
78
77
|
});
|
|
79
78
|
}
|
|
80
79
|
}
|
|
@@ -1,111 +1,110 @@
|
|
|
1
|
-
import {BaseApi} from
|
|
1
|
+
import { BaseApi } from '../../glitterBundle/api/base.js';
|
|
2
2
|
|
|
3
|
-
export class Article{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
data: JSON.stringify(json)
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
public static post(tData:{
|
|
69
|
-
tag:string,
|
|
70
|
-
name:string,
|
|
71
|
-
copy:string
|
|
72
|
-
},status:number=1){
|
|
73
|
-
return BaseApi.create({
|
|
74
|
-
"url": getBaseUrl() + `/api-public/v1/article/manager`,
|
|
75
|
-
"type": "POST",
|
|
76
|
-
"headers": {
|
|
77
|
-
"Content-Type": "application/json",
|
|
78
|
-
"g-app": getConfig().config.appName,
|
|
79
|
-
"Authorization": getConfig().config.token
|
|
80
|
-
},
|
|
81
|
-
data: JSON.stringify({
|
|
82
|
-
status:status,
|
|
83
|
-
"data":tData
|
|
84
|
-
})
|
|
85
|
-
})
|
|
86
|
-
}
|
|
87
|
-
public static put(tData:any){
|
|
88
|
-
return BaseApi.create({
|
|
89
|
-
"url": getBaseUrl() + `/api-public/v1/article/manager`,
|
|
90
|
-
"type": "PUT",
|
|
91
|
-
"headers": {
|
|
92
|
-
"Content-Type": "application/json",
|
|
93
|
-
"g-app": getConfig().config.appName,
|
|
94
|
-
"Authorization": getConfig().config.token
|
|
95
|
-
},
|
|
96
|
-
data: JSON.stringify({
|
|
97
|
-
"data":tData
|
|
98
|
-
})
|
|
99
|
-
})
|
|
100
|
-
}
|
|
3
|
+
export class Article {
|
|
4
|
+
public static get(json: {
|
|
5
|
+
limit: number;
|
|
6
|
+
page: number;
|
|
7
|
+
search?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
tag?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
for_index?: string;
|
|
12
|
+
status?: string;
|
|
13
|
+
page_type?: string;
|
|
14
|
+
app_name?: string;
|
|
15
|
+
id_list?: string;
|
|
16
|
+
}) {
|
|
17
|
+
return BaseApi.create({
|
|
18
|
+
url:
|
|
19
|
+
getBaseUrl() +
|
|
20
|
+
`/api-public/v1/article/manager?${(() => {
|
|
21
|
+
let par = [`limit=${json.limit}`, `page=${json.page}`];
|
|
22
|
+
json.search && par.push(`search=${json.search}`);
|
|
23
|
+
json.id && par.push(`id=${json.id}`);
|
|
24
|
+
json.tag && par.push(`tag=${json.tag}`);
|
|
25
|
+
json.label && par.push(`label=${json.label}`);
|
|
26
|
+
json.for_index && par.push(`for_index=${json.for_index}`);
|
|
27
|
+
json.status && par.push(`status=${json.status}`);
|
|
28
|
+
json.page_type && par.push(`page_type=${json.page_type}`);
|
|
29
|
+
json.id_list && par.push(`id_list=${json.id_list}`);
|
|
30
|
+
return par.join('&');
|
|
31
|
+
})()}`,
|
|
32
|
+
type: 'GET',
|
|
33
|
+
headers: {
|
|
34
|
+
'g-app': json.app_name || getConfig().config.appName,
|
|
35
|
+
'Content-Type': 'application/json',
|
|
36
|
+
Authorization: getConfig().config.token,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
public static delete(json: { id: string }) {
|
|
41
|
+
return BaseApi.create({
|
|
42
|
+
url: getBaseUrl() + `/api-public/v1/article`,
|
|
43
|
+
type: 'DELETE',
|
|
44
|
+
headers: {
|
|
45
|
+
'Content-Type': 'application/json',
|
|
46
|
+
'g-app': getConfig().config.appName,
|
|
47
|
+
Authorization: getConfig().config.token,
|
|
48
|
+
},
|
|
49
|
+
data: JSON.stringify(json),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
public static deleteV2(json: { id: string }) {
|
|
53
|
+
return BaseApi.create({
|
|
54
|
+
url: getBaseUrl() + `/api-public/v1/article/manager`,
|
|
55
|
+
type: 'DELETE',
|
|
56
|
+
headers: {
|
|
57
|
+
'Content-Type': 'application/json',
|
|
58
|
+
'g-app': getConfig().config.appName,
|
|
59
|
+
Authorization: getConfig().config.token,
|
|
60
|
+
},
|
|
61
|
+
data: JSON.stringify(json),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
101
64
|
|
|
65
|
+
public static post(
|
|
66
|
+
tData: {
|
|
67
|
+
tag: string;
|
|
68
|
+
name: string;
|
|
69
|
+
copy: string;
|
|
70
|
+
},
|
|
71
|
+
status: number = 1
|
|
72
|
+
) {
|
|
73
|
+
return BaseApi.create({
|
|
74
|
+
url: getBaseUrl() + `/api-public/v1/article/manager`,
|
|
75
|
+
type: 'POST',
|
|
76
|
+
headers: {
|
|
77
|
+
'Content-Type': 'application/json',
|
|
78
|
+
'g-app': getConfig().config.appName,
|
|
79
|
+
Authorization: getConfig().config.token,
|
|
80
|
+
},
|
|
81
|
+
data: JSON.stringify({
|
|
82
|
+
status: status,
|
|
83
|
+
data: tData,
|
|
84
|
+
}),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
public static put(tData: any) {
|
|
88
|
+
return BaseApi.create({
|
|
89
|
+
url: getBaseUrl() + `/api-public/v1/article/manager`,
|
|
90
|
+
type: 'PUT',
|
|
91
|
+
headers: {
|
|
92
|
+
'Content-Type': 'application/json',
|
|
93
|
+
'g-app': getConfig().config.appName,
|
|
94
|
+
Authorization: getConfig().config.token,
|
|
95
|
+
},
|
|
96
|
+
data: JSON.stringify({
|
|
97
|
+
data: tData,
|
|
98
|
+
}),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
function getConfig() {
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
const saasConfig: { config: any; api: any } = (window.parent as any).saasConfig;
|
|
105
|
+
return saasConfig;
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
function getBaseUrl() {
|
|
110
|
-
|
|
111
|
-
}
|
|
109
|
+
return getConfig().config.url;
|
|
110
|
+
}
|
|
@@ -14,6 +14,7 @@ export class ApiRecommend {
|
|
|
14
14
|
let par = [`limit=${json.limit}`, `page=${json.page}`];
|
|
15
15
|
json.user_id && par.push(`user_id=${json.user_id}`);
|
|
16
16
|
json.code && par.push(`code=${json.code}`);
|
|
17
|
+
json.id_list && par.push(`id_list=${json.id_list}`);
|
|
17
18
|
return par.join('&');
|
|
18
19
|
})()}`,
|
|
19
20
|
type: 'GET',
|