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.
@@ -1,14 +1,29 @@
1
1
  'use strict';
2
2
 
3
+ import {dataVal, statusDataVal, statusShow,getAttrData} from "@/utils/AttrTools";
4
+
3
5
  /**
4
6
  * @description 当表单组件中有联动操作时候,使用方法进行返回
5
7
  */
6
8
  export default {
7
9
  style: [],
8
- content: (data) => {
9
- let width = 750,height = 562.5;
10
- if(data.height) height = Number(data.height);
11
- if(data.width) width = Number(data.width);
10
+ content: (data, gValue,gColor,oldData) => {
11
+ debugger
12
+ const defWidth = 750,defHeight = 562;
13
+ let height = defHeight, width = defWidth;
14
+ if(data.height !== undefined) height = Number(data.height) || defHeight;
15
+ if(data.width !== undefined) width = Number(data.width) || defWidth;
16
+
17
+ let defOldWidthAndHeight = {width:750,height:562};
18
+ if(data['widthAndHeight'] === undefined && height && width) defOldWidthAndHeight = {height,width};
19
+
20
+ //高宽的
21
+ let widthAndHeight = getAttrData(data,'widthAndHeight', [{width:750,height:562},defOldWidthAndHeight],{
22
+ sKey: 'widthAndHeightStatus',
23
+ fields:['widthAndHeight'],
24
+ isData: true,
25
+ gValue
26
+ });
12
27
 
13
28
  return [
14
29
  {
@@ -18,19 +33,110 @@ export default {
18
33
  groupKey:'advanced',
19
34
  },
20
35
  {
21
- label: '边距设置:',
36
+ ele: 'title',
37
+ label: '基础',
38
+ size: 'small',
39
+ groupKey:'content',
40
+ },
41
+ {
42
+ label: '外边距',
43
+ ele: 'xd-radio',
44
+ groupKey: 'content',
45
+ valueKey: 'marginStatus',
46
+ value: statusDataVal({data, key:'marginStatus', fields:['margin'],gValue}),
47
+ labelInline:true,
48
+ list: [
49
+ {label: '默认', value: 'D'},
50
+ {label: '自定义', value: 'C'},
51
+ ]
52
+ },
53
+ {ele: 'group_start'},
54
+ {
55
+ label: '',
22
56
  ele: 'xd-margin-padding',
23
- valueKey: 'margin',
24
57
  groupKey:'content',
25
- value: data.margin || null,
58
+ valueKey: 'margin',
59
+ value: dataVal({
60
+ data,
61
+ key:'margin',
62
+ dValue:0,
63
+ gValue,
64
+ isPM: true,
65
+ }),
66
+ hidden: !statusShow({data, key: 'marginStatus', fields:['margin'], gValue}),
26
67
  setting: {
27
68
  type: 'margin',
28
69
  },
29
- placeholder: '请设置边距设置',
30
- inline: false,
31
- notice: '设置边距充,<span style="color: red">单位:像素(px)</span>。默认值:<span style="color: red">0</span>像素',
32
-
33
70
  },
71
+ {ele: 'group_end'},
72
+ {
73
+ label: '圆角',
74
+ ele: 'xd-radio',
75
+ groupKey: 'content',
76
+ valueKey: 'radiusStatus',
77
+ value: statusDataVal({data, key:'radiusStatus',cValue: 'N', fields:['radius'],gValue}),
78
+ labelInline:true,
79
+ list: [
80
+ {label: '默认', value: 'D'},
81
+ {label: '无圆角', value: 'N'},
82
+ {label: '自定义', value: 'C'},
83
+ ]
84
+ },
85
+ {ele: 'group_start'},
86
+ {
87
+ label: '',
88
+ ele: 'xd-site-select-list',
89
+ labelInline: true,
90
+ valueKey: 'radius',
91
+ value: dataVal({data, key:'radius', dValue:'10', gValue}),
92
+ hidden: !statusShow({data, key: 'radiusStatus', fields:['radius'], gValue}),
93
+ placeholder: '请选择圆角',
94
+ multiple: false,
95
+ className: 'input80',
96
+ groupKey:'content',
97
+ handleCustom({action, data}) {
98
+ XdBus.getParentApi('getOptionsSettingList')({
99
+ setting_id: 'edtix_style_radius',
100
+ key: Date.now()
101
+ })
102
+ .then(res => {
103
+ res.list = res.list.filter(item=>{
104
+ return item.label !== '无';
105
+ });
106
+ data.cb(res.list)
107
+ })
108
+ .catch(error => {
109
+ console.error(error);
110
+ });
111
+ },
112
+ },
113
+ {ele: 'group_end'},
114
+ {
115
+ label: '比例/尺寸',
116
+ ele: 'xd-radio',
117
+ groupKey: 'content',
118
+ valueKey: 'widthAndHeightStatus',
119
+ value: statusDataVal({data, key:'widthAndHeightStatus', fields:['widthAndHeight'],gValue}),
120
+ labelInline:true,
121
+ list: [
122
+ {label: '默认(750x562像素)', value: 'D'},
123
+ {label: '自定义', value: 'C'},
124
+ ]
125
+ },
126
+ {ele: 'group_start'},
127
+ {
128
+ label: '',
129
+ ele: 'xd-width-and-height',
130
+ groupKey:'content',
131
+ valueKey: 'widthAndHeight',
132
+ value: dataVal({data, key:'widthAndHeight', dValue:gValue.isAdd && gValue.isFirst ?{width:750,height:562}:defOldWidthAndHeight, gValue}),
133
+ hidden: !statusShow({data, key: 'widthAndHeightStatus', fields:['widthAndHeight'], gValue}),
134
+ setting: {
135
+ disabledWidth: true,
136
+ disabledHeight: false,
137
+ }
138
+ },
139
+ {ele: 'group_end'},
34
140
  {
35
141
  label: '图片真实宽度:',
36
142
  groupKey:'content',
@@ -39,6 +145,7 @@ export default {
39
145
  valueKey: 'width',
40
146
  value: data.width || '',
41
147
  className: 'input60',
148
+ hidden: true,
42
149
  inline:false,
43
150
  notice:'图片真实宽度设置,单位像素,默认:<span style="color:red">750</span>px',
44
151
  },
@@ -50,35 +157,55 @@ export default {
50
157
  valueKey: 'height',
51
158
  value: data.height||'',
52
159
  className: 'input60',
160
+ hidden: true,
53
161
  inline:false,
54
162
  notice:'图片真实高度设置,单位像素,默认:<span style="color:red">562.5</span>px',
55
163
  },
56
164
  {
57
- label: '占位背景图片:',
165
+ label: '图片路径',
58
166
  ele: 'xd-upload',
59
167
  valueKey: 'backgroundImage',
60
- groupKey:'content',
61
- value: data.backgroundImage || {},
62
- defaultValue: data.backgroundImage || null,
168
+ defaultValue: dataVal({data, key:'backgroundImage', dValue: {}, gValue}),
169
+ value: dataVal({data, key:'backgroundImage', dValue:{}, gValue}),
170
+ labelInline:true,
63
171
  slot: true,
64
- oneWidth: 300,
65
- oneHeight: 300 * height / width,
66
- elinputClassName: 'input40',
67
- tipsformet: `上传文件格式:@imageType@,不超过@size@MB,图片尺寸:<span style="color:red"> ${width}*${height}</span>像素`,
172
+ tipsformet: `<span style="font-size: 12px; color: #999;line-height: 16px">上传文件格式:@imageType@,不超过@size@MB.,建议尺寸为:<span style="color:red">${widthAndHeight.width}*${widthAndHeight.height}</span>像素。</span>`,
68
173
  type: ['jpg', 'png', 'jpeg'],
69
174
  styleType: 'one',
70
175
  uploadType: 'aliyun',
71
- size: 1,
72
- action: 'action',
73
- sort: true,
176
+ size: 2,
177
+ action: 'aliyun',
178
+ oneWidth: 350,
179
+ oneHeight: 350 * (widthAndHeight.height)/ widthAndHeight.width,
180
+ groupKey: 'content',
74
181
  maxlen: 1,
182
+ extendClass:['itemBackgroundColor']
183
+ },
184
+ {
185
+ label: '版本号:',
186
+ ele: 'el-input',
187
+ type: 'text',
188
+ groupKey: 'content',
189
+ valueKey: 'version',
190
+ value: 'v2.0',
191
+ hidden: true,
192
+ },
193
+ {
194
+ label: '过滤引用模版字段:',
195
+ ele: 'el-input',
196
+ type: 'text',
197
+ groupKey: 'content',
198
+ valueKey: 'refFilterKey',
199
+ value: '[]',
200
+ hidden: true,
75
201
  },
76
202
  {
77
203
  label: '',
78
204
  ele: 'slot',
79
205
  slot: 'is_reference',
80
- groupKey:'advanced',
206
+ groupKey:'content',
81
207
  },
208
+
82
209
  ].filter(i=>i)
83
210
  },
84
211
  advanced: [],
@@ -14,8 +14,8 @@
14
14
  </view>
15
15
  <!-- #endif -->
16
16
  <view class="jfb-base-image-block__body">
17
- <view class="image" :style="[bodyStyle]">
18
- <image :src="backgroundImageComp" alt="bgImage"></image>
17
+ <view class="image" :style="[bodyStyleComp]">
18
+ <image v-if="backgroundImageComp" :src="backgroundImageComp" alt="bgImage"></image>
19
19
  </view>
20
20
  </view>
21
21
  </view>
@@ -23,9 +23,8 @@
23
23
 
24
24
  <script>
25
25
  import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
26
- import { jfbRootExec } from "@/utils/xd.event";
27
26
  import JfbBaseImageBlockMixin from "./JfbBaseImageBlockMixin";
28
- import { getContainerPropsValue } from "@/utils/xd.base";
27
+ import { gCPVal } from "@/utils/xd.base";
29
28
  import componentsMixins from "@/mixins/componentsMixins";
30
29
  import extsMixins from "@/mixins/extsMixins";
31
30
  import getServiceUrl from "@/common/getServiceUrl";
@@ -38,14 +37,6 @@
38
37
  componentsMixins, extsMixins, JfbBaseImageBlockMixin
39
38
  ],
40
39
  computed:{
41
- marginComp(){
42
- let str = `${this.checkValue(this.margin.top, 0)}rpx`;
43
- str = `${str} ${this.checkValue(this.margin.right, 0)}rpx`;
44
- str = `${str} ${this.checkValue(this.margin.bottom, 0)}rpx`;
45
- str = `${str} ${this.checkValue(this.margin.left,0)}rpx`;
46
- return str;
47
- },
48
-
49
40
  backgroundImageComp(){
50
41
  if(this.$xdUniHelper.checkVarType(this.backgroundImage) === 'object') {
51
42
  if(this.backgroundImage.url) return getServiceUrl(this.backgroundImage.url,'size8')
@@ -54,26 +45,32 @@
54
45
  return '';
55
46
  },
56
47
 
57
- bodyStyle(){
58
- let outWidth = uni.getSystemInfoSync().safeArea.width * this.$pxNum;
59
- let outMarginRL = this.checkValue(this.margin.right, 0) + this.checkValue(this.margin.left, 0);
48
+ bodyStyleComp(){
49
+ let {width,height} = this.widthAndHeight;
50
+ let outWidth = 750 - this.getPMValue(this.margin,'RL',0);
60
51
  let bgColor = 'rgba(0,0,0,0)';
61
52
  if(this.backgroundImageComp === '') bgColor = '#f8f8f8'
62
53
  return {
63
- margin: this.marginComp,
64
- width: (outWidth - outMarginRL) +'rpx',
65
- height: this.height * (outWidth - outMarginRL)/this.width + 'rpx',
66
- backgroundColor: bgColor
54
+ margin: this.getMarginAndPadding(this.margin,0),
55
+ width: outWidth +'rpx',
56
+ height: (Number(height) * (outWidth)/Number(width)) + 'rpx',
57
+ backgroundColor: bgColor,
58
+ borderRadius: this.radius + 'rpx',
59
+ overflow:'hidden'
67
60
  }
68
61
  }
69
62
  },
70
63
  data() {
71
64
  return {
72
65
  closeMask: true,
73
- height: 562.5,
74
- width: 750,
75
- margin:{},
76
- backgroundImage:{},
66
+ margin:{},//边距
67
+ backgroundImage:{},//图片
68
+ radius:0,//圆角
69
+ //高宽
70
+ widthAndHeight:{
71
+ width: 750,
72
+ height: 562
73
+ },
77
74
  }
78
75
  },
79
76
  watch: {
@@ -87,16 +84,21 @@
87
84
  },
88
85
  methods: {
89
86
  onJfbLoad(options) {
87
+
90
88
  },
89
+
91
90
  /**
92
91
  * @description 监听事件变化
93
92
  * @param container {object} 业务组件对象自己
94
93
  */
95
94
  init(container) {
96
- this.height = Number(getContainerPropsValue(container, 'content.height', 562.5));
97
- this.width = Number(getContainerPropsValue(container, 'content.width', 750));
98
- this.margin = getContainerPropsValue(container, 'content.margin', {});
99
- this.backgroundImage = getContainerPropsValue(container, 'content.backgroundImage', {})
95
+ let height = Number(gCPVal(container, 'height', 562));
96
+ let width = Number(gCPVal(container, 'width', 750));
97
+ this.margin = gCPVal(container, 'margin', 0,{sKey: 'marginStatus', fields: ['margin'], isPMR: true});
98
+ this.widthAndHeight = gCPVal(container, 'widthAndHeight', [{width: 750, height: 562},{width,height}],{sKey: 'widthAndHeightStatus', fields: ['widthAndHeight']});
99
+ this.backgroundImage = gCPVal(container, 'backgroundImage', {});
100
+ this.radius = gCPVal(container, 'radius', [this.gStyleValue.radius,0],{sKey: 'radiusStatus', fields: ['radius']})||0;
101
+
100
102
  },
101
103
  }
102
104
  }