jufubao-base 1.0.194-beta1 → 1.0.194-beta4

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.194-beta1",
3
+ "version": "1.0.194-beta4",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -0,0 +1,85 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description 当表单组件中有联动操作时候,使用方法进行返回
5
+ */
6
+ export default {
7
+ 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);
12
+
13
+ return [
14
+ {
15
+ label: '',
16
+ ele: 'slot',
17
+ slot: 'is_reference_title',
18
+ groupKey:'advanced',
19
+ },
20
+ {
21
+ label: '边距设置:',
22
+ ele: 'xd-margin-padding',
23
+ valueKey: 'margin',
24
+ groupKey:'content',
25
+ value: data.margin || null,
26
+ setting: {
27
+ type: 'margin',
28
+ },
29
+ placeholder: '请设置边距设置',
30
+ inline: false,
31
+ notice: '设置边距充,<span style="color: red">单位:像素(px)</span>。默认值:<span style="color: red">0</span>像素',
32
+
33
+ },
34
+ {
35
+ label: '图片真实宽度:',
36
+ groupKey:'content',
37
+ ele: 'el-input',
38
+ type: 'number',
39
+ valueKey: 'width',
40
+ value: data.width || '',
41
+ className: 'input60',
42
+ inline:false,
43
+ notice:'图片真实宽度设置,单位像素,默认:<span style="color:red">750</span>px',
44
+ },
45
+ {
46
+ label: '图片真实高度:',
47
+ groupKey:'content',
48
+ ele: 'el-input',
49
+ type: 'number',
50
+ valueKey: 'height',
51
+ value: data.height||'',
52
+ className: 'input60',
53
+ inline:false,
54
+ notice:'图片真实高度设置,单位像素,默认:<span style="color:red">562.5</span>px',
55
+ },
56
+ {
57
+ label: '占位背景图片:',
58
+ ele: 'xd-upload',
59
+ valueKey: 'backgroundImage',
60
+ groupKey:'content',
61
+ value: data.backgroundImage || {},
62
+ defaultValue: data.backgroundImage || null,
63
+ 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>像素`,
68
+ type: ['jpg', 'png', 'jpeg'],
69
+ styleType: 'one',
70
+ uploadType: 'aliyun',
71
+ size: 1,
72
+ action: 'action',
73
+ sort: true,
74
+ maxlen: 1,
75
+ },
76
+ {
77
+ label: '',
78
+ ele: 'slot',
79
+ slot: 'is_reference',
80
+ groupKey:'advanced',
81
+ },
82
+ ].filter(i=>i)
83
+ },
84
+ advanced: [],
85
+ };
@@ -14,7 +14,10 @@
14
14
  </view>
15
15
  <!-- #endif -->
16
16
  <view class="jfb-base-image-block__body">
17
- <view>测试插件( {{containerId}} )</view>
17
+ <view class="x-line"></view>
18
+ <view class="image" :style="[bodyStyle]">
19
+ <image :src="backgroundImageComp" alt="bgImage"></image>
20
+ </view>
18
21
  </view>
19
22
  </view>
20
23
  </template>
@@ -26,6 +29,7 @@
26
29
  import { getContainerPropsValue } from "@/utils/xd.base";
27
30
  import componentsMixins from "@/mixins/componentsMixins";
28
31
  import extsMixins from "@/mixins/extsMixins";
32
+ import getServiceUrl from "@/common/getServiceUrl";
29
33
  export default {
30
34
  name: "JfbBaseImageBlock",
31
35
  components: {
@@ -34,10 +38,43 @@
34
38
  mixins: [
35
39
  componentsMixins, extsMixins, JfbBaseImageBlockMixin
36
40
  ],
41
+ computed:{
42
+ marginComp(){
43
+ let str = `${this.checkValue(this.margin.top, 0)}rpx`;
44
+ str = `${str} ${this.checkValue(this.margin.right, 0)}rpx`;
45
+ str = `${str} ${this.checkValue(this.margin.bottom, 0)}rpx`;
46
+ str = `${str} ${this.checkValue(this.margin.left,0)}rpx`;
47
+ return str;
48
+ },
49
+
50
+ backgroundImageComp(){
51
+ if(this.$xdUniHelper.checkVarType(this.backgroundImage) === 'object') {
52
+ if(this.backgroundImage.url) return getServiceUrl(this.backgroundImage.url,'size8')
53
+ else return ''
54
+ }
55
+ return '';
56
+ },
57
+
58
+ bodyStyle(){
59
+ let outWidth = uni.getSystemInfoSync().safeArea.width * this.$pxNum;
60
+ let outMarginRL = this.checkValue(this.margin.right, 0) + this.checkValue(this.margin.left, 0);
61
+ let bgColor = 'rgba(0,0,0,0)';
62
+ if(this.backgroundImageComp === '') bgColor = '#f8f8f8'
63
+ return {
64
+ margin: this.marginComp,
65
+ width: (outWidth - outMarginRL) +'rpx',
66
+ height: this.height * (outWidth - outMarginRL)/this.width + 'rpx',
67
+ backgroundColor: bgColor
68
+ }
69
+ }
70
+ },
37
71
  data() {
38
72
  return {
39
-
40
- //todo
73
+ closeMask: true,
74
+ height: 562.5,
75
+ width: 750,
76
+ margin:{},
77
+ backgroundImage:{},
41
78
  }
42
79
  },
43
80
  watch: {
@@ -48,52 +85,19 @@
48
85
  },
49
86
  created() {
50
87
  this.init(this.container);
51
-
52
- //todo
53
88
  },
54
89
  methods: {
55
90
  onJfbLoad(options) {
56
-
57
- // jfbRootExec('baiduUserLogin', {
58
-
59
- // vm: this,// data: {
60
-
61
- // account: 'gaoshiyong',// password: '123456789',// type: 3,// ...options
62
-
63
- // }
64
-
65
- // }).then().catch()
66
91
  },
67
92
  /**
68
93
  * @description 监听事件变化
69
94
  * @param container {object} 业务组件对象自己
70
95
  */
71
96
  init(container) {
72
-
73
- //this.bgcolor = getContainerPropsValue(container, 'content.bgcolor', '#fff');
74
-
75
- //this.height = getContainerPropsValue(container, 'content.height', 10);
76
- },
77
- onJfbScroll(options) {
78
- console.log('event.onJfbScroll', options)
79
- },
80
- onJfbReachBottom(options) {
81
- console.log('event.onJfbReachBottom', options)
82
- },
83
- onJfbShow(options) {
84
- console.log('event.onJfbShow', options)
85
- },
86
- onJfbHide(options) {
87
- console.log('event.onJfbHide', options)
88
- },
89
- onJfbBack(options) {
90
- console.log('event.onJfbBack', options)
91
- },
92
- onJfbUpdate(...data) {
93
- console.log('event.onJfbUpdate', data)
94
- },
95
- onJfbCustomEvent(options) {
96
- console.log('event.onJfbReachBottom', options)
97
+ this.height = Number(getContainerPropsValue(container, 'content.height', 562.5));
98
+ this.width = Number(getContainerPropsValue(container, 'content.width', 750));
99
+ this.margin = getContainerPropsValue(container, 'content.margin', {});
100
+ this.backgroundImage = getContainerPropsValue(container, 'content.backgroundImage', {})
97
101
  },
98
102
  }
99
103
  }
@@ -104,8 +108,12 @@
104
108
  @import "./JfbBaseImageBlockLess.less";
105
109
 
106
110
  .jfb-base-image-block {
111
+ min-height: 20rpx!important;
107
112
  &__body{
108
-
113
+ .image image {
114
+ height: 100%;
115
+ width: 100%;
116
+ }
109
117
  }
110
118
  }
111
119
  </style>
@@ -1,18 +1,30 @@
1
1
  'use strict';
2
2
 
3
3
 
4
+ //@AttrImport
5
+ import Attr from "./Attr";
6
+ //@EndAttrImport
7
+
4
8
 
5
9
  export default {
6
10
  data() {
7
11
  return {
8
12
  //#ifdef H5
9
13
 
14
+ //@AttrData
15
+ Attr:{}, //对外开发编辑属性
16
+ //@EndAttrData
17
+
10
18
  // #endif
11
19
  cssRoot: 'jfb-base-image-block'
12
20
  }
13
21
  },
14
22
  created() {
15
23
 
24
+ //@AttrDataCreated
25
+ this.Attr = this.$xdUniHelper.customClone(Attr);
26
+ //@EndAttrDataCreated
27
+
16
28
 
17
29
  },
18
30
  }
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
-
3
- import console from "@dcloudio/uni-h5/src/core/helpers/console";
2
+ function checkValue(value, dValue = 0){
3
+ if(value === undefined || value === '' || value === null) return dValue;
4
+ return Number(value || 0);
5
+ }
4
6
 
5
7
  /**
6
8
  * @description 当表单组件中有联动操作时候,使用方法进行返回
@@ -8,6 +10,26 @@ import console from "@dcloudio/uni-h5/src/core/helpers/console";
8
10
  export default {
9
11
  style:[],
10
12
  content:(params)=>{
13
+ let poster = params.poster;
14
+ let showBg = false;
15
+ let posterHeight = 0;
16
+ if(toString.call(params.poster) === '[object Object]') {
17
+ if(poster.size && poster.size.height && poster.size.width){
18
+ showBg = true;
19
+ posterHeight = Number(poster.size.height)
20
+ }
21
+ }
22
+ let paddingDeflaut = 20;
23
+ if(toString.call(params.background) === '[object Object]'){
24
+ if(params.background && params.background.url) {
25
+ paddingDeflaut = 0
26
+ }
27
+ }
28
+ let marginRL = checkValue((params.margin||{}).right,0) + checkValue((params.margin||{}).left,0);
29
+ let paddingBT = checkValue((params.bgImagePadding||{}).bottom,paddingDeflaut) + checkValue((params.bgImagePadding||{}).top,paddingDeflaut);
30
+ let outWidth = Math.floor(750 - marginRL);
31
+ let outHeight = Math.floor(posterHeight + paddingBT);
32
+
11
33
  if(!params['isCarousel']) params['isCarousel'] = 1;
12
34
  return [
13
35
  {
@@ -253,7 +275,7 @@ export default {
253
275
  size: 'small',
254
276
  groupKey:'content',
255
277
  },
256
- params.poster && params.poster['type']&& params.poster['type'] !== '1' && {
278
+ showBg && params.poster && params.poster['type']&& params.poster['type'] !== '1' && {
257
279
  label: '广告背景图:',
258
280
  ele: 'xd-upload',
259
281
  valueKey: 'background',
@@ -261,10 +283,10 @@ export default {
261
283
  value: params.background || {},
262
284
  defaultValue: params.background || null,
263
285
  slot: true,
264
- oneWidth: 100,
265
- oneHeight: 100,
286
+ oneWidth: 375,
287
+ oneHeight: 375*outHeight/outWidth,
266
288
  elinputClassName: 'input40',
267
- tipsformet: '上传文件格式:@imageType@,不超过@size@MB.',
289
+ tipsformet: `上传文件格式:@imageType@,不超过@size@MB,尺寸:${outWidth}*${outHeight}像素`,
268
290
  type: ['jpg', 'png', 'jpeg'],
269
291
  styleType: 'one',
270
292
  uploadType: 'aliyun',