jufubao-base 1.0.194-beta3 → 1.0.194-beta5

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-beta3",
3
+ "version": "1.0.194-beta5",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -14,7 +14,6 @@
14
14
  </view>
15
15
  <!-- #endif -->
16
16
  <view class="jfb-base-image-block__body">
17
- <view class="x-line"></view>
18
17
  <view class="image" :style="[bodyStyle]">
19
18
  <image :src="backgroundImageComp" alt="bgImage"></image>
20
19
  </view>
@@ -110,9 +109,15 @@
110
109
  .jfb-base-image-block {
111
110
  min-height: 20rpx!important;
112
111
  &__body{
113
- .image image {
114
- height: 100%;
115
- width: 100%;
112
+ display: inline-block;
113
+ width: 100%;
114
+
115
+ .image{
116
+ position: relative;
117
+ & > image {
118
+ height: 100%;
119
+ width: 100%;
120
+ }
116
121
  }
117
122
  }
118
123
  }
@@ -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',
@@ -194,15 +194,25 @@
194
194
  },
195
195
  getConfig(){
196
196
  let cell = this.posterType === '2' ? 2: (this.posterType === '3' ? 3 : 4);
197
+
198
+ //间距值
197
199
  let spacing = Math.floor((cell - 1) * this.padding * this.$rpxNum);
200
+
201
+ //主题填充
198
202
  let paddingDefault = 0;
199
203
  if(this.background === 'none' || this.background === '' || this.$xdUniHelper.isEmpty(this.background)) paddingDefault = 20;
200
- let addPadding = this.checkValue(this.bgImagePadding.right, paddingDefault) + this.checkValue(this.bgImagePadding.left, paddingDefault);
201
- addPadding = addPadding * this.$rpxNum;
202
- let margin = (this.checkValue(this.mS.right, 0) + this.checkValue(this.mS.left, 0)) * this.$rpxNum;
203
- let viewWidth = uni.getSystemInfoSync().safeArea.width -margin - addPadding - spacing;
204
- let width = Math.floor(viewWidth / cell);
204
+ let outPaddingRL = this.checkValue(this.bgImagePadding.right, paddingDefault) + this.checkValue(this.bgImagePadding.left, paddingDefault);
205
+ outPaddingRL = outPaddingRL * this.$rpxNum;
206
+
207
+ //外边距
208
+ let marginRL = (this.checkValue(this.mS.right, 0) + this.checkValue(this.mS.left, 0)) * this.$rpxNum;
209
+
210
+ //总统
211
+ let viewWidth = uni.getSystemInfoSync().safeArea.width - marginRL - outPaddingRL - spacing;
212
+ let width = viewWidth / cell;
205
213
  let height = this.height * width / this.width;
214
+
215
+
206
216
  return {
207
217
  mode: this.getMode,
208
218
  dotStyleData: this.dotStyleData,
@@ -658,6 +668,9 @@
658
668
  .jfb-base-poster {
659
669
  min-height: 60rpx!important;
660
670
  &__body{
671
+ display: inline-block;
672
+ width: 100%;
673
+
661
674
  & > view.jfb-base-poster-cont {
662
675
  box-sizing: border-box;
663
676
  overflow: hidden;
@@ -65,7 +65,7 @@
65
65
  marginTop: indext < config.cell ? 0 : config.padding + 'rpx',
66
66
  }"
67
67
  >
68
- <image :style="{ width: width + 'px', height: height + 'px'}" :src="it.image_url" mode="widthFix"></image>
68
+ <image :style="{ width: width + 'px', height: height + 'px'}" :src="it.image_url"></image>
69
69
  </view>
70
70
  </view>
71
71
  </swiper-item>
@@ -102,7 +102,7 @@
102
102
  }"
103
103
  @click="handleClick(it)"
104
104
  >
105
- <image :style="{ width: width + 'px', height: height + 'px'}" :src="it.image_url" mode="widthFix"></image>
105
+ <image :style="{ width: width + 'px', height: height + 'px'}" :src="it.image_url"></image>
106
106
  </view>
107
107
  </view>
108
108
  </template>