@conecli/cone-render 0.9.1-shop2.3 → 0.9.1-shop2.30

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.
Files changed (113) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/assets/icon_blue_info.svg +1 -0
  3. package/dist/common/const.ts +1 -1
  4. package/dist/common/environmentType.ts +1 -0
  5. package/dist/common/index.h5.ts +1 -1
  6. package/dist/common/index.jd.ts +1 -1
  7. package/dist/common/index.ts +1 -1
  8. package/dist/common/index.weapp.ts +1 -1
  9. package/dist/common/jdplayerSdk.ts +1 -0
  10. package/dist/common/jssdk.ts +1 -0
  11. package/dist/common/pageType.ts +1 -0
  12. package/dist/common/sgmCustomCode.ts +1 -0
  13. package/dist/common/token/index.h5.ts +1 -1
  14. package/dist/common/token/token.jd.ts +1 -1
  15. package/dist/common/token/token.ts +1 -1
  16. package/dist/common/wxappApi.jd.ts +1 -0
  17. package/dist/components/ErrorBoundary.tsx +1 -1
  18. package/dist/components/base/CountDown/index.tsx +1 -1
  19. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  20. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  21. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  22. package/dist/components/base/CustomVideo/common.ts +1 -0
  23. package/dist/components/base/CustomVideo/index.tsx +1 -1
  24. package/dist/components/base/Dialog/index.module.scss +5 -0
  25. package/dist/components/base/Dialog/index.tsx +1 -1
  26. package/dist/components/base/Exposure/index.h5.tsx +1 -1
  27. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  28. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  29. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  30. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  31. package/dist/components/base/InViewRender/index.tsx +1 -1
  32. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  33. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  34. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  35. package/dist/components/base/LazyLoadImage/index.h5.module.scss +23 -20
  36. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  37. package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
  38. package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
  39. package/dist/components/base/NetworkDataError/const.ts +1 -1
  40. package/dist/components/base/NetworkDataError/index.module.scss +7 -0
  41. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  42. package/dist/components/base/Price/Base/index.tsx +1 -1
  43. package/dist/components/base/Price/Double/index.tsx +1 -1
  44. package/dist/components/base/Price/index.tsx +1 -1
  45. package/dist/components/debug/DebugLayout/index.module.scss +67 -0
  46. package/dist/components/debug/DebugLayout/index.tsx +1 -0
  47. package/dist/components/debug/DebugLayout/utils.ts +1 -0
  48. package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
  49. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  50. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  51. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  52. package/dist/components/floorItem.jd.tsx +1 -1
  53. package/dist/components/floorItem.tsx +1 -1
  54. package/dist/components/floorItem.weapp.tsx +1 -1
  55. package/dist/components/isv/Floor/index.tsx +1 -1
  56. package/dist/components/remoteFloorItem.tsx +1 -1
  57. package/dist/interface/common.ts +1 -1
  58. package/dist/interface/component.ts +1 -1
  59. package/dist/interface/jumpEventReport.ts +1 -1
  60. package/dist/interface/service.ts +1 -1
  61. package/dist/interface/utils.ts +1 -1
  62. package/dist/jumpEventReport/base.ts +1 -1
  63. package/dist/jumpEventReport/const.ts +1 -1
  64. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  65. package/dist/jumpEventReport/index.h5.ts +1 -1
  66. package/dist/jumpEventReport/index.jd.ts +1 -1
  67. package/dist/jumpEventReport/index.weapp.ts +1 -1
  68. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  69. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  70. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  71. package/dist/jumpEventReport/web/report.ts +1 -1
  72. package/dist/jumpEventReport/web.base.ts +1 -1
  73. package/dist/jumpEventReport/web.jd.ts +1 -1
  74. package/dist/jumpEventReport/web.jdb.ts +1 -1
  75. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  76. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  77. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  78. package/dist/jumpEventReport/web.tjm.ts +1 -0
  79. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  80. package/dist/modules/ContainerFloorList/index.h5.module.scss +18 -1
  81. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  82. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  83. package/dist/open/api/device.ts +1 -1
  84. package/dist/open/api/environment.ts +1 -1
  85. package/dist/open/api/index.ts +1 -1
  86. package/dist/open/api/jump copy.ts +1 -1
  87. package/dist/open/api/request.ts +1 -1
  88. package/dist/open/api/shopMember.ts +1 -1
  89. package/dist/open/api/track.ts +1 -1
  90. package/dist/open/api/util.ts +1 -1
  91. package/dist/open/components/index.ts +1 -1
  92. package/dist/sass/app.h5.scss +49 -3
  93. package/dist/sass/base.scss +57 -0
  94. package/dist/service/fetchGateway.ts +1 -1
  95. package/dist/service/http/colorSign.ts +1 -1
  96. package/dist/service/http/const.ts +1 -1
  97. package/dist/service/http/h5Http.ts +1 -0
  98. package/dist/service/http/index.h5.ts +1 -0
  99. package/dist/service/requestServer.h5.ts +1 -0
  100. package/dist/service/requestServer.ts +1 -1
  101. package/dist/utils/connectNativeJsBridge.ts +1 -1
  102. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  103. package/dist/utils/draExceptionAndProfile.ts +1 -1
  104. package/dist/utils/h5Utils.ts +1 -1
  105. package/dist/utils/index.h5.ts +1 -1
  106. package/dist/utils/index.ts +1 -1
  107. package/dist/utils/index.weapp.ts +1 -1
  108. package/dist/utils/jm-common.js +1 -1
  109. package/dist/utils/sgmCodeUtils.ts +1 -0
  110. package/dist/utils/taroRenderUtil.ts +1 -1
  111. package/dist/utils/utils.ts +1 -1
  112. package/package.json +1 -1
  113. package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
@@ -0,0 +1 @@
1
+ import React, {useEffect, useRef} from 'react'
2
  const { title, openAppParams, style, hasCommonHeader = true, hasDownloadTips = true, headerParams } = props
1
3
  const headerRef:any = useRef(null)
2
4
  useEffect(() => {
3
5
  hasCommonHeader && initCommonHeader()
4
6
  hasDownloadTips && initDownloadAppLayerConfigData()
5
7
  }, [])
6
8
  const isScrolledToTop = () => {
7
9
  return window.scrollY !== undefined ? window.scrollY === 0 :
8
10
  document.documentElement.scrollTop === 0 || document.body.scrollTop === 0;
9
11
  }
10
12
  const scrollEventFunc = () => {
11
13
  if(!headerRef.current) return
12
14
  const stickyTop = headerRef.current?.getBoundingClientRect()?.top || 0;
13
15
  if(Math.trunc(stickyTop) <= 0 && !isScrolledToTop()) {
14
16
  console.log('scroll 添加class',Math.trunc(stickyTop), isScrolledToTop())
15
17
  headerRef.current.classList.add('d-mobile-header-sticky');
16
18
  }else {
17
19
  console.log('scroll 移除class',Math.trunc(stickyTop), isScrolledToTop())
18
20
  headerRef.current.classList.remove('d-mobile-header-sticky');
19
21
  }
20
22
  }
21
23
  useEffect(() => {
22
24
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL,() => {
23
25
  scrollEventFunc()
24
26
  })
25
27
  },[])
26
28
  const initCommonHeader = () => {
27
29
  if (window?.MCommonHeaderBottom) {
28
30
  const mchb = new MCommonHeaderBottom()
29
31
  const headerArg = {
30
32
  moduleName: 'shop',
31
33
  hrederId: 'm_common_header',
32
34
  title,
33
35
  stype: 1,
34
36
  onClickJdkey: function () {
35
37
  console.log('==>m_common_header jdkey click.')
36
38
  },
37
39
  ...headerParams
38
40
  }
39
41
  mchb.header(headerArg)
40
42
  }
41
43
  }
42
44
  const initDownloadAppLayerConfigData = () => {
43
45
  const getEle = document.getElementById('m_common_tip')
44
46
  getEle &&
45
47
  window.$ &&
46
48
  window.$.downloadAppLayerConfigData &&
47
49
  window.$.downloadAppLayerConfigData({
48
50
  tipId: 'm_common_tip',
49
51
  M_sourceFrom: 'jshop',
50
52
  bottom: 74,
51
53
  onClickTipX: () => {
52
54
  Taro.eventCenter.trigger(
53
55
  TaroEventType.DOWN_LOAD_APP_CLOSE_CHANGE,
54
56
  true,
55
57
  )
56
58
  },
57
59
  downloadAppPlugIn: {
58
60
  M_sourceFrom: 'jshop',
59
61
  openAppBtnId: 'download_openapp',
60
62
  downAppURl: '//conecli.com/downloadApp/download.html?channel=jd-m',
61
63
  inteneUrl: 'openapp.jdmobile://virtual?',
62
64
  inteneUrlParams: {
63
65
  category: 'jump',
64
66
  des: 'jshopMain',
65
67
  shopId: `${global.info.queryInfo.shopId || ''}`,
66
68
  venderId: `${global.info.queryInfo.venderId || ''}`,
67
69
  sourceType: global.info.queryInfo?.sourceType || 'M-H5',
68
70
  sourceValue: global.info.queryInfo?.sourceValue || 'Mshop',
69
71
  ...openAppParams,
70
72
  },
71
73
  },
72
74
  })
73
75
  }
74
76
  return !isWxMiniH5View && !isJdApp ? (
75
77
  <View
76
78
  className={mobileCommonHeaderStyle['d-mobile-header-layout']}
77
79
  style={style}
78
80
  ref={headerRef}
79
81
  >
80
82
  <View
81
83
  id="m_common_tip"
82
84
  className={mobileCommonHeaderStyle['d-mobile-common-tip']}
83
85
  />
84
86
  {hasCommonHeader && (
85
87
  <View
86
88
  id="m_common_header"
87
89
  className={mobileCommonHeaderStyle['d-mobile-common-header']}
88
90
  />
89
91
  )}
90
92
  </View>
91
93
  ) : null
92
94
  title: '店铺',
93
95
  openAppParams: {},
@@ -1 +1 @@
1
- import { NETWORK_DATA_TYPE } from '../../../common/const'
2
1
  [NETWORK_DATA_TYPE.NO_NET_WORK]: '网络连接已断开',
3
2
  [NETWORK_DATA_TYPE.DATA_ERROR]: '数据加载失败',
4
3
  [NETWORK_DATA_TYPE.NO_DATA]: '你访问的内容飞到太空了',
5
4
  [NETWORK_DATA_TYPE.RISK]: '活动太火爆',
6
5
  [NETWORK_DATA_TYPE.NO_NET_WORK]: '请检查您的网络设置',
7
6
  [NETWORK_DATA_TYPE.DATA_ERROR]: '请稍后重试',
8
7
  [NETWORK_DATA_TYPE.NO_DATA]: '',
9
8
  [NETWORK_DATA_TYPE.RISK]: '页面加载失败,请稍后再试',
10
9
  NETWORK_DATA_TYPE.NO_NET_WORK,
11
10
  NETWORK_DATA_TYPE.DATA_ERROR,
12
11
  NETWORK_DATA_TYPE.NO_DATA,
13
12
  NETWORK_DATA_TYPE.RISK,
14
13
  No_Data_Bmall:'no-data-bmall',
14
+ import { NETWORK_DATA_TYPE } from '../../../common/const'
15
15
  [NETWORK_DATA_TYPE.NO_NET_WORK]: '网络连接已断开',
16
16
  [NETWORK_DATA_TYPE.DATA_ERROR]: '数据加载失败',
17
17
  [NETWORK_DATA_TYPE.NO_DATA]: '你访问的内容飞到太空了',
18
18
  [NETWORK_DATA_TYPE.RISK]: '活动太火爆',
19
19
  [NETWORK_DATA_TYPE.NO_NET_WORK]: '请检查您的网络设置',
20
20
  [NETWORK_DATA_TYPE.DATA_ERROR]: '请稍后重试',
21
21
  [NETWORK_DATA_TYPE.NO_DATA]: '',
22
22
  [NETWORK_DATA_TYPE.RISK]: '页面加载失败,请稍后再试',
23
23
  NETWORK_DATA_TYPE.NO_NET_WORK,
24
24
  NETWORK_DATA_TYPE.DATA_ERROR,
25
25
  NETWORK_DATA_TYPE.NO_DATA,
26
26
  NETWORK_DATA_TYPE.RISK,
27
27
  No_Data_Bmall:'no-data-bmall',
@@ -50,6 +50,10 @@
50
50
  .d-no-data-tip-1 {
51
51
  background-image: url('https://img14.360buyimg.com/imagetools/jfs/t1/152550/40/8432/21643/5fc9cae0E5391a506/523da679188ff687.png');
52
52
  }
53
+
54
+ .d-no-data-tip-2 {
55
+ background-image: url('https://img11.360buyimg.com/imagetools/jfs/t1/142705/35/17776/5911/5fd1e62dE4fbc2300/3ee1d4160db1dac6.png');
56
+ }
53
57
  .d-no-network-err-tip {
54
58
  background-image: url('https://img14.360buyimg.com/imagetools/jfs/t1/146556/1/17745/7493/5fd1e62dE86e86669/96f5c91befa8e991.png');
55
59
  }
@@ -85,3 +89,6 @@
85
89
  min-height: 500px;
86
90
  background: #f2f2f2;
87
91
  }
92
+ .d-shop-network-no-position {
93
+ position: static;
94
+ }
@@ -1 +1 @@
1
- import { Button, View } from '@tarojs/components'
2
1
  NetWorkErrorSubTip,
3
2
  subMessage,
4
3
  backgroundColorWhite,
5
4
  const useErrorTip = message != '' ? message : NetWorkErrorTip[netWorkDataType]
6
5
  const useErrorSubTip = subMessage? subMessage: NetWorkErrorSubTip[netWorkDataType]
7
6
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
8
7
  const maxHeight = latestRes.displayHeight || 546
9
8
  style={{maxHeight: isMemberPage ? '100vh' : maxHeight}}
10
9
  {useErrorSubTip? <View className={netWorkErrorStyle['d-error-sub-tip']}>{useErrorSubTip}</View>: null}
11
10
  <Button
12
11
  onClick={refershInitData}
13
12
  className={classNames(
14
13
  netWorkErrorStyle['d-opt-btn'],
15
14
  'd-button-no-border',
16
15
  )}
17
16
  plain
18
17
  size="mini"
19
18
  >
20
19
  重新加载
21
20
  </Button>
22
21
  )}
23
22
  subMessage: '',
23
+ import { Button, View } from '@tarojs/components'
24
24
  NetWorkErrorList,
25
25
  NetWorkErrorTip,
26
26
  NetWorkErrorSubTip,
27
27
  NetWorkShowType,
28
28
  NetWork_Image_Type,
29
29
  const {
30
30
  className,
31
31
  message,
32
32
  subMessage,
33
33
  btnLabel,
34
34
  backgroundColorWhite,
35
35
  netWorkDataType,
36
36
  netWorkShowType,
37
37
  netWorkImageType,
38
38
  refreshCallBackFn,
39
39
  viewMaxHeight,
40
40
  noPosition = false,
41
41
  } = props
42
42
  const refershInitData = useCallback(() => {
43
43
  refreshCallBackFn && refreshCallBackFn(true)
44
44
  }, [])
45
45
  const useErrorTip = message != '' ? message : NetWorkErrorTip[netWorkDataType]
46
46
  const useErrorSubTip = subMessage
47
47
  ? subMessage
48
48
  : NetWorkErrorSubTip[netWorkDataType]
49
49
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
50
50
  const maxHeight = latestRes.displayHeight || 546
51
51
  return NetWorkErrorList.includes(netWorkDataType as NETWORK_DATA_TYPE) ? (
52
52
  <View
53
53
  style={{ maxHeight: viewMaxHeight !== '' ? viewMaxHeight : isMemberPage ? '100vh' : maxHeight }}
54
54
  className={classNames(
55
55
  netWorkErrorStyle['d-shop-network'],
56
56
  {
57
57
  [netWorkErrorStyle['d-shop-network-white']]: backgroundColorWhite,
58
58
  },
59
59
  {
60
60
  [netWorkErrorStyle['d-shop-network-part']]:
61
61
  netWorkShowType === NetWorkShowType.PART,
62
62
  },
63
63
  {
64
64
  [netWorkErrorStyle['d-network-jd-shop-view']]: isH5AndJdShopView,
65
65
  },
66
66
  {
67
67
  [netWorkErrorStyle['d-shop-network-no-position']]: noPosition
68
68
  },
69
69
  'flexible-center-box',
70
70
  className,
71
71
  )}
72
72
  >
73
73
  <View className={classNames(netWorkErrorStyle['d-error-content'],'d-error-content')}>
74
74
  <View
75
75
  className={classNames(
76
76
  netWorkErrorStyle['d-error-type'],
77
77
  netWorkErrorStyle[`d-${netWorkDataType}`],
78
78
  netWorkErrorStyle[`d-${netWorkImageType}`],
79
79
  'd-error-type'
80
80
  )}
81
81
  />
82
82
  <View className={classNames(netWorkErrorStyle['d-error-tip'],'d-error-tip')}>
83
83
  {useErrorTip}
84
84
  </View>
85
85
  {useErrorSubTip ? <View className={classNames(netWorkErrorStyle['d-error-sub-tip'],'d-error-sub-tip')}>{useErrorSubTip}</View> : null}
86
86
  <View className={'flexible-horizontal-center-box'}>
87
87
  {refreshCallBackFn && (
88
88
  <Button
89
89
  onClick={refershInitData}
90
90
  className={classNames(
91
91
  netWorkErrorStyle['d-opt-btn'],
92
92
  'd-button-no-border',
93
93
  'd-opt-btn'
94
94
  )}
95
95
  plain
96
96
  size="mini"
97
97
  >
98
98
  {btnLabel}
99
99
  </Button>
100
100
  )}
101
101
  </View>
102
102
  </View>
103
103
  </View>
104
104
  ) : null
105
105
  className: '',
106
106
  message: '',
107
107
  subMessage: '',
108
108
  btnLabel: '重新加载',
109
109
  backgroundColorWhite: false,
110
110
  netWorkDataType: NETWORK_DATA_TYPE.NORMAL,
111
111
  netWorkImageType: NetWork_Image_Type.No_Data_Default_Tip,
112
112
  netWorkShowType: NetWorkShowType.FULL,
113
113
  refreshCallBackFn: null,
114
114
  viewMaxHeight: ''
@@ -1 +1 @@
1
- import React from 'react'
2
1
  priceLabelText: "到手价"
2
+ import React from 'react'
3
3
  if(/^\d+(\.\d+)?[eE][+-]?\d+$/.test(value)){
4
4
  sgmCustomReport({
5
5
  code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
6
6
  msg: {
7
7
  price: value,
8
8
  originalPrice: initValue,
9
9
  msg: "当前价格为科学计数数据,上报关注该价格"
10
10
  },
11
11
  })
12
12
  }
13
13
  if(value === "NaN"){
14
14
  sgmCustomReport({
15
15
  code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_basePrice`),
16
16
  msg: {
17
17
  price: value,
18
18
  originalPrice: initValue,
19
19
  msg: "价格转换异常,兜底展示暂无报价"
20
20
  },
21
21
  })
22
22
  value = "暂无报价"
23
23
  }
24
24
  priceLabelText: "到手价"
@@ -1 +1 @@
1
- import React from 'react';
2
1
  const result = String(strPrice).match(/(-?\d+)\.?(\d+)?/);
3
2
  if(result && Number(result[0]) > 0){
4
3
  return {
5
4
  integerPrice: result[1],
6
5
  decimalPrice: (result[2] || '').replace(/0+$/, '')
7
6
  }
8
7
  }else{
9
8
  return null;
10
9
  }
11
10
  const {
12
11
  jdPrice,
13
12
  finalPrice,
14
13
  priceText = '',
15
14
  priceType,
16
15
  hitUserIdentity = false,
17
16
  isAuctionWare,
18
17
  fallbackRender = null,
19
18
  className = null,
20
19
  style = {},
21
20
  childrenClassName = null,
22
21
  bigNoPriceClassName = null,
23
22
  bigSymbolClassName = null,
24
23
  bigIntegerClassName = null,
25
24
  bigDecimalClassName = null,
26
25
  priceDescClassName = null,
27
26
  smallPriceClassName = null,
28
27
  lineNumber = 1,
29
28
  size = 'M'
30
29
  } = props
31
30
  const especialHitStyleType = {
32
31
  7: 'plusStyle',
33
32
  9: 'samStyle'
34
33
  }
35
34
  const especialMissStyleType = {
36
35
  7: 'plusStyle',
37
36
  8: 'fansStyle',
38
37
  9: 'samStyle',
39
38
  10: 'studentStyle',
40
39
  12: 'yhdStyle',
41
40
  13: 'memberStyle'
42
41
  }
43
42
  const isNoPrice = priceType === 4
44
43
  const isUseFinalPriceAsBigPrice = [1, 2, 6, 14, 16, 17, 18].includes(priceType)
45
44
  const isEquivalentHit = isUseFinalPriceAsBigPrice || hitUserIdentity
46
45
  const bigPriceObj = getDeconstructPrice(isEquivalentHit? finalPrice: jdPrice)
47
46
  if(isAuctionWare || (!isNoPrice && bigPriceObj === null)){
48
47
  return fallbackRender
49
48
  }
50
49
  const {integerPrice, decimalPrice = ''} = bigPriceObj || {}
51
50
  const isOnlyShowBigPrice = priceType === 3
52
51
  const isHideSmallPrice = priceType === 14
53
52
  const smallPrice = isEquivalentHit? jdPrice: finalPrice
54
53
  const isPriceDescInFront = isEquivalentHit
55
54
  const hitColorStyle = isEquivalentHit? styles[especialHitStyleType[priceType]]: null
56
55
  const missColorStyle = isEquivalentHit? null: styles[especialMissStyleType[priceType]]
57
56
  const isBigPriceHasDecimal = decimalPrice !== '' && !/^0+$/.test(decimalPrice)
58
57
  const sizeLineHeight = {
59
58
  'XS': 28,
60
59
  'S': 34,
61
60
  'M': 40,
62
61
  'L': 46,
63
62
  'XL': 52
64
63
  }
65
64
  const lineHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25)
66
65
  const wrapHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25 * lineNumber)
67
66
  const computedHeightStyle = {
68
67
  height: wrapHeight
69
68
  }
70
69
  const itemCommonStyle = {
71
70
  height: lineHeight
72
71
  }
73
72
  const needSizeStyles = ['bigNoPrice', 'bigSymbol', 'bigInteger', 'bigDecimal', 'priceDesc', 'smallPrice']
74
73
  const sizeStyles = needSizeStyles.reduce((acc, cur) => {
75
74
  acc[cur] = styles[cur + size]
76
75
  return acc
77
76
  }, {})
78
77
  const noPriceShowText = priceText || (/^[\u4e00-\u9fa5]+$/.test(jdPrice)? jdPrice: '')
79
78
  return (
80
79
  <View className={classNames(styles.wrap, className)} style={{...computedHeightStyle, ...style}}>
81
80
  {isNoPrice?
82
81
  <Text className={classNames(styles.childStyle, styles.bigStyle, styles.bigNoPrice, sizeStyles['bigNoPrice'], childrenClassName, bigNoPriceClassName)} style={{...itemCommonStyle}}>{noPriceShowText}</Text>
83
82
  :
84
83
  [
85
84
  <Text className={classNames(styles.childStyle, styles.bigStyle, styles.bigSymbol, sizeStyles['bigSymbol'], hitColorStyle, childrenClassName, bigSymbolClassName)} key="bigSymbol" style={{...itemCommonStyle}}>¥</Text>,
86
85
  <Text className={classNames(styles.childStyle, styles.bigStyle, styles.bigInteger, sizeStyles['bigInteger'], hitColorStyle, !isOnlyShowBigPrice && !isBigPriceHasDecimal && !isPriceDescInFront ? styles.rightMargin : null, childrenClassName, bigIntegerClassName)} key="bigInteger" style={{...itemCommonStyle}}>{integerPrice}</Text>,
87
86
  isBigPriceHasDecimal?
88
87
  <Text className={classNames(styles.childStyle, styles.bigStyle, styles.bigDecimal, sizeStyles['bigDecimal'], hitColorStyle, isPriceDescInFront ? null : styles.rightMargin, childrenClassName, bigDecimalClassName)} key="bigDecimal" style={{...itemCommonStyle}}>.{decimalPrice}</Text>
89
88
  :
90
89
  null
91
90
  ,
92
91
  !isOnlyShowBigPrice && [
93
92
  isPriceDescInFront && <Text className={classNames(styles.childStyle, styles.priceDesc, sizeStyles['priceDesc'], styles.bigStyle, hitColorStyle, isPriceDescInFront ? styles.rightMargin : null, childrenClassName, priceDescClassName)} key="descFront" style={{...itemCommonStyle}}>{priceText}</Text>,
94
93
  smallPrice && !isHideSmallPrice ? <Text className={classNames(styles.childStyle, styles.smallPrice, sizeStyles['smallPrice'], styles.smallStyle, missColorStyle, childrenClassName, smallPriceClassName)} key="smallPrice" style={{...itemCommonStyle}}>¥{smallPrice}</Text> : null,
95
94
  !isPriceDescInFront && <Text className={classNames(styles.childStyle, styles.priceDesc, sizeStyles['priceDesc'], styles.smallStyle, styles.missPriceDesc, missColorStyle, childrenClassName, priceDescClassName)} key="descBack" style={{...itemCommonStyle}}>{priceText}</Text>
96
95
  ]
97
96
  ]
98
97
  }
99
98
  </View>
100
99
  )
100
+ import React from 'react';
101
101
  console.warn("🚗 ~~ file: index.tsx:22 ~~ reportException() ~~ {type, detail, text}:", {type, data, text})
102
102
  sgmCustomReport({
103
103
  code: getSgmCustomCode(`${SgmCustomCode.PRICE_RENDER}_${type}`),
104
104
  msg: {
105
105
  type,
106
106
  data,
107
107
  text: '[双价格组件]' + text
108
108
  },
109
109
  })
110
110
  return rest.some(item => item === undefined || item === '')
111
111
  const numPrice = Number(strPrice)
112
112
  if(isNaN(numPrice)){
113
113
  reportException({
114
114
  type: 'isNotNumericType',
115
115
  data: props,
116
116
  text: `传入价格字段值“${strPrice}”转换数字报错`
117
117
  })
118
118
  return false
119
119
  }
120
120
  else if(numPrice <= 0){
121
121
  reportException({
122
122
  type: 'isNotPositiveNumber',
123
123
  data: props,
124
124
  text: `传入价格字段值“${strPrice}”不是一个正数`
125
125
  })
126
126
  return false
127
127
  }
128
128
  const result = numPrice.toString().match(/(\d+)(\.(\d+))?/)
129
129
  if(result && result[3]?.length > 2){
130
130
  reportException({
131
131
  type: 'decimalPlaceTooLong',
132
132
  data: props,
133
133
  text: `传入价格字段值“${strPrice}”小数位不能超过2位`
134
134
  })
135
135
  return false
136
136
  }
137
137
  if(/^\d+(\.\d+)?[eE][+-]?\d+$/.test(strPrice)){
138
138
  reportException({
139
139
  type: 'findScientificNotation',
140
140
  data: props,
141
141
  text: `传入价格字段值“${strPrice}”是一个科学计数法格式`
142
142
  })
143
143
  }
144
144
  return true
145
145
  const {jdPrice, finalPrice} = props
146
146
  if(jdPrice && finalPrice && Number(jdPrice) <= Number(finalPrice)){
147
147
  reportException({
148
148
  type: 'pricesCompareException',
149
149
  data: props,
150
150
  text: `身份/到手价必须小于松果价`
151
151
  })
152
152
  return false
153
153
  }else{
154
154
  return true
155
155
  }
156
156
  const numPrice = Number(strPrice)
157
157
  const result = numPrice.toString().match(/(\d+)(\.(\d+))?/)
158
158
  if(result){
159
159
  return {
160
160
  integerPrice: result[1],
161
161
  decimalPrice: (result[3] || '').replace(/0+$/, '')
162
162
  }
163
163
  }else{
164
164
  reportException({
165
165
  type: 'deconstructException',
166
166
  data: props,
167
167
  text: `解构传入价格字段值“${strPrice}”解构发生异常`
168
168
  })
169
169
  return null
170
170
  }
171
171
  const {
172
172
  jdPrice,
173
173
  finalPrice,
174
174
  priceText = '',
175
175
  priceType,
176
176
  hitUserIdentity = false,
177
177
  fallbackRender = null,
178
178
  className = null,
179
179
  style = {},
180
180
  childrenClassName = null,
181
181
  bigNoPriceClassName = null,
182
182
  bigSymbolClassName = null,
183
183
  bigIntegerClassName = null,
184
184
  bigDecimalClassName = null,
185
185
  priceDescClassName = null,
186
186
  smallPriceClassName = null,
187
187
  lineNumber = 1,
188
188
  size = 'M',
189
189
  isDefaultRemoveSmallPrice = false
190
190
  } = props
191
191
  let useBackstop = false
192
192
  if(isNull(props.jdPrice, props.priceType)){
193
193
  useBackstop = true
194
194
  reportException({
195
195
  type: 'paramMiss',
196
196
  data: props,
197
197
  text: '缺少必要入参:jdPrice、priceType'
198
198
  })
199
199
  }else if(!allowedNoHitUserIdentityTypes.includes(props.priceType) && props.hitUserIdentity === undefined){
200
200
  useBackstop = true
201
201
  reportException({
202
202
  type: 'paramMiss',
203
203
  data: props,
204
204
  text: `价格类型${props.priceType}缺少必要入参:hitUserIdentity`
205
205
  })
206
206
  }
207
207
  const especialHitStyleType = {
208
208
  7: 'plusStyle',
209
209
  9: 'samStyle'
210
210
  }
211
211
  const especialMissStyleType = {
212
212
  7: 'plusStyle',
213
213
  8: 'fansStyle',
214
214
  9: 'samStyle',
215
215
  10: 'studentStyle',
216
216
  12: 'yhdStyle',
217
217
  13: 'memberStyle'
218
218
  }
219
219
  const isTextPrice = priceType === 4
220
220
  if(!isTextPrice && !useBackstop){
221
221
  if(finalPrice && !numericPriceValidate(finalPrice, props)){
222
222
  useBackstop = true
223
223
  }else if(!numericPriceValidate(jdPrice, props)){
224
224
  useBackstop = true
225
225
  }
226
226
  if(!useBackstop && !pricesCompareValidate(props)){
227
227
  useBackstop = true
228
228
  }
229
229
  }
230
230
  const isUseFinalPriceAsBigPrice = allowedNoHitUserIdentityTypes.includes(priceType)
231
231
  const isEquivalentHit = isUseFinalPriceAsBigPrice || hitUserIdentity
232
232
  const bigPriceObj = (isTextPrice || useBackstop)? {}: getDeconstructPrice(isEquivalentHit && !isNull(finalPrice)? finalPrice: jdPrice, props)
233
233
  const {integerPrice = '', decimalPrice = ''} = bigPriceObj || {}
234
234
  const isOnlyShowBigPrice = priceType === 3 || isNull(finalPrice)
235
235
  const smallPrice = isEquivalentHit? jdPrice: finalPrice
236
236
  const isHideSmallPrice = priceType === 14 || isDefaultRemoveSmallPrice || isNaN(Number(smallPrice))
237
237
  const isPriceDescInFront = isEquivalentHit
238
238
  const hitColorStyle = isEquivalentHit? styles[especialHitStyleType[priceType]]: null
239
239
  const missColorStyle = isEquivalentHit? null: styles[especialMissStyleType[priceType]]
240
240
  const isBigPriceHasDecimal = decimalPrice !== '' && !/^0+$/.test(decimalPrice)
241
241
  const sizeLineHeight = {
242
242
  'XS': 28,
243
243
  'S': 34,
244
244
  'M': 40,
245
245
  'L': 46,
246
246
  'XL': 52
247
247
  }
248
248
  const lineHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25)
249
249
  const wrapHeight = Taro.pxTransform(sizeLineHeight[size] * 1.25 * lineNumber)
250
250
  const computedHeightStyle = {
251
251
  height: wrapHeight
252
252
  }
253
253
  const itemCommonStyle = {
254
254
  height: lineHeight
255
255
  }
256
256
  const needSizeStyles = ['bigNoPrice', 'bigSymbol', 'bigInteger', 'bigDecimal', 'priceDesc', 'smallPrice']
257
257
  const sizeStyles = needSizeStyles.reduce((acc, cur) => {
258
258
  acc[cur] = styles[cur + size]
259
259
  return acc
260
260
  }, {})
261
261
  const finalFallbackText = '暂无报价'
262
262
  const noPriceShowText = priceText || (/^[\u4e00-\u9fa5]+$/.test(jdPrice)? jdPrice: finalFallbackText)
263
263
  if(useBackstop && fallbackRender){
264
264
  return fallbackRender
265
265
  }
266
266
  return (
267
267
  <View className={classNames(styles.wrap, className)} style={{...computedHeightStyle, ...style}}>
268
268
  {isTextPrice || useBackstop?
269
269
  <Text className={classNames(styles.childStyle, styles.bigStyle, styles.bigNoPrice, sizeStyles['bigNoPrice'], childrenClassName, bigNoPriceClassName)} style={{...itemCommonStyle}}>{useBackstop? finalFallbackText: noPriceShowText}</Text>
270
270
  :
271
271
  [
272
272
  <Text className={classNames(styles.childStyle, styles.bigStyle, styles.bigSymbol, sizeStyles['bigSymbol'], hitColorStyle, childrenClassName, bigSymbolClassName)} key="bigSymbol" style={{...itemCommonStyle}}>¥</Text>,
273
273
  <Text className={classNames(styles.childStyle, styles.bigStyle, styles.bigInteger, sizeStyles['bigInteger'], hitColorStyle, !isOnlyShowBigPrice && !isBigPriceHasDecimal && !isPriceDescInFront ? styles.rightMargin : null, childrenClassName, bigIntegerClassName)} key="bigInteger" style={{...itemCommonStyle}}>{integerPrice}</Text>,
274
274
  isBigPriceHasDecimal?
275
275
  <Text className={classNames(styles.childStyle, styles.bigStyle, styles.bigDecimal, sizeStyles['bigDecimal'], hitColorStyle, isPriceDescInFront ? null : styles.rightMargin, childrenClassName, bigDecimalClassName)} key="bigDecimal" style={{...itemCommonStyle}}>.{decimalPrice}</Text>
276
276
  :
277
277
  null
278
278
  ,
279
279
  !isOnlyShowBigPrice && [
280
280
  isPriceDescInFront && <Text className={classNames(styles.childStyle, styles.priceDesc, sizeStyles['priceDesc'], styles.bigStyle, hitColorStyle, isPriceDescInFront ? styles.rightMargin : null, childrenClassName, priceDescClassName)} key="descFront" style={{...itemCommonStyle}}>{priceText}</Text>,
281
281
  <view style={{
282
282
  display: 'inline-flex'
283
283
  }}>
284
284
  {smallPrice && !isHideSmallPrice ? <Text className={classNames(styles.childStyle, styles.smallPrice, sizeStyles['smallPrice'], styles.smallStyle, missColorStyle, childrenClassName, smallPriceClassName)} key="smallPrice" style={{...itemCommonStyle}}>¥{Number(smallPrice)}</Text> : null}
285
285
  {!isPriceDescInFront && !isHideSmallPrice && <Text className={classNames(styles.childStyle, styles.priceDesc, sizeStyles['priceDesc'], styles.smallStyle, styles.missPriceDesc, missColorStyle, childrenClassName, priceDescClassName)} key="descBack" style={{...itemCommonStyle}}>{priceText}</Text>}
286
286
  </view>
287
287
  ]
288
288
  ]
289
289
  }
290
290
  </View>
291
291
  )
@@ -1 +1 @@
1
- import React from 'react'
2
1
  <BasePrice {...props}/>
3
2
  :
4
3
  <DoublePrice {...props} />
4
+ import React from 'react'
5
5
  if (props.priceType === undefined) {
6
6
  if (props.value === undefined) {
7
7
  if (props.jdPrice === undefined) {
8
8
  return null
9
9
  } else {
10
10
  return <BasePrice {...props} value={props.jdPrice} />
11
11
  }
12
12
  } else {
13
13
  return <BasePrice {...props} />
14
14
  }
15
15
  } else {
16
16
  return <DoublePrice {...props} />
17
17
  }
@@ -0,0 +1,67 @@
1
+
2
+ .debug-layout-warp {
3
+ position: absolute;
4
+ border-radius: 12PX;
5
+ top: 0;
6
+ left: 0;
7
+ right: 0;
8
+ bottom: 0;
9
+ z-index: 50;
10
+
11
+ .debug-layout {
12
+ position: absolute;
13
+ border-radius: 12PX;
14
+ top: 0;
15
+ left: 0;
16
+ right: 0;
17
+ bottom: 0;
18
+
19
+ border: 1PX solid #f50707;
20
+ background-color: rgba(219, 38, 38, 0.2);
21
+
22
+ &[data-module-type='JOINT'] {
23
+ border: 1PX solid #f507c9;
24
+ background-color: rgba(219, 38, 150, 0.2);
25
+ }
26
+
27
+ &.green {
28
+ border: 1PX solid #04a607;
29
+ background-color: rgba(38, 219, 71, 0.2);
30
+ }
31
+
32
+ .cd-version-list {
33
+ pointer-events: none;
34
+ position: absolute;
35
+ font-size: 0;
36
+ top: 0;
37
+ left: 0;
38
+ right: 0;
39
+ background-color: transparent;
40
+ text-align: center;
41
+ overflow: hidden;
42
+ }
43
+
44
+ .cd-version-item {
45
+ display: inline-block;
46
+ background-color: #00c853;
47
+ font-size: 30px;
48
+ color: white;
49
+ padding: 1PX 3PX;
50
+ border-radius: 4PX;
51
+ margin: 0 5PX;
52
+ &[data-version='3.5.4'] {
53
+ background-color: #999;
54
+ }
55
+ }
56
+ }
57
+
58
+ .d-info {
59
+ position: relative;
60
+ cursor: pointer;
61
+ z-index: 3;
62
+ margin: 3PX 3PX;
63
+ width: 22PX;
64
+ height: 22PX;
65
+ background: url('../../../assets/icon_blue_info.svg') center center / 22PX 22PX no-repeat;
66
+ }
67
+ }