jufubao-base 1.0.196-beta101 → 1.0.196-beta102

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-base",
3
- "version": "1.0.196-beta101",
3
+ "version": "1.0.196-beta102",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -1,22 +1,6 @@
1
1
  'use strict';
2
2
 
3
- function oloTonNewBorAndSha(type,width,color, style=''){
4
- if(type === 'Y') {
5
- let def = {
6
- type: 'Y',
7
- value: {
8
- width: width,
9
- color:color,
10
- }
11
- }
12
- if(style) def.value.style = style;
13
- return def
14
- }
15
- return {
16
- type: 'N',
17
- value:null,
18
- }
19
- }
3
+ import {oldTonNewBorAndSha, checkValue} from '@/utils/AttrTools'
20
4
 
21
5
  /**
22
6
  * @description 当表单组件中有联动操作时候,使用方法进行返回
@@ -24,7 +8,11 @@ function oloTonNewBorAndSha(type,width,color, style=''){
24
8
  export default {
25
9
  style: [],
26
10
  content:(data)=>{
27
- let defAddBtnBorder = oloTonNewBorAndSha()
11
+ let defContBorder = oldTonNewBorAndSha(data.contBorder, data.is_border,data.is_border_w ,data.is_border_c,'solid');
12
+ if(defContBorder.type === 'Y' && data.is_border ==='Y') {
13
+ data.is_border = 'N'
14
+ }
15
+
28
16
  return [
29
17
  {
30
18
  label: '',
@@ -293,51 +281,7 @@ export default {
293
281
  },
294
282
  value: data['addBtnBorder'] || {},
295
283
  },
296
- //=====属性已废弃(不能删除,已隐藏)====
297
- {
298
- ele: 'title',
299
- label: '边框设置',
300
- size: 'small',
301
- groupKey:'style',
302
- hidden: true
303
- },
304
- {
305
- label: '是否有边框:',
306
- ele: 'xd-radio',
307
- valueKey: 'is_border',
308
- groupKey:'style',
309
- value: data['is_border'] || 'N',
310
- placeholder: '请选择是否有边框',
311
- multiple: false,
312
- className: 'input80',
313
- hidden: true,
314
- list: [
315
- {label: '是', value: 'Y'},
316
- {label: '否', value: 'N'},
317
- ]
318
- },
319
- data['is_border'] === 'Y' && {
320
- label: '边框颜色:',
321
- ele: 'xd-color',
322
- valueKey: 'is_border_c',
323
- groupKey:'style',
324
- value: data['is_border_c'] || '',
325
- placeholder: '请选择边框颜色',
326
- classNmae: 'input80',
327
- hidden: true
328
- },
329
- data['is_border'] === 'Y' && {
330
- label: '边框大小:',
331
- ele: 'el-input',
332
- type: 'number',
333
- valueKey: 'is_border_w',
334
- groupKey:'style',
335
- value: data['is_border_w'] || '',
336
- placeholder: '请输入边框颜色',
337
- className: 'input80',
338
- hidden: true
339
- },
340
- //=====属性已废弃(不能删除,已隐藏)====
284
+
341
285
 
342
286
 
343
287
  {
@@ -415,10 +359,10 @@ export default {
415
359
  ele: 'xd-border',
416
360
  groupKey:'style',
417
361
  valueKey: 'contBorder',
418
- value: data['contBorder'] || {},
362
+ value: defContBorder,
419
363
  labelInline:true,
420
364
  setting: {
421
- selected:'N'
365
+ selected: defContBorder.type
422
366
  },
423
367
  },
424
368
  {
@@ -492,6 +436,51 @@ export default {
492
436
  },
493
437
  },
494
438
 
439
+ //=====属性已废弃(不能删除,已隐藏)====
440
+ {
441
+ ele: 'title',
442
+ label: '边框设置',
443
+ size: 'small',
444
+ groupKey:'style',
445
+ hidden: true
446
+ },
447
+ {
448
+ label: '是否有边框:',
449
+ ele: 'xd-radio',
450
+ valueKey: 'is_border',
451
+ groupKey:'style',
452
+ value: data['is_border'] || 'N',
453
+ placeholder: '请选择是否有边框',
454
+ multiple: false,
455
+ className: 'input80',
456
+ hidden: true,
457
+ list: [
458
+ {label: '是', value: 'Y'},
459
+ {label: '否', value: 'N'},
460
+ ]
461
+ },
462
+ {
463
+ label: '边框颜色:',
464
+ ele: 'xd-color',
465
+ valueKey: 'is_border_c',
466
+ groupKey:'style',
467
+ value: data['is_border_c'] || '',
468
+ placeholder: '请选择边框颜色',
469
+ classNmae: 'input80',
470
+ hidden: true
471
+ },
472
+ {
473
+ label: '边框大小:',
474
+ ele: 'el-input',
475
+ type: 'number',
476
+ valueKey: 'is_border_w',
477
+ groupKey:'style',
478
+ value: data['is_border_w'] || '',
479
+ placeholder: '请输入边框颜色',
480
+ className: 'input80',
481
+ hidden: true
482
+ },
483
+ //=====属性已废弃(不能删除,已隐藏)====
495
484
 
496
485
 
497
486
  {
@@ -35,7 +35,7 @@
35
35
  :style="{
36
36
  borderRadius: radius + 'rpx',
37
37
  background: backgroundColor,
38
- border: borderBox,
38
+ border: borderBoxComp,
39
39
  marginTop: rowSpacing + 'rpx',
40
40
  padding:contentPaddingComp,
41
41
  boxShadow: contShadow
@@ -84,31 +84,23 @@
84
84
  mixins: [componentsMixins,extsMixins,JfbBaseUserCenterMixin],
85
85
  computed: {
86
86
  titleMarginComp(){
87
- let str = `${this.checkValue(this.titleMargin.top, 0)}rpx`;
88
- str = `${str} ${this.checkValue(this.titleMargin.right, 0)}rpx`;
89
- str = `${str} ${this.checkValue(this.titleMargin.bottom, 0)}rpx`;
90
- str = `${str} ${this.checkValue(this.titleMargin.left, 0)}rpx`;
91
87
  return {
92
- padding: str,
88
+ padding: this.getMarginAndPadding(this.titleMargin, 0),
93
89
  }
94
90
  },
95
91
  outPadding() {
96
- let str = `${this.checkValue(this.bodyPadding.top, 0)}rpx`;
97
- str = `${str} ${this.checkValue(this.bodyPadding.right, 0)}rpx`;
98
- str = `${str} ${this.checkValue(this.bodyPadding.bottom, 0)}rpx`;
99
- str = `${str} ${this.checkValue(this.bodyPadding.left, 0)}rpx`;
100
- return str
92
+ return this.getMarginAndPadding(this.bodyPadding,0)
101
93
  },
102
94
  outMargin() {
103
- let str = `${this.checkValue(this.bodyMargin.top, 20)}rpx`;
104
- str = `${str} ${this.checkValue(this.bodyMargin.right, 20)}rpx`;
105
- str = `${str} ${this.checkValue(this.bodyMargin.bottom, 20)}rpx`;
106
- str = `${str} ${this.checkValue(this.bodyMargin.left, 20)}rpx`;
107
- return str
95
+ return this.getMarginAndPadding(this.bodyMargin, 20)
108
96
  },
109
- borderBox() {
110
- if (this.is_border === 'Y') return `${this.is_border_w}rpx ${this.is_border_s} ${this.is_border_c}`;
111
- else return '0';
97
+ borderBoxComp() {
98
+ return this.getBorderCompatibleOldStyle(this.contBorder, {
99
+ color: this.is_border_c,
100
+ width: this.is_border_w,
101
+ type: this.is_border,
102
+ style: 'solid'
103
+ })
112
104
  },
113
105
  titleStyleComp(){
114
106
  return {
@@ -152,11 +144,7 @@
152
144
  }
153
145
  },
154
146
  contentPaddingComp(){
155
- let str = `${this.checkValue(this.contentPadding.top, 40)}rpx`;
156
- str = `${str} ${this.checkValue(this.contentPadding.right, 40)}rpx`;
157
- str = `${str} ${this.checkValue(this.contentPadding.bottom, 40)}rpx`;
158
- str = `${str} ${this.checkValue(this.contentPadding.left, 40)}rpx`;
159
- return str
147
+ return this.getMarginAndPadding(this.contentPadding, 40)
160
148
  },
161
149
  },
162
150
  data() {
@@ -196,6 +184,7 @@
196
184
  btnRadius:'40',
197
185
 
198
186
  //边框
187
+ contBorder:{},
199
188
  is_border: 'Y',
200
189
  is_border_w: 0,
201
190
  is_border_c: '',
@@ -258,18 +247,13 @@
258
247
  this.btnTextColor = getContainerPropsValue(container, 'content.btnTextColor', '#fff');
259
248
  this.btnFontSize = getContainerPropsValue(container, 'content.btnFontSize',26);
260
249
  this.btnRadius = getContainerPropsValue(container, 'content.btnRadius','40');
250
+
251
+ //边框兼容
261
252
  this.contBorder = getContainerPropsValue(container, 'content.contBorder', {});
262
253
  this.is_border = getContainerPropsValue(container, 'content.is_border', 'N');
263
254
  this.is_border_c = getContainerPropsValue(container, 'content.is_border_c', '#fff');
264
255
  this.is_border_w = getContainerPropsValue(container, 'content.is_border_w', 2);
265
- this.is_border_s = 'solid';
266
- if(this.contBorder.type === 'Y') {
267
- this.is_border = 'Y';
268
- if(this.contBorder.value && this.contBorder.value.width) this.is_border_w = this.contBorder.value.width;
269
- if(this.contBorder.value && this.contBorder.value.color) this.is_border_c = this.contBorder.value.color;
270
- if(this.contBorder.value && this.contBorder.value.style) this.is_border_s = this.contBorder.value.style;
271
256
 
272
- }
273
257
  //链接
274
258
  this.add_url = getContainerPropsValue(container, 'content.add_url', {value: ''}).value;
275
259
  this.pwd_url = getContainerPropsValue(container, 'content.pwd_url', {value: ''}).value;
@@ -1,10 +1,22 @@
1
1
  'use strict';
2
+ import {oldTonNewBorAndSha, checkValue} from '@/utils/AttrTools'
3
+
2
4
  /**
3
5
  * @description 当表单组件中有联动操作时候,使用方法进行返回
4
6
  */
5
7
  export default {
6
8
  style: [],
7
9
  content: (data)=>{
10
+ let defContBorder = oldTonNewBorAndSha(data.contBorder, data.is_border,data.is_border_w ,data.is_border_c,'solid');
11
+ if(defContBorder.type === 'Y' && data.is_border ==='Y') {
12
+ data.is_border = 'N'
13
+ }
14
+
15
+ let defContShadow = oldTonNewBorAndSha(data.contShadow, data.is_shadow,data.is_shadow_w ,data.is_shadow_bg);
16
+ if(defContShadow.type === 'Y' && data.is_shadow ==='Y') {
17
+ data.is_shadow = 'N'
18
+ }
19
+
8
20
  return [
9
21
  {
10
22
  label: '内容排版:',
@@ -101,10 +113,10 @@ export default {
101
113
  ele: 'xd-shadow',
102
114
  groupKey:'style',
103
115
  valueKey: 'contShadow',
104
- value: data['contShadow'] || '',
116
+ value: defContShadow,
105
117
  labelInline:true,
106
118
  setting: {
107
- selected: 'N'
119
+ selected: defContShadow.type
108
120
  },
109
121
  handleCustom({action, data}) {
110
122
  XdBus.getParentApi('getOptionsSettingList')({setting_id: 'edtix_style_radius'})
@@ -122,10 +134,10 @@ export default {
122
134
  ele: 'xd-border',
123
135
  groupKey:'style',
124
136
  valueKey: 'contBorder',
125
- value: data['contBorder'] || '',
137
+ value: defContBorder,
126
138
  labelInline:true,
127
139
  setting: {
128
- selected:'N'
140
+ selected:defContBorder.type
129
141
  },
130
142
  },
131
143
  {
@@ -245,7 +257,7 @@ export default {
245
257
  {label: '否', value: 'N'},
246
258
  ]
247
259
  },
248
- data['is_shadow'] === 'Y' && {
260
+ {
249
261
  label: '投影颜色:',
250
262
  ele: 'xd-color',
251
263
  valueKey: 'is_shadow_bg',
@@ -255,7 +267,7 @@ export default {
255
267
  classNmae: 'input80',
256
268
  hidden: true,
257
269
  },
258
- data['is_shadow'] === 'Y' && {
270
+ {
259
271
  label: '投影范围:',
260
272
  groupKey:'style',
261
273
  ele: 'xd-site-select-list',
@@ -278,6 +290,8 @@ export default {
278
290
  },
279
291
  hidden: true,
280
292
  },
293
+
294
+ //=====属性已废弃(不能删除,已隐藏)====
281
295
  {
282
296
  ele: 'title',
283
297
  label: '边框设置',
@@ -300,7 +314,7 @@ export default {
300
314
  {label: '否', value: 'N'},
301
315
  ]
302
316
  },
303
- data['is_border'] === 'Y' && {
317
+ {
304
318
  label: '边框颜色:',
305
319
  hidden: true,
306
320
  ele: 'xd-color',
@@ -310,7 +324,7 @@ export default {
310
324
  placeholder: '请选择边框颜色',
311
325
  classNmae: 'input80',
312
326
  },
313
- data['is_border'] === 'Y' && {
327
+ {
314
328
  hidden: true,
315
329
  label: '边框大小:',
316
330
  ele: 'el-input',
@@ -321,7 +335,7 @@ export default {
321
335
  placeholder: '请输入边框颜色',
322
336
  className: 'input80',
323
337
  },
324
- //=====属性已废弃====
338
+ //=====属性已废弃(不能删除,已隐藏)====
325
339
 
326
340
  0&&{
327
341
  label: '是否显示设置:',
@@ -17,14 +17,7 @@
17
17
  <view class="x-line"></view>
18
18
  <view
19
19
  class="jfb-base-user-info__body-header"
20
- :style="{
21
- margin: marginComp,
22
- background : backgroundColor,
23
- padding: paddingComp,
24
- boxShadow: shadow,
25
- borderRadius: radius + 'rpx',
26
- border: borderBox
27
- }"
20
+ :style="[boxStyleComp]"
28
21
  v-if="userInfo !== null"
29
22
  >
30
23
  <view
@@ -78,20 +71,30 @@
78
71
  computed: {
79
72
  ...mapState(['jfbAuthorize']),
80
73
 
81
- marginComp() {
82
- let str = `${this.checkValue(this.margin.top, 20)}rpx`;
83
- str = `${str} ${this.checkValue(this.margin.right, 20)}rpx`;
84
- str = `${str} ${this.checkValue(this.margin.bottom, 20)}rpx`;
85
- str = `${str} ${this.checkValue(this.margin.left, 20)}rpx`;
86
- return str
87
- },
88
- paddingComp() {
89
- let str = `${this.checkValue(this.padding.top, 20)}rpx`;
90
- str = `${str} ${this.checkValue(this.padding.right, 20)}rpx`;
91
- str = `${str} ${this.checkValue(this.padding.bottom, 20)}rpx`;
92
- str = `${str} ${this.checkValue(this.padding.left, 20)}rpx`;
93
- return str
74
+ boxStyleComp(){
75
+ let border = this.getBorderCompatibleOldStyle(this.contBorder, {
76
+ color: this.is_border_c,
77
+ width: this.is_border_w,
78
+ type: this.is_border,
79
+ style: 'solid'
80
+ })
81
+
82
+ let shadow = this.getShadowCompatibleOldStyle(this.contShadow, {
83
+ color: this.is_shadow_bg,
84
+ width: this.is_shadow_w,
85
+ type: this.is_shadow,
86
+ })
87
+ return {
88
+ margin: this.getMarginAndPadding(this.margin, 20),
89
+ background : this.backgroundColor,
90
+ padding: this.getMarginAndPadding(this.padding, 20),
91
+ boxShadow: shadow,
92
+ borderRadius: this.radius + 'rpx',
93
+ border: border,
94
+
95
+ }
94
96
  },
97
+
95
98
  shadow(){
96
99
  if(this.is_shadow === 'Y') return `0 0 ${this.is_shadow_w}rpx ${this.is_shadow_bg}`;
97
100
  else return '0 0 0 rgba(0,0,0,0)';
@@ -100,6 +103,7 @@
100
103
  if (this.is_border === 'Y') return `${this.is_border_w}rpx ${this.is_border_s} ${this.is_border_c}`;
101
104
  else return '0';
102
105
  },
106
+
103
107
  nickNameStyle(){
104
108
  return {
105
109
  fontSize: this.nickStyle.fontSize || '32rpx',
@@ -135,15 +139,16 @@
135
139
  radius: 0,
136
140
 
137
141
  //投影
142
+ contShadow:{},
138
143
  is_shadow: 'N',
139
144
  is_shadow_bg: 0,
140
145
  is_shadow_w: 0,
141
146
 
142
147
  //边框
148
+ contBorder:{},
143
149
  is_border: 'N',
144
150
  is_border_w: 0,
145
151
  is_border_c: '',
146
- is_border_s:'solid',
147
152
 
148
153
  //其他
149
154
  margin: {},
@@ -233,29 +238,17 @@
233
238
  this.imageColor = getContainerPropsValue(container, 'content.imageColor', '#333');
234
239
 
235
240
  //Shadow
236
- this.contShadow = getContainerPropsValue(container, 'content.contShadow', {})
237
241
  this.is_shadow = getContainerPropsValue(container, 'content.is_shadow', 'N');
238
242
  this.is_shadow_bg = getContainerPropsValue(container, 'content.is_shadow_bg', '#fff');
239
243
  this.is_shadow_w = getContainerPropsValue(container, 'content.is_shadow_w', '10');
240
- if(this.contShadow.type === 'Y') {
241
- this.is_shadow = 'Y';
242
- if(this.contShadow.value && this.contShadow.value.width) this.is_shadow_w = this.contShadow.value.width;
243
- if(this.contShadow.value && this.contShadow.value.color) this.is_shadow_bg = this.contShadow.value.color;
244
- }
244
+ this.contShadow = getContainerPropsValue(container, 'content.contShadow', {})
245
245
 
246
246
  //边框
247
- this.contBorder = getContainerPropsValue(container, 'content.contBorder', {});
248
247
  this.is_border = getContainerPropsValue(container, 'content.is_border', 'N');
249
248
  this.is_border_c = getContainerPropsValue(container, 'content.is_border_c', '#fff');
250
249
  this.is_border_w = getContainerPropsValue(container, 'content.is_border_w', 0);
251
- this.is_border_s = 'solid';
252
- if(this.contBorder.type === 'Y') {
253
- this.is_border = 'Y';
254
- if(this.contBorder.value && this.contBorder.value.width) this.is_border_w = this.contBorder.value.width;
255
- if(this.contBorder.value && this.contBorder.value.color) this.is_border_c = this.contBorder.value.color;
256
- if(this.contBorder.value && this.contBorder.value.style) this.is_border_s = this.contBorder.value.style;
250
+ this.contBorder = getContainerPropsValue(container, 'content.contBorder', {});
257
251
 
258
- }
259
252
 
260
253
  this.nickStyle = getContainerPropsValue(container, 'content.nickStyle', {});
261
254
  this.logoutStyle = getContainerPropsValue(container, 'content.logoutStyle', {});
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  import ICONS from '@/ICONS'
3
+ import {oldTonNewBorAndSha, checkValue} from '@/utils/AttrTools'
3
4
 
4
5
  /**
5
6
  * @description 当表单组件中有联动操作时候,使用方法进行返回
@@ -7,6 +8,11 @@ import ICONS from '@/ICONS'
7
8
  export default {
8
9
  style: [],
9
10
  content: (data)=>{
11
+ let defContBorder = oldTonNewBorAndSha(data.contBorder, data.is_border,data.is_border_w ,data.is_border_c,'solid');
12
+ if(defContBorder.type === 'Y' && data.is_border ==='Y') {
13
+ data.is_border = 'N'
14
+ }
15
+
10
16
  return [
11
17
  {
12
18
  label: '',
@@ -337,7 +343,8 @@ export default {
337
343
  value: data['addBtnBorder'] || {},
338
344
  labelInline:true,
339
345
  setting: {
340
- selected:'N'
346
+ selected:'N',
347
+ isDef: true
341
348
  },
342
349
  },
343
350
 
@@ -416,10 +423,10 @@ export default {
416
423
  ele: 'xd-border',
417
424
  groupKey:'style',
418
425
  valueKey: 'contBorder',
419
- value: data['contBorder'] || {},
426
+ value: defContBorder,
420
427
  labelInline:true,
421
428
  setting: {
422
- selected:'N'
429
+ selected:defContBorder.type
423
430
  },
424
431
  },
425
432
  {
@@ -463,7 +470,7 @@ export default {
463
470
  labelInline:true,
464
471
  },
465
472
 
466
-
473
+ //=====属性已废弃(不能删除,已隐藏)====
467
474
  {
468
475
  label: '是否有边框:',
469
476
  ele: 'xd-radio',
@@ -479,7 +486,7 @@ export default {
479
486
  {label: '否', value: 'N'},
480
487
  ]
481
488
  },
482
- data['is_border'] === 'Y' && {
489
+ {
483
490
  label: '边框颜色:',
484
491
  ele: 'xd-color',
485
492
  groupKey:'style',
@@ -489,7 +496,7 @@ export default {
489
496
  placeholder: '请选择边框颜色',
490
497
  classNmae: 'input80',
491
498
  },
492
- data['is_border'] === 'Y' && {
499
+ {
493
500
  label: '边框大小:',
494
501
  ele: 'el-input',
495
502
  type: 'number',
@@ -500,6 +507,7 @@ export default {
500
507
  placeholder: '请输入边框大小',
501
508
  className: 'input80',
502
509
  },
510
+ //=====属性已废弃(不能删除,已隐藏)====
503
511
 
504
512
  {
505
513
  label: '设置售后订单列表地址:',
@@ -82,18 +82,10 @@
82
82
  mixins: [componentsMixins,extsMixins,JfbBaseUserOrderMixin],
83
83
  computed: {
84
84
  titleMarginComp(){
85
- let padding = `${this.checkValue(this.titleMargin.top, 0)}rpx`;
86
- padding = `${padding} ${this.checkValue(this.titleMargin.right, 0)}rpx`;
87
- padding = `${padding} ${this.checkValue(this.titleMargin.bottom, 0)}rpx`;
88
- padding = `${padding} ${this.checkValue(this.titleMargin.left, 0)}rpx`;
89
85
  return {
90
- padding: padding
86
+ padding: this.getMarginAndPadding(this.titleMargin, 0)
91
87
  }
92
88
  },
93
- borderComp() {
94
- if (this.is_border === 'Y') return `${this.is_border_w}rpx solid ${this.is_border_c}`;
95
- else return '0';
96
- },
97
89
  titleStyleComp(){
98
90
  return {
99
91
  fontSize: this.titleStyle.fontSize || '28rpx',
@@ -102,19 +94,9 @@
102
94
  }
103
95
  },
104
96
  bodyStyleComp(){
105
- let margin = `${this.checkValue(this.bodyMargin.top, 20)}rpx`;
106
- margin = `${margin} ${this.checkValue(this.bodyMargin.right, 20)}rpx`;
107
- margin = `${margin} ${this.checkValue(this.bodyMargin.bottom, 20)}rpx`;
108
- margin = `${margin} ${this.checkValue(this.bodyMargin.left, 20)}rpx`;
109
-
110
- let padding = `${this.checkValue(this.bodyPadding.top, 0)}rpx`;
111
- padding = `${padding} ${this.checkValue(this.bodyPadding.right, 0)}rpx`;
112
- padding = `${padding} ${this.checkValue(this.bodyPadding.bottom, 0)}rpx`;
113
- padding = `${padding} ${this.checkValue(this.bodyPadding.left, 0)}rpx`;
114
-
115
97
  return {
116
- margin,
117
- padding,
98
+ margin: this.getMarginAndPadding(this.bodyMargin, 20),
99
+ padding: this.getMarginAndPadding(this.bodyPadding, 0),
118
100
  borderRadius: this.bodyRadius + 'rpx',
119
101
  backgroundColor: this.bodyBackgroundColor,
120
102
  }
@@ -127,6 +109,11 @@
127
109
  if(value.color) border['borderColor'] = value.color;
128
110
  if(value.style) border['borderStyle'] = value.style;
129
111
  }
112
+ if(this.addBtnBorder && this.addBtnBorder.type === 'N') {
113
+ border['borderWidth'] = 0;
114
+ border['borderColor'] = '';
115
+ border['borderStyle'] = ''
116
+ }
130
117
  let addBtnShadow = {};
131
118
  if(this.addBtnShadow && this.addBtnShadow.type === 'Y') {
132
119
  let value = this.addBtnShadow.value || {};
@@ -154,30 +141,20 @@
154
141
  }
155
142
  },
156
143
  contStyleComp(){
157
- let borderStyle = 'solid';
158
- let borderWidth = 0;
159
- let borderColor = 'rgba(0,0,0,0)';
160
- if(this.is_border === 'Y') {
161
- if(this.is_border_w !== undefined) borderWidth = this.is_border_w;
162
- if(this.is_border_c !== undefined) borderColor = this.is_border_c;
163
- }
164
- if(this.contBorder && this.contBorder.type === 'Y') {
165
- let value = this.contBorder.value ||{};
166
- if(value.width) borderWidth = value.width + 'rpx';
167
- if(value.color) borderColor = value.color;
168
- if(value.style) borderStyle = value.style;
169
- }
170
- let padding = `${this.checkValue(this.contPadding.top, 40)}rpx`;
171
- padding = `${padding} ${this.checkValue(this.contPadding.right, 20)}rpx`;
172
- padding = `${padding} ${this.checkValue(this.contPadding.bottom, 34)}rpx`;
173
- padding = `${padding} ${this.checkValue(this.contPadding.left, 20)}rpx`;
144
+ let border = this.getBorderCompatibleOldStyle(this.contBorder, {
145
+ color: this.is_border_c,
146
+ width: this.is_border_w,
147
+ type: this.is_border,
148
+ style: 'solid'
149
+ })
150
+
174
151
  return {
175
152
  borderRadius: this.radius + 'rpx',
176
153
  backgroundColor: this.backgroundColor,
177
154
  marginTop: this.spacing + 'rpx',
178
- border: `${borderWidth} ${borderStyle} ${borderColor}`,
155
+ border: border,
179
156
  boxShadow: this.contShadow,
180
- padding
157
+ padding: this.getMarginAndPadding(this.contPadding,{top:40, bottom: 34, left: 20, right: 20})
181
158
  }
182
159
  }
183
160
  },
@@ -171,7 +171,6 @@ export default {
171
171
  }
172
172
 
173
173
  //保存到vuex
174
- console.log('setStyleCommon',this)
175
174
  this.setStyleCommon(this.styles);
176
175
 
177
176
  //初始化风格
@@ -207,24 +206,53 @@ export default {
207
206
  mounted() {
208
207
  let that = this;
209
208
  this.autoHideMask();
209
+
210
+ //调试模式设置值
211
+ let zIndex = 4;
212
+ if( this['hideMask'] === true) zIndex = -1;
213
+ if(this['closeMask'] === true) zIndex = -1;
214
+ if(this['closeMask'] === false) zIndex = 4;
215
+ document.querySelector(':root').style.setProperty('--preview-z-index', zIndex);
216
+
217
+ //生产元素
218
+ if(this.$configProject.isPreview) {
219
+ if(zIndex ===-1) {
220
+ let parentRoot = document.querySelector(`.${this.cssRoot}`);
221
+ for(let i=0; i < 4;i++) {
222
+ let span = document.createElement('span');
223
+ span.className = 'xd-preview-line xd-preview-line-' + i;
224
+ parentRoot.appendChild(span);
225
+ }
226
+ }
227
+
228
+ }
229
+
210
230
  if (this.$configProject.isPreview && this.selfMask !== true ) {
211
- this.$nextTick(()=>{
212
- function handle() {
213
- let elx = that.$el.getElementsByClassName(`${that.cssRoot}__body`);
214
- if (elx.length === 0) {
215
- setTimeout(() => {
216
- handle()
217
- }, 50)
218
- } else {
219
- let len = elx.length;
220
- for (let i = 0; i < len; i++) {
221
- if (!elx.item(i).classList.contains('isGPreview')) {
222
- elx.item(i).classList.add("isGPreview");
223
- }
231
+ //启动关闭
232
+ if(this['closeMask'] === true) {
233
+ return;
234
+ }
235
+
236
+ function handle() {
237
+ let elx = that.$el.getElementsByClassName(`${that.cssRoot}__body`);
238
+ if (elx.length === 0) {
239
+ setTimeout(() => {
240
+ handle()
241
+ }, 50)
242
+ }
243
+ else {
244
+ let len = elx.length;
245
+ for (let i = 0; i < len; i++) {
246
+ if (!elx.item(i).classList.contains('isGPreview')) {
247
+ elx.item(i).classList.add("isGPreview");
224
248
  }
225
249
  }
226
250
  }
227
- handle();
251
+ }
252
+ this.$nextTick(()=>{
253
+ setTimeout(()=>{
254
+ handle();
255
+ },200)
228
256
  });
229
257
  }
230
258
 
@@ -261,10 +289,13 @@ export default {
261
289
  autoHideMask(){
262
290
  if(this.$configProject.isPreview && this.hideMask === true){
263
291
  this.$nextTick(()=>{
264
- let className = this.$el.classList;
265
- if(!className.contains('gHideMask')) {
266
- className.add("gHideMask")
267
- }
292
+ setTimeout(()=>{
293
+ let className = this.$el.classList;
294
+ if(!className.contains('gHideMask')) {
295
+ className.add("gHideMask")
296
+ }
297
+ },200)
298
+
268
299
  })
269
300
  }
270
301
  },
@@ -459,26 +490,171 @@ export default {
459
490
  return Number(value || 0);
460
491
  },
461
492
 
493
+ /**
494
+ * @description 获取图片链接
495
+ * @param image
496
+ * @return {string}
497
+ */
498
+ getBgImage(image = {}){
499
+ let bg = 'none';
500
+ if(this.$xdUniHelper.checkVarType(image) === 'object') {
501
+ if(!this.$xdUniHelper.isEmpty(image)) {
502
+ return `url(${getServiceUrl(image.url)})`
503
+ }
504
+ }
505
+ return bg
506
+ },
507
+
508
+ //阴影样式生成
462
509
  getXdShadow(defaultObj, newObj){
463
510
  if(newObj.type === 'N' || this.$xdUniHelper.isEmpty(newObj)) return `0 0 0 rgba(0,0,0,0)`;
511
+ return this.getXdBorder(defaultObj,newObj,'shadow')
512
+ },
513
+
514
+ //边框样式生成
515
+ getXdBorder(defaultObj, newObj, type='border'){
516
+ if(newObj.type === 'N' || this.$xdUniHelper.isEmpty(newObj)) return `0`;
464
517
  let width = defaultObj.width;
465
518
  let color = defaultObj.color;
466
- if(newObj.value !== null) {
467
- if(newObj.value.width) width = newObj.value.width;
468
- if(newObj.value.color) color = newObj.value.color
469
- }
519
+ let style = defaultObj.style || 'solid';
520
+ let value = newObj.value || {};
521
+ if(value.width) width = value.width;
522
+ if(value.color) color = value.color;
523
+ if(value.style) style = value.style;
524
+ if(type === 'border') return `${width}rpx ${style} ${color}`
470
525
  return `0 0 ${width}rpx ${color}`;
471
526
  },
472
527
 
473
- getXdBorder(defaultObj, newObj){
474
- if(newObj.type === 'N' || this.$xdUniHelper.isEmpty(newObj)) return `0`
475
- let width = defaultObj.width;
476
- let color = defaultObj.color;
477
- if(newObj.value !== null) {
478
- if(newObj.value.width) width = newObj.value.width
479
- if(newObj.value.color) color = newObj.value.color
528
+ getBorderCompatibleOldStyle(newObj={}, oldObj={}, type='border'){
529
+ let contWidth = 0;
530
+ let contColor = 'rgba(0.0.0.0)';
531
+ let contrStyle = 'solid';
532
+
533
+ if(oldObj.type === 'Y') {
534
+ if(oldObj.width !== undefined) contWidth = oldObj.width;
535
+ if(oldObj.color !== undefined) contColor = oldObj.color;
536
+ }
537
+ if(newObj.type === 'Y') {
538
+ let value = newObj.value || {};
539
+ if(value.color) contColor = value.color;
540
+ if(value.style) contrStyle = value.style;
541
+ if(value.width) contWidth = value.width;
542
+ }
543
+
544
+ if(type === 'border'){
545
+ if(oldObj.type === 'N' && newObj.type === 'N') return 0;
546
+ return `${contWidth}rpx ${contrStyle} ${contColor}`
547
+ }
548
+ return `0 0 ${contWidth}rpx ${contColor}` ;
549
+ },
550
+
551
+ getShadowCompatibleOldStyle(newShadow={},oldShadow={}){
552
+ return this.getBorderCompatibleOldStyle(newShadow,oldShadow, 'shadow')
553
+ },
554
+
555
+ /**
556
+ * @description 获取边框或投影宽度值
557
+ * @param newObj {Object} border|shadow
558
+ * @param width {number|string} 老模式宽
559
+ * @param type {string} 老模式宽是否启用 Y/N
560
+ * @return {number}
561
+ */
562
+ getBorOrShWidth(newObj={}, {width, type}) {
563
+ let tempWidth = 0;
564
+ if(type === 'Y' && width !== undefined) tempWidth = width;
565
+ if(newObj.type === 'Y') {
566
+ let value = newObj.value || {};
567
+ if(value.width !== undefined) tempWidth = value.width;
568
+ }
569
+ return Number(tempWidth);
570
+ },
571
+
572
+ /**
573
+ * @description 解析切换元素属性方法
574
+ * @param newObj
575
+ * @param fontSize {String} 默认字体大小, 格式:24rpx
576
+ * @param lineHeight {Number} 默认行高 格式:30
577
+ * @param color {String} 默认颜色
578
+ * @param bgColor {String} 默认背景色
579
+ * @param fontWeight {String} 字体粗线
580
+ * @param gradientColor {String} 渐变色 参考:https://www.colorzilla.com/gradient-editor/
581
+ * @param type {String} 获取样式类型: ''=>获取普通样式 act=>获取选中样式
582
+ * @return {{}}
583
+ */
584
+ getFontAndBgcStyle(newObj, {fontSize, lineHeight, color, bgColor, fontWeight,gradientColor},type='' ){
585
+ let temp = {};
586
+ let colorKey = 'color',
587
+ fontSizeKey='fontSize',
588
+ lineHeightKey = 'lineHeight',
589
+ fontWeightKey = 'fontWeight',
590
+ bgColorKey = 'bgColor',
591
+ gradientColorKey = 'gradientColor';
592
+ if(type === 'act') {
593
+ colorKey = `actColor`;
594
+ fontSizeKey='actFontSize';
595
+ lineHeightKey = 'actLineHeight';
596
+ fontWeightKey = 'actFontWeight';
597
+ bgColorKey = 'actBgColor';
598
+ gradientColorKey = 'actGradientColor';
599
+ }
600
+ if(newObj[colorKey] || color) temp['color'] = newObj[colorKey] || color;
601
+ if(newObj[fontSizeKey] || color) temp['fontSize'] = newObj[fontSizeKey] || fontSize;
602
+ if(newObj[lineHeightKey] || lineHeight) temp['lineHeight'] = (newObj[lineHeightKey] || lineHeight) + 'rpx';
603
+ if(newObj[fontWeightKey] || fontWeight) temp['fontWeight'] = newObj[fontWeightKey] || fontWeight;
604
+ if(newObj[bgColorKey] || bgColor) temp['backgroundColor'] = newObj[bgColorKey] || bgColor;
605
+ if(newObj[gradientColorKey] || gradientColor) temp['backgroundImage'] = newObj[gradientColorKey] || gradientColor;
606
+ return temp;
607
+
608
+ },
609
+
610
+ /**
611
+ * @description 数据
612
+ * @param marAndPadding {Object}
613
+ * @param defVale {Object|number}
614
+ */
615
+ getMarginAndPadding(marAndPadding, defVale){
616
+ let top = 0, left=0,bottom=0,right=0;
617
+ if(typeof defVale === 'number') {
618
+ top=defVale;
619
+ left=defVale;
620
+ bottom=defVale;
621
+ right=defVale;
622
+ }
623
+ if(this.$xdUniHelper.checkVarType(defVale) === 'object') {
624
+ if(defVale.top !== undefined) top = defVale.top;
625
+ if(defVale.right !== undefined) right = defVale.right;
626
+ if(defVale.bottom !== undefined) bottom = defVale.bottom;
627
+ if(defVale.left !== undefined) left = defVale.left;
628
+ }
629
+ let str = `${this.checkValue(marAndPadding.top, top)}rpx`;
630
+ str = `${str} ${this.checkValue(marAndPadding.right, right)}rpx`;
631
+ str = `${str} ${this.checkValue(marAndPadding.bottom, bottom)}rpx`;
632
+ str = `${str} ${this.checkValue(marAndPadding.left, left)}rpx`;
633
+ return str
634
+ },
635
+
636
+ /**
637
+ * @description 获取商品显示规则
638
+ * @param container
639
+ * @return {{isAddCart: *, isShowDiscount: *, isPrice: *, is_show_brand: *, showActivityPrice: *, isShowTag: *, differ: *}}
640
+ */
641
+ getProductConfig(container){
642
+ let is_show_brand = getContainerPropsValue(container, "content.is_show_brand", "N");
643
+ let isPrice = getContainerPropsValue(container, "content.isPrice", "Y");
644
+ let isShowDiscount = getContainerPropsValue(container, "content.isShowDiscount", "Y");
645
+ let differ = getContainerPropsValue(container, "content.differ", 1);
646
+ let showActivityPrice = getContainerPropsValue(container, "content.showActivityPrice", "N");
647
+ let isShowTag = getContainerPropsValue(container, "content.isShowTag", "Y");
648
+ let isAddCart = getContainerPropsValue(container, "content.isAddCart", "N");
649
+ return {
650
+ isShowDiscount: isShowDiscount,
651
+ isPrice: isPrice,
652
+ isAddCart: isAddCart,
653
+ is_show_brand: is_show_brand,
654
+ showActivityPrice:showActivityPrice,
655
+ isShowTag : isShowTag,
656
+ differ: differ,
480
657
  }
481
- return `${width}rpx solid ${color}`;
482
658
  },
483
659
 
484
660
  getUrlCallback(path){
@@ -591,21 +767,20 @@ export default {
591
767
  return redirect_data.path
592
768
  }
593
769
  else {
594
- return `//${projectAttr.host}/${redirect_data.frontPath}`
770
+ return `//${projectAttr.host}${redirect_data.frontPath}`
595
771
  }
596
772
 
597
773
  }
598
774
  //#endif
599
775
 
600
776
  //#ifdef MP-WEIXIN
601
-
602
- let dir = this.getUrlHasSpStrDIR(redirect_data.path);
777
+ let dir = redirect_data.dir;
603
778
  if(redirect_data['appType'] === 'wxmp'){
604
779
  if(projectAttr.deploy_dir === dir) return redirect_data.path;
605
780
  else return null;
606
781
  }
607
782
  else if(redirect_data['appType'] === 'h5'){
608
-
783
+ return `https://${projectAttr.host}${redirect_data.frontPath}`
609
784
  }
610
785
  else return null;
611
786
  //#endif