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
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
import { GVC } from '../glitterBundle/GVController.js';
|
|
2
|
-
import { EditorElem } from '../glitterBundle/plugins/editor-elem.js';
|
|
3
|
-
import { PageSplit } from './splitPage.js';
|
|
4
|
-
import { Tool } from '../modules/tool.js';
|
|
5
|
-
import { ApiShop } from '../glitter-base/route/shopping.js';
|
|
6
|
-
import { Article } from '../glitter-base/route/article.js';
|
|
7
|
-
import { ApiUser } from '../glitter-base/route/user.js';
|
|
8
|
-
import { ApiStock } from '../glitter-base/route/stock.js';
|
|
9
2
|
import { ShareDialog } from '../glitterBundle/dialog/ShareDialog.js';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { FormCheck } from '../cms-plugin/module/form-check.js';
|
|
13
|
-
import { TableStorage } from '../cms-plugin/module/table-storage.js';
|
|
14
|
-
import { ProductAi } from '../cms-plugin/ai-generator/product-ai.js';
|
|
15
|
-
import { imageLibrary } from '../modules/image-library.js';
|
|
3
|
+
import { Tool } from '../modules/tool.js';
|
|
4
|
+
import { BgWidget } from './bg-widget.js';
|
|
16
5
|
import { Animation } from '../glitterBundle/module/Animation.js';
|
|
6
|
+
import { Article } from '../glitter-base/route/article.js';
|
|
7
|
+
import { ApiRecommend } from '../glitter-base/route/recommend.js';
|
|
17
8
|
|
|
18
9
|
const html = String.raw;
|
|
19
10
|
const css = String.raw;
|
|
20
11
|
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
export type ShopType = 'group' | 'recommend' | 'hidden' | 'onepage';
|
|
13
|
+
|
|
14
|
+
type ShopObject = { key: string; icon: string; title: string };
|
|
15
|
+
|
|
16
|
+
type OptionData = { key: string; name: string; realname: string };
|
|
17
|
+
|
|
18
|
+
type ViewControl = 'selected' | 'view';
|
|
19
|
+
|
|
20
|
+
type ViewModel = {
|
|
21
|
+
controllerId: string;
|
|
22
|
+
control: ViewControl;
|
|
23
|
+
mainId: string;
|
|
24
|
+
selectedId: string;
|
|
25
|
+
loading: Boolean;
|
|
26
|
+
pageType: ShopType;
|
|
27
|
+
searchType: 'title';
|
|
28
|
+
search: string;
|
|
29
|
+
orderString: string;
|
|
30
|
+
dataList: OptionData[];
|
|
31
|
+
filterList: { key: string; name: string }[];
|
|
32
|
+
postData: string[];
|
|
33
|
+
filterData: string[];
|
|
34
|
+
};
|
|
28
35
|
|
|
29
36
|
export class BgDialog {
|
|
30
37
|
gvc: GVC;
|
|
@@ -42,13 +49,21 @@ export class BgDialog {
|
|
|
42
49
|
}
|
|
43
50
|
|
|
44
51
|
private init() {
|
|
45
|
-
this.gvc.addStyle(
|
|
52
|
+
this.gvc.addStyle(`
|
|
46
53
|
.${this.prefix}_body {
|
|
47
54
|
border-radius: 10px;
|
|
48
55
|
background: #fff;
|
|
49
56
|
overflow-y: auto;
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
${
|
|
58
|
+
this.isMobile
|
|
59
|
+
? `
|
|
60
|
+
width: calc(100vw - 20px);
|
|
61
|
+
`
|
|
62
|
+
: `
|
|
63
|
+
min-width: calc(100vw - 40%);
|
|
64
|
+
max-width: calc(100vw - 20px);
|
|
65
|
+
`
|
|
66
|
+
}
|
|
52
67
|
}
|
|
53
68
|
|
|
54
69
|
.${this.prefix}_header {
|
|
@@ -59,21 +74,29 @@ export class BgDialog {
|
|
|
59
74
|
padding: 12px 20px;
|
|
60
75
|
}
|
|
61
76
|
|
|
62
|
-
.${this.prefix}
|
|
77
|
+
.${this.prefix}_main {
|
|
78
|
+
max-height: 540px;
|
|
79
|
+
border: 20px solid #fff;
|
|
80
|
+
gap: 0;
|
|
81
|
+
position: relative;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.${this.prefix}_triple_bar {
|
|
63
85
|
display: flex;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
position: sticky;
|
|
88
|
+
top: 0;
|
|
89
|
+
background-color: #fff;
|
|
68
90
|
}
|
|
69
91
|
|
|
70
|
-
.${this.prefix}
|
|
71
|
-
|
|
92
|
+
.${this.prefix}_param_bar {
|
|
93
|
+
display: flex;
|
|
94
|
+
margin-top: 8px;
|
|
95
|
+
gap: 10px;
|
|
72
96
|
}
|
|
73
97
|
|
|
74
|
-
.${this.prefix}
|
|
75
|
-
|
|
76
|
-
border: 1px solid #ddd;
|
|
98
|
+
.${this.prefix}_checkbox_container {
|
|
99
|
+
min-height: 353px;
|
|
77
100
|
}
|
|
78
101
|
|
|
79
102
|
.${this.prefix}_footer {
|
|
@@ -93,138 +116,402 @@ export class BgDialog {
|
|
|
93
116
|
display: flex;
|
|
94
117
|
align-items: center;
|
|
95
118
|
justify-content: end;
|
|
96
|
-
gap:
|
|
119
|
+
gap: ${this.isMobile ? 8 : 14}px;
|
|
97
120
|
}
|
|
98
|
-
`);
|
|
99
|
-
}
|
|
100
121
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
${obj.options
|
|
109
|
-
.map(opt => {
|
|
110
|
-
return html` <option class="c_select_option" value="${opt.key}" ${obj.default === opt.key ? 'selected' : ''}>
|
|
111
|
-
${opt.value}
|
|
112
|
-
</option>`;
|
|
113
|
-
})
|
|
114
|
-
.join('')}
|
|
115
|
-
${obj.options.find(opt => obj.default === opt.key)
|
|
116
|
-
? ''
|
|
117
|
-
: html`<option class="d-none" selected>請選擇項目</option>`}
|
|
118
|
-
</select>`;
|
|
119
|
-
}
|
|
122
|
+
.${this.prefix}_view_all {
|
|
123
|
+
color: #4d86db;
|
|
124
|
+
font-size: 16px;
|
|
125
|
+
font-weight: 400;
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
overflow-wrap: break-word;
|
|
128
|
+
}
|
|
120
129
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
130
|
+
.${this.prefix}_clear_all {
|
|
131
|
+
margin-right: 8px;
|
|
132
|
+
font-size: 16px;
|
|
133
|
+
text-decoration: underline;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
}
|
|
126
136
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
137
|
+
.${this.prefix}_icon {
|
|
138
|
+
width: 16px;
|
|
139
|
+
height: 16px;
|
|
140
|
+
margin-right: 8px;
|
|
141
|
+
text-align: center;
|
|
142
|
+
}
|
|
143
|
+
`);
|
|
131
144
|
}
|
|
132
145
|
|
|
133
|
-
|
|
134
|
-
return html`<span
|
|
135
|
-
style="color: #4D86DB; font-size: 16px; font-weight: 400; cursor:pointer; overflow-wrap: break-word;"
|
|
136
|
-
onclick="${event}"
|
|
137
|
-
>${text}</span
|
|
138
|
-
>`;
|
|
146
|
+
viewAll(event: string, text: string = '檢視已選取項目'): string {
|
|
147
|
+
return html`<span class="${this.prefix}_view_all" onclick="${event}">${text}</span>`;
|
|
139
148
|
}
|
|
140
149
|
|
|
141
150
|
clearAll(event: string, text: string = '清除全部'): string {
|
|
142
|
-
return html`<span
|
|
143
|
-
|
|
144
|
-
|
|
151
|
+
return html`<span class="${this.prefix}_clear_all" onclick="${event}">${text}</span>`;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
shopTypeRecord(): Record<ShopType, ShopObject> {
|
|
155
|
+
return {
|
|
156
|
+
hidden: {
|
|
157
|
+
key: 'hidden',
|
|
158
|
+
icon: html`<i class="fa-solid fa-face-dotted ${this.prefix}_icon"></i>`,
|
|
159
|
+
title: '隱形賣場',
|
|
160
|
+
},
|
|
161
|
+
onepage: {
|
|
162
|
+
key: 'onepage',
|
|
163
|
+
icon: html`<i class="fa-regular fa-file ${this.prefix}_icon"></i>`,
|
|
164
|
+
title: '一頁商店',
|
|
165
|
+
},
|
|
166
|
+
group: {
|
|
167
|
+
key: 'group',
|
|
168
|
+
icon: html`<i class="fa-regular fa-puzzle-piece ${this.prefix}_icon"></i>`,
|
|
169
|
+
title: '拼團賣場',
|
|
170
|
+
},
|
|
171
|
+
recommend: {
|
|
172
|
+
key: 'recommend',
|
|
173
|
+
icon: html`<i class="fa-regular fa-share-nodes ${this.prefix}_icon"></i>`,
|
|
174
|
+
title: '分銷連結',
|
|
175
|
+
},
|
|
176
|
+
};
|
|
145
177
|
}
|
|
146
178
|
|
|
147
|
-
marketShop() {
|
|
179
|
+
marketShop(args: { def: string[]; callback: (postData: string[]) => void }) {
|
|
148
180
|
const gvc = this.gvc;
|
|
149
181
|
const glitter = this.glitter;
|
|
182
|
+
const dialog = new ShareDialog(glitter);
|
|
183
|
+
|
|
184
|
+
const vm: ViewModel = {
|
|
185
|
+
controllerId: glitter.getUUID(),
|
|
186
|
+
control: 'view' as ViewControl,
|
|
187
|
+
mainId: glitter.getUUID(),
|
|
188
|
+
selectedId: glitter.getUUID(),
|
|
189
|
+
loading: true,
|
|
190
|
+
pageType: 'hidden',
|
|
191
|
+
searchType: 'title',
|
|
192
|
+
search: '',
|
|
193
|
+
orderString: '',
|
|
194
|
+
dataList: [], // 所有資料陣列
|
|
195
|
+
filterList: [], // 搜尋結果陣列
|
|
196
|
+
postData: args.def, // 預計回調資料
|
|
197
|
+
filterData: [], // 與搜尋結果相關的預計回調資料
|
|
198
|
+
};
|
|
150
199
|
|
|
151
|
-
const marketOptions =
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return glitter.innerDialog(
|
|
159
|
-
(gvc: GVC) => {
|
|
160
|
-
const vm = {
|
|
161
|
-
id: gvc.glitter.getUUID(),
|
|
162
|
-
loading: false,
|
|
200
|
+
const marketOptions = Object.values(this.shopTypeRecord())
|
|
201
|
+
.filter(item => item.key !== 'group')
|
|
202
|
+
.map(item => {
|
|
203
|
+
return {
|
|
204
|
+
key: item.key,
|
|
205
|
+
value: item.title,
|
|
163
206
|
};
|
|
207
|
+
});
|
|
164
208
|
|
|
165
|
-
|
|
166
|
-
${gvc.bindView({
|
|
167
|
-
bind: vm.id,
|
|
168
|
-
view: () => {
|
|
169
|
-
if (vm.loading) {
|
|
170
|
-
return 'Loading';
|
|
171
|
-
}
|
|
209
|
+
const searchTypeOptions = [{ key: 'title', value: '賣場名稱' }];
|
|
172
210
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
211
|
+
const resetPostData = () => {
|
|
212
|
+
vm.postData = [
|
|
213
|
+
...new Set(
|
|
214
|
+
vm.postData
|
|
215
|
+
.filter(key => {
|
|
216
|
+
return !vm.filterList.some(item => item.key === key);
|
|
217
|
+
})
|
|
218
|
+
.concat(vm.filterData)
|
|
219
|
+
),
|
|
220
|
+
];
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const selectedView = (gvc: GVC) => {
|
|
224
|
+
const selectedList = vm.dataList.filter(item => vm.postData.includes(item.key));
|
|
225
|
+
|
|
226
|
+
const bindView = gvc.bindView({
|
|
227
|
+
bind: vm.selectedId,
|
|
228
|
+
view: () => {
|
|
229
|
+
return html` <div class="${this.prefix}_header">
|
|
230
|
+
<div class="tx_700">賣場列表</div>
|
|
231
|
+
<div class="flex-fill"></div>
|
|
232
|
+
</div>
|
|
233
|
+
<div class="c_dialog">
|
|
234
|
+
<div class="c_dialog_body">
|
|
235
|
+
<div class="c_dialog_main ${this.prefix}_main">
|
|
236
|
+
<div class="${this.prefix}_triple_bar">
|
|
237
|
+
${[
|
|
238
|
+
BgWidget.tripletCheckboxContainer(
|
|
181
239
|
gvc,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
240
|
+
'賣場名稱',
|
|
241
|
+
(() => {
|
|
242
|
+
if (vm.postData.length === 0) return -1;
|
|
243
|
+
return vm.postData.length === selectedList.length ? 1 : 0;
|
|
244
|
+
})(),
|
|
245
|
+
r => {
|
|
246
|
+
vm.postData = r === 1 ? selectedList.map(({ key }: { key: any }) => key) : [];
|
|
247
|
+
gvc.notifyDataChange(vm.selectedId);
|
|
248
|
+
}
|
|
249
|
+
),
|
|
250
|
+
BgWidget.horizontalLine({ margin: 0.5 }),
|
|
251
|
+
].join('')}
|
|
252
|
+
</div>
|
|
253
|
+
<div class="${this.prefix}_checkbox_container">
|
|
254
|
+
${BgWidget.multiCheckboxContainer(gvc, selectedList, vm.postData, text => {
|
|
255
|
+
vm.postData = text;
|
|
256
|
+
gvc.notifyDataChange(vm.selectedId);
|
|
257
|
+
})}
|
|
258
|
+
</div>
|
|
259
|
+
</div>
|
|
260
|
+
<div class="${this.prefix}_footer">
|
|
261
|
+
<div class="${this.prefix}_footer_left">
|
|
262
|
+
${this.viewAll(
|
|
263
|
+
gvc.event(() => {
|
|
264
|
+
gvc.closeDialog();
|
|
265
|
+
vm.control = 'view';
|
|
266
|
+
}),
|
|
267
|
+
'繼續選擇'
|
|
268
|
+
)}
|
|
269
|
+
</div>
|
|
270
|
+
<div class="${this.prefix}_footer_right">
|
|
271
|
+
${[
|
|
272
|
+
this.clearAll(
|
|
273
|
+
gvc.event(() => {
|
|
274
|
+
if (vm.postData.length > 0) {
|
|
275
|
+
dialog.checkYesOrNot({
|
|
276
|
+
text: '確定要清除所有已選取的選項嗎?',
|
|
277
|
+
callback: bool => {
|
|
278
|
+
if (bool) {
|
|
279
|
+
vm.postData = [];
|
|
280
|
+
gvc.notifyDataChange(vm.selectedId);
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
}),
|
|
286
|
+
this.isMobile ? '全刪' : '清除全部'
|
|
287
|
+
),
|
|
288
|
+
BgWidget.cancel(
|
|
289
|
+
gvc.event(() => {
|
|
290
|
+
gvc.closeDialog();
|
|
291
|
+
})
|
|
292
|
+
),
|
|
293
|
+
BgWidget.save(
|
|
294
|
+
gvc.event(() => {
|
|
295
|
+
args.callback(vm.postData);
|
|
296
|
+
gvc.closeDialog();
|
|
297
|
+
}),
|
|
298
|
+
'完成'
|
|
299
|
+
),
|
|
300
|
+
].join('')}
|
|
218
301
|
</div>
|
|
219
|
-
</div
|
|
302
|
+
</div>
|
|
303
|
+
</div>
|
|
304
|
+
</div>`;
|
|
305
|
+
},
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
return html`<div class="${this.prefix}_body">${bindView}</div>`;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
const dialogView = (gvc: GVC) => {
|
|
312
|
+
const bindView = gvc.bindView({
|
|
313
|
+
bind: vm.mainId,
|
|
314
|
+
view: () => {
|
|
315
|
+
if (vm.loading) {
|
|
316
|
+
return html`<div class="my-4">${BgWidget.spinner()}</div>`;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
vm.filterList = vm.dataList.filter(
|
|
320
|
+
item => item.key.includes(vm.pageType) && item.realname.includes(vm.search)
|
|
321
|
+
);
|
|
322
|
+
vm.filterData = vm.postData.filter(key => vm.filterList.find(item => item.key === key));
|
|
323
|
+
|
|
324
|
+
const pageTypeSelect = BgWidget.select({
|
|
325
|
+
gvc,
|
|
326
|
+
default: vm.pageType,
|
|
327
|
+
options: marketOptions,
|
|
328
|
+
callback: value => {
|
|
329
|
+
vm.pageType = value;
|
|
330
|
+
vm.search = '';
|
|
331
|
+
gvc.notifyDataChange(vm.mainId);
|
|
332
|
+
},
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
const searchTypeSelect = BgWidget.select({
|
|
336
|
+
gvc,
|
|
337
|
+
default: vm.searchType,
|
|
338
|
+
options: searchTypeOptions,
|
|
339
|
+
callback: value => {
|
|
340
|
+
vm.searchType = value;
|
|
341
|
+
gvc.notifyDataChange(vm.mainId);
|
|
220
342
|
},
|
|
221
|
-
|
|
222
|
-
|
|
343
|
+
style: 'max-width: 120px;',
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
const searchPlace = BgWidget.searchPlace(
|
|
347
|
+
gvc.event(e => {
|
|
348
|
+
vm.search = e.value;
|
|
349
|
+
gvc.notifyDataChange(vm.mainId);
|
|
350
|
+
}),
|
|
351
|
+
vm.search || '',
|
|
352
|
+
'搜尋賣場名稱',
|
|
353
|
+
'0',
|
|
354
|
+
'0'
|
|
355
|
+
);
|
|
356
|
+
|
|
357
|
+
return html` <div class="${this.prefix}_header">
|
|
358
|
+
<div class="tx_700">賣場列表</div>
|
|
359
|
+
<div class="flex-fill"></div>
|
|
360
|
+
</div>
|
|
361
|
+
<div class="c_dialog">
|
|
362
|
+
<div class="c_dialog_body">
|
|
363
|
+
<div class="c_dialog_main ${this.prefix}_main">
|
|
364
|
+
<div class="${this.prefix}_triple_bar">
|
|
365
|
+
${this.isMobile
|
|
366
|
+
? html` <div class="${this.prefix}_param_bar">${[pageTypeSelect, searchTypeSelect].join('')}</div>
|
|
367
|
+
<div class="w-100 mt-2">${searchPlace}</div>`
|
|
368
|
+
: html`${pageTypeSelect}
|
|
369
|
+
<div class="${this.prefix}_param_bar">
|
|
370
|
+
${[searchTypeSelect, html`<div class="w-100">${searchPlace}</div>`].join('')}
|
|
371
|
+
</div>`}
|
|
372
|
+
${[
|
|
373
|
+
BgWidget.mbContainer(12),
|
|
374
|
+
BgWidget.tripletCheckboxContainer(
|
|
375
|
+
gvc,
|
|
376
|
+
'賣場名稱',
|
|
377
|
+
(() => {
|
|
378
|
+
if (vm.filterData.length === 0) return -1;
|
|
379
|
+
return vm.filterData.length === vm.filterList.length ? 1 : 0;
|
|
380
|
+
})(),
|
|
381
|
+
r => {
|
|
382
|
+
vm.filterData = r === 1 ? vm.filterList.map(({ key }: { key: any }) => key) : [];
|
|
383
|
+
resetPostData();
|
|
384
|
+
gvc.notifyDataChange(vm.mainId);
|
|
385
|
+
}
|
|
386
|
+
),
|
|
387
|
+
BgWidget.horizontalLine({ margin: 0.5 }),
|
|
388
|
+
].join('')}
|
|
389
|
+
</div>
|
|
390
|
+
<div class="${this.prefix}_checkbox_container">
|
|
391
|
+
${BgWidget.multiCheckboxContainer(gvc, vm.filterList, vm.filterData, text => {
|
|
392
|
+
vm.filterData = text;
|
|
393
|
+
resetPostData();
|
|
394
|
+
gvc.notifyDataChange(vm.mainId);
|
|
395
|
+
})}
|
|
396
|
+
</div>
|
|
397
|
+
</div>
|
|
398
|
+
<div class="${this.prefix}_footer">
|
|
399
|
+
<div class="${this.prefix}_footer_left">
|
|
400
|
+
${this.viewAll(
|
|
401
|
+
gvc.event(() => {
|
|
402
|
+
if (vm.postData.length > 0) {
|
|
403
|
+
gvc.closeDialog();
|
|
404
|
+
vm.control = 'selected';
|
|
405
|
+
}
|
|
406
|
+
}),
|
|
407
|
+
this.isMobile ? `檢視(${vm.postData.length})` : `檢視已選賣場(${vm.postData.length})`
|
|
408
|
+
)}
|
|
409
|
+
</div>
|
|
410
|
+
<div class="${this.prefix}_footer_right">
|
|
411
|
+
${[
|
|
412
|
+
this.clearAll(
|
|
413
|
+
gvc.event(() => {
|
|
414
|
+
if (vm.postData.length > 0) {
|
|
415
|
+
dialog.checkYesOrNot({
|
|
416
|
+
text: '確定要清除所有已選取的選項嗎?',
|
|
417
|
+
callback: bool => {
|
|
418
|
+
if (bool) {
|
|
419
|
+
vm.postData = [];
|
|
420
|
+
gvc.notifyDataChange(vm.mainId);
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}),
|
|
426
|
+
this.isMobile ? '全刪' : '清除全部'
|
|
427
|
+
),
|
|
428
|
+
BgWidget.cancel(
|
|
429
|
+
gvc.event(() => {
|
|
430
|
+
gvc.closeDialog();
|
|
431
|
+
})
|
|
432
|
+
),
|
|
433
|
+
BgWidget.save(
|
|
434
|
+
gvc.event(() => {
|
|
435
|
+
args.callback(vm.postData);
|
|
436
|
+
gvc.closeDialog();
|
|
437
|
+
}),
|
|
438
|
+
'完成'
|
|
439
|
+
),
|
|
440
|
+
].join('')}
|
|
441
|
+
</div>
|
|
442
|
+
</div>
|
|
443
|
+
</div>
|
|
444
|
+
</div>`;
|
|
445
|
+
},
|
|
446
|
+
onCreate: () => {
|
|
447
|
+
if (vm.loading) {
|
|
448
|
+
vm.dataList = [];
|
|
449
|
+
|
|
450
|
+
Promise.all([
|
|
451
|
+
Article.get({
|
|
452
|
+
page: 0,
|
|
453
|
+
limit: 9999,
|
|
454
|
+
search: vm.search || undefined,
|
|
455
|
+
status: '0,1',
|
|
456
|
+
}),
|
|
457
|
+
ApiRecommend.getList({
|
|
458
|
+
page: 0,
|
|
459
|
+
limit: 9999,
|
|
460
|
+
data: {},
|
|
461
|
+
token: (window.parent as any).config.token,
|
|
462
|
+
}),
|
|
463
|
+
]).then(dataArray => {
|
|
464
|
+
const [article, recommend] = dataArray;
|
|
465
|
+
const shopTypeRecord = this.shopTypeRecord();
|
|
466
|
+
|
|
467
|
+
if (Array.isArray(article.response?.data)) {
|
|
468
|
+
article.response.data.map((item: any) => {
|
|
469
|
+
if (['hidden', 'shopping'].includes(item.content.page_type)) {
|
|
470
|
+
const pageType = item.content.page_type === 'hidden' ? 'hidden' : 'onepage';
|
|
471
|
+
|
|
472
|
+
vm.dataList.push({
|
|
473
|
+
key: `${pageType}-${item.id}`,
|
|
474
|
+
name: `${shopTypeRecord[pageType].icon}${item.content.name}`,
|
|
475
|
+
realname: item.content.name,
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
if (Array.isArray(recommend.response?.data)) {
|
|
482
|
+
recommend.response.data.map((item: any) => {
|
|
483
|
+
vm.dataList.push({
|
|
484
|
+
key: `recommend-${item.id}`,
|
|
485
|
+
name: `${shopTypeRecord.recommend.icon}${item.content.title}`,
|
|
486
|
+
realname: item.content.title,
|
|
487
|
+
});
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
vm.loading = false;
|
|
492
|
+
gvc.notifyDataChange(vm.mainId);
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
return html`<div class="${this.prefix}_body">${bindView}</div>`;
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
return gvc.bindView({
|
|
502
|
+
bind: vm.controllerId,
|
|
503
|
+
dataList: [{ obj: vm, key: 'control' }],
|
|
504
|
+
view: () => {
|
|
505
|
+
switch (vm.control) {
|
|
506
|
+
case 'selected':
|
|
507
|
+
glitter.innerDialog(selectedView, glitter.getUUID(), { animation: Animation.fade });
|
|
508
|
+
break;
|
|
509
|
+
case 'view':
|
|
510
|
+
glitter.innerDialog(dialogView, glitter.getUUID(), { animation: Animation.fade });
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
return '';
|
|
223
514
|
},
|
|
224
|
-
|
|
225
|
-
{
|
|
226
|
-
animation: Animation.fade,
|
|
227
|
-
}
|
|
228
|
-
);
|
|
515
|
+
});
|
|
229
516
|
}
|
|
230
517
|
}
|
|
@@ -800,7 +800,7 @@ ${(_d = obj.default) !== null && _d !== void 0 ? _d : ''}</textarea
|
|
|
800
800
|
>
|
|
801
801
|
</div>`;
|
|
802
802
|
}
|
|
803
|
-
static searchPlace(event,
|
|
803
|
+
static searchPlace(event, value, placeholder, margin, padding) {
|
|
804
804
|
const defMargin = document.body.clientWidth > 768 ? '16px 0' : '8px 0';
|
|
805
805
|
const defPadding = document.body.clientWidth > 768 ? '0 16px' : '0';
|
|
806
806
|
return html `
|
|
@@ -816,7 +816,7 @@ ${(_d = obj.default) !== null && _d !== void 0 ? _d : ''}</textarea
|
|
|
816
816
|
style="border-radius: 10px; border: 1px solid #DDD; padding-left: 50px;"
|
|
817
817
|
placeholder="${placeholder}"
|
|
818
818
|
onchange="${event}"
|
|
819
|
-
value="${
|
|
819
|
+
value="${value}"
|
|
820
820
|
/>
|
|
821
821
|
</div>
|
|
822
822
|
</div>
|
|
@@ -2044,8 +2044,8 @@ ${(_d = obj.default) !== null && _d !== void 0 ? _d : ''}</textarea
|
|
|
2044
2044
|
class="${trIndex === 0 ? ids.tr : ''} ${dd.find(d3 => d3.tooltip)
|
|
2045
2045
|
? 'tr-tooltip-container'
|
|
2046
2046
|
: ''}"
|
|
2047
|
-
onclick="${gvc.event(() => {
|
|
2048
|
-
obj.rowClick && obj.rowClick(dd, trIndex);
|
|
2047
|
+
onclick="${gvc.event((e, event) => {
|
|
2048
|
+
obj.rowClick && obj.rowClick(dd, trIndex, e, event);
|
|
2049
2049
|
})}"
|
|
2050
2050
|
onmouseover="${gvc.event(() => {
|
|
2051
2051
|
$(`#${ids.pencil}${trIndex}`).removeClass('d-none');
|