jufubao-base 1.0.194-beta3 → 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-beta3",
3
+ "version": "1.0.194-beta4",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -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',