ts-glitter 13.4.6 → 13.4.8
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-blog.js +466 -413
- package/lowcode/backend-manager/bg-blog.ts +1298 -1244
- package/lowcode/form-view/editor/array-items.js +1 -1
- package/lowcode/form-view/editor/array-items.ts +1 -1
- package/lowcode/form-view/editor/color-selector.ts +1 -1
- package/lowcode/glitterBundle/Glitter.js +9 -2
- package/lowcode/glitterBundle/Glitter.ts +9 -2
- package/lowcode/glitterBundle/plugins/editor-elem.js +726 -592
- package/lowcode/glitterBundle/plugins/editor-elem.ts +1533 -1277
- package/lowcode/jspage/editor.js +15 -9
- package/lowcode/jspage/editor.ts +16 -10
- package/lowcode/jspage/main.js +52 -24
- package/lowcode/jspage/main.ts +91 -50
- package/lowcode/official_view_component/official/component.js +5 -0
- package/lowcode/official_view_component/official/component.ts +5 -0
- package/lowcode/official_view_component/official/form.js +110 -78
- package/lowcode/official_view_component/official/form.ts +238 -192
- package/package.json +1 -1
- package/src/api-public/controllers/article.js +3 -0
- package/src/api-public/controllers/article.js.map +1 -1
- package/src/api-public/controllers/article.ts +3 -0
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import {GVC} from '../glitterBundle/GVController.js';
|
|
2
|
+
import {EditorElem} from '../glitterBundle/plugins/editor-elem.js';
|
|
3
|
+
import {BgWidget} from './bg-widget.js';
|
|
4
|
+
import {ApiUser} from '../glitter-base/route/user.js';
|
|
5
|
+
import {ShareDialog} from '../glitterBundle/dialog/ShareDialog.js';
|
|
6
|
+
import {ApiPageConfig} from '../api/pageConfig.js';
|
|
7
|
+
import {Article} from '../glitter-base/route/article.js';
|
|
8
|
+
import {MenusSetting} from '../cms-plugin/menus-setting.js';
|
|
9
|
+
import {BaseApi} from '../glitterBundle/api/base.js';
|
|
10
|
+
import {BgProduct, OptionsItem} from './bg-product.js';
|
|
11
|
+
import {CheckInput} from '../modules/checkInput.js';
|
|
12
|
+
import {config} from "../config.js";
|
|
12
13
|
|
|
13
14
|
interface MenuItem {
|
|
14
15
|
link: string;
|
|
@@ -22,7 +23,8 @@ export class BgBlog {
|
|
|
22
23
|
public static contentManager(
|
|
23
24
|
gvc: GVC,
|
|
24
25
|
type: 'select' | 'list' | 'collection' = 'list',
|
|
25
|
-
callback: (list: any[]) => void = () => {
|
|
26
|
+
callback: (list: any[]) => void = () => {
|
|
27
|
+
},
|
|
26
28
|
is_page: boolean,
|
|
27
29
|
widget: any,
|
|
28
30
|
page_tab: 'page' | 'hidden' | 'shopping'
|
|
@@ -55,34 +57,35 @@ export class BgBlog {
|
|
|
55
57
|
},
|
|
56
58
|
{
|
|
57
59
|
key: '發布時間',
|
|
58
|
-
value: html`<span
|
|
60
|
+
value: html`<span
|
|
61
|
+
class="fs-7">${glitter.ut.dateFormat(new Date(dd.created_time), 'yyyy-MM-dd')}</span>`,
|
|
59
62
|
},
|
|
60
63
|
{
|
|
61
64
|
key: '預覽',
|
|
62
65
|
value: html`
|
|
63
66
|
<div
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
67
|
+
class="d-flex align-items-center justify-content-center hoverBtn me-2 border"
|
|
68
|
+
style="height:28px;width:28px;border-radius:5px;cursor:pointer;color:#151515;"
|
|
69
|
+
onclick="${gvc.event((e, event) => {
|
|
70
|
+
const href = (() => {
|
|
71
|
+
return `https://${(window.parent as any).glitter.share.editorViewModel.domain}/${
|
|
72
|
+
is_page
|
|
73
|
+
? (() => {
|
|
74
|
+
switch (page_tab) {
|
|
75
|
+
case 'shopping':
|
|
76
|
+
return 'shop';
|
|
77
|
+
case 'hidden':
|
|
78
|
+
return 'hidden';
|
|
79
|
+
case 'page':
|
|
80
|
+
return 'pages';
|
|
81
|
+
}
|
|
82
|
+
})()
|
|
83
|
+
: `blogs`
|
|
84
|
+
}/${dd.content.tag}`;
|
|
85
|
+
})();
|
|
86
|
+
(window.parent as any).glitter.openNewTab(href);
|
|
87
|
+
event.stopPropagation();
|
|
88
|
+
})}"
|
|
86
89
|
>
|
|
87
90
|
<i class="fa-regular fa-eye" aria-hidden="true"></i>
|
|
88
91
|
</div>
|
|
@@ -92,178 +95,193 @@ export class BgBlog {
|
|
|
92
95
|
});
|
|
93
96
|
}
|
|
94
97
|
|
|
98
|
+
if ((window.parent as any).glitter.getUrlParameter('page-id')) {
|
|
99
|
+
Article.get({
|
|
100
|
+
page: 0,
|
|
101
|
+
limit: 1,
|
|
102
|
+
id: (window.parent as any).glitter.getUrlParameter('page-id')
|
|
103
|
+
}).then(async (data) => {
|
|
104
|
+
vm.data = data.response.data[0];
|
|
105
|
+
vm.type = 'replace';
|
|
106
|
+
})
|
|
107
|
+
}
|
|
95
108
|
return gvc.bindView(() => {
|
|
96
109
|
const id = glitter.getUUID();
|
|
97
110
|
return {
|
|
98
111
|
bind: id,
|
|
99
|
-
dataList: [{
|
|
112
|
+
dataList: [{obj: vm, key: 'type'}],
|
|
100
113
|
view: () => {
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
)}
|
|
120
|
-
${BgWidget.grayNote(
|
|
121
|
-
is_page
|
|
122
|
-
? (() => {
|
|
123
|
-
switch (page_tab) {
|
|
124
|
-
case 'hidden':
|
|
125
|
-
return '隱形賣場僅能透過連結分享,無法顯示於 Google 搜尋列表';
|
|
126
|
-
case 'page':
|
|
127
|
-
return '打造自訂頁面,顯示品牌官網的獨特內容';
|
|
128
|
-
case 'shopping':
|
|
129
|
-
return '放大特定商品重點,打造專屬爆品產品,一頁下單快速購物';
|
|
130
|
-
}
|
|
131
|
-
})()
|
|
132
|
-
: '快速分享商店最新資訊的好功能'
|
|
133
|
-
)}
|
|
134
|
-
</div>
|
|
135
|
-
<div class="flex-fill"></div>
|
|
136
|
-
<div style="display: flex; gap: 12px;">
|
|
137
|
-
${is_page
|
|
138
|
-
? ''
|
|
139
|
-
: BgWidget.grayButton(
|
|
140
|
-
'網誌分類',
|
|
141
|
-
gvc.event(() => {
|
|
142
|
-
vm.type = 'collection';
|
|
143
|
-
gvc.notifyDataChange(id);
|
|
144
|
-
})
|
|
145
|
-
)}
|
|
146
|
-
${BgWidget.darkButton(
|
|
147
|
-
`新增${is_page ? `頁面` : `網誌`}`,
|
|
148
|
-
gvc.event(() => {
|
|
149
|
-
vm.data = { content: {} };
|
|
150
|
-
vm.type = 'add';
|
|
151
|
-
})
|
|
152
|
-
)}
|
|
153
|
-
</div>
|
|
154
|
-
</div>
|
|
155
|
-
${BgWidget.mainCard(
|
|
156
|
-
[
|
|
157
|
-
BgWidget.searchPlace(
|
|
158
|
-
gvc.event((e) => {
|
|
159
|
-
vm.query = e.value;
|
|
160
|
-
gvc.notifyDataChange(id);
|
|
161
|
-
}),
|
|
162
|
-
vm.query || '',
|
|
163
|
-
'搜尋所有文章'
|
|
164
|
-
),
|
|
165
|
-
BgWidget.tableV3({
|
|
166
|
-
gvc: gvc,
|
|
167
|
-
getData: (vd) => {
|
|
168
|
-
vmi = vd;
|
|
169
|
-
const limit = 20;
|
|
170
|
-
Article.get({
|
|
171
|
-
page: vmi.page - 1,
|
|
172
|
-
limit: limit,
|
|
173
|
-
search: vm.query || undefined,
|
|
174
|
-
for_index: is_page ? `false` : `true`,
|
|
175
|
-
status: '0,1',
|
|
176
|
-
page_type: page_tab,
|
|
177
|
-
}).then((data) => {
|
|
178
|
-
vm.dataList = data.response.data;
|
|
179
|
-
vmi.pageSize = Math.ceil(data.response.total / limit);
|
|
180
|
-
vmi.originalData = vm.dataList;
|
|
181
|
-
vmi.tableData = getDatalist();
|
|
182
|
-
vmi.loading = false;
|
|
183
|
-
vmi.callback();
|
|
184
|
-
});
|
|
185
|
-
},
|
|
186
|
-
rowClick: (data, index) => {
|
|
187
|
-
if (type === 'select') {
|
|
188
|
-
vm.dataList[index].checked = !vm.dataList[index].checked;
|
|
189
|
-
vmi.data = getDatalist();
|
|
190
|
-
vmi.callback();
|
|
191
|
-
callback(
|
|
192
|
-
vm.dataList.filter((dd: any) => {
|
|
193
|
-
return dd.checked;
|
|
194
|
-
})
|
|
195
|
-
);
|
|
196
|
-
} else {
|
|
197
|
-
vm.data = vm.dataList[index];
|
|
198
|
-
vm.type = 'replace';
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
filter: [
|
|
202
|
-
{
|
|
203
|
-
name: '批量移除',
|
|
204
|
-
event: (checkedData) => {
|
|
205
|
-
const dialog = new ShareDialog(glitter);
|
|
206
|
-
dialog.checkYesOrNot({
|
|
207
|
-
text: '是否確認刪除所選項目?',
|
|
208
|
-
callback: (response) => {
|
|
209
|
-
if (response) {
|
|
210
|
-
dialog.dataLoading({ visible: true });
|
|
211
|
-
Article.deleteV2({
|
|
212
|
-
id: checkedData
|
|
213
|
-
.map((dd: any) => {
|
|
214
|
-
return dd.id;
|
|
215
|
-
})
|
|
216
|
-
.join(`,`),
|
|
217
|
-
}).then((res) => {
|
|
218
|
-
dialog.dataLoading({ visible: false });
|
|
219
|
-
if (res.result) {
|
|
220
|
-
vm.dataList = undefined;
|
|
221
|
-
gvc.notifyDataChange(id);
|
|
222
|
-
} else {
|
|
223
|
-
dialog.errorMessage({ text: '刪除失敗' });
|
|
224
|
-
}
|
|
225
|
-
});
|
|
114
|
+
if ((window.parent as any).glitter.getUrlParameter('page-id') && vm.type!=='replace') {
|
|
115
|
+
return ``
|
|
116
|
+
} else {
|
|
117
|
+
if (vm.type === 'list') {
|
|
118
|
+
return BgWidget.container(
|
|
119
|
+
html`
|
|
120
|
+
<div class="d-flex w-100 align-items-center mb-3 ${type === 'select' ? `d-none` : ``}">
|
|
121
|
+
<div class="d-flex flex-column" style="gap:5px;">
|
|
122
|
+
${BgWidget.title(
|
|
123
|
+
is_page
|
|
124
|
+
? (() => {
|
|
125
|
+
switch (page_tab) {
|
|
126
|
+
case 'hidden':
|
|
127
|
+
return '隱形賣場';
|
|
128
|
+
case 'page':
|
|
129
|
+
return '自訂頁面';
|
|
130
|
+
case 'shopping':
|
|
131
|
+
return '一頁商店';
|
|
226
132
|
}
|
|
227
|
-
}
|
|
133
|
+
})()
|
|
134
|
+
: '網誌文章'
|
|
135
|
+
)}
|
|
136
|
+
${BgWidget.grayNote(
|
|
137
|
+
is_page
|
|
138
|
+
? (() => {
|
|
139
|
+
switch (page_tab) {
|
|
140
|
+
case 'hidden':
|
|
141
|
+
return '隱形賣場僅能透過連結分享,無法顯示於 Google 搜尋列表';
|
|
142
|
+
case 'page':
|
|
143
|
+
return '打造自訂頁面,顯示品牌官網的獨特內容';
|
|
144
|
+
case 'shopping':
|
|
145
|
+
return '放大特定商品重點,打造專屬爆品產品,一頁下單快速購物';
|
|
146
|
+
}
|
|
147
|
+
})()
|
|
148
|
+
: '快速分享商店最新資訊的好功能'
|
|
149
|
+
)}
|
|
150
|
+
</div>
|
|
151
|
+
<div class="flex-fill"></div>
|
|
152
|
+
<div style="display: flex; gap: 12px;">
|
|
153
|
+
${is_page
|
|
154
|
+
? ''
|
|
155
|
+
: BgWidget.grayButton(
|
|
156
|
+
'網誌分類',
|
|
157
|
+
gvc.event(() => {
|
|
158
|
+
vm.type = 'collection';
|
|
159
|
+
gvc.notifyDataChange(id);
|
|
160
|
+
})
|
|
161
|
+
)}
|
|
162
|
+
${BgWidget.darkButton(
|
|
163
|
+
`新增${is_page ? `頁面` : `網誌`}`,
|
|
164
|
+
gvc.event(() => {
|
|
165
|
+
vm.data = {content: {}};
|
|
166
|
+
vm.type = 'add';
|
|
167
|
+
})
|
|
168
|
+
)}
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
${BgWidget.mainCard(
|
|
172
|
+
[
|
|
173
|
+
BgWidget.searchPlace(
|
|
174
|
+
gvc.event((e) => {
|
|
175
|
+
vm.query = e.value;
|
|
176
|
+
gvc.notifyDataChange(id);
|
|
177
|
+
}),
|
|
178
|
+
vm.query || '',
|
|
179
|
+
'搜尋所有文章'
|
|
180
|
+
),
|
|
181
|
+
BgWidget.tableV3({
|
|
182
|
+
gvc: gvc,
|
|
183
|
+
getData: (vd) => {
|
|
184
|
+
vmi = vd;
|
|
185
|
+
const limit = 20;
|
|
186
|
+
Article.get({
|
|
187
|
+
page: vmi.page - 1,
|
|
188
|
+
limit: limit,
|
|
189
|
+
search: vm.query || undefined,
|
|
190
|
+
for_index: is_page ? `false` : `true`,
|
|
191
|
+
status: '0,1',
|
|
192
|
+
page_type: page_tab,
|
|
193
|
+
}).then((data) => {
|
|
194
|
+
vm.dataList = data.response.data;
|
|
195
|
+
vmi.pageSize = Math.ceil(data.response.total / limit);
|
|
196
|
+
vmi.originalData = vm.dataList;
|
|
197
|
+
vmi.tableData = getDatalist();
|
|
198
|
+
vmi.loading = false;
|
|
199
|
+
vmi.callback();
|
|
228
200
|
});
|
|
229
201
|
},
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
202
|
+
rowClick: (data, index) => {
|
|
203
|
+
if (type === 'select') {
|
|
204
|
+
vm.dataList[index].checked = !vm.dataList[index].checked;
|
|
205
|
+
vmi.data = getDatalist();
|
|
206
|
+
vmi.callback();
|
|
207
|
+
callback(
|
|
208
|
+
vm.dataList.filter((dd: any) => {
|
|
209
|
+
return dd.checked;
|
|
210
|
+
})
|
|
211
|
+
);
|
|
212
|
+
} else {
|
|
213
|
+
vm.data = vm.dataList[index];
|
|
214
|
+
vm.type = 'replace';
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
filter: [
|
|
218
|
+
{
|
|
219
|
+
name: '批量移除',
|
|
220
|
+
event: (checkedData) => {
|
|
221
|
+
const dialog = new ShareDialog(glitter);
|
|
222
|
+
dialog.checkYesOrNot({
|
|
223
|
+
text: '是否確認刪除所選項目?',
|
|
224
|
+
callback: (response) => {
|
|
225
|
+
if (response) {
|
|
226
|
+
dialog.dataLoading({visible: true});
|
|
227
|
+
Article.deleteV2({
|
|
228
|
+
id: checkedData
|
|
229
|
+
.map((dd: any) => {
|
|
230
|
+
return dd.id;
|
|
231
|
+
})
|
|
232
|
+
.join(`,`),
|
|
233
|
+
}).then((res) => {
|
|
234
|
+
dialog.dataLoading({visible: false});
|
|
235
|
+
if (res.result) {
|
|
236
|
+
vm.dataList = undefined;
|
|
237
|
+
gvc.notifyDataChange(id);
|
|
238
|
+
} else {
|
|
239
|
+
dialog.errorMessage({text: '刪除失敗'});
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
}),
|
|
249
|
+
].join('')
|
|
250
|
+
)}
|
|
251
|
+
`,
|
|
252
|
+
BgWidget.getContainerWidth()
|
|
253
|
+
);
|
|
254
|
+
} else if (vm.type == 'replace') {
|
|
255
|
+
(window.parent as any).glitter.setUrlParameter('page-id', vm.data.id)
|
|
256
|
+
return editor({
|
|
249
257
|
gvc: gvc,
|
|
258
|
+
vm: vm,
|
|
259
|
+
is_page: is_page,
|
|
250
260
|
widget: widget,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
261
|
+
page_tab: page_tab,
|
|
262
|
+
});
|
|
263
|
+
} else if (vm.type == 'collection') {
|
|
264
|
+
return BgWidget.container(
|
|
265
|
+
setCollection({
|
|
266
|
+
gvc: gvc,
|
|
267
|
+
widget: widget,
|
|
268
|
+
key: 'blog_collection',
|
|
269
|
+
goBack: () => {
|
|
270
|
+
vm.type = 'list';
|
|
271
|
+
gvc.notifyDataChange(id);
|
|
272
|
+
},
|
|
273
|
+
}),
|
|
274
|
+
BgWidget.getContainerWidth()
|
|
275
|
+
);
|
|
276
|
+
} else {
|
|
277
|
+
return editor({
|
|
278
|
+
gvc: gvc,
|
|
279
|
+
vm: vm,
|
|
280
|
+
is_page: is_page,
|
|
281
|
+
widget: widget,
|
|
282
|
+
page_tab: page_tab,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
267
285
|
}
|
|
268
286
|
},
|
|
269
287
|
};
|
|
@@ -283,258 +301,266 @@ export class BgBlog {
|
|
|
283
301
|
}
|
|
284
302
|
`);
|
|
285
303
|
const containerID = gvc.glitter.getUUID();
|
|
286
|
-
return html
|
|
304
|
+
return html`
|
|
305
|
+
<div class="d-flex align-items-center">
|
|
287
306
|
${BgWidget.goBack(
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
307
|
+
gvc.event(() => {
|
|
308
|
+
callback(undefined);
|
|
309
|
+
})
|
|
291
310
|
)}
|
|
292
311
|
<div>${[BgWidget.title('選擇模板'), BgWidget.grayNote('請選擇一個符合您需求的模板')].join('')}</div>
|
|
293
312
|
</div>
|
|
294
313
|
${[
|
|
295
|
-
html
|
|
314
|
+
html`
|
|
315
|
+
<div class="my-3"></div>`,
|
|
296
316
|
BgWidget.card(
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
name: '空白內容',
|
|
328
|
-
page_type: 'page',
|
|
329
|
-
preview_image: null,
|
|
330
|
-
appName: 'shop_template_black_style',
|
|
331
|
-
template_type: 2,
|
|
332
|
-
template_config: {
|
|
333
|
-
tag: ['頁面範例'],
|
|
334
|
-
desc: '',
|
|
317
|
+
gvc.bindView(() => {
|
|
318
|
+
return {
|
|
319
|
+
bind: containerID,
|
|
320
|
+
view: () => {
|
|
321
|
+
return gvc.bindView(() => {
|
|
322
|
+
let data: any = undefined;
|
|
323
|
+
const id = gvc.glitter.getUUID();
|
|
324
|
+
if (page_tab !== 'page') {
|
|
325
|
+
ApiPageConfig.getPageTemplate({
|
|
326
|
+
template_from: 'all',
|
|
327
|
+
page: '0',
|
|
328
|
+
limit: '3000',
|
|
329
|
+
type: 'page',
|
|
330
|
+
tag: (() => {
|
|
331
|
+
switch (page_tab) {
|
|
332
|
+
case 'shopping':
|
|
333
|
+
case 'hidden':
|
|
334
|
+
return `一頁購物`;
|
|
335
|
+
default:
|
|
336
|
+
return ``;
|
|
337
|
+
}
|
|
338
|
+
})(),
|
|
339
|
+
search: vm.search,
|
|
340
|
+
}).then((res) => {
|
|
341
|
+
data = res;
|
|
342
|
+
data.response.result.data = [
|
|
343
|
+
{
|
|
344
|
+
id: 20739,
|
|
345
|
+
userID: '234285319',
|
|
346
|
+
tag: 'empty',
|
|
335
347
|
name: '空白內容',
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
348
|
+
page_type: 'page',
|
|
349
|
+
preview_image: null,
|
|
350
|
+
appName: 'shop_template_black_style',
|
|
351
|
+
template_type: 2,
|
|
352
|
+
template_config: {
|
|
353
|
+
tag: ['頁面範例'],
|
|
354
|
+
desc: '',
|
|
355
|
+
name: '空白內容',
|
|
356
|
+
image: ['https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1709282671899-BLANK PAGE.jpg'],
|
|
357
|
+
status: 'wait',
|
|
358
|
+
post_to: 'all',
|
|
359
|
+
version: '1.0',
|
|
360
|
+
created_by: 'liondesign.io',
|
|
361
|
+
preview_img: '',
|
|
362
|
+
},
|
|
342
363
|
},
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
{
|
|
362
|
-
id: 20739,
|
|
363
|
-
userID: '234285319',
|
|
364
|
-
tag: 'empty',
|
|
365
|
-
name: '空白內容',
|
|
366
|
-
page_type: 'page',
|
|
367
|
-
preview_image: null,
|
|
368
|
-
appName: 'shop_template_black_style',
|
|
369
|
-
template_type: 2,
|
|
370
|
-
template_config: {
|
|
371
|
-
tag: ['頁面範例'],
|
|
372
|
-
desc: '',
|
|
373
|
-
name: '空白內容',
|
|
374
|
-
image: ['https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1709282671899-BLANK PAGE.jpg'],
|
|
375
|
-
status: 'wait',
|
|
376
|
-
post_to: 'all',
|
|
377
|
-
version: '1.0',
|
|
378
|
-
created_by: 'liondesign.io',
|
|
379
|
-
preview_img: '',
|
|
380
|
-
},
|
|
381
|
-
},
|
|
382
|
-
].concat(
|
|
383
|
-
dd.response.data.map((dd: any) => {
|
|
384
|
-
return {
|
|
364
|
+
].concat(data.response.result.data);
|
|
365
|
+
gvc.notifyDataChange(id);
|
|
366
|
+
});
|
|
367
|
+
} else {
|
|
368
|
+
Article.get({
|
|
369
|
+
page: 0,
|
|
370
|
+
limit: 20,
|
|
371
|
+
search: ``,
|
|
372
|
+
for_index: `false`,
|
|
373
|
+
status: '0,1',
|
|
374
|
+
page_type: page_tab,
|
|
375
|
+
app_name: 't_1726217714800',
|
|
376
|
+
}).then((dd) => {
|
|
377
|
+
data = {
|
|
378
|
+
response: {
|
|
379
|
+
result: {
|
|
380
|
+
data: [
|
|
381
|
+
{
|
|
385
382
|
id: 20739,
|
|
386
383
|
userID: '234285319',
|
|
387
|
-
tag:
|
|
388
|
-
name:
|
|
384
|
+
tag: 'empty',
|
|
385
|
+
name: '空白內容',
|
|
389
386
|
page_type: 'page',
|
|
390
387
|
preview_image: null,
|
|
391
|
-
|
|
392
|
-
appName: 't_1726217714800',
|
|
388
|
+
appName: 'shop_template_black_style',
|
|
393
389
|
template_type: 2,
|
|
394
390
|
template_config: {
|
|
395
|
-
tag: [],
|
|
391
|
+
tag: ['頁面範例'],
|
|
396
392
|
desc: '',
|
|
397
|
-
name:
|
|
398
|
-
image: [
|
|
393
|
+
name: '空白內容',
|
|
394
|
+
image: ['https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1709282671899-BLANK PAGE.jpg'],
|
|
399
395
|
status: 'wait',
|
|
400
396
|
post_to: 'all',
|
|
401
397
|
version: '1.0',
|
|
402
398
|
created_by: 'liondesign.io',
|
|
403
399
|
preview_img: '',
|
|
404
400
|
},
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
|
|
401
|
+
},
|
|
402
|
+
].concat(
|
|
403
|
+
dd.response.data.map((dd: any) => {
|
|
404
|
+
return {
|
|
405
|
+
id: 20739,
|
|
406
|
+
userID: '234285319',
|
|
407
|
+
tag: dd.content.tag,
|
|
408
|
+
name: dd.content.name,
|
|
409
|
+
page_type: 'page',
|
|
410
|
+
preview_image: null,
|
|
411
|
+
_config: dd.content.config,
|
|
412
|
+
appName: 't_1726217714800',
|
|
413
|
+
template_type: 2,
|
|
414
|
+
template_config: {
|
|
415
|
+
tag: [],
|
|
416
|
+
desc: '',
|
|
417
|
+
name: dd.content.name,
|
|
418
|
+
image: [dd.content.seo.image],
|
|
419
|
+
status: 'wait',
|
|
420
|
+
post_to: 'all',
|
|
421
|
+
version: '1.0',
|
|
422
|
+
created_by: 'liondesign.io',
|
|
423
|
+
preview_img: '',
|
|
424
|
+
},
|
|
425
|
+
};
|
|
426
|
+
})
|
|
427
|
+
),
|
|
428
|
+
},
|
|
408
429
|
},
|
|
409
|
-
}
|
|
410
|
-
};
|
|
430
|
+
};
|
|
411
431
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
432
|
+
gvc.notifyDataChange(id);
|
|
433
|
+
});
|
|
434
|
+
}
|
|
415
435
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
436
|
+
return {
|
|
437
|
+
bind: id,
|
|
438
|
+
view: () => {
|
|
439
|
+
if (data) {
|
|
440
|
+
return (() => {
|
|
441
|
+
if (data.response.result.data.length === 0) {
|
|
442
|
+
if (!vm.search) {
|
|
443
|
+
return html`
|
|
444
|
+
<div class="d-flex align-items-center justify-content-center flex-column w-100 py-4"
|
|
445
|
+
style="width:700px;gap:10px;">
|
|
446
|
+
<img src="./img/box-open-solid.svg"/>
|
|
447
|
+
<span class="color39 text-center">尚未自製任何模塊<br/>請前往開發者模式自製專屬模塊</span>
|
|
448
|
+
</div>
|
|
449
|
+
`;
|
|
450
|
+
} else {
|
|
451
|
+
return html`
|
|
452
|
+
<div class="d-flex align-items-center justify-content-center flex-column w-100 py-4"
|
|
453
|
+
style="width:700px;gap:10px;">
|
|
454
|
+
<img src="./img/box-open-solid.svg"/>
|
|
455
|
+
<span class="color39 text-center">查無相關模塊</span>
|
|
456
|
+
</div>
|
|
457
|
+
`;
|
|
458
|
+
}
|
|
429
459
|
} else {
|
|
430
460
|
return html`
|
|
431
|
-
<div class="
|
|
432
|
-
<
|
|
433
|
-
|
|
461
|
+
<div class="w-100" style="overflow-y: auto;">
|
|
462
|
+
<div class="row m-0 pt-2 w-100">
|
|
463
|
+
${data.response.result.data
|
|
464
|
+
.sort((a: any, b: any) => {
|
|
465
|
+
if (a.tag === 'empty' || b.tag === 'empty') {
|
|
466
|
+
return b.tag === 'empty' ? 1 : -1;
|
|
467
|
+
} else {
|
|
468
|
+
return a.template_config.name.localeCompare(b.template_config.name);
|
|
469
|
+
}
|
|
470
|
+
})
|
|
471
|
+
.map((dd: any, index: number) => {
|
|
472
|
+
return html`
|
|
473
|
+
<div class="col-6 col-sm-3 mb-3 rounded-3">
|
|
474
|
+
<div class="d-flex flex-column justify-content-center w-100 "
|
|
475
|
+
style="gap:5px;cursor:pointer;">
|
|
476
|
+
<div
|
|
477
|
+
class="card w-100 position-relative rounded hoverHidden bgf6 rounded-3"
|
|
478
|
+
style="padding-bottom: ${(800 / 600) * 100}%;"
|
|
479
|
+
>
|
|
480
|
+
<div
|
|
481
|
+
class="position-absolute w-100 h-100 d-flex align-items-center justify-content-center rounded-3"
|
|
482
|
+
style="overflow: hidden;"
|
|
483
|
+
>
|
|
484
|
+
<img
|
|
485
|
+
class="w-100 "
|
|
486
|
+
src="${dd.template_config.image[0] ??
|
|
487
|
+
'https://d3jnmi1tfjgtti.cloudfront.net/file/252530754/1713445383494-未命名(1080x1080像素).jpg'}"
|
|
488
|
+
/>
|
|
489
|
+
</div>
|
|
490
|
+
|
|
491
|
+
<div
|
|
492
|
+
class="position-absolute w-100 h-100 align-items-center justify-content-center rounded fs-6 flex-column"
|
|
493
|
+
style="background: rgba(0,0,0,0.5);gap:5px;"
|
|
494
|
+
>
|
|
495
|
+
<button
|
|
496
|
+
class="btn btn-secondary d-flex align-items-center "
|
|
497
|
+
style="height: 28px;width: 75px;gap:5px;"
|
|
498
|
+
onclick="${gvc.event(() => {
|
|
499
|
+
if (dd.tag === 'empty') {
|
|
500
|
+
const a: any = [];
|
|
501
|
+
(a as any).name = '空白頁面';
|
|
502
|
+
callback(a);
|
|
503
|
+
} else {
|
|
504
|
+
if (dd._config) {
|
|
505
|
+
dd._config.name = dd.template_config.name;
|
|
506
|
+
callback(dd._config);
|
|
507
|
+
} else {
|
|
508
|
+
BaseApi.create({
|
|
509
|
+
url: `${(window as any).glitterBackend}/api/v1/template?appName=${dd.appName}&tag=${
|
|
510
|
+
dd.tag
|
|
511
|
+
}`,
|
|
512
|
+
type: 'get',
|
|
513
|
+
}).then((res) => {
|
|
514
|
+
res.response.result[0].config.name = dd.template_config.name;
|
|
515
|
+
callback(res.response.result[0].config);
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
})}"
|
|
520
|
+
>
|
|
521
|
+
選擇
|
|
522
|
+
</button>
|
|
523
|
+
</div>
|
|
524
|
+
</div>
|
|
525
|
+
<h3 class="fs-6 mb-0 d-flex justify-content-between align-items-center fw-500 mt-1">
|
|
526
|
+
${dd.template_config.name}
|
|
527
|
+
<i
|
|
528
|
+
class="fa-solid fa-eye ${dd.tag === 'empty' ? `d-none` : ``}"
|
|
529
|
+
style="cursor:pointer;"
|
|
530
|
+
onclick="${gvc.event(() => {
|
|
531
|
+
(window.parent as any).glitter.openNewTab(
|
|
532
|
+
`${gvc.glitter.root_path}pages/${dd.tag}?appName=${dd.appName}`
|
|
533
|
+
);
|
|
534
|
+
})}"
|
|
535
|
+
></i>
|
|
536
|
+
</h3>
|
|
537
|
+
</div>
|
|
538
|
+
</div>`;
|
|
539
|
+
})
|
|
540
|
+
.join('')}
|
|
541
|
+
</div>
|
|
434
542
|
</div>
|
|
435
543
|
`;
|
|
436
544
|
}
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
<div
|
|
457
|
-
class="position-absolute w-100 h-100 d-flex align-items-center justify-content-center rounded-3"
|
|
458
|
-
style="overflow: hidden;"
|
|
459
|
-
>
|
|
460
|
-
<img
|
|
461
|
-
class="w-100 "
|
|
462
|
-
src="${dd.template_config.image[0] ??
|
|
463
|
-
'https://d3jnmi1tfjgtti.cloudfront.net/file/252530754/1713445383494-未命名(1080x1080像素).jpg'}"
|
|
464
|
-
/>
|
|
465
|
-
</div>
|
|
466
|
-
|
|
467
|
-
<div
|
|
468
|
-
class="position-absolute w-100 h-100 align-items-center justify-content-center rounded fs-6 flex-column"
|
|
469
|
-
style="background: rgba(0,0,0,0.5);gap:5px;"
|
|
470
|
-
>
|
|
471
|
-
<button
|
|
472
|
-
class="btn btn-secondary d-flex align-items-center "
|
|
473
|
-
style="height: 28px;width: 75px;gap:5px;"
|
|
474
|
-
onclick="${gvc.event(() => {
|
|
475
|
-
if (dd.tag === 'empty') {
|
|
476
|
-
const a: any = [];
|
|
477
|
-
(a as any).name = '空白頁面';
|
|
478
|
-
callback(a);
|
|
479
|
-
} else {
|
|
480
|
-
if (dd._config) {
|
|
481
|
-
dd._config.name = dd.template_config.name;
|
|
482
|
-
callback(dd._config);
|
|
483
|
-
} else {
|
|
484
|
-
BaseApi.create({
|
|
485
|
-
url: `${(window as any).glitterBackend}/api/v1/template?appName=${dd.appName}&tag=${
|
|
486
|
-
dd.tag
|
|
487
|
-
}`,
|
|
488
|
-
type: 'get',
|
|
489
|
-
}).then((res) => {
|
|
490
|
-
res.response.result[0].config.name = dd.template_config.name;
|
|
491
|
-
callback(res.response.result[0].config);
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
})}"
|
|
496
|
-
>
|
|
497
|
-
選擇
|
|
498
|
-
</button>
|
|
499
|
-
</div>
|
|
500
|
-
</div>
|
|
501
|
-
<h3 class="fs-6 mb-0 d-flex justify-content-between align-items-center fw-500 mt-1">
|
|
502
|
-
${dd.template_config.name}
|
|
503
|
-
<i
|
|
504
|
-
class="fa-solid fa-eye ${dd.tag === 'empty' ? `d-none` : ``}"
|
|
505
|
-
style="cursor:pointer;"
|
|
506
|
-
onclick="${gvc.event(() => {
|
|
507
|
-
(window.parent as any).glitter.openNewTab(
|
|
508
|
-
`${gvc.glitter.root_path}pages/${dd.tag}?appName=${dd.appName}`
|
|
509
|
-
);
|
|
510
|
-
})}"
|
|
511
|
-
></i>
|
|
512
|
-
</h3>
|
|
513
|
-
</div>
|
|
514
|
-
</div>`;
|
|
515
|
-
})
|
|
516
|
-
.join('')}
|
|
517
|
-
</div>
|
|
518
|
-
</div>
|
|
519
|
-
`;
|
|
520
|
-
}
|
|
521
|
-
})();
|
|
522
|
-
} else {
|
|
523
|
-
return html` <div class="w-100 p-3 d-flex align-items-center justify-content-center flex-column" style="gap: 10px;">
|
|
524
|
-
<div class="spinner-border fs-5"></div>
|
|
525
|
-
<div class="fs-6 fw-500">載入中...</div>
|
|
526
|
-
</div>`;
|
|
527
|
-
}
|
|
528
|
-
},
|
|
529
|
-
divCreate: {
|
|
530
|
-
style: '',
|
|
531
|
-
},
|
|
532
|
-
};
|
|
533
|
-
});
|
|
534
|
-
},
|
|
535
|
-
divCreate: {},
|
|
536
|
-
};
|
|
537
|
-
})
|
|
545
|
+
})();
|
|
546
|
+
} else {
|
|
547
|
+
return html`
|
|
548
|
+
<div class="w-100 p-3 d-flex align-items-center justify-content-center flex-column"
|
|
549
|
+
style="gap: 10px;">
|
|
550
|
+
<div class="spinner-border fs-5"></div>
|
|
551
|
+
<div class="fs-6 fw-500">載入中...</div>
|
|
552
|
+
</div>`;
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
divCreate: {
|
|
556
|
+
style: '',
|
|
557
|
+
},
|
|
558
|
+
};
|
|
559
|
+
});
|
|
560
|
+
},
|
|
561
|
+
divCreate: {},
|
|
562
|
+
};
|
|
563
|
+
})
|
|
538
564
|
),
|
|
539
565
|
].join('')} `;
|
|
540
566
|
}
|
|
@@ -558,6 +584,7 @@ function editor(cf: { gvc: GVC; vm: any; is_page: boolean; widget: any; page_tab
|
|
|
558
584
|
id: gvc.glitter.getUUID(),
|
|
559
585
|
type: 'detail',
|
|
560
586
|
};
|
|
587
|
+
|
|
561
588
|
return BgWidget.container(
|
|
562
589
|
gvc.bindView(() => {
|
|
563
590
|
return {
|
|
@@ -591,10 +618,12 @@ function editor(cf: { gvc: GVC; vm: any; is_page: boolean; widget: any; page_tab
|
|
|
591
618
|
case 'detail':
|
|
592
619
|
return detail(gvc, cf, vm, cVm, cf.page_tab);
|
|
593
620
|
case 'template':
|
|
621
|
+
|
|
594
622
|
return template_select(gvc, cf, vm, cVm, cf.page_tab);
|
|
595
623
|
default:
|
|
596
624
|
return ``;
|
|
597
625
|
}
|
|
626
|
+
|
|
598
627
|
},
|
|
599
628
|
divCreate: {},
|
|
600
629
|
};
|
|
@@ -614,629 +643,636 @@ function detail(gvc: GVC, cf: any, vm: any, cVm: any, page_tab: 'page' | 'hidden
|
|
|
614
643
|
}, 100);
|
|
615
644
|
return ``;
|
|
616
645
|
}
|
|
646
|
+
const domainPrefix = `${
|
|
647
|
+
cf.is_page
|
|
648
|
+
? (() => {
|
|
649
|
+
switch (page_tab) {
|
|
650
|
+
case 'shopping':
|
|
651
|
+
return 'shop';
|
|
652
|
+
case 'hidden':
|
|
653
|
+
return 'hidden';
|
|
654
|
+
case 'page':
|
|
655
|
+
return 'pages';
|
|
656
|
+
default:
|
|
657
|
+
return '';
|
|
658
|
+
}
|
|
659
|
+
})()
|
|
660
|
+
: 'blogs'
|
|
661
|
+
}`
|
|
617
662
|
return html`
|
|
618
663
|
<div class="d-flex w-100 align-items-center mb-3 ">
|
|
619
664
|
${BgWidget.goBack(
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
665
|
+
gvc.event(() => {
|
|
666
|
+
(window.parent as any).glitter.setUrlParameter('page-id', undefined)
|
|
667
|
+
vm.type = 'list';
|
|
668
|
+
})
|
|
623
669
|
)}
|
|
624
670
|
${BgWidget.title(
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
671
|
+
cf.is_page
|
|
672
|
+
? (() => {
|
|
673
|
+
switch (page_tab) {
|
|
674
|
+
case 'hidden':
|
|
675
|
+
return '隱形賣場';
|
|
676
|
+
case 'page':
|
|
677
|
+
return '自訂頁面';
|
|
678
|
+
case 'shopping':
|
|
679
|
+
return '一頁商店';
|
|
680
|
+
}
|
|
681
|
+
})()
|
|
682
|
+
: '編輯網誌'
|
|
637
683
|
)}
|
|
638
684
|
<div class="flex-fill"></div>
|
|
639
685
|
<div class="d-flex ${cf.is_page ? `` : `d-none`}">
|
|
640
686
|
${BgWidget.grayButton(
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
687
|
+
'套用模板',
|
|
688
|
+
gvc.event(() => {
|
|
689
|
+
cVm.type = 'template';
|
|
690
|
+
gvc.notifyDataChange(cVm.id);
|
|
691
|
+
})
|
|
646
692
|
)}
|
|
647
693
|
<div class="mx-1"></div>
|
|
648
694
|
${BgWidget.grayButton(
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
695
|
+
'前往設計',
|
|
696
|
+
gvc.event(() => {
|
|
697
|
+
(window.parent as any).glitter.setUrlParameter('page-id', vm.data.id);
|
|
698
|
+
(window.parent as any).glitter.share.switch_to_web_builder(`${domainPrefix}/${vm.data.content.tag}`);
|
|
699
|
+
})
|
|
700
|
+
)}
|
|
701
|
+
</div>
|
|
702
|
+
</div>
|
|
703
|
+
${BgWidget.container(
|
|
704
|
+
html`
|
|
705
|
+
<div class="d-flex justify-content-center p-0 ${document.body.clientWidth < 768 ? 'flex-column' : ''}"
|
|
706
|
+
style="gap: 24px">
|
|
707
|
+
<div class="d-flex flex-column "
|
|
708
|
+
style="gap:10px;${document.body.clientWidth > 768 ? 'width: 73.5%;' : ''}">
|
|
709
|
+
${BgWidget.container(
|
|
710
|
+
gvc.bindView(() => {
|
|
711
|
+
vm.data.status = vm.data.status ?? 1;
|
|
712
|
+
const id = gvc.glitter.getUUID();
|
|
713
|
+
return {
|
|
714
|
+
bind: id,
|
|
715
|
+
view: () => {
|
|
716
|
+
return [
|
|
717
|
+
BgWidget.mainCard(
|
|
718
|
+
(() => {
|
|
719
|
+
const prefixURL = `https://${(window.parent as any).glitter.share.editorViewModel.domain}/${
|
|
720
|
+
cf.is_page
|
|
721
|
+
? (() => {
|
|
722
|
+
switch (page_tab) {
|
|
723
|
+
case 'shopping':
|
|
724
|
+
return 'shop';
|
|
725
|
+
case 'hidden':
|
|
726
|
+
return 'hidden';
|
|
727
|
+
case 'page':
|
|
728
|
+
return 'pages';
|
|
729
|
+
default:
|
|
730
|
+
return '';
|
|
731
|
+
}
|
|
732
|
+
})()
|
|
733
|
+
: 'blogs'
|
|
734
|
+
}/`;
|
|
735
|
+
return [
|
|
736
|
+
BgWidget.title('基本設定', 'font-size: 16px;'),
|
|
737
|
+
html`
|
|
738
|
+
<div style="display: flex; align-items: center; gap: 4px; margin: 18px 0;">
|
|
739
|
+
<div class="tx_normal">網頁啟用</div>
|
|
740
|
+
${BgWidget.switchButton(gvc, vm.data.status, (bool) => {
|
|
741
|
+
vm.data.status = bool ? 1 : 0;
|
|
742
|
+
gvc.notifyDataChange(id);
|
|
743
|
+
})}
|
|
744
|
+
</div>`,
|
|
745
|
+
BgWidget.editeInput({
|
|
746
|
+
gvc: gvc,
|
|
747
|
+
title: '網頁名稱',
|
|
748
|
+
default: vm.data.content.name || '',
|
|
749
|
+
placeHolder: '請輸入網頁名稱',
|
|
750
|
+
callback: (text) => {
|
|
751
|
+
vm.data.content.name = text;
|
|
752
|
+
},
|
|
753
|
+
}),
|
|
754
|
+
html`
|
|
755
|
+
<div>
|
|
756
|
+
<div class="tx_normal fw-normal mb-2">
|
|
757
|
+
自訂網址
|
|
758
|
+
</div>
|
|
759
|
+
<div
|
|
760
|
+
style="justify-content: flex-start; align-items: center; display: inline-flex;border:1px solid #EAEAEA;border-radius: 10px;overflow: hidden; ${document
|
|
761
|
+
.body.clientWidth > 768
|
|
762
|
+
? 'gap: 18px; '
|
|
763
|
+
: 'flex-direction: column; gap: 0px; '}"
|
|
764
|
+
class="w-100"
|
|
765
|
+
>
|
|
766
|
+
<div class="${document.body.clientWidth > 768 ? `` : `w-100`}"
|
|
767
|
+
style="padding: 9px 18px;background: #EAEAEA ;${document.body.clientWidth > 768 ? `justify-content: center;` : `justify-content: start;`} align-items: center; gap: 5px; display: flex">
|
|
768
|
+
<div style="text-align: right; color: #393939; font-size: 16px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word">
|
|
769
|
+
${prefixURL}
|
|
770
|
+
</div>
|
|
771
|
+
</div>
|
|
772
|
+
<input
|
|
773
|
+
class="flex-fill"
|
|
774
|
+
style="width:100%;border:none;background:none;text-align: start; color: #393939; font-size: 16px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word; ${document
|
|
775
|
+
.body.clientWidth > 768
|
|
776
|
+
? ''
|
|
777
|
+
: 'padding: 9px 18px;'}"
|
|
778
|
+
value="${vm.data.content.tag || ''}"
|
|
779
|
+
onchange="${gvc.event((e) => {
|
|
780
|
+
let text = e.value;
|
|
781
|
+
if (!CheckInput.isEnglishNumberHyphen(text)) {
|
|
782
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
783
|
+
dialog.infoMessage({text: '僅能輸入英文或數字與連接號'});
|
|
784
|
+
gvc.notifyDataChange(id);
|
|
785
|
+
} else {
|
|
786
|
+
vm.data.content.tag = text;
|
|
787
|
+
gvc.notifyDataChange(id);
|
|
788
|
+
}
|
|
789
|
+
})}"
|
|
790
|
+
/>
|
|
791
|
+
</div>
|
|
792
|
+
</div>`,
|
|
793
|
+
html`
|
|
794
|
+
<div class="mt-2 mb-1"><span
|
|
795
|
+
class="tx_normal me-2">網址預覽</span>${BgWidget.greenNote(prefixURL + (vm.data.content.tag ?? ''))}
|
|
796
|
+
</div>`,
|
|
797
|
+
...(() => {
|
|
798
|
+
return [
|
|
799
|
+
BgWidget.editeInput({
|
|
800
|
+
gvc: gvc,
|
|
801
|
+
title: 'SEO標題',
|
|
802
|
+
default: vm.data.content.seo.title,
|
|
803
|
+
placeHolder: `請輸入SEO標題`,
|
|
804
|
+
callback: (text) => {
|
|
805
|
+
vm.data.content.title = text;
|
|
806
|
+
vm.data.content.seo.title = text;
|
|
807
|
+
gvc.notifyDataChange(id);
|
|
808
|
+
},
|
|
809
|
+
}),
|
|
810
|
+
BgWidget.textArea({
|
|
811
|
+
gvc: gvc,
|
|
812
|
+
title: 'SEO描述',
|
|
813
|
+
default: vm.data.content.seo.content,
|
|
814
|
+
placeHolder: `請輸入中繼描述`,
|
|
815
|
+
callback: (text) => {
|
|
816
|
+
vm.data.content.description = text;
|
|
817
|
+
vm.data.content.seo.content = text;
|
|
818
|
+
gvc.notifyDataChange(id);
|
|
819
|
+
},
|
|
820
|
+
}),
|
|
821
|
+
html`
|
|
822
|
+
<div>
|
|
823
|
+
<div class="tx_normal">
|
|
824
|
+
社群分享縮圖
|
|
825
|
+
</div>
|
|
826
|
+
<div class="mt-1 mb-2">
|
|
827
|
+
${BgWidget.grayNote('建議尺寸為 200px * 200px 以上')}
|
|
828
|
+
</div>
|
|
829
|
+
${BgWidget.imageSelector(gvc, vm.data.content.seo.image || '', (text) => {
|
|
830
|
+
vm.data.content.seo.image = text;
|
|
831
|
+
gvc.notifyDataChange(id);
|
|
832
|
+
})}
|
|
833
|
+
</div>`,
|
|
834
|
+
,
|
|
835
|
+
];
|
|
836
|
+
})(),
|
|
837
|
+
...(() => {
|
|
838
|
+
if (`${vm.data.content.for_index}` === 'true') {
|
|
839
|
+
return [
|
|
840
|
+
[
|
|
841
|
+
html`
|
|
842
|
+
<div class="tx_normal my-3">
|
|
843
|
+
網誌內文
|
|
844
|
+
</div>`,
|
|
845
|
+
EditorElem.richText({
|
|
846
|
+
gvc: gvc,
|
|
847
|
+
def: vm.data.content.text ?? '',
|
|
848
|
+
callback: (text) => {
|
|
849
|
+
vm.data.content.text = text;
|
|
850
|
+
},
|
|
851
|
+
}),
|
|
852
|
+
].join(BgWidget.mbContainer(12)),
|
|
853
|
+
];
|
|
854
|
+
} else {
|
|
855
|
+
return [];
|
|
856
|
+
}
|
|
857
|
+
})(),
|
|
858
|
+
].join(BgWidget.mbContainer(12));
|
|
859
|
+
})()
|
|
860
|
+
),
|
|
861
|
+
].join('');
|
|
862
|
+
},
|
|
863
|
+
divCreate: {
|
|
864
|
+
style: 'padding: 0;',
|
|
865
|
+
},
|
|
866
|
+
};
|
|
867
|
+
}),
|
|
868
|
+
undefined,
|
|
869
|
+
'padding: 0 !important; margin: 0 !important; width: 100%;'
|
|
870
|
+
)}
|
|
871
|
+
${(() => {
|
|
872
|
+
vm.data.content.relative = vm.data.content.relative || 'collection';
|
|
873
|
+
vm.data.content.relative_data = vm.data.content.relative_data || [];
|
|
874
|
+
vm.data.content.with_discount = vm.data.content.with_discount || 'false';
|
|
875
|
+
|
|
654
876
|
return gvc.bindView(() => {
|
|
655
877
|
const id = gvc.glitter.getUUID();
|
|
656
878
|
return {
|
|
657
879
|
bind: id,
|
|
658
880
|
view: () => {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
881
|
+
// 顯示套用的賣場商品列表
|
|
882
|
+
if (vm.data.content.page_type === 'hidden' || vm.data.content.page_type === 'shopping') {
|
|
883
|
+
return [
|
|
884
|
+
BgWidget.mainCard(
|
|
885
|
+
[
|
|
886
|
+
BgWidget.title(
|
|
887
|
+
html`預設加入購物車
|
|
888
|
+
<div class="badge ms-2"
|
|
889
|
+
style="background:#eaeaea;color:#393939;">
|
|
890
|
+
以下設定的商品會自動加入購物車
|
|
891
|
+
</div>`,
|
|
892
|
+
'font-size: 16px;'
|
|
893
|
+
),
|
|
894
|
+
html`
|
|
895
|
+
<div class="my-2"></div>`,
|
|
896
|
+
[
|
|
897
|
+
html`${(() => {
|
|
898
|
+
return gvc.bindView(() => {
|
|
899
|
+
const subVM = {
|
|
900
|
+
id: gvc.glitter.getUUID(),
|
|
901
|
+
loading: true,
|
|
902
|
+
dataList: [] as OptionsItem[],
|
|
903
|
+
};
|
|
904
|
+
return {
|
|
905
|
+
bind: subVM.id,
|
|
906
|
+
view: () => {
|
|
907
|
+
if (subVM.loading) {
|
|
908
|
+
return BgWidget.spinner();
|
|
909
|
+
}
|
|
910
|
+
return html`
|
|
911
|
+
<div class="d-flex flex-column p-2"
|
|
912
|
+
style="gap: 18px;">
|
|
913
|
+
<div class="d-flex align-items-center gray-bottom-line-18 "
|
|
914
|
+
style="gap: 24px; justify-content: space-between;">
|
|
915
|
+
<div class="form-check-label c_updown_label">
|
|
916
|
+
<div class="tx_normal">
|
|
917
|
+
產品列表
|
|
918
|
+
</div>
|
|
919
|
+
</div>
|
|
920
|
+
${BgWidget.grayButton(
|
|
921
|
+
'搜尋商品',
|
|
922
|
+
gvc.event(() => {
|
|
923
|
+
BgProduct.variantsSelector({
|
|
924
|
+
gvc: gvc,
|
|
925
|
+
filter_variants: vm.data.content.relative_data.map((dd: any) => {
|
|
926
|
+
return [dd.product_id].concat(dd.variant.spec).join('-');
|
|
927
|
+
}),
|
|
928
|
+
callback: async (value) => {
|
|
929
|
+
vm.data.content.relative_data = value.map((dd: any) => {
|
|
930
|
+
return {
|
|
931
|
+
variant: dd.variant_content,
|
|
932
|
+
product_id: dd.product_id,
|
|
933
|
+
};
|
|
934
|
+
});
|
|
935
|
+
subVM.loading = true;
|
|
936
|
+
gvc.notifyDataChange(subVM.id);
|
|
937
|
+
},
|
|
938
|
+
});
|
|
939
|
+
}),
|
|
940
|
+
{textStyle: 'font-weight: 400;'}
|
|
941
|
+
)}
|
|
942
|
+
</div>
|
|
943
|
+
${subVM.dataList
|
|
944
|
+
.map((opt: OptionsItem, index) => {
|
|
945
|
+
return html`
|
|
946
|
+
<div class="d-flex align-items-center form-check-label c_updown_label gap-3">
|
|
947
|
+
<span class="tx_normal"
|
|
948
|
+
style="min-width: 20px;">${index + 1} .</span>
|
|
949
|
+
${BgWidget.validImageBox({
|
|
950
|
+
gvc: gvc,
|
|
951
|
+
image: opt.image,
|
|
952
|
+
width: 40
|
|
953
|
+
})}
|
|
954
|
+
<div class="tx_normal ${opt.note ? 'mb-1' : ''} d-flex flex-column">
|
|
955
|
+
${opt.value}
|
|
956
|
+
${opt.note ? html`
|
|
957
|
+
<div class="tx_gray_12">
|
|
958
|
+
${opt.note}
|
|
959
|
+
</div> ` : ''}
|
|
960
|
+
</div>
|
|
961
|
+
<div class="flex-fill"></div>
|
|
962
|
+
${BgWidget.cancel(
|
|
963
|
+
gvc.event(() => {
|
|
964
|
+
vm.data.content.relative_data.splice(index, 1);
|
|
965
|
+
subVM.dataList.splice(index, 1);
|
|
966
|
+
gvc.notifyDataChange(subVM.id);
|
|
967
|
+
}),
|
|
968
|
+
'移除'
|
|
969
|
+
)}
|
|
970
|
+
</div>
|
|
971
|
+
`;
|
|
972
|
+
})
|
|
973
|
+
.join('') || `<div class="w-100 d-flex align-content-center justify-content-center">尚未加入任何賣場商品</div>`}
|
|
974
|
+
</div>
|
|
975
|
+
`;
|
|
976
|
+
},
|
|
977
|
+
onCreate: () => {
|
|
978
|
+
if (subVM.loading) {
|
|
979
|
+
if (vm.data.content.relative_data.length === 0) {
|
|
980
|
+
setTimeout(() => {
|
|
981
|
+
subVM.dataList = [];
|
|
982
|
+
subVM.loading = false;
|
|
983
|
+
gvc.notifyDataChange(subVM.id);
|
|
984
|
+
}, 300);
|
|
985
|
+
} else {
|
|
986
|
+
new Promise<OptionsItem[]>(async (resolve) => {
|
|
987
|
+
const products_data = await BgProduct.getProductOpts(
|
|
988
|
+
vm.data.content.relative_data.map((dd: any) => {
|
|
989
|
+
return dd.product_id;
|
|
990
|
+
})
|
|
991
|
+
);
|
|
992
|
+
vm.data.content.relative_data = vm.data.content.relative_data.filter((dd: any) => {
|
|
993
|
+
return products_data.find((d1) => {
|
|
994
|
+
return `${dd.product_id}` === `${d1.key}`;
|
|
995
|
+
});
|
|
996
|
+
});
|
|
997
|
+
subVM.dataList = vm.data.content.relative_data.map((dd: any) => {
|
|
998
|
+
const product: any = JSON.parse(
|
|
999
|
+
JSON.stringify(
|
|
1000
|
+
products_data.find((d1) => {
|
|
1001
|
+
return `${dd.product_id}` === `${d1.key}`;
|
|
1002
|
+
})
|
|
1003
|
+
)
|
|
1004
|
+
);
|
|
1005
|
+
product.note = dd.variant.spec.join(' / ');
|
|
1006
|
+
return product;
|
|
1007
|
+
});
|
|
1008
|
+
resolve(subVM.dataList);
|
|
1009
|
+
}).then((data) => {
|
|
1010
|
+
subVM.dataList = data;
|
|
1011
|
+
subVM.loading = false;
|
|
1012
|
+
gvc.notifyDataChange(subVM.id);
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
},
|
|
1017
|
+
};
|
|
1018
|
+
});
|
|
1019
|
+
})()}`,
|
|
1020
|
+
].join(''),
|
|
1021
|
+
].join('')
|
|
1022
|
+
),
|
|
1023
|
+
].join('');
|
|
1024
|
+
} else {
|
|
1025
|
+
return [].join('');
|
|
1026
|
+
}
|
|
668
1027
|
},
|
|
669
1028
|
divCreate: {
|
|
670
|
-
class: `
|
|
671
|
-
style: `background: rgba(0,0,0,0.5);`,
|
|
672
|
-
},
|
|
673
|
-
onCreate: () => {
|
|
674
|
-
const interval = setInterval(() => {
|
|
675
|
-
const iframe: any = window.parent.document.querySelector('#editor_dialog')!;
|
|
676
|
-
if (iframe.contentWindow.glitter) {
|
|
677
|
-
iframe.contentWindow.glitter.share.editor_vm = {
|
|
678
|
-
close: () => {
|
|
679
|
-
gvc.closeDialog();
|
|
680
|
-
},
|
|
681
|
-
callback: (cf: any) => {
|
|
682
|
-
vm.data.content.config = cf.config;
|
|
683
|
-
saveData(gvc, cf, vm, cVm, true);
|
|
684
|
-
},
|
|
685
|
-
page_data: {
|
|
686
|
-
config: JSON.parse(JSON.stringify(vm.data.content.config || [])),
|
|
687
|
-
page_config: {},
|
|
688
|
-
name: vm.data.content.name || '尚未設定頁面標題',
|
|
689
|
-
},
|
|
690
|
-
title: vm.data.content.name || '尚未設定頁面標題',
|
|
691
|
-
};
|
|
692
|
-
clearInterval(interval);
|
|
693
|
-
}
|
|
694
|
-
}, 100);
|
|
1029
|
+
class: `w-100 mt-2`,
|
|
695
1030
|
},
|
|
696
1031
|
};
|
|
697
1032
|
});
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
{
|
|
701
|
-
dismiss: () => {},
|
|
702
|
-
}
|
|
703
|
-
);
|
|
704
|
-
})
|
|
705
|
-
)}
|
|
706
|
-
</div>
|
|
707
|
-
</div>
|
|
708
|
-
${BgWidget.container(
|
|
709
|
-
html`
|
|
710
|
-
<div class="d-flex justify-content-center p-0 ${document.body.clientWidth < 768 ? 'flex-column' : ''}" style="gap: 24px">
|
|
711
|
-
<div class="d-flex flex-column " style="gap:10px;${document.body.clientWidth > 768 ? 'width: 73.5%;' : ''}">
|
|
1033
|
+
})()}
|
|
1034
|
+
</div>
|
|
712
1035
|
${BgWidget.container(
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
(() => {
|
|
722
|
-
const prefixURL = `https://${(window.parent as any).glitter.share.editorViewModel.domain}/${
|
|
723
|
-
cf.is_page
|
|
724
|
-
? (() => {
|
|
725
|
-
switch (page_tab) {
|
|
726
|
-
case 'shopping':
|
|
727
|
-
return 'shop';
|
|
728
|
-
case 'hidden':
|
|
729
|
-
return 'hidden';
|
|
730
|
-
case 'page':
|
|
731
|
-
return 'pages';
|
|
732
|
-
default:
|
|
733
|
-
return '';
|
|
734
|
-
}
|
|
735
|
-
})()
|
|
736
|
-
: 'blogs'
|
|
737
|
-
}/`;
|
|
1036
|
+
BgWidget.mainCard(
|
|
1037
|
+
gvc.bindView(() => {
|
|
1038
|
+
console.log(`vm.data.content.template=>`, vm.data.content.template);
|
|
1039
|
+
const id = gvc.glitter.getUUID();
|
|
1040
|
+
vm.data.status = vm.data.status ?? '1';
|
|
1041
|
+
return {
|
|
1042
|
+
bind: id,
|
|
1043
|
+
view: () => {
|
|
738
1044
|
return [
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
vm.data.status = bool ? 1 : 0;
|
|
744
|
-
gvc.notifyDataChange(id);
|
|
745
|
-
})}
|
|
746
|
-
</div>`,
|
|
747
|
-
BgWidget.editeInput({
|
|
748
|
-
gvc: gvc,
|
|
749
|
-
title: '網頁名稱',
|
|
750
|
-
default: vm.data.content.name || '',
|
|
751
|
-
placeHolder: '請輸入網頁名稱',
|
|
752
|
-
callback: (text) => {
|
|
753
|
-
vm.data.content.name = text;
|
|
754
|
-
},
|
|
755
|
-
}),
|
|
756
|
-
html` <div>
|
|
757
|
-
<div class="tx_normal fw-normal mb-2">自訂網址</div>
|
|
758
|
-
<div
|
|
759
|
-
style="justify-content: flex-start; align-items: center; display: inline-flex;border:1px solid #EAEAEA;border-radius: 10px;overflow: hidden; ${document
|
|
760
|
-
.body.clientWidth > 768
|
|
761
|
-
? 'gap: 18px; '
|
|
762
|
-
: 'flex-direction: column; gap: 0px; '}"
|
|
763
|
-
class="w-100"
|
|
764
|
-
>
|
|
765
|
-
<div class="${document.body.clientWidth > 768 ? ``:`w-100`}" style="padding: 9px 18px;background: #EAEAEA ;${document.body.clientWidth > 768 ? `justify-content: center;`:`justify-content: start;`} align-items: center; gap: 5px; display: flex">
|
|
766
|
-
<div style="text-align: right; color: #393939; font-size: 16px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word">
|
|
767
|
-
${prefixURL}
|
|
768
|
-
</div>
|
|
769
|
-
</div>
|
|
770
|
-
<input
|
|
771
|
-
class="flex-fill"
|
|
772
|
-
style="width:100%;border:none;background:none;text-align: start; color: #393939; font-size: 16px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word; ${document
|
|
773
|
-
.body.clientWidth > 768
|
|
774
|
-
? ''
|
|
775
|
-
: 'padding: 9px 18px;'}"
|
|
776
|
-
value="${vm.data.content.tag || ''}"
|
|
777
|
-
onchange="${gvc.event((e) => {
|
|
778
|
-
let text = e.value;
|
|
779
|
-
if (!CheckInput.isEnglishNumberHyphen(text)) {
|
|
780
|
-
const dialog = new ShareDialog(gvc.glitter);
|
|
781
|
-
dialog.infoMessage({ text: '僅能輸入英文或數字與連接號' });
|
|
782
|
-
gvc.notifyDataChange(id);
|
|
783
|
-
} else {
|
|
784
|
-
vm.data.content.tag = text;
|
|
785
|
-
gvc.notifyDataChange(id);
|
|
786
|
-
}
|
|
787
|
-
})}"
|
|
788
|
-
/>
|
|
789
|
-
</div>
|
|
790
|
-
</div>`,
|
|
791
|
-
html` <div class="mt-2 mb-1"><span class="tx_normal me-2">網址預覽</span>${BgWidget.greenNote(prefixURL + (vm.data.content.tag ?? ''))}</div>`,
|
|
792
|
-
...(() => {
|
|
793
|
-
return [
|
|
794
|
-
BgWidget.editeInput({
|
|
795
|
-
gvc: gvc,
|
|
796
|
-
title: 'SEO標題',
|
|
797
|
-
default: vm.data.content.seo.title,
|
|
798
|
-
placeHolder: `請輸入SEO標題`,
|
|
799
|
-
callback: (text) => {
|
|
800
|
-
vm.data.content.title = text;
|
|
801
|
-
vm.data.content.seo.title = text;
|
|
802
|
-
gvc.notifyDataChange(id);
|
|
803
|
-
},
|
|
804
|
-
}),
|
|
805
|
-
BgWidget.textArea({
|
|
1045
|
+
cf.is_page
|
|
1046
|
+
? ``
|
|
1047
|
+
: EditorElem.select({
|
|
1048
|
+
title: '啟用狀態',
|
|
806
1049
|
gvc: gvc,
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
1050
|
+
def: `${vm.data.status}`,
|
|
1051
|
+
array: [
|
|
1052
|
+
{
|
|
1053
|
+
title: '啟用',
|
|
1054
|
+
value: '1',
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
title: '隱藏',
|
|
1058
|
+
value: '0',
|
|
1059
|
+
},
|
|
1060
|
+
],
|
|
1061
|
+
callback: (text: string) => {
|
|
1062
|
+
vm.data.status = text;
|
|
813
1063
|
gvc.notifyDataChange(id);
|
|
814
1064
|
},
|
|
815
1065
|
}),
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
1066
|
+
EditorElem.pageSelect(
|
|
1067
|
+
gvc,
|
|
1068
|
+
'選擇佈景主題',
|
|
1069
|
+
vm.data.content.template ?? '',
|
|
1070
|
+
(data) => {
|
|
1071
|
+
vm.data.content.template = data;
|
|
1072
|
+
},
|
|
1073
|
+
(dd) => {
|
|
1074
|
+
const filter_result = dd.group !== 'glitter-article' && dd.page_type === 'article' && dd.page_config.template_type === 'blog';
|
|
1075
|
+
if (filter_result && !vm.data.content.template) {
|
|
1076
|
+
vm.data.content.template = dd.tag;
|
|
821
1077
|
gvc.notifyDataChange(id);
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
1078
|
+
}
|
|
1079
|
+
return filter_result;
|
|
1080
|
+
}
|
|
1081
|
+
),
|
|
1082
|
+
EditorElem.editeInput({
|
|
1083
|
+
gvc: gvc,
|
|
1084
|
+
title: '作者名稱',
|
|
1085
|
+
default: vm.data.content.author,
|
|
1086
|
+
placeHolder: '請輸入作者名稱',
|
|
1087
|
+
callback: (text) => {
|
|
1088
|
+
vm.data.content.author = text;
|
|
1089
|
+
},
|
|
1090
|
+
}),
|
|
1091
|
+
gvc.bindView(() => {
|
|
1092
|
+
const id = gvc.glitter.getUUID();
|
|
1093
|
+
return {
|
|
1094
|
+
bind: id,
|
|
1095
|
+
view: () => {
|
|
1096
|
+
if (cf.is_page) {
|
|
1097
|
+
return ``;
|
|
1098
|
+
}
|
|
1099
|
+
vm.data.content.collection = vm.data.content.collection ?? [];
|
|
1100
|
+
return [
|
|
1101
|
+
html`
|
|
1102
|
+
<div class="d-flex align-items-center my-3"
|
|
1103
|
+
style="gap: 10px;">
|
|
1104
|
+
${EditorElem.h3('預覽圖')}
|
|
1105
|
+
${BgWidget.grayButton(
|
|
1106
|
+
'添加檔案',
|
|
1107
|
+
gvc.event(() => {
|
|
1108
|
+
EditorElem.uploadFileFunction({
|
|
1109
|
+
gvc: gvc,
|
|
1110
|
+
callback: (text) => {
|
|
1111
|
+
vm.data.content.preview_image = text;
|
|
1112
|
+
gvc.notifyDataChange(id);
|
|
1113
|
+
},
|
|
1114
|
+
type: `image/*, video/*`,
|
|
1115
|
+
});
|
|
1116
|
+
})
|
|
1117
|
+
)}
|
|
1118
|
+
</div>`,
|
|
1119
|
+
EditorElem.flexMediaManager({
|
|
833
1120
|
gvc: gvc,
|
|
834
|
-
|
|
835
|
-
callback: (text) => {
|
|
836
|
-
vm.data.content.text = text;
|
|
837
|
-
},
|
|
1121
|
+
data: vm.data.content.preview_image ? [vm.data.content.preview_image] : [],
|
|
838
1122
|
}),
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
return [];
|
|
843
|
-
}
|
|
844
|
-
})(),
|
|
845
|
-
].join(BgWidget.mbContainer(12));
|
|
846
|
-
})()
|
|
847
|
-
),
|
|
848
|
-
].join('');
|
|
849
|
-
},
|
|
850
|
-
divCreate: {
|
|
851
|
-
style: 'padding: 0;',
|
|
852
|
-
},
|
|
853
|
-
};
|
|
854
|
-
}),
|
|
855
|
-
undefined,
|
|
856
|
-
'padding: 0 !important; margin: 0 !important; width: 100%;'
|
|
857
|
-
)}
|
|
858
|
-
${(() => {
|
|
859
|
-
vm.data.content.relative = vm.data.content.relative || 'collection';
|
|
860
|
-
vm.data.content.relative_data = vm.data.content.relative_data || [];
|
|
861
|
-
vm.data.content.with_discount = vm.data.content.with_discount || 'false';
|
|
862
|
-
|
|
863
|
-
return gvc.bindView(() => {
|
|
864
|
-
const id = gvc.glitter.getUUID();
|
|
865
|
-
return {
|
|
866
|
-
bind: id,
|
|
867
|
-
view: () => {
|
|
868
|
-
// 顯示套用的賣場商品列表
|
|
869
|
-
if (vm.data.content.page_type === 'hidden' || vm.data.content.page_type === 'shopping') {
|
|
870
|
-
return [
|
|
871
|
-
BgWidget.mainCard(
|
|
872
|
-
[
|
|
873
|
-
BgWidget.title(
|
|
874
|
-
html`預設加入購物車
|
|
875
|
-
<div class="badge ms-2" style="background:#eaeaea;color:#393939;">以下設定的商品會自動加入購物車</div>`,
|
|
876
|
-
'font-size: 16px;'
|
|
877
|
-
),
|
|
878
|
-
html`<div class="my-2"></div>`,
|
|
879
|
-
[
|
|
880
|
-
html`${(() => {
|
|
881
|
-
return gvc.bindView(() => {
|
|
882
|
-
const subVM = {
|
|
883
|
-
id: gvc.glitter.getUUID(),
|
|
884
|
-
loading: true,
|
|
885
|
-
dataList: [] as OptionsItem[],
|
|
886
|
-
};
|
|
887
|
-
return {
|
|
888
|
-
bind: subVM.id,
|
|
889
|
-
view: () => {
|
|
890
|
-
if (subVM.loading) {
|
|
891
|
-
return BgWidget.spinner();
|
|
1123
|
+
(() => {
|
|
1124
|
+
if (cf.is_page) {
|
|
1125
|
+
return ``;
|
|
892
1126
|
}
|
|
893
1127
|
return html`
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
return
|
|
906
|
-
})
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
return {
|
|
910
|
-
variant: dd.variant_content,
|
|
911
|
-
product_id: dd.product_id,
|
|
912
|
-
};
|
|
913
|
-
});
|
|
914
|
-
subVM.loading = true;
|
|
915
|
-
gvc.notifyDataChange(subVM.id);
|
|
916
|
-
},
|
|
1128
|
+
${EditorElem.h3('文章分類')}
|
|
1129
|
+
${gvc.bindView(() => {
|
|
1130
|
+
const tagID = gvc.glitter.getUUID();
|
|
1131
|
+
let listTag: string[] = [];
|
|
1132
|
+
ApiUser.getPublicConfig('blog_collection', 'manager').then((data: any) => {
|
|
1133
|
+
if (data.response.value) {
|
|
1134
|
+
vm.link = data.response.value;
|
|
1135
|
+
|
|
1136
|
+
function setCheck(link: MenuItem[]) {
|
|
1137
|
+
link.map((dd) => {
|
|
1138
|
+
const it = vm.data.content.collection.find((d1: string) => {
|
|
1139
|
+
return d1 === dd.link;
|
|
1140
|
+
});
|
|
1141
|
+
it && listTag.push(dd.title);
|
|
1142
|
+
setCheck(dd.items);
|
|
917
1143
|
});
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
setCheck(vm.link);
|
|
1147
|
+
|
|
1148
|
+
gvc.notifyDataChange(tagID);
|
|
1149
|
+
}
|
|
1150
|
+
});
|
|
1151
|
+
return {
|
|
1152
|
+
bind: tagID,
|
|
1153
|
+
view: () => {
|
|
1154
|
+
return listTag
|
|
1155
|
+
.map((dd: any) => {
|
|
1156
|
+
return html`
|
|
1157
|
+
<div class="badge bg_orange mt-2 me-2 fs-sm">
|
|
1158
|
+
${dd}
|
|
1159
|
+
</div>`;
|
|
1160
|
+
})
|
|
1161
|
+
.join('');
|
|
1162
|
+
},
|
|
1163
|
+
divCreate: {
|
|
1164
|
+
class: `d-flex flex-wrap`,
|
|
1165
|
+
},
|
|
1166
|
+
};
|
|
1167
|
+
})}
|
|
1168
|
+
<div
|
|
1169
|
+
class="cursor_pointer bt_c39 ms-2 p-1 mt-3"
|
|
1170
|
+
onclick="${gvc.event(() => {
|
|
1171
|
+
cVm.type = 'collection';
|
|
1172
|
+
gvc.notifyDataChange(cVm.id);
|
|
1173
|
+
})}"
|
|
1174
|
+
>
|
|
1175
|
+
<i class="fa-solid fa-plus me-2"
|
|
1176
|
+
aria-hidden="true"></i>
|
|
1177
|
+
添加與編輯分類
|
|
944
1178
|
</div>
|
|
945
1179
|
`;
|
|
946
|
-
},
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
gvc.notifyDataChange(subVM.id);
|
|
954
|
-
}, 300);
|
|
955
|
-
} else {
|
|
956
|
-
new Promise<OptionsItem[]>(async (resolve) => {
|
|
957
|
-
const products_data = await BgProduct.getProductOpts(
|
|
958
|
-
vm.data.content.relative_data.map((dd: any) => {
|
|
959
|
-
return dd.product_id;
|
|
960
|
-
})
|
|
961
|
-
);
|
|
962
|
-
vm.data.content.relative_data = vm.data.content.relative_data.filter((dd: any) => {
|
|
963
|
-
return products_data.find((d1) => {
|
|
964
|
-
return `${dd.product_id}` === `${d1.key}`;
|
|
965
|
-
});
|
|
966
|
-
});
|
|
967
|
-
subVM.dataList = vm.data.content.relative_data.map((dd: any) => {
|
|
968
|
-
const product: any = JSON.parse(
|
|
969
|
-
JSON.stringify(
|
|
970
|
-
products_data.find((d1) => {
|
|
971
|
-
return `${dd.product_id}` === `${d1.key}`;
|
|
972
|
-
})
|
|
973
|
-
)
|
|
974
|
-
);
|
|
975
|
-
product.note = dd.variant.spec.join(' / ');
|
|
976
|
-
return product;
|
|
977
|
-
});
|
|
978
|
-
resolve(subVM.dataList);
|
|
979
|
-
}).then((data) => {
|
|
980
|
-
subVM.dataList = data;
|
|
981
|
-
subVM.loading = false;
|
|
982
|
-
gvc.notifyDataChange(subVM.id);
|
|
983
|
-
});
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
},
|
|
987
|
-
};
|
|
988
|
-
});
|
|
989
|
-
})()}`,
|
|
990
|
-
].join(''),
|
|
991
|
-
].join('')
|
|
992
|
-
),
|
|
993
|
-
].join('');
|
|
994
|
-
} else {
|
|
995
|
-
return [].join('');
|
|
996
|
-
}
|
|
997
|
-
},
|
|
998
|
-
divCreate: {
|
|
999
|
-
class: `w-100 mt-2`,
|
|
1000
|
-
},
|
|
1001
|
-
};
|
|
1002
|
-
});
|
|
1003
|
-
})()}
|
|
1004
|
-
</div>
|
|
1005
|
-
${BgWidget.container(
|
|
1006
|
-
BgWidget.mainCard(
|
|
1007
|
-
gvc.bindView(() => {
|
|
1008
|
-
console.log(`vm.data.content.template=>`, vm.data.content.template);
|
|
1009
|
-
const id = gvc.glitter.getUUID();
|
|
1010
|
-
vm.data.status = vm.data.status ?? '1';
|
|
1011
|
-
return {
|
|
1012
|
-
bind: id,
|
|
1013
|
-
view: () => {
|
|
1014
|
-
return [
|
|
1015
|
-
cf.is_page
|
|
1016
|
-
? ``
|
|
1017
|
-
: EditorElem.select({
|
|
1018
|
-
title: '啟用狀態',
|
|
1019
|
-
gvc: gvc,
|
|
1020
|
-
def: `${vm.data.status}`,
|
|
1021
|
-
array: [
|
|
1022
|
-
{
|
|
1023
|
-
title: '啟用',
|
|
1024
|
-
value: '1',
|
|
1025
|
-
},
|
|
1026
|
-
{
|
|
1027
|
-
title: '隱藏',
|
|
1028
|
-
value: '0',
|
|
1029
|
-
},
|
|
1030
|
-
],
|
|
1031
|
-
callback: (text: string) => {
|
|
1032
|
-
vm.data.status = text;
|
|
1033
|
-
gvc.notifyDataChange(id);
|
|
1034
|
-
},
|
|
1035
|
-
}),
|
|
1036
|
-
EditorElem.pageSelect(
|
|
1037
|
-
gvc,
|
|
1038
|
-
'選擇佈景主題',
|
|
1039
|
-
vm.data.content.template ?? '',
|
|
1040
|
-
(data) => {
|
|
1041
|
-
vm.data.content.template = data;
|
|
1042
|
-
},
|
|
1043
|
-
(dd) => {
|
|
1044
|
-
const filter_result = dd.group !== 'glitter-article' && dd.page_type === 'article' && dd.page_config.template_type === 'blog';
|
|
1045
|
-
if (filter_result && !vm.data.content.template) {
|
|
1046
|
-
vm.data.content.template = dd.tag;
|
|
1047
|
-
gvc.notifyDataChange(id);
|
|
1048
|
-
}
|
|
1049
|
-
return filter_result;
|
|
1050
|
-
}
|
|
1051
|
-
),
|
|
1052
|
-
EditorElem.editeInput({
|
|
1053
|
-
gvc: gvc,
|
|
1054
|
-
title: '作者名稱',
|
|
1055
|
-
default: vm.data.content.author,
|
|
1056
|
-
placeHolder: '請輸入作者名稱',
|
|
1057
|
-
callback: (text) => {
|
|
1058
|
-
vm.data.content.author = text;
|
|
1180
|
+
})(),
|
|
1181
|
+
].join(`<div class="my-2"></div>`);
|
|
1182
|
+
},
|
|
1183
|
+
divCreate: {},
|
|
1184
|
+
};
|
|
1185
|
+
}),
|
|
1186
|
+
].join('');
|
|
1059
1187
|
},
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
return [
|
|
1071
|
-
html` <div class="d-flex align-items-center my-3" style="gap: 10px;">
|
|
1072
|
-
${EditorElem.h3('預覽圖')}
|
|
1073
|
-
${BgWidget.grayButton(
|
|
1074
|
-
'添加檔案',
|
|
1075
|
-
gvc.event(() => {
|
|
1076
|
-
EditorElem.uploadFileFunction({
|
|
1077
|
-
gvc: gvc,
|
|
1078
|
-
callback: (text) => {
|
|
1079
|
-
vm.data.content.preview_image = text;
|
|
1080
|
-
gvc.notifyDataChange(id);
|
|
1081
|
-
},
|
|
1082
|
-
type: `image/*, video/*`,
|
|
1083
|
-
});
|
|
1084
|
-
})
|
|
1085
|
-
)}
|
|
1086
|
-
</div>`,
|
|
1087
|
-
EditorElem.flexMediaManager({
|
|
1088
|
-
gvc: gvc,
|
|
1089
|
-
data: vm.data.content.preview_image ? [vm.data.content.preview_image] : [],
|
|
1090
|
-
}),
|
|
1091
|
-
(() => {
|
|
1092
|
-
if (cf.is_page) {
|
|
1093
|
-
return ``;
|
|
1094
|
-
}
|
|
1095
|
-
return html`
|
|
1096
|
-
${EditorElem.h3('文章分類')}
|
|
1097
|
-
${gvc.bindView(() => {
|
|
1098
|
-
const tagID = gvc.glitter.getUUID();
|
|
1099
|
-
let listTag: string[] = [];
|
|
1100
|
-
ApiUser.getPublicConfig('blog_collection', 'manager').then((data: any) => {
|
|
1101
|
-
if (data.response.value) {
|
|
1102
|
-
vm.link = data.response.value;
|
|
1103
|
-
|
|
1104
|
-
function setCheck(link: MenuItem[]) {
|
|
1105
|
-
link.map((dd) => {
|
|
1106
|
-
const it = vm.data.content.collection.find((d1: string) => {
|
|
1107
|
-
return d1 === dd.link;
|
|
1108
|
-
});
|
|
1109
|
-
it && listTag.push(dd.title);
|
|
1110
|
-
setCheck(dd.items);
|
|
1111
|
-
});
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
setCheck(vm.link);
|
|
1115
|
-
|
|
1116
|
-
gvc.notifyDataChange(tagID);
|
|
1117
|
-
}
|
|
1118
|
-
});
|
|
1119
|
-
return {
|
|
1120
|
-
bind: tagID,
|
|
1121
|
-
view: () => {
|
|
1122
|
-
return listTag
|
|
1123
|
-
.map((dd: any) => {
|
|
1124
|
-
return html` <div class="badge bg_orange mt-2 me-2 fs-sm">${dd}</div>`;
|
|
1125
|
-
})
|
|
1126
|
-
.join('');
|
|
1127
|
-
},
|
|
1128
|
-
divCreate: {
|
|
1129
|
-
class: `d-flex flex-wrap`,
|
|
1130
|
-
},
|
|
1131
|
-
};
|
|
1132
|
-
})}
|
|
1133
|
-
<div
|
|
1134
|
-
class="cursor_pointer bt_c39 ms-2 p-1 mt-3"
|
|
1135
|
-
onclick="${gvc.event(() => {
|
|
1136
|
-
cVm.type = 'collection';
|
|
1137
|
-
gvc.notifyDataChange(cVm.id);
|
|
1138
|
-
})}"
|
|
1139
|
-
>
|
|
1140
|
-
<i class="fa-solid fa-plus me-2" aria-hidden="true"></i>
|
|
1141
|
-
添加與編輯分類
|
|
1142
|
-
</div>
|
|
1143
|
-
`;
|
|
1144
|
-
})(),
|
|
1145
|
-
].join(`<div class="my-2"></div>`);
|
|
1146
|
-
},
|
|
1147
|
-
divCreate: {},
|
|
1148
|
-
};
|
|
1149
|
-
}),
|
|
1150
|
-
].join('');
|
|
1151
|
-
},
|
|
1152
|
-
};
|
|
1153
|
-
})
|
|
1154
|
-
),
|
|
1155
|
-
undefined,
|
|
1156
|
-
'padding: 0 !important; margin: 0 !important; width: 26.5%;'
|
|
1157
|
-
)}
|
|
1158
|
-
</div>
|
|
1159
|
-
`,
|
|
1160
|
-
undefined,
|
|
1161
|
-
'padding: 0 !important;'
|
|
1188
|
+
};
|
|
1189
|
+
})
|
|
1190
|
+
),
|
|
1191
|
+
undefined,
|
|
1192
|
+
'padding: 0 !important; margin: 0 !important; width: 26.5%;'
|
|
1193
|
+
)}
|
|
1194
|
+
</div>
|
|
1195
|
+
`,
|
|
1196
|
+
undefined,
|
|
1197
|
+
'padding: 0 !important;'
|
|
1162
1198
|
)}
|
|
1163
1199
|
${BgWidget.mbContainer(240)}
|
|
1164
1200
|
<div class="update-bar-container">
|
|
1165
1201
|
${vm.data.id
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1202
|
+
? BgWidget.redButton(
|
|
1203
|
+
`刪除${cf.is_page ? '頁面' : '網誌'}`,
|
|
1204
|
+
gvc.event(() => {
|
|
1205
|
+
const dialog = new ShareDialog(gvc.glitter);
|
|
1206
|
+
dialog.checkYesOrNot({
|
|
1207
|
+
text: '是否確認刪除此頁面?',
|
|
1208
|
+
callback: async (response) => {
|
|
1209
|
+
if (response) {
|
|
1210
|
+
await cf.widget.event('loading', {
|
|
1211
|
+
title: '刪除中...',
|
|
1212
|
+
});
|
|
1213
|
+
Article.deleteV2({
|
|
1214
|
+
id: `${vm.data.id}`,
|
|
1215
|
+
}).then(async (res) => {
|
|
1216
|
+
await cf.widget.event('loading', {
|
|
1217
|
+
title: '刪除中...',
|
|
1218
|
+
visible: false,
|
|
1219
|
+
});
|
|
1220
|
+
if (res.result) {
|
|
1221
|
+
vm.dataList = undefined;
|
|
1222
|
+
vm.type = 'list';
|
|
1223
|
+
} else {
|
|
1224
|
+
await cf.widget.event('error', {
|
|
1225
|
+
title: '刪除失敗',
|
|
1226
|
+
visible: false,
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
},
|
|
1232
|
+
});
|
|
1233
|
+
})
|
|
1234
|
+
)
|
|
1235
|
+
: ''}
|
|
1200
1236
|
${BgWidget.cancel(
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1237
|
+
gvc.event(() => {
|
|
1238
|
+
if (!vm.data.id) {
|
|
1239
|
+
cf.widget.event('error', {
|
|
1240
|
+
title: '請先儲存',
|
|
1241
|
+
});
|
|
1242
|
+
} else {
|
|
1243
|
+
const href = (() => {
|
|
1244
|
+
return `${gvc.glitter.root_path}${
|
|
1245
|
+
cf.is_page
|
|
1246
|
+
? (() => {
|
|
1247
|
+
switch (page_tab) {
|
|
1248
|
+
case 'shopping':
|
|
1249
|
+
return 'shop';
|
|
1250
|
+
case 'hidden':
|
|
1251
|
+
return 'hidden';
|
|
1252
|
+
case 'page':
|
|
1253
|
+
return 'pages';
|
|
1254
|
+
}
|
|
1255
|
+
return ``;
|
|
1256
|
+
})()
|
|
1257
|
+
: `blogs`
|
|
1258
|
+
}/${vm.data.content.tag}?preview=true&appName=${(window.parent as any).appName}`;
|
|
1259
|
+
})();
|
|
1260
|
+
localStorage.setItem('preview_data', JSON.stringify(vm.data.content));
|
|
1261
|
+
(window.parent as any).glitter.openNewTab(href);
|
|
1262
|
+
}
|
|
1263
|
+
}),
|
|
1264
|
+
'預覽'
|
|
1229
1265
|
)}
|
|
1230
1266
|
${BgWidget.cancel(
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1267
|
+
gvc.event(() => {
|
|
1268
|
+
vm.type = 'list';
|
|
1269
|
+
}),
|
|
1270
|
+
'取消'
|
|
1235
1271
|
)}
|
|
1236
1272
|
${BgWidget.save(
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1273
|
+
gvc.event(async () => {
|
|
1274
|
+
saveData(gvc, cf, vm, cVm, false);
|
|
1275
|
+
})
|
|
1240
1276
|
)}
|
|
1241
1277
|
</div>
|
|
1242
1278
|
`;
|
|
@@ -1452,13 +1488,13 @@ function setCollection(cf: {
|
|
|
1452
1488
|
check(it, items);
|
|
1453
1489
|
const dialog = new ShareDialog(gvc.glitter);
|
|
1454
1490
|
if (!it.link || !it.title) {
|
|
1455
|
-
dialog.infoMessage({
|
|
1491
|
+
dialog.infoMessage({text: '請確實填寫欄位內容'});
|
|
1456
1492
|
return false;
|
|
1457
1493
|
} else if (exists_count) {
|
|
1458
|
-
dialog.infoMessage({
|
|
1494
|
+
dialog.infoMessage({text: '此標籤已被使用'});
|
|
1459
1495
|
return false;
|
|
1460
1496
|
} else if (title_exists_count) {
|
|
1461
|
-
dialog.infoMessage({
|
|
1497
|
+
dialog.infoMessage({text: '此標題已被使用'});
|
|
1462
1498
|
return false;
|
|
1463
1499
|
} else {
|
|
1464
1500
|
return true;
|
|
@@ -1470,287 +1506,304 @@ function setCollection(cf: {
|
|
|
1470
1506
|
return {
|
|
1471
1507
|
bind: vm.id,
|
|
1472
1508
|
view: () => {
|
|
1473
|
-
return html`
|
|
1509
|
+
return html`
|
|
1510
|
+
<div class="d-flex align-items-center my-3">
|
|
1474
1511
|
${BgWidget.goBack(
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1512
|
+
cf.gvc.event(() => {
|
|
1513
|
+
cf.goBack();
|
|
1514
|
+
})
|
|
1478
1515
|
)}${BgWidget.title('分類設定')}
|
|
1479
1516
|
</div>
|
|
1480
1517
|
<div
|
|
1481
|
-
|
|
1518
|
+
style="max-width:100%;width: 856px; padding: 20px; background: white; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.08); border-radius: 10px; overflow: hidden; justify-content: center; align-items: center; display: inline-flex"
|
|
1482
1519
|
>
|
|
1483
1520
|
<div style="width: 100%; position: relative">
|
|
1484
1521
|
<div style="width: 100%; left: 0px; top: 0px; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 20px; display: inline-flex">
|
|
1485
1522
|
<div
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1523
|
+
class="w-100 ${getSelectCount({
|
|
1524
|
+
items: vm.link,
|
|
1525
|
+
}) > 0
|
|
1526
|
+
? ``
|
|
1527
|
+
: `d-none`}"
|
|
1528
|
+
style="height: 40px; padding: 12px 18px;background: #F7F7F7; border-radius: 10px; justify-content: flex-end; align-items: center; gap: 8px; display: inline-flex"
|
|
1492
1529
|
>
|
|
1493
1530
|
<div style="flex: 1 1 0; color: #393939; font-size: 14px; font-family: Noto Sans; font-weight: 700; word-wrap: break-word">
|
|
1494
|
-
|
|
1531
|
+
已選取${getSelectCount({
|
|
1495
1532
|
items: vm.link,
|
|
1496
1533
|
})}項
|
|
1497
1534
|
</div>
|
|
1498
1535
|
<div
|
|
1499
|
-
|
|
1536
|
+
style="cursor:pointer;padding: 4px 14px;background: white; box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.10); border-radius: 20px; border: 1px #DDDDDD solid; justify-content: flex-start; align-items: flex-start; gap: 10px; display: flex"
|
|
1500
1537
|
>
|
|
1501
1538
|
<div
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1539
|
+
style="color: #393939; font-size: 14px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word"
|
|
1540
|
+
onclick="${gvc.event(() => {
|
|
1541
|
+
vm.link = deleteSelect(vm.link);
|
|
1542
|
+
gvc.notifyDataChange(vm.id);
|
|
1543
|
+
})}"
|
|
1507
1544
|
>
|
|
1508
1545
|
刪除
|
|
1509
1546
|
</div>
|
|
1510
1547
|
</div>
|
|
1511
1548
|
</div>
|
|
1512
|
-
<div class="d-flex align-items-center"
|
|
1549
|
+
<div class="d-flex align-items-center"
|
|
1550
|
+
style="width: 100%; height: 22px; position: relative;gap:29px;">
|
|
1513
1551
|
<div
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
return !(dd as any).selected;
|
|
1518
|
-
}),
|
|
1519
|
-
})
|
|
1520
|
-
? `fa-solid fa-square-check`
|
|
1521
|
-
: `fa-regular fa-square`}"
|
|
1522
|
-
style="color:#393939;width: 16px; height: 16px;cursor: pointer;"
|
|
1523
|
-
onclick="${cf.gvc.event((e, event) => {
|
|
1524
|
-
event.stopPropagation();
|
|
1525
|
-
|
|
1526
|
-
if (
|
|
1527
|
-
vm.link.find((dd) => {
|
|
1552
|
+
class="${allSelect({
|
|
1553
|
+
items: vm.link,
|
|
1554
|
+
selected: !vm.link.find((dd) => {
|
|
1528
1555
|
return !(dd as any).selected;
|
|
1529
|
-
})
|
|
1530
|
-
)
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1556
|
+
}),
|
|
1557
|
+
})
|
|
1558
|
+
? `fa-solid fa-square-check`
|
|
1559
|
+
: `fa-regular fa-square`}"
|
|
1560
|
+
style="color:#393939;width: 16px; height: 16px;cursor: pointer;"
|
|
1561
|
+
onclick="${cf.gvc.event((e, event) => {
|
|
1562
|
+
event.stopPropagation();
|
|
1563
|
+
|
|
1564
|
+
if (
|
|
1565
|
+
vm.link.find((dd) => {
|
|
1566
|
+
return !(dd as any).selected;
|
|
1567
|
+
})
|
|
1568
|
+
) {
|
|
1569
|
+
selectAll({
|
|
1570
|
+
items: vm.link,
|
|
1571
|
+
} as any);
|
|
1572
|
+
} else {
|
|
1573
|
+
clearAll({
|
|
1574
|
+
items: vm.link,
|
|
1575
|
+
} as any);
|
|
1576
|
+
}
|
|
1577
|
+
gvc.notifyDataChange(vm.id);
|
|
1578
|
+
})}"
|
|
1541
1579
|
></div>
|
|
1542
|
-
<div style="left: 61px; top: 0px; color: #393939; font-size: 16px; font-family: Noto Sans; font-weight: 700; word-wrap: break-word"
|
|
1580
|
+
<div style="left: 61px; top: 0px; color: #393939; font-size: 16px; font-family: Noto Sans; font-weight: 700; word-wrap: break-word">
|
|
1581
|
+
選單名稱
|
|
1582
|
+
</div>
|
|
1543
1583
|
</div>
|
|
1544
1584
|
<div style="align-self: stretch; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 18px; display: flex">
|
|
1545
1585
|
${(() => {
|
|
1546
1586
|
function renderItems(array: MenuItem[]): string {
|
|
1547
1587
|
const id = gvc.glitter.getUUID();
|
|
1548
1588
|
return (
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1589
|
+
gvc.bindView(() => {
|
|
1590
|
+
return {
|
|
1591
|
+
bind: id,
|
|
1592
|
+
view: () => {
|
|
1593
|
+
return array
|
|
1594
|
+
.map((dd, index) => {
|
|
1595
|
+
dd.items;
|
|
1596
|
+
const list = html`
|
|
1597
|
+
<div
|
|
1598
|
+
class=" w-100 "
|
|
1599
|
+
style="width: 100%; justify-content: flex-start; align-items: center; gap: 5px; display: inline-flex;cursor: pointer;"
|
|
1600
|
+
onclick="${cf.gvc.event(() => {
|
|
1601
|
+
if (dd.items && dd.items.length > 0) {
|
|
1602
|
+
(dd as any).toggle = !(dd as any).toggle;
|
|
1603
|
+
gvc.notifyDataChange(vm.id);
|
|
1604
|
+
}
|
|
1605
|
+
})}"
|
|
1606
|
+
>
|
|
1607
|
+
<div
|
|
1608
|
+
class="${allSelect(dd) ? `fa-solid fa-square-check` : `fa-regular fa-square`}"
|
|
1609
|
+
style="color:#393939;width: 16px; height: 16px;"
|
|
1610
|
+
onclick="${cf.gvc.event((e, event) => {
|
|
1611
|
+
event.stopPropagation();
|
|
1612
|
+
(dd as any).selected = !(dd as any).selected;
|
|
1613
|
+
if ((dd as any).selected) {
|
|
1614
|
+
selectAll(dd);
|
|
1615
|
+
} else {
|
|
1616
|
+
clearAll(dd);
|
|
1617
|
+
}
|
|
1618
|
+
gvc.notifyDataChange(vm.id);
|
|
1619
|
+
})}"
|
|
1620
|
+
></div>
|
|
1621
|
+
<div class="hoverF2 pe-2"
|
|
1622
|
+
style="width: 100%; justify-content: flex-start; align-items: center; gap: 8px; display: flex">
|
|
1623
|
+
<i
|
|
1624
|
+
class="ms-2 fa-solid fa-grip-dots-vertical color39 dragItem hoverBtn d-flex align-items-center justify-content-center"
|
|
1625
|
+
style="cursor: pointer;width:25px;height: 25px;"
|
|
1626
|
+
></i>
|
|
1627
|
+
<div style="flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; display: inline-flex">
|
|
1628
|
+
<div style="justify-content: flex-start; align-items: center; gap: 8px; display: inline-flex">
|
|
1629
|
+
<div style="color: #393939; font-size: 16px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word">
|
|
1630
|
+
${dd.title}
|
|
1631
|
+
</div>
|
|
1632
|
+
${dd.items && dd.items.length > 0
|
|
1633
|
+
? !(dd as any).toggle
|
|
1634
|
+
? `<i class="fa-solid fa-angle-down color39"></i>`
|
|
1635
|
+
: `<i class="fa-solid fa-angle-up color39"></i>`
|
|
1636
|
+
: ``}
|
|
1637
|
+
</div>
|
|
1638
|
+
<div style="justify-content: flex-start; align-items: center; gap: 8px; display: inline-flex">
|
|
1639
|
+
<div
|
|
1640
|
+
style="color: #3366BB; font-size: 14px; font-family: Noto Sans; font-weight: 400; line-height: 14px; word-wrap: break-word"
|
|
1641
|
+
>
|
|
1642
|
+
${dd.title}
|
|
1643
|
+
</div>
|
|
1644
|
+
<div style="color: #159240; font-size: 14px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word">
|
|
1645
|
+
${dd.link}
|
|
1646
|
+
</div>
|
|
1647
|
+
</div>
|
|
1590
1648
|
</div>
|
|
1591
|
-
|
|
1592
|
-
? !(dd as any).toggle
|
|
1593
|
-
? `<i class="fa-solid fa-angle-down color39"></i>`
|
|
1594
|
-
: `<i class="fa-solid fa-angle-up color39"></i>`
|
|
1595
|
-
: ``}
|
|
1596
|
-
</div>
|
|
1597
|
-
<div style="justify-content: flex-start; align-items: center; gap: 8px; display: inline-flex">
|
|
1649
|
+
<div class="flex-fill"></div>
|
|
1598
1650
|
<div
|
|
1599
|
-
|
|
1651
|
+
class="child me-2"
|
|
1652
|
+
onclick="${cf.gvc.event((e, event) => {
|
|
1653
|
+
event.stopPropagation();
|
|
1654
|
+
MenusSetting.collectionEvent(
|
|
1655
|
+
{
|
|
1656
|
+
link: '',
|
|
1657
|
+
title: '',
|
|
1658
|
+
items: [],
|
|
1659
|
+
},
|
|
1660
|
+
(data) => {
|
|
1661
|
+
dd.items = dd.items || [];
|
|
1662
|
+
dd.items.push(data);
|
|
1663
|
+
if (checkLinkExists(data, vm.link)) {
|
|
1664
|
+
gvc.notifyDataChange(vm.id);
|
|
1665
|
+
return true;
|
|
1666
|
+
} else {
|
|
1667
|
+
dd.items.splice(dd.items.length - 1, 1);
|
|
1668
|
+
return false;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
);
|
|
1672
|
+
})}"
|
|
1600
1673
|
>
|
|
1601
|
-
|
|
1674
|
+
<i class="fa-solid fa-plus"
|
|
1675
|
+
style="color:#393939;"></i>
|
|
1602
1676
|
</div>
|
|
1603
|
-
<div
|
|
1604
|
-
|
|
1677
|
+
<div
|
|
1678
|
+
class="child"
|
|
1679
|
+
onclick="${cf.gvc.event((e, event) => {
|
|
1680
|
+
event.stopPropagation();
|
|
1681
|
+
const og = JSON.parse(JSON.stringify(dd));
|
|
1682
|
+
|
|
1683
|
+
MenusSetting.collectionEvent(dd, (data) => {
|
|
1684
|
+
if (checkLinkExists(data, vm.link)) {
|
|
1685
|
+
array[index] = data;
|
|
1686
|
+
gvc.notifyDataChange(vm.id);
|
|
1687
|
+
return true;
|
|
1688
|
+
} else {
|
|
1689
|
+
data.link = og.link;
|
|
1690
|
+
data.title = og.title;
|
|
1691
|
+
return false;
|
|
1692
|
+
}
|
|
1693
|
+
});
|
|
1694
|
+
})}"
|
|
1695
|
+
>
|
|
1696
|
+
<i class="fa-solid fa-pencil"
|
|
1697
|
+
style="color:#393939;"></i>
|
|
1605
1698
|
</div>
|
|
1606
1699
|
</div>
|
|
1607
1700
|
</div>
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
gvc.notifyDataChange(vm.id);
|
|
1645
|
-
return true;
|
|
1646
|
-
} else {
|
|
1647
|
-
data.link = og.link;
|
|
1648
|
-
data.title = og.title;
|
|
1649
|
-
return false;
|
|
1650
|
-
}
|
|
1651
|
-
});
|
|
1652
|
-
})}"
|
|
1653
|
-
>
|
|
1654
|
-
<i class="fa-solid fa-pencil" style="color:#393939;"></i>
|
|
1655
|
-
</div>
|
|
1656
|
-
</div>
|
|
1657
|
-
</div>
|
|
1658
|
-
${dd.items && dd.items.length > 0
|
|
1659
|
-
? html`
|
|
1660
|
-
<div class=" w-100 ${(dd as any).toggle ? `` : `d-none`}" style="padding-left: 35px;">
|
|
1661
|
-
${renderItems(dd.items as MenuItem[]) as any}
|
|
1662
|
-
</div>
|
|
1663
|
-
`
|
|
1664
|
-
: ``}
|
|
1665
|
-
`;
|
|
1666
|
-
return html` <li class="w-100 ">${list}</li>`;
|
|
1667
|
-
})
|
|
1668
|
-
.join('');
|
|
1669
|
-
},
|
|
1670
|
-
divCreate: {
|
|
1671
|
-
elem: 'ul',
|
|
1672
|
-
class: `w-100 my-2`,
|
|
1673
|
-
style: `display:flex;flex-direction: column;gap:18px;`,
|
|
1674
|
-
},
|
|
1675
|
-
onCreate: () => {
|
|
1676
|
-
gvc.glitter.addMtScript(
|
|
1677
|
-
[
|
|
1678
|
-
{
|
|
1679
|
-
src: `https://raw.githack.com/SortableJS/Sortable/master/Sortable.js`,
|
|
1680
|
-
},
|
|
1681
|
-
],
|
|
1682
|
-
() => {},
|
|
1683
|
-
() => {}
|
|
1684
|
-
);
|
|
1685
|
-
const interval = setInterval(() => {
|
|
1686
|
-
//@ts-ignore
|
|
1687
|
-
if (window.Sortable) {
|
|
1688
|
-
try {
|
|
1689
|
-
gvc.addStyle(`
|
|
1701
|
+
${dd.items && dd.items.length > 0
|
|
1702
|
+
? html`
|
|
1703
|
+
<div class=" w-100 ${(dd as any).toggle ? `` : `d-none`}"
|
|
1704
|
+
style="padding-left: 35px;">
|
|
1705
|
+
${renderItems(dd.items as MenuItem[]) as any}
|
|
1706
|
+
</div>
|
|
1707
|
+
`
|
|
1708
|
+
: ``}
|
|
1709
|
+
`;
|
|
1710
|
+
return html`
|
|
1711
|
+
<li class="w-100 ">${list}</li>`;
|
|
1712
|
+
})
|
|
1713
|
+
.join('');
|
|
1714
|
+
},
|
|
1715
|
+
divCreate: {
|
|
1716
|
+
elem: 'ul',
|
|
1717
|
+
class: `w-100 my-2`,
|
|
1718
|
+
style: `display:flex;flex-direction: column;gap:18px;`,
|
|
1719
|
+
},
|
|
1720
|
+
onCreate: () => {
|
|
1721
|
+
gvc.glitter.addMtScript(
|
|
1722
|
+
[
|
|
1723
|
+
{
|
|
1724
|
+
src: `https://raw.githack.com/SortableJS/Sortable/master/Sortable.js`,
|
|
1725
|
+
},
|
|
1726
|
+
],
|
|
1727
|
+
() => {
|
|
1728
|
+
},
|
|
1729
|
+
() => {
|
|
1730
|
+
}
|
|
1731
|
+
);
|
|
1732
|
+
const interval = setInterval(() => {
|
|
1733
|
+
//@ts-ignore
|
|
1734
|
+
if (window.Sortable) {
|
|
1735
|
+
try {
|
|
1736
|
+
gvc.addStyle(`
|
|
1690
1737
|
ul {
|
|
1691
1738
|
list-style: none;
|
|
1692
1739
|
padding: 0;
|
|
1693
1740
|
}
|
|
1694
1741
|
`);
|
|
1695
1742
|
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1743
|
+
function swapArr(arr: any, index1: number, index2: number) {
|
|
1744
|
+
const data = arr[index1];
|
|
1745
|
+
arr.splice(index1, 1);
|
|
1746
|
+
arr.splice(index2, 0, data);
|
|
1747
|
+
}
|
|
1701
1748
|
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
}) +
|
|
1724
|
-
html` <div
|
|
1725
|
-
class=""
|
|
1726
|
-
style="cursor:pointer;align-self: stretch; height: 50px; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 10px; display: flex"
|
|
1727
|
-
onclick="${cf.gvc.event(() => {
|
|
1728
|
-
MenusSetting.collectionEvent(
|
|
1729
|
-
{
|
|
1730
|
-
link: '',
|
|
1731
|
-
title: '',
|
|
1732
|
-
items: [],
|
|
1749
|
+
let startIndex = 0;
|
|
1750
|
+
//@ts-ignore
|
|
1751
|
+
Sortable.create(gvc.getBindViewElem(id).get(0), {
|
|
1752
|
+
group: id,
|
|
1753
|
+
animation: 100,
|
|
1754
|
+
handle: '.dragItem',
|
|
1755
|
+
onChange: function (evt: any) {
|
|
1756
|
+
},
|
|
1757
|
+
onEnd: (evt: any) => {
|
|
1758
|
+
swapArr(array, startIndex, evt.newIndex);
|
|
1759
|
+
gvc.notifyDataChange(id);
|
|
1760
|
+
},
|
|
1761
|
+
onStart: function (evt: any) {
|
|
1762
|
+
startIndex = evt.oldIndex;
|
|
1763
|
+
},
|
|
1764
|
+
});
|
|
1765
|
+
} catch (e) {
|
|
1766
|
+
}
|
|
1767
|
+
clearInterval(interval);
|
|
1768
|
+
}
|
|
1769
|
+
}, 100);
|
|
1733
1770
|
},
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1771
|
+
};
|
|
1772
|
+
}) +
|
|
1773
|
+
html`
|
|
1774
|
+
<div
|
|
1775
|
+
class=""
|
|
1776
|
+
style="cursor:pointer;align-self: stretch; height: 50px; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 10px; display: flex"
|
|
1777
|
+
onclick="${cf.gvc.event(() => {
|
|
1778
|
+
MenusSetting.collectionEvent(
|
|
1779
|
+
{
|
|
1780
|
+
link: '',
|
|
1781
|
+
title: '',
|
|
1782
|
+
items: [],
|
|
1783
|
+
},
|
|
1784
|
+
(data) => {
|
|
1785
|
+
array.push(data);
|
|
1786
|
+
if (checkLinkExists(data, vm.link)) {
|
|
1787
|
+
gvc.notifyDataChange(vm.id);
|
|
1788
|
+
return true;
|
|
1789
|
+
} else {
|
|
1790
|
+
array.splice(array.length - 1, 1);
|
|
1791
|
+
return false;
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
);
|
|
1795
|
+
})}"
|
|
1796
|
+
>
|
|
1797
|
+
<div
|
|
1798
|
+
style="align-self: stretch; height: 54px; border-radius: 10px; border: 1px #DDDDDD solid; justify-content: center; align-items: center; gap: 6px; display: inline-flex"
|
|
1799
|
+
>
|
|
1800
|
+
<i class="fa-solid fa-plus"
|
|
1801
|
+
style="color: #3366BB;font-size: 16px; "></i>
|
|
1802
|
+
<div style="color: #3366BB; font-size: 16px; font-family: Noto Sans; font-weight: 400; word-wrap: break-word">
|
|
1803
|
+
新增選單
|
|
1804
|
+
</div>
|
|
1805
|
+
</div>
|
|
1806
|
+
</div>`
|
|
1754
1807
|
);
|
|
1755
1808
|
}
|
|
1756
1809
|
|
|
@@ -1760,17 +1813,18 @@ function setCollection(cf: {
|
|
|
1760
1813
|
</div>
|
|
1761
1814
|
</div>
|
|
1762
1815
|
</div>
|
|
1763
|
-
<div class="position-fixed bg-body bottom-0 w-100 d-flex align-items-center justify-content-end p-3 border-top"
|
|
1816
|
+
<div class="position-fixed bg-body bottom-0 w-100 d-flex align-items-center justify-content-end p-3 border-top"
|
|
1817
|
+
style="gap:10px;left:0px;">
|
|
1764
1818
|
${BgWidget.cancel(
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1819
|
+
gvc.event(() => {
|
|
1820
|
+
cf.goBack();
|
|
1821
|
+
})
|
|
1768
1822
|
)}
|
|
1769
1823
|
${BgWidget.save(
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1824
|
+
gvc.event(() => {
|
|
1825
|
+
save();
|
|
1826
|
+
}),
|
|
1827
|
+
'確認'
|
|
1774
1828
|
)}
|
|
1775
1829
|
</div>`;
|
|
1776
1830
|
},
|