jufubao-base 1.0.310 → 1.0.311-beta101

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,308 @@
1
+ 'use strict';
2
+
3
+ import {dataVal} from "@/utils/AttrTools";
4
+
5
+ export default (data, gValue, gColor, oldData)=>{
6
+ let show_tip_icon = 'N';
7
+ if(data['show_tip_icon'] !== undefined) show_tip_icon = data['show_tip_icon'];
8
+
9
+ let style = '1';
10
+ if(data['style'] !== undefined) style = data['style'];
11
+
12
+ let defNotice = {
13
+ type: 'notice',
14
+ position:{},
15
+ }
16
+
17
+ return[
18
+ {
19
+ ele: 'title',
20
+ label: '基础',
21
+ size: 'small',
22
+ groupKey:'content',
23
+ },
24
+
25
+ {
26
+ label: '广告内容',
27
+ ele: 'xd-site-news',
28
+ valueKey: 'notice',
29
+ value: dataVal({data, key:'notice', dValue:defNotice, gValue}),
30
+ groupKey:'content',
31
+ className: 'input100',
32
+ labelInline: true,
33
+ setting: {
34
+ config: {
35
+ sort: true,
36
+ maxlen: 100,
37
+ action: 'aliyun',
38
+ size: 5,
39
+ tipsformet: '上传文件格式:@imageType@,不超过@size@MB.',
40
+ uploadType: 'aliyun',
41
+ type: ['jpg', 'png', 'jpeg']
42
+ },
43
+ isNew: true,
44
+ },
45
+ handleCustom({action, data}) {
46
+ if (data && data.params) {
47
+ //当一个插件中出现使用内容分类时候需要设置code值,在页面引用时候容器id + code进行拼接
48
+ //data.params = Object.assign({}, data.params, {code: 'g_test_id'});
49
+ }
50
+
51
+ //获取返回参数(场景类型名称为必填)
52
+ let loading = { close(){}}
53
+
54
+ //获取显示内容
55
+ if (action === 'screen') {
56
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: 'edtix_bucket_content_tip'})
57
+ .then(res => {
58
+ loading.close();
59
+ data.cb(res['list'])
60
+ })
61
+ .catch(error => {
62
+ console.error(error);
63
+ loading.close();
64
+ });
65
+
66
+ }
67
+
68
+ //获取返回参数(广告位高度必选项)
69
+ if (action === 'getNewsInfo') {
70
+ XdBus.getParentApi('cmsGetPublishEditxContent')(data.params)
71
+ .then(res => {
72
+ loading.close()
73
+ data.cb({list: res.list, selectId: res.selected})
74
+ })
75
+ .catch(error => {
76
+ loading.close()
77
+ console.error(error);
78
+ });
79
+ }
80
+
81
+ //获取产品业务线列表
82
+ if (action === 'namespace') {
83
+ XdBus.getParentApi('getOptionsNamespaces')({})
84
+ .then(res => {
85
+ loading.close()
86
+ data.cb(res['list'])
87
+ })
88
+ .catch(error => {
89
+ loading.close()
90
+ console.error(error);
91
+ });
92
+ }
93
+
94
+ //使用内容分类
95
+ if (action === 'cmsPublishEditxContent') {
96
+ loading = XdBus.getParentApi('loading')({});
97
+ XdBus.getParentApi('cmsPublishEditxContent')(data.params)
98
+ .then(res => {
99
+ console.log('cmsPublishEditxContent', res)
100
+ loading.close();
101
+ data.cb(res)
102
+ })
103
+ .catch(error => {
104
+ loading.close();
105
+ console.error(error);
106
+ });
107
+ }
108
+
109
+ //位置列表
110
+ if (action === 'getListPostion') {
111
+ loading = XdBus.getParentApi('loading')({});
112
+ XdBus.getParentApi('getListNewsPosition')(data.params)
113
+ .then(res => {
114
+ loading.close();
115
+ data.cb(res)
116
+ })
117
+ .catch(error => {
118
+ loading.close();
119
+ console.error(error);
120
+ });
121
+ }
122
+
123
+ //位置创建
124
+ if (action === 'addPostion') {
125
+ loading = XdBus.getParentApi('loading')({});
126
+ XdBus.getParentApi('addNewsPosition')(data.params)
127
+ .then(res => {
128
+ loading.close();
129
+ data.cb(true)
130
+ })
131
+ .catch(error => {
132
+ console.error(error);
133
+ loading.close();
134
+ data.cb(false)
135
+ });
136
+ }
137
+
138
+ //位置编辑
139
+ if (action === 'editPostion') {
140
+ loading = XdBus.getParentApi('loading')({});
141
+ XdBus.getParentApi('updateNewsPosition')(data.params)
142
+ .then(res => {
143
+ loading.close();
144
+ data.cb(true)
145
+ })
146
+ .catch(error => {
147
+ console.error(error);
148
+ loading.close();
149
+ data.cb(false)
150
+ });
151
+ }
152
+
153
+ //位置删除
154
+ if (action === 'deleltePostion') {
155
+ loading = XdBus.getParentApi('loading')({});
156
+ XdBus.getParentApi('deleteNewsPosition')(data.params)
157
+ .then(res => {
158
+ loading.close();
159
+ data.cb(true)
160
+ })
161
+ .catch(error => {
162
+ console.error(error);
163
+ loading.close();
164
+ data.cb(false)
165
+ });
166
+ }
167
+
168
+ //获取广告位内容列表
169
+ if (action === 'getListContent') {
170
+ loading = XdBus.getParentApi('loading')({});
171
+ XdBus.getParentApi('getListNewsContent')(data.params)
172
+ .then(res => {
173
+ loading.close();
174
+ data.cb(res)
175
+ })
176
+ .catch(error => {
177
+ loading.close();
178
+ console.error(error);
179
+ });
180
+ }
181
+
182
+ //广告内容创建
183
+ if (action === 'addContent') {
184
+ loading = XdBus.getParentApi('loading')({});
185
+ XdBus.getParentApi('addNewsContent')(data.params)
186
+ .then(res => {
187
+ loading.close();
188
+ data.cb(true)
189
+ })
190
+ .catch(error => {
191
+ console.error(error);
192
+ loading.close();
193
+ data.cb(false)
194
+ });
195
+ }
196
+
197
+ //广告内容编辑
198
+ if (action === 'editContent') {
199
+ loading = XdBus.getParentApi('loading')({});
200
+ XdBus.getParentApi('updateNewsContent')(data.params)
201
+ .then(res => {
202
+ loading.close();
203
+ data.cb(true)
204
+ })
205
+ .catch(error => {
206
+ console.error(error);
207
+ loading.close();
208
+ data.cb(false)
209
+ });
210
+ }
211
+
212
+ //广告内容删除
213
+ if (action === 'deleteContent') {
214
+ loading = XdBus.getParentApi('loading')({});
215
+ XdBus.getParentApi('deleteNewsContent')(data.params)
216
+ .then(res => {
217
+ loading.close();
218
+ data.cb(true)
219
+ })
220
+ .catch(error => {
221
+ console.error(error);
222
+ loading.close();
223
+ data.cb(false)
224
+ });
225
+ }
226
+
227
+ //内容发布
228
+ if (action === 'publish') {
229
+ loading = XdBus.getParentApi('loading')({});
230
+ console.log('publish', data.params)
231
+ XdBus.getParentApi('cmsPublishContent')(data.params)
232
+ .then(res => {
233
+ loading.close();
234
+ data.cb(res)
235
+ })
236
+ .catch(error => {
237
+ loading.close();
238
+ console.error(error);
239
+ });
240
+ }
241
+
242
+ //通知页面进行刷新
243
+ if (action === 'update') {
244
+ loading = XdBus.getParentApi('loading')({});
245
+ XdBus.getParentApi('getXdBusUpdateView')('onUpdateView', {});
246
+ loading.close()
247
+ }
248
+ },
249
+ inline: false,
250
+ },
251
+ {
252
+ label: "组件样式",
253
+ ele: "xd-style-image",
254
+ groupKey: 'content',
255
+ valueKey: "style",
256
+ value: style,
257
+ labelInline:true,
258
+ className: 'input100',
259
+ handleCustom(cusRes) {
260
+ XdBus.getParentApi('getCompStylesOptions')({
261
+ layout_ids: 'HW64GfWi8pNTiOZYk0b1o',
262
+ key: Date.now()
263
+ })
264
+ .then(res => {
265
+ cusRes.data.cb(res)
266
+ })
267
+ .catch(error => {
268
+ console.error(error);
269
+ });
270
+ },
271
+ },
272
+
273
+ {ele: 'group_start'},
274
+ {
275
+ label: "提示图标:",
276
+ ele: "xd-radio",
277
+ valueKey: "show_tip_icon",
278
+ value: show_tip_icon,
279
+ groupKey: 'content',
280
+ labelInline: true,
281
+ list: [
282
+ { label: '显示', value: 'Y' },
283
+ { label: '隐藏', value: 'N' }
284
+ ],
285
+ cusStyle: { marginBottom: show_tip_icon === 'Y' ? 0: '10px!important'},
286
+ hidden: style !== '1',
287
+ },
288
+ {
289
+ label: "",
290
+ ele: 'xd-upload',
291
+ valueKey: 'staticTipIcon',
292
+ groupKey:'content',
293
+ value: data.staticTipIcon || {},
294
+ defaultValue: data.staticTipIcon || null,
295
+ slot: true,
296
+ tipsformet: '<span style="color: #666; font-size: 12px">上传文件格式:@imageType@,不超过@size@MB。</span>',
297
+ type: ['jpg', 'png', 'jpeg'],
298
+ styleType: 'one',
299
+ uploadType: 'aliyun',
300
+ size: .5,
301
+ action: 'action',
302
+ sort: true,
303
+ cusStyle: { paddingLeft: '92px'},
304
+ hidden: style !== '1' || show_tip_icon !== 'Y',
305
+ },
306
+ {ele: 'group_end'},
307
+ ].filter(i=>i)
308
+ }
@@ -0,0 +1,395 @@
1
+ 'use strict';
2
+
3
+ import {dataVal, statusDataVal, statusShow} from "@/utils/AttrTools";
4
+ import Color from "color";
5
+
6
+ export default function (data, gValue, gColor, oldData) {
7
+ let show_tip_icon = 'N';
8
+ if(data['show_tip_icon'] !== undefined) show_tip_icon = data['show_tip_icon'];
9
+
10
+ let textAlign = 'left';
11
+ if(data['textAlign'] !== undefined) textAlign = data['textAlign'];
12
+
13
+ let isTitle = false;
14
+ if(data['isTitle'] !== undefined) isTitle = data['isTitle'];
15
+
16
+ //背景颜色
17
+ let defBgc = Color(gColor.warningColor).alpha(0.2).toString();
18
+
19
+ let style = '1';
20
+ if(data['style'] !== undefined) style = data['style'];
21
+
22
+
23
+ //标题文字大小
24
+ let defOldFontSize = '20rpx'; //内容
25
+ let defOldTitleFontSize = '26rpx'; //标题
26
+ if(data['fontSize'] !== undefined) {
27
+ if(typeof data['fontSize'] === 'string') {
28
+ if(data['fontSize']) {
29
+ defOldFontSize = parseInt(data['fontSize']) + 'rpx';
30
+ defOldTitleFontSize = (parseInt(data['fontSize']) + 4) + 'rpx';
31
+ }
32
+ }
33
+ if(typeof data['fontSize'] === 'number'){
34
+ defOldFontSize = data['fontSize'] + 'rpx';
35
+ defOldTitleFontSize = (data['fontSize'] + 4) + 'rpx'
36
+ }
37
+ }
38
+ let defFontSize = '24rpx'; //内容
39
+ let defTitleFontSize = '28rpx'; //标题
40
+ let fontColor = data['textColor'] || gColor.warningColor;
41
+ debugger
42
+
43
+
44
+
45
+ return [
46
+ style === '1' && {
47
+ ele: 'title',
48
+ label: '风格一(静态显示)',
49
+ size: 'small',
50
+ groupKey:'style',
51
+ },
52
+
53
+ {
54
+ label: '圆角',
55
+ ele: 'xd-radio',
56
+ groupKey: 'style',
57
+ valueKey: 'radiusStatus',
58
+ value: statusDataVal({data, key:'radiusStatus',cValue: 'N',dValue:'N', fields:['radius'],gValue}),
59
+ labelInline:true,
60
+ hidden: style !== '1',
61
+ list: [
62
+ {label: '默认', value: 'D'},
63
+ {label: '无圆角', value: 'N'},
64
+ {label: '自定义', value: 'C'},
65
+ ]
66
+ },
67
+ {ele: 'group_start'},
68
+ {
69
+ label: '',
70
+ ele: 'xd-site-select-list',
71
+ labelInline: true,
72
+ valueKey: 'radius',
73
+ value: dataVal({data, key:'radius', dValue:'10', gValue}),
74
+ hidden: style !== '1' || !statusShow({data, key: 'radiusStatus', fields:['radius'], gValue}),
75
+ placeholder: '请选择圆角',
76
+ multiple: false,
77
+ className: 'input100',
78
+ groupKey:'style',
79
+ handleCustom({action, data}) {
80
+ XdBus.getParentApi('getOptionsSettingList')({
81
+ setting_id: 'edtix_style_radius',
82
+ key: Date.now()
83
+ })
84
+ .then(res => {
85
+ res.list = res.list.filter(item=>{
86
+ return item.label !== '无';
87
+ });
88
+ data.cb(res.list)
89
+ })
90
+ .catch(error => {
91
+ console.error(error);
92
+ });
93
+ },
94
+ },
95
+ {ele: 'group_end'},
96
+
97
+ {
98
+ label: '背景',
99
+ ele: 'xd-radio',
100
+ groupKey: 'style',
101
+ valueKey: 'bgcStatus',
102
+ value: statusDataVal({data, key:'bgcStatus', fields:['bgc'],gValue}),
103
+ labelInline:true,
104
+ hidden: style !== '1',
105
+ list: [
106
+ {label: '默认', value: 'D'},
107
+ {label: '自定义', value: 'C'},
108
+ ]
109
+ },
110
+ {ele: 'group_start'},
111
+ {
112
+ label: '',
113
+ ele: 'xd-color',
114
+ valueKey: 'bgc',
115
+ value: dataVal({data, key:'bgc', dValue:defBgc, gValue}),
116
+ hidden: style !== '1'|| !statusShow({data, key: 'bgcStatus', fields:['bgc'], gValue}),
117
+ placeholder: '请输入内容背景',
118
+ classNmae: 'input100',
119
+ groupKey: 'style',
120
+ labelInline: true,
121
+ setting: {
122
+ showAlpha: true
123
+ }
124
+ },
125
+ {ele: 'group_end'},
126
+
127
+ {
128
+ label: '外边距',
129
+ ele: 'xd-radio',
130
+ groupKey: 'style',
131
+ valueKey: 'marginStatus',
132
+ value: statusDataVal({data, key:'marginStatus', fields:['margin'],gValue}),
133
+ labelInline:true,
134
+ hidden: style !== '1',
135
+ list: [
136
+ {label: '默认', value: 'D'},
137
+ {label: '自定义', value: 'C'},
138
+ ]
139
+ },
140
+ {ele: 'group_start'},
141
+ {
142
+ label: '',
143
+ ele: 'xd-margin-padding',
144
+ groupKey:'style',
145
+ valueKey: 'margin',
146
+ value: dataVal({
147
+ data,
148
+ key:'margin',
149
+ dValue:0,
150
+ gValue,
151
+ isPM: true,
152
+ }),
153
+ hidden: style !== '1' || !statusShow({data, key: 'marginStatus', fields:['margin'], gValue}),
154
+ setting: {
155
+ type: 'margin',
156
+ },
157
+ },
158
+ {ele: 'group_end'},
159
+
160
+ style === '1' && {
161
+ ele:'xd-line-title',
162
+ groupKey:'style',
163
+ label: '标题样式'
164
+ },
165
+ {
166
+ label: '是否显示',
167
+ ele: 'xd-radio',
168
+ groupKey: 'style',
169
+ valueKey: 'isTitle',
170
+ value: isTitle,
171
+ labelInline:true,
172
+ hidden: style !== '1',
173
+ list: [
174
+ {label: '显示', value: true},
175
+ {label: '隐藏', value: false},
176
+ ]
177
+ },
178
+ {
179
+ label: '对齐方式',
180
+ ele: 'xd-radio',
181
+ valueKey: 'textAlign',
182
+ groupKey:'style',
183
+ className: 'input100',
184
+ labelInline:true,
185
+ value: textAlign,
186
+ hidden: style !== '1'|| isTitle === false,
187
+ list: [
188
+ {"label": "左", "value": 'left'},
189
+ {"label": "中", "value": 'center'},
190
+ {"label": "右", "value": 'right'},
191
+ ]
192
+ },
193
+ {
194
+ label: '标题文字',
195
+ ele: 'xd-radio',
196
+ groupKey: 'style',
197
+ valueKey: 'titleStyleStatus',
198
+ value: statusDataVal({data, key:'titleStyleStatus', fields:['titleStyle'],gValue}),
199
+ labelInline:true,
200
+ hidden: style !== '1'||isTitle === false,
201
+ list: [
202
+ {label: '默认', value: 'D'},
203
+ {label: '自定义', value: 'C'},
204
+ ]
205
+ },
206
+ {ele: 'group_start'},
207
+ {
208
+ label: '',
209
+ ele: 'xd-text-and-bgc',
210
+ groupKey:'style',
211
+ valueKey: 'titleStyle',
212
+ value: dataVal({data, key:'titleStyle', dValue: gValue.isAdd && gValue.isFirst ? {
213
+ color: fontColor,
214
+ fontSize: defTitleFontSize,
215
+ fontWeight:'normal',
216
+ }:{
217
+ color: fontColor,
218
+ fontSize: defOldTitleFontSize,
219
+ fontWeight:'normal',
220
+ }, gValue}),
221
+ hidden: style !== '1'|| isTitle === false || !statusShow({data, key: 'titleStyleStatus', fields:['titleStyle'], gValue}),
222
+ setting: {
223
+ fontSize: true,
224
+ weight:true,
225
+ bgColor:false,
226
+ selected:false,
227
+ default:{}
228
+ },
229
+ handleCustom({action, data}) {
230
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: 'edtix_style_font_size'})
231
+ .then(res => {
232
+ data.cb(res.list)
233
+ })
234
+ .catch(error => {
235
+ console.error(error);
236
+ data.cb([])
237
+ });
238
+ },
239
+ },
240
+ {ele: 'group_end'},
241
+ {
242
+ label: '内边距',
243
+ ele: 'xd-radio',
244
+ groupKey: 'style',
245
+ valueKey: 'titlePaddingStatus',
246
+ value: statusDataVal({data, key:'titlePaddingStatus', fields:['titlePadding'],gValue}),
247
+ labelInline:true,
248
+ hidden: style !== '1' || isTitle === false,
249
+ list: [
250
+ {label: '默认', value: 'D'},
251
+ {label: '自定义', value: 'C'},
252
+ ]
253
+ },
254
+ {ele: 'group_start'},
255
+ {
256
+ label: '',
257
+ ele: 'xd-margin-padding',
258
+ groupKey:'style',
259
+ valueKey: 'titlePadding',
260
+ value: dataVal({
261
+ data,
262
+ key:'titlePadding',
263
+ dValue:gValue.isAdd && gValue.isFirst ? 16: 20,
264
+ gValue,
265
+ isPM: true,
266
+ }),
267
+ hidden: style !== '1'|| isTitle === false || !statusShow({data, key: 'titlePaddingStatus', fields:['titlePadding'], gValue}),
268
+ setting: {
269
+ type: 'margin',
270
+ },
271
+ },
272
+ {ele: 'group_end'},
273
+
274
+ style === '1' && {
275
+ ele:'xd-line-title',
276
+ groupKey:'style',
277
+ label: '内容样式'
278
+ },
279
+ {
280
+ label: '内容文字',
281
+ ele: 'xd-radio',
282
+ groupKey: 'style',
283
+ valueKey: 'contStyleStatus',
284
+ value: statusDataVal({data, key:'contStyleStatus', fields:['contStyle'],gValue}),
285
+ labelInline:true,
286
+ hidden: style !== '1',
287
+ list: [
288
+ {label: '默认', value: 'D'},
289
+ {label: '自定义', value: 'C'},
290
+ ]
291
+ },
292
+ {ele: 'group_start'},
293
+ {
294
+ label: '',
295
+ ele: 'xd-text-and-bgc',
296
+ groupKey:'style',
297
+ valueKey: 'contStyle',
298
+ value: dataVal({data, key:'contStyle', dValue:gValue.isAdd && gValue.isFirst ? {
299
+ color: fontColor,
300
+ fontSize: defFontSize,
301
+ fontWeight:'normal',
302
+ }:{
303
+ color: fontColor,
304
+ fontSize: defOldFontSize,
305
+ fontWeight:'normal',
306
+ }, gValue}),
307
+ hidden: style !== '1'|| !statusShow({data, key: 'contStyleStatus', fields:['contStyle'], gValue}),
308
+ setting: {
309
+ fontSize: true,
310
+ weight:true,
311
+ bgColor:false,
312
+ selected:false,
313
+ default:{}
314
+ },
315
+ handleCustom({action, data}) {
316
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: 'edtix_style_font_size'})
317
+ .then(res => {
318
+ data.cb(res.list)
319
+ })
320
+ .catch(error => {
321
+ console.error(error);
322
+ data.cb([])
323
+ });
324
+ },
325
+ },
326
+ {ele: 'group_end'},
327
+
328
+ //==废弃================
329
+ {
330
+ label: '内文字颜色:',
331
+ ele: 'xd-color',
332
+ groupKey:'style',
333
+ valueKey: 'textColor',
334
+ value: data.textColor || '',
335
+ placeholder: '请选择内文字颜色',
336
+ classNmae: 'input80',
337
+ hidden: true,
338
+ },
339
+ {
340
+ label: '内容文字大小:',
341
+ ele: 'xd-site-select-list',
342
+ valueKey: 'fontSize',
343
+ value: data['fontSize'],
344
+ groupKey:'style',
345
+ placeholder: '请选择内容文字大小',
346
+ multiple: false,
347
+ className: 'input80',
348
+ hidden: true,
349
+ handleCustom({action, data}) {
350
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: 'edtix_style_font_size'})
351
+ .then(res => {
352
+ data.cb(res.list)
353
+ })
354
+ .catch(error => {
355
+ console.error(error);
356
+ });
357
+ },
358
+ },
359
+ //==废弃================
360
+
361
+ {
362
+ label: '内边距',
363
+ ele: 'xd-radio',
364
+ groupKey: 'style',
365
+ valueKey: 'paddingStatus',
366
+ value: statusDataVal({data, key:'paddingStatus', fields:['padding'],gValue}),
367
+ labelInline:true,
368
+ hidden: style !== '1',
369
+ list: [
370
+ {label: '默认', value: 'D'},
371
+ {label: '自定义', value: 'C'},
372
+ ]
373
+ },
374
+ {ele: 'group_start'},
375
+ {
376
+ label: '',
377
+ ele: 'xd-margin-padding',
378
+ groupKey:'style',
379
+ valueKey: 'padding',
380
+ value: dataVal({
381
+ data,
382
+ key:'padding',
383
+ dValue:gValue.isAdd && gValue.isFirst ? 16: 20,
384
+ gValue,
385
+ isPM: true,
386
+ }),
387
+ hidden: style !== '1' || !statusShow({data, key: 'paddingStatus', fields:['padding'], gValue}),
388
+ setting: {
389
+ type: 'margin',
390
+ },
391
+ },
392
+ {ele: 'group_end'},
393
+
394
+ ].filter(i=>i)
395
+ }