jufubao-base 1.0.197-beta3 → 1.0.197-beta5

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.
@@ -0,0 +1,496 @@
1
+ 'use strict';
2
+ import ICONS from "@/ICONS.js"
3
+
4
+ /**
5
+ * @description 当表单组件中有联动操作时候,使用方法进行返回
6
+ */
7
+ export default {
8
+ style: [],
9
+ content: (data) => {
10
+ return [
11
+ {
12
+ label: "logo设置",
13
+ ele: "xd-radio",
14
+ valueKey: "showLogoType",
15
+ value: data.showLogoType,
16
+ list: [
17
+ { label: "使用应用logo", value: 'default' },
18
+ { label: "自定义logo", value: 'self' },
19
+ ],
20
+ groupKey: "content"
21
+ },
22
+ {
23
+ label: '上传自定义logo:',
24
+ ele: 'xd-upload',
25
+ valueKey: 'selfLogo',
26
+ groupKey:'content',
27
+ value: data.selfLogo || {},
28
+ defaultValue: data.selfLogo || null,
29
+ slot: true,
30
+ oneWidth: 100,
31
+ oneHeight: 100,
32
+ elinputClassName: 'input40',
33
+ tipsformet: '上传文件格式:@imageType@,不超过@size@MB.建议高度为<span style="color:red">100px</span>,宽度自适应',
34
+ type: ['jpg', 'png', 'jpeg'],
35
+ styleType: 'one',
36
+ uploadType: 'aliyun',
37
+ size: 5,
38
+ action: 'action',
39
+ sort: true,
40
+ maxlen: 100,
41
+ hidden: data.showLogoType !== 'self'
42
+ },
43
+ {
44
+ label: "是否站点名称:",
45
+ ele: "xd-radio",
46
+ valueKey: "showSiteName",
47
+ value: data.showSiteName || "Y",
48
+ list: [
49
+ { label: "展示", value: "Y" },
50
+ { label: "隐藏", value: "N" },
51
+ ],
52
+ groupKey:'content',
53
+ },
54
+ {
55
+ label: '是否分类入口:',
56
+ ele: 'xd-radio',
57
+ valueKey: 'showCategory',
58
+ value: data.showCategory || "Y",
59
+ list: [
60
+ { label: "展示", value: "Y" },
61
+ { label: "隐藏", value: "N" },
62
+ ],
63
+ groupKey:'content'
64
+ },
65
+ {
66
+ label: "分类ICON:",
67
+ ele: "xd-select-list",
68
+ valueKey: "categoryIcon",
69
+ value: data.categoryIcon,
70
+ list: ICONS,
71
+ groupKey:'content',
72
+ className: "input80",
73
+ hidden: data.showCategory !== "Y"
74
+ },
75
+
76
+ {
77
+ label: "导航配置",
78
+ ele: "title",
79
+ groupKey:'content',
80
+ size: "small",
81
+ hidden: data.showCategory !== "Y"
82
+ },
83
+ {
84
+ label: "是否展开导航(预览调试):",
85
+ ele: "xd-radio",
86
+ valueKey: "navExpand",
87
+ value: data.navExpand || "Y",
88
+ list: [
89
+ { label: "展开", value: "Y" },
90
+ { label: "收起", value: "N" },
91
+ ],
92
+ groupKey:'content',
93
+ hidden: data.showCategory !== "Y"
94
+ },
95
+ {
96
+ label: '导航列表配置:',
97
+ ele: 'xd-site-poster',
98
+ valueKey: 'poster',
99
+ className: 'input80',
100
+ value: data.poster || {},
101
+ groupKey:'content',
102
+ setting: {
103
+ count: 1,
104
+ scene: {label: '广告', value: 'normal'}
105
+ },
106
+ handleCustom({action, data}) {
107
+ //设置场景参数
108
+ if(data) {
109
+ data.params = Object.assign({}, {scene: 'normal'}, data.params || {})
110
+ }
111
+
112
+ //获取显示内容
113
+ if (action === 'screenList') {
114
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: 'editx_base_ad_split_screen'})
115
+ .then(res => {
116
+ data.cb(res['list'])
117
+ })
118
+ .catch(error => {
119
+ console.error(error);
120
+ });
121
+ return
122
+ }
123
+
124
+ //获取返回参数(广告位高度必选项)
125
+ if (action === 'getPosterInfo') {
126
+ XdBus.getParentApi('cmsGetPublishEditxContent')(data.params)
127
+ .then(res => {
128
+ data.cb({list: res.list, selectId: res.selected})
129
+ })
130
+ .catch(error => {
131
+ console.error(error);
132
+ });
133
+ return
134
+ }
135
+
136
+ //使用内容分类
137
+ if (action === 'cmsPublishEditxContent') {
138
+ XdBus.getParentApi('cmsPublishEditxContent')(data.params)
139
+ .then(res => {
140
+ data.cb(res)
141
+ })
142
+ .catch(error => {
143
+ console.error(error);
144
+ });
145
+ return
146
+ }
147
+
148
+ let loading = XdBus.getParentApi('loading')({});
149
+ //位置列表
150
+ if (action === 'getListPostion') {
151
+ XdBus.getParentApi('getListPosterPosition')(data.params)
152
+ .then(res => {
153
+ loading.close();
154
+ data.cb(res)
155
+ })
156
+ .catch(error => {
157
+ loading.close();
158
+ console.error(error);
159
+ });
160
+ }
161
+
162
+ //位置创建
163
+ if (action === 'addPostion') {
164
+ XdBus.getParentApi('addPosterPosition')(data.params)
165
+ .then(res => {
166
+ loading.close();
167
+ data.cb(true)
168
+ })
169
+ .catch(error => {
170
+ console.error(error);
171
+ loading.close();
172
+ data.cb(false)
173
+ });
174
+ }
175
+
176
+ //位置编辑
177
+ if (action === 'editPostion') {
178
+ XdBus.getParentApi('updatePosterPosition')(data.params)
179
+ .then(res => {
180
+ loading.close();
181
+ data.cb(true)
182
+ })
183
+ .catch(error => {
184
+ console.error(error);
185
+ loading.close();
186
+ data.cb(false)
187
+ });
188
+ }
189
+
190
+ //位置删除
191
+ if (action === 'deleltePostion') {
192
+ XdBus.getParentApi('deletePosterPosition')(data.params)
193
+ .then(res => {
194
+ loading.close();
195
+ data.cb(true)
196
+ })
197
+ .catch(error => {
198
+ console.error(error);
199
+ loading.close();
200
+ data.cb(false)
201
+ });
202
+ }
203
+
204
+ //获取广告位内容列表
205
+ if (action === 'getListContent') {
206
+ XdBus.getParentApi('getListPosterContent')(data.params)
207
+ .then(res => {
208
+ loading.close();
209
+ data.cb(res)
210
+ })
211
+ .catch(error => {
212
+ loading.close();
213
+ console.error(error);
214
+ });
215
+ }
216
+
217
+ //广告内容创建
218
+ if (action === 'addContent') {
219
+ XdBus.getParentApi('addPosterContent')(data.params)
220
+ .then(res => {
221
+ loading.close();
222
+ data.cb(true)
223
+ })
224
+ .catch(error => {
225
+ console.error(error);
226
+ loading.close();
227
+ data.cb(false)
228
+ });
229
+ }
230
+
231
+ //广告内容编辑
232
+ if (action === 'editContent') {
233
+ XdBus.getParentApi('updatePosterContent')(data.params)
234
+ .then(res => {
235
+ loading.close();
236
+ data.cb(true)
237
+ })
238
+ .catch(error => {
239
+ console.error(error);
240
+ loading.close();
241
+ data.cb(false)
242
+ });
243
+ }
244
+
245
+ //广告内容删除
246
+ if (action === 'deleteContent') {
247
+ XdBus.getParentApi('deletePosterContent')(data.params)
248
+ .then(res => {
249
+ loading.close();
250
+ data.cb(true)
251
+ })
252
+ .catch(error => {
253
+ console.error(error);
254
+ loading.close();
255
+ data.cb(false)
256
+ });
257
+ }
258
+
259
+ //获取广告内容跳转地址类型
260
+ if (action === 'jumpPosterContentType') {
261
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: "cms_setting"})
262
+ .then(res => {
263
+ loading.close();
264
+ data.cb(res['redirect_type'])
265
+ })
266
+ .catch(error => {
267
+ loading.close();
268
+ console.error(error);
269
+ });
270
+ }
271
+
272
+ //发布
273
+ if (action === 'publish') {
274
+ console.log('publish', data.params)
275
+ XdBus.getParentApi('cmsPublishContent')(data.params)
276
+ .then(res => {
277
+ loading.close();
278
+ data.cb(res)
279
+ })
280
+ .catch(error => {
281
+ loading.close();
282
+ console.error(error);
283
+ });
284
+ }
285
+
286
+ //获取站内页面地址
287
+ if (action === 'router') {
288
+ loading.close()
289
+ return XdBus.getParentApi('getPagesTree');
290
+
291
+ }
292
+
293
+ //通知页面进行刷新
294
+ if(action === 'update') {
295
+ XdBus.getParentApi('getXdBusUpdateView')('onUpdateView', {});
296
+ loading.close()
297
+ }
298
+ },
299
+ rules: [{
300
+ required: true,
301
+ validator: (rule, value, callback) => {
302
+ let message = '请设置广告相关内容';
303
+ if(!value) {
304
+ callback(message);
305
+ return;
306
+ }
307
+ if(value.size && !value.size.height){
308
+ callback(message);
309
+ return
310
+ }
311
+
312
+ if(value.size && !value.size.width){
313
+ callback(message);
314
+ return
315
+ }
316
+ callback()
317
+ },trigger: ['blur', 'change']
318
+ }],
319
+ },
320
+ {
321
+ label: "导航内容显示列数:",
322
+ ele: "xd-select-list",
323
+ valueKey: "navColumn",
324
+ value: data.navColumn || 4,
325
+ list: [
326
+ { label: "3列", value: 3 },
327
+ { label: "4列", value: 4 },
328
+ { label: "5列", value: 5 },
329
+ { label: "6列", value: 6 },
330
+ ],
331
+ className: "input80",
332
+ groupKey:'content',
333
+ hidden: data.showCategory !== "Y" || data.navExpand !== "Y"
334
+ },
335
+ {
336
+ label: "导航内容显示行数:",
337
+ ele: "xd-select-list",
338
+ valueKey: "navRow",
339
+ value: data.navRow || 2,
340
+ list: [
341
+ { label: "1行", value: 1 },
342
+ { label: "2行", value: 2 },
343
+ { label: "3行", value: 3 },
344
+ { label: "4行", value: 4 },
345
+ ],
346
+ className: "input80",
347
+ groupKey:'content',
348
+ hidden: data.showCategory !== "Y" || data.navExpand !== "Y"
349
+ },
350
+ {
351
+ label: "导航内边距配置:",
352
+ ele: "xd-margin-padding",
353
+ valueKey: "navPadding",
354
+ value: data.navPadding,
355
+ groupKey:'content',
356
+ setting: {
357
+ type: "padding"
358
+ },
359
+ inline: false,
360
+ notice: '设置内填充,<span style="color: red">单位:像素</span>。默认值:<span style="color: red">20</span>像素',
361
+ hidden: data.showCategory !== "Y" || data.navExpand !== "Y"
362
+ },
363
+ {
364
+ label: '导航ICON宽度:',
365
+ ele: "el-input",
366
+ valueKey: "iconWidth",
367
+ value: data.iconWidth || 100,
368
+ className: "input80",
369
+ groupKey:'content',
370
+ hidden: data.showCategory !== "Y" || data.navExpand !== "Y"
371
+ },
372
+ {
373
+ label: "导航ICON高度:",
374
+ ele: "el-input",
375
+ valueKey: "iconHeight",
376
+ value: data.iconHeight || 100,
377
+ className: "input80",
378
+ groupKey:'content',
379
+ hidden: data.showCategory !== "Y" || data.navExpand !== "Y"
380
+ },
381
+ {
382
+ label: "导航ICON外边距:",
383
+ ele: "xd-margin-padding",
384
+ valueKey: "iconMargin",
385
+ value: data.iconMargin,
386
+ groupKey:'content',
387
+ setting: {
388
+ type: "margin"
389
+ },
390
+ hidden: data.showCategory !== "Y" || data.navExpand !== "Y"
391
+ },
392
+ {
393
+ label: "单个导航背景色:",
394
+ ele: "xd-color",
395
+ valueKey: "navBgColor",
396
+ value: data.navBgColor,
397
+ groupKey:'content',
398
+ hidden: data.showCategory !== "Y" || data.navExpand !== "Y"
399
+ },
400
+ {
401
+ label: '单个导航字体颜色:',
402
+ ele: "xd-color",
403
+ valueKey: "navFontColor",
404
+ value: data.navFontColor,
405
+ groupKey:'content',
406
+ hidden: data.showCategory !== "Y" || data.navExpand !== "Y"
407
+ },
408
+ {
409
+ label: "导航横向间距:",
410
+ ele: "el-input",
411
+ valueKey: "navColumnGap",
412
+ value: data.navColumnGap || 10,
413
+ className: "input80",
414
+ groupKey:'content',
415
+ hidden: data.showCategory !== "Y" || data.navExpand !== "Y"
416
+ },
417
+ {
418
+ label: "导航垂直间距:",
419
+ ele: "el-input",
420
+ valueKey: "navRowGap",
421
+ value: data.navRowGap || 10,
422
+ className: "input80",
423
+ groupKey:'content',
424
+ hidden: data.showCategory !== "Y" || data.navExpand !== "Y"
425
+ },
426
+ {
427
+ label: "导航ICON圆角:",
428
+ ele: 'xd-site-select-list',
429
+ valueKey: 'navRadius',
430
+ groupKey:'content',
431
+ value: data.navRadius || '20',
432
+ placeholder: '请选择导航圆角设置',
433
+ multiple: false,
434
+ className: 'input80',
435
+ handleCustom({action, data}) {
436
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: 'edtix_style_radius'})
437
+ .then(res => {
438
+ data.cb(res.list)
439
+ })
440
+ .catch(error => {
441
+ console.error(error);
442
+ });
443
+ },
444
+ },
445
+ {
446
+ label: "导航ICON阴影:",
447
+ ele: "xd-shadow",
448
+ valueKey: "navShadow",
449
+ value: data.navShadow,
450
+ groupKey:'content',
451
+ handleCustom({action, data}) {
452
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: 'edtix_style_radius'})
453
+ .then(res => {
454
+ data.cb(res.list)
455
+ })
456
+ .catch(error => {
457
+ console.error(error);
458
+ data.cb([])
459
+ });
460
+ },
461
+ hidden: data.showCategory !== "Y" || data.navExpand !== "Y"
462
+ },
463
+ {
464
+ label: "背景颜色:",
465
+ ele: "xd-color",
466
+ valueKey: "bgColor",
467
+ value: data.bgColor,
468
+ groupKey:'style'
469
+ },
470
+ {
471
+ label: "站点名称字体设置:",
472
+ ele: "xd-font",
473
+ valueKey: "siteNameFont",
474
+ value: data.siteNameFont,
475
+ groupKey:'style',
476
+ setting: {
477
+ align: false,
478
+ lineHeight: false,
479
+ },
480
+ handleCustom({action, data}) {
481
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: 'edtix_style_font_size'})
482
+ .then(res => {
483
+ data.cb(res.list)
484
+ })
485
+ .catch(error => {
486
+ data.cb([])
487
+ console.error(error);
488
+ });
489
+ },
490
+ inline: false,
491
+ hidden: data.showSiteName !== "Y"
492
+ }
493
+ ].filter(i=>i)
494
+ },
495
+ advanced: [],
496
+ };