jufubao-base 1.0.63-beta1 → 1.0.63-beta201

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,346 @@
1
+ 'use strict';
2
+
3
+ import console from "@dcloudio/uni-h5/src/core/helpers/console";
4
+
5
+ /**
6
+ * @description 当表单组件中有联动操作时候,使用方法进行返回
7
+ */
8
+ export default {
9
+ style:[],
10
+ content:(params)=>{
11
+ if(!params['isCarousel']) params['isCarousel'] = 1;
12
+ return [
13
+ {
14
+ label: '广告位置配置:', //label
15
+ ele: 'xd-site-poster', //package 名称
16
+ valueKey: 'poster', //form[valueKey]
17
+ className: 'input80',
18
+ value: params.poster || {},
19
+ setting: {
20
+ count: 1,
21
+ scene: {label: '广告', value: 'normal'}
22
+ },
23
+ handleCustom({action, data}) {
24
+ //设置场景参数
25
+ if(data) {
26
+ data.params = Object.assign({}, {scene: 'normal'}, data.params || {})
27
+ }
28
+
29
+ //获取显示内容
30
+ if (action === 'screenList') {
31
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: 'editx_base_ad_split_screen'})
32
+ .then(res => {
33
+ data.cb(res['list'])
34
+ })
35
+ .catch(error => {
36
+ console.error(error);
37
+ });
38
+ return
39
+ }
40
+
41
+ //获取返回参数(广告位高度必选项)
42
+ if (action === 'getPosterInfo') {
43
+ XdBus.getParentApi('cmsGetPublishEditxContent')(data.params)
44
+ .then(res => {
45
+ data.cb({list: res.list, selectId: res.selected})
46
+ })
47
+ .catch(error => {
48
+ console.error(error);
49
+ });
50
+ return
51
+ }
52
+
53
+ //使用内容分类
54
+ if (action === 'cmsPublishEditxContent') {
55
+ XdBus.getParentApi('cmsPublishEditxContent')(data.params)
56
+ .then(res => {
57
+ data.cb(res)
58
+ })
59
+ .catch(error => {
60
+ console.error(error);
61
+ });
62
+ return
63
+ }
64
+
65
+ let loading = XdBus.getParentApi('loading')({});
66
+ //位置列表
67
+ if (action === 'getListPostion') {
68
+ XdBus.getParentApi('getListPosterPosition')(data.params)
69
+ .then(res => {
70
+ loading.close();
71
+ data.cb(res)
72
+ })
73
+ .catch(error => {
74
+ loading.close();
75
+ console.error(error);
76
+ });
77
+ }
78
+
79
+ //位置创建
80
+ if (action === 'addPostion') {
81
+ XdBus.getParentApi('addPosterPosition')(data.params)
82
+ .then(res => {
83
+ loading.close();
84
+ data.cb(true)
85
+ })
86
+ .catch(error => {
87
+ console.error(error);
88
+ loading.close();
89
+ data.cb(false)
90
+ });
91
+ }
92
+
93
+ //位置编辑
94
+ if (action === 'editPostion') {
95
+ XdBus.getParentApi('updatePosterPosition')(data.params)
96
+ .then(res => {
97
+ loading.close();
98
+ data.cb(true)
99
+ })
100
+ .catch(error => {
101
+ console.error(error);
102
+ loading.close();
103
+ data.cb(false)
104
+ });
105
+ }
106
+
107
+ //位置删除
108
+ if (action === 'deleltePostion') {
109
+ XdBus.getParentApi('deletePosterPosition')(data.params)
110
+ .then(res => {
111
+ loading.close();
112
+ data.cb(true)
113
+ })
114
+ .catch(error => {
115
+ console.error(error);
116
+ loading.close();
117
+ data.cb(false)
118
+ });
119
+ }
120
+
121
+ //获取广告位内容列表
122
+ if (action === 'getListContent') {
123
+ XdBus.getParentApi('getListPosterContent')(data.params)
124
+ .then(res => {
125
+ loading.close();
126
+ data.cb(res)
127
+ })
128
+ .catch(error => {
129
+ loading.close();
130
+ console.error(error);
131
+ });
132
+ }
133
+
134
+ //广告内容创建
135
+ if (action === 'addContent') {
136
+ XdBus.getParentApi('addPosterContent')(data.params)
137
+ .then(res => {
138
+ loading.close();
139
+ data.cb(true)
140
+ })
141
+ .catch(error => {
142
+ console.error(error);
143
+ loading.close();
144
+ data.cb(false)
145
+ });
146
+ }
147
+
148
+ //广告内容编辑
149
+ if (action === 'editContent') {
150
+ XdBus.getParentApi('updatePosterContent')(data.params)
151
+ .then(res => {
152
+ loading.close();
153
+ data.cb(true)
154
+ })
155
+ .catch(error => {
156
+ console.error(error);
157
+ loading.close();
158
+ data.cb(false)
159
+ });
160
+ }
161
+
162
+ //广告内容删除
163
+ if (action === 'deleteContent') {
164
+ XdBus.getParentApi('deletePosterContent')(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 === 'jumpPosterContentType') {
178
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: "cms_setting"})
179
+ .then(res => {
180
+ loading.close();
181
+ data.cb(res['redirect_type'])
182
+ })
183
+ .catch(error => {
184
+ loading.close();
185
+ console.error(error);
186
+ });
187
+ }
188
+
189
+ //发布
190
+ if (action === 'publish') {
191
+ console.log('publish', data.params)
192
+ XdBus.getParentApi('cmsPublishContent')(data.params)
193
+ .then(res => {
194
+ loading.close();
195
+ data.cb(res)
196
+ })
197
+ .catch(error => {
198
+ loading.close();
199
+ console.error(error);
200
+ });
201
+ }
202
+
203
+ //获取站内页面地址
204
+ if (action === 'router') {
205
+ loading.close()
206
+ return XdBus.getParentApi('getPagesTree');
207
+
208
+ }
209
+
210
+ //通知页面进行刷新
211
+ if(action === 'update') {
212
+ XdBus.getParentApi('getXdBusUpdateView')('onUpdateView', {});
213
+ loading.close()
214
+ }
215
+ },
216
+ inline: false,
217
+ notice: '',
218
+ rules: [
219
+ {required: true, message: '请选择广告位置', trigger: 'change'},
220
+ ],
221
+ },
222
+ params.poster && params.poster['type'] !== '1' && {
223
+ label: '广告位内容间距设置:',
224
+ ele: 'el-input',
225
+ type: 'number',
226
+ valueKey: 'padding',
227
+ value: params.padding || 0,
228
+ className: 'input40',
229
+ placeholder: '请广告位内容间距设置',
230
+ notice: '在使用通屏显示类型广告位之外的样式时,该属性生效,单位:像素(px)',
231
+ inline: false,
232
+ },
233
+ {
234
+ label: '广告圆角设置:',
235
+ ele: 'xd-site-select-list',
236
+ valueKey: 'radius',
237
+ value: params['radius'] || '20',
238
+ placeholder: '请选择广告圆角设置',
239
+ multiple: false,
240
+ className: 'input80',
241
+ handleCustom({action, data}) {
242
+ XdBus.getParentApi('getOptionsSettingList')({setting_id: 'edtix_style_radius'})
243
+ .then(res => {
244
+ data.cb(res.list)
245
+ })
246
+ .catch(error => {
247
+ console.error(error);
248
+ });
249
+ },
250
+ },
251
+ {
252
+ label: '广告位边距设置:',
253
+ ele: 'xd-margin-padding',
254
+ valueKey: 'margin',
255
+ value: params.margin || null,
256
+ disabled: false,
257
+ setting: {
258
+ type: 'margin',
259
+ },
260
+ placeholder: '请设置广告位边距设置',
261
+
262
+ },
263
+ {
264
+ label: '广告位置使用张数:',
265
+ ele: 'el-input',
266
+ type: 'number',
267
+ valueKey: 'number',
268
+ value: params.number || 1,
269
+ placeholder: '请输入广告位置使用张数',
270
+ className: 'input40',
271
+ unit: '张',
272
+ rules: [
273
+ {
274
+ required: true,
275
+ message: '请输入广告位置使用张数',
276
+ trigger: 'blur'
277
+ },
278
+ ]
279
+ },
280
+ {
281
+ label: '广告位显示方式:',
282
+ ele: 'xd-radio',
283
+ valueKey: 'isCarousel',
284
+ value: params['isCarousel'] || 1,
285
+ rules: [
286
+ {required: true, message: '请选择广告位显示方式', trigger: ['blur', 'change']}
287
+ ],
288
+ list: [
289
+ {"label": "焦点图显示", "value": 1},
290
+ {"label": "轮播图显示", "value": 2},
291
+ ]
292
+ },
293
+ params['isCarousel'] === 2 && {
294
+ label: '广告位轮播周期:',
295
+ ele: 'el-input',
296
+ type: 'number',
297
+ isKey: true,
298
+ valueKey: 'carouselTime',
299
+ value: params.carouselTime || 5,
300
+ placeholder: '请输入广告位轮播周期,单位秒',
301
+ className: 'input40',
302
+ unit: '秒',
303
+ rules: [
304
+ {
305
+ required: true,
306
+ message: '请输入广告位置高度',
307
+ trigger: 'blur'
308
+ },
309
+ ]
310
+ },
311
+ params['isCarousel'] === 2 && {
312
+ label: '广告显示dot类型:', //label
313
+ ele: 'xd-select-list', //package 名称
314
+ valueKey: 'dot_type', //form[valueKey]
315
+ value: params['dot_type'] || 'dot', //v-model
316
+ placeholder: '请选择广告显示dot类型',
317
+ multiple: false,
318
+ className: 'input80',
319
+ list:[
320
+ {label: '显示圆点', value: 'dot'},
321
+ {label: '显示长方形', value: 'default'},
322
+ {label: '显示圆点+长条', value: 'round'},
323
+ {label: '显示索引+标题', value: 'nav'},
324
+ {label: '显示索引', value: 'indexes'},
325
+ ],
326
+ notice: '在使用非通屏显示类型广告位之外的样式时,<span style="color: red">(显示索引+标题|显示索引)</span>使用"<span style="color: red">显示圆点</span>"',
327
+ inline: false,
328
+ },
329
+ params['isCarousel'] === 2 && {
330
+ label: '广告位内容显示行数:',
331
+ ele: 'xd-radio',
332
+ valueKey: 'rows',
333
+ value: params.rows || 1,
334
+ list: [
335
+ {"label": "一行", "value": 1},
336
+ {"label": "两行", "value": 2},
337
+ ]
338
+ },
339
+
340
+
341
+ ].filter(i=>i)
342
+ },
343
+ advanced: [
344
+
345
+ ],
346
+ };