@conecli/cone-render 0.8.18 → 0.8.19-beta.0

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 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  inViewCallback
3
2
  if (isH5AndJdShopView) {
4
3
  useEffect(() => {
5
4
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
6
5
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
7
6
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
8
7
  !componentShowStateRef.current && dealPageScrollInfo(res)
9
8
  })
10
9
  }, [])
11
10
  useEffect(() => {
12
11
  if(componentShowState){
13
12
  typeof inViewCallback === 'function' && inViewCallback()
14
13
  console.log('InViewRender -- 店铺H5 展示啦!')
15
14
  }
16
15
  }, [componentShowState])
17
16
 
18
17
  const dealPageScrollInfo = (res) => {
19
18
  if (componentLazyRef.current) {
20
19
  const eleClientRect =
21
20
  componentLazyRef.current.getBoundingClientRect()
22
21
  const getContainerHeightOffSetY = res.displayHeight + res.offSetY
23
22
  const eleOffsetTop = Math.ceil(eleClientRect.top)
24
23
  if (!componentShowStateRef.current) {
25
24
  if (getContainerHeightOffSetY > eleOffsetTop) {
26
25
  componentShowStateRef.current = true
27
26
  setComponentShowState(true)
28
27
  Taro.nextTick(() => {
29
28
  setComponentRenderShowState(true)
30
29
  })
31
30
  }
32
31
  }
33
32
  }
34
33
  }
35
34
  return (
36
35
  <View
37
36
  ref={componentLazyRef}
38
37
  className={classNames(
39
38
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
40
39
  'd-app-floor-lazy-load',
41
40
  )}
42
41
  style={{
43
42
  minHeight: `${
44
43
  componentRenderShowState ? 'auto' : height + (typeof height === 'number'? 'px': '')
45
44
  }`,
46
45
  backgroundColor: componentRenderShowState
47
46
  ? 'transparent'
48
47
  : '#ffffff',
49
48
  }}
50
49
  >
51
50
  {componentShowState ? children : placeholder}
52
51
  </View>
53
52
  )
54
53
  } else {
55
54
  const rootDom = document.querySelector('#J_shopHomeRoot')
56
55
  const { ref, inView } = useInView({
57
56
  threshold: 0,
58
57
  triggerOnce: true,
59
58
  root: rootDom,
60
59
  rootMargin: `0px 0px 0px 0px`,
61
60
  })
62
61
  useEffect(() => {
63
62
  if(inView){
64
63
  typeof inViewCallback === 'function' && inViewCallback()
65
64
  console.log('InViewRender -- 其它H5 展示啦!')
66
65
  }
67
66
  }, [inView])
68
67
  return (
69
68
  <View
70
69
  ref={ref}
71
70
  style={{
72
71
  minHeight: `${inView ? 'auto' : height + 'px'}`,
73
72
  backgroundColor: 'transparent',
74
73
  }}
75
74
  >
76
75
  {inView ? children : placeholder}
77
76
  </View>
78
77
  )
79
78
  }
80
79
  inViewCallback: null,
80
+ import Taro from '@tarojs/taro'
81
81
  TaroEventType,
82
82
  const {
83
83
  children,
84
84
  placeholder,
85
85
  height,
86
86
  inViewCallback
87
87
  } = props
88
88
  const [componentShowState, setComponentShowState] = useState(false)
89
89
  const [componentRenderShowState, setComponentRenderShowState] =
90
90
  useState(false)
91
91
  const componentLazyRef = useRef<HTMLElement | null>(null)
92
92
  const componentShowStateRef = useRef(false)
93
93
  if (isH5AndJdShopView) {
94
94
  useEffect(() => {
95
95
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
96
96
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
97
97
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
98
98
  !componentShowStateRef.current && dealPageScrollInfo(res)
99
99
  })
100
100
  }, [])
101
101
  useEffect(() => {
102
102
  if (componentShowState) {
103
103
  typeof inViewCallback === 'function' && inViewCallback()
104
104
  console.log('InViewRender -- 店铺H5 展示啦!')
105
105
  }
106
106
  }, [componentShowState])
107
107
 
108
108
  const dealPageScrollInfo = (res) => {
109
109
  if (componentLazyRef.current) {
110
110
  const eleClientRect =
111
111
  componentLazyRef.current.getBoundingClientRect()
112
112
  const getContainerHeightOffSetY = res.displayHeight + res.offSetY
113
113
  const eleOffsetTop = Math.ceil(eleClientRect.top)
114
114
  if (!componentShowStateRef.current) {
115
115
  if (getContainerHeightOffSetY > eleOffsetTop) {
116
116
  componentShowStateRef.current = true
117
117
  setComponentShowState(true)
118
118
  Taro.nextTick(() => {
119
119
  setComponentRenderShowState(true)
120
120
  })
121
121
  }
122
122
  }
123
123
  }
124
124
  }
125
125
  return (
126
126
  <View
127
127
  ref={componentLazyRef}
128
128
  className={classNames(
129
129
  lazyLayoutLoadStyle['d-app-floor-lazy-layout-load'],
130
130
  'd-app-floor-lazy-load',
131
131
  )}
132
132
  style={{
133
133
  minHeight: `${componentRenderShowState ? 'auto' : height + (typeof height === 'number' ? 'px' : '')
134
134
  }`,
135
135
  backgroundColor: componentRenderShowState
136
136
  ? 'transparent'
137
137
  : '#ffffff',
138
138
  }}
139
139
  >
140
140
  {componentShowState ? children : placeholder}
141
141
  </View>
142
142
  )
143
143
  } else {
144
144
  const rootDom = document.querySelector('#J_shopHomeRoot')
145
145
  const { ref, inView } = useInView({
146
146
  threshold: 0,
147
147
  triggerOnce: true,
148
148
  root: rootDom || null,
149
149
  rootMargin: `0px 0px 0px 0px`,
150
150
  })
151
151
  useEffect(() => {
152
152
  if (inView) {
153
153
  typeof inViewCallback === 'function' && inViewCallback()
154
154
  console.log('InViewRender -- 其它H5 展示啦!')
155
155
  }
156
156
  }, [inView])
157
157
  return (
158
158
  <View
159
159
  ref={ref}
160
160
  style={{
161
161
  minHeight: `${inView ? 'auto' : height + 'px'}`,
162
162
  backgroundColor: 'transparent',
163
163
  }}
164
164
  >
165
165
  {inView ? children : placeholder}
166
166
  </View>
167
167
  )
168
168
  }
169
169
  children: null,
170
170
  placeholder: null,
171
171
  height: 1,
172
172
  className: '',
173
173
  lazyNodeClassName: '',
174
174
  inViewCallback: null,
@@ -1 +1 @@
1
- export const NetWorkTypeQuality = {
1
+ export const NetWorkTypeQuality = {
@@ -1 +1 @@
1
- import React, { useCallback, useEffect, useRef, useState } from 'react'
2
1
  const [componentShowState, setComponentShowState] = useState(false)
3
2
  const componentLazyRef = useRef<HTMLElement | null>(null)
4
3
  const componentShowStateRef = useRef(false)
5
4
  useEffect(() => {
6
5
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
7
6
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
8
7
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
9
8
  !componentShowStateRef.current && dealPageScrollInfo(res)
10
9
  })
11
10
 
12
11
 
13
12
  <View
14
13
  ref={componentLazyRef}
15
14
  className={classNames(
16
15
  imageStyle['d-app-lazy-image'],
17
16
  {
18
17
  [imageStyle['d-lazy-sku-image']]: isSkuImage,
19
18
  },
20
19
  {
21
20
  [imageStyle['d-hide-image-error']]: imageErrState,
22
21
  },
23
22
  {
24
23
  [imageStyle['d-load-completed']]: loadSuccess,
25
24
  },
26
25
  {
27
26
  'd-imag-rendering-crisp-edges':
28
27
  !taroJdBaseInfo.info.pageInfo.isVipShop &&
29
28
  imagRenderingSet,
30
29
  },
31
30
  'J_html5ImageBg',
32
31
  className,
33
32
  )}
34
33
  style={{
35
34
  ...style,
36
35
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
37
36
  >
38
37
  {(componentShowState || lazyLoad === false) && <img
39
38
  src={getQualityImage(
40
39
  imgSrc,
41
40
  taroJdBaseInfo.info.pageInfo.isVipShop
42
41
  ? NetWorkTypeQuality['perfect']
43
42
  : NetWorkTypeQuality[getNetWorkType],
44
43
  )}
45
44
  onLoad={imageLoad.bind(this, imgSrc)}
46
45
  onError={imageError}
47
46
  />}
48
47
  </View>
49
48
  ) : (
50
49
  <Image
51
50
  style={{
52
51
  ...style,
53
52
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
54
53
  }}
55
54
  className={classNames(
56
55
  imageStyle['d-lazy-image'],
57
56
  {
58
57
  [imageStyle['d-lazy-sku-image']]: isSkuImage,
59
58
  },
60
59
  {
61
60
  [imageStyle['d-hide-image-error']]: imageErrState,
62
61
  },
63
62
  {
64
63
  [imageStyle['d-load-completed']]: loadSuccess,
65
64
  },
66
65
  {
67
66
  'd-imag-rendering-crisp-edges': imagRenderingSet,
68
67
  },
69
68
  className,
70
69
  )}
71
70
  src={getQualityImage(
72
71
  imgSrc,
73
72
  NetWorkTypeQuality[getNetWorkType],
74
73
  )}
75
74
  lazyLoad={lazyLoad}
76
75
  onError={imageError}
77
76
  onLoad={imageLoad.bind(this, imgSrc)}
78
77
  {...otherOption}
79
78
  />
80
79
  )
80
+ import React, { useCallback, useEffect, useRef, useState } from 'react'
81
81
  const [componentShowState, setComponentShowState] = useState(false)
82
82
  const componentLazyRef = useRef<HTMLElement | null>(null)
83
83
  const componentShowStateRef = useRef(false)
84
84
  useEffect(() => {
85
85
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
86
86
  !componentShowStateRef.current && dealPageScrollInfo(latestRes)
87
87
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
88
88
  !componentShowStateRef.current && dealPageScrollInfo(res)
89
89
  })
90
90
 
91
91
  <View
92
92
  ref={componentLazyRef}
93
93
  className={classNames(
94
94
  imageStyle['d-app-lazy-image'],
95
95
  {
96
96
  [imageStyle['d-lazy-sku-image']]: isSkuImage,
97
97
  },
98
98
  {
99
99
  [imageStyle['d-hide-image-error']]: imageErrState,
100
100
  },
101
101
  {
102
102
  [imageStyle['d-load-completed']]: loadSuccess,
103
103
  },
104
104
  {
105
105
  'd-imag-rendering-crisp-edges':
106
106
  !taroJdBaseInfo.info.pageInfo.isVipShop &&
107
107
  imagRenderingSet,
108
108
  },
109
109
  'J_html5ImageBg',
110
110
  className,
111
111
  )}
112
112
  style={{
113
113
  ...style,
114
114
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
115
115
  >
116
116
  {(componentShowState || lazyLoad === false) && <img
117
117
  src={getQualityImage(
118
118
  imgSrc,
119
119
  taroJdBaseInfo.info.pageInfo.isVipShop
120
120
  ? NetWorkTypeQuality['perfect']
121
121
  : NetWorkTypeQuality[getNetWorkType],
122
122
  )}
123
123
  onLoad={imageLoad.bind(this, imgSrc)}
124
124
  onError={imageError}
125
125
  />}
126
126
  </View>
127
127
  ) : (
128
128
  <Image
129
129
  style={{
130
130
  ...style,
131
131
  ...changeStyleIncludeWidthAndHeightAndBgColor(),
132
132
  }}
133
133
  className={classNames(
134
134
  imageStyle['d-lazy-image'],
135
135
  {
136
136
  [imageStyle['d-lazy-sku-image']]: isSkuImage,
137
137
  },
138
138
  {
139
139
  [imageStyle['d-hide-image-error']]: imageErrState,
140
140
  },
141
141
  {
142
142
  [imageStyle['d-load-completed']]: loadSuccess,
143
143
  },
144
144
  {
145
145
  'd-imag-rendering-crisp-edges': imagRenderingSet,
146
146
  },
147
147
  className,
148
148
  )}
149
149
  src={getQualityImage(
150
150
  imgSrc,
151
151
  NetWorkTypeQuality[getNetWorkType],
152
152
  )}
153
153
  lazyLoad={lazyLoad}
154
154
  onError={imageError}
155
155
  onLoad={imageLoad.bind(this, imgSrc)}
156
156
  {...otherOption}
157
157
  />
158
158
  )
@@ -52,6 +52,15 @@
52
52
  background-size: contain;
53
53
  }
54
54
  }
55
+ &.d-price-label{
56
+ &:after{
57
+ // 价格后面追加显示文案例如“到手价”的默认样式
58
+ content: attr(data-after);
59
+ font-size: 20px;
60
+ color: #FFFFFF;
61
+ margin-left: 8px;
62
+ }
63
+ }
55
64
  &.d-plus-price {
56
65
  .int-txt,
57
66
  .sym-sub,
@@ -1 +1 @@
1
- import React from 'react'
1
+ import React from 'react'
2
2
  priceLabelText: "到手价"
@@ -1 +1 @@
1
- import React from 'react'
2
1
  containerIndex?: number
3
2
  containerData?: any
4
3
  shopTotalInfo?: any
5
4
  selectContainerFn?: Function
6
5
  selectContainerId?: string
7
6
  placeHolderPreContainerId?: string
8
7
  children?: any
9
8
  style?: {
10
9
  [key: string]: any
11
10
  };
12
11
  layoutLeftRightMargin?: number
13
12
  }
13
+ import React from 'react'
14
14
  customErrorIsvFloorModule?: React.ReactElement | undefined
15
15
  containerIndex?: number
16
16
  containerData?: any
17
17
  shopTotalInfo?: any
18
18
  selectContainerFn?: Function
19
19
  selectContainerId?: string
20
20
  placeHolderPreContainerId?: string
21
21
  children?: any
22
22
  style?: {
23
23
  [key: string]: any
24
24
  };
25
25
  layoutLeftRightMargin?: number
26
26
  }
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
@@ -1 +1 @@
1
- import { isH5 } from '../utils'
1
+ import { isH5 } from '../utils'
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  console.log('京购商详页跳转:', this.jumpMiniPath.detail)
3
2
  if(global){
4
3
  if(global.miniAppLogInstance){
5
4
  }else{
6
5
  console.log('global.miniAppLogInstance为空!')
7
6
  }
8
7
  }else{
9
8
  console.log('global为空!')
10
9
  }
10
+ import Taro from '@tarojs/taro'
11
11
  console.log('京购商详页跳转:', this.jumpMiniPath.detail)
12
12
  if(global){
13
13
  if(global.miniAppLogInstance){
14
14
  }else{
15
15
  console.log('global.miniAppLogInstance为空!')
16
16
  }
17
17
  }else{
18
18
  console.log('global为空!')
19
19
  }
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
1
+ import Taro from '@tarojs/taro'
@@ -1 +1 @@
1
- import global from '../common'
1
+ import global from '../common'
@@ -1 +1 @@
1
- import { JdJumpJdApp } from './jdJumpJdApp'
1
+ import { JdJumpJdApp } from './jdJumpJdApp'
@@ -1 +1 @@
1
- import global from '../common'
2
1
  console.log('window.shopGlobalSwitch:', JSON.stringify(window.shopGlobalSwitch))
3
2
  console.log('进入了 isH5AndJingGouMini && this.isH5OpenToWxapp 的if')
4
3
  this.jingGouMiniState = true
5
4
  window.isJingGouMiniViewState = true
6
5
  console.log('进入了 iwx?.miniProgram then ')
7
6
  global.info.isJingGouMiniViewState = true
8
7
  if (location.pathname == '/shop/home') {
9
8
  const getQueryData = parseQueryUrlString(
10
9
  location.search,
11
10
  )
12
11
  this.jdJumpToShopHome({
13
12
  ...getQueryData,
14
13
  type: 'redirectTo',
15
14
  })
16
15
  }
17
16
  console.log('进入了 isH5AndJingGouMini && this.isH5OpenToWxapp 的esle')
18
17
  }
18
+ import global from '../common'
19
19
  console.log('window.shopGlobalSwitch:', JSON.stringify(window.shopGlobalSwitch))
20
20
  console.log('进入了 isH5AndJingGouMini && this.isH5OpenToWxapp 的if')
21
21
  this.jingGouMiniState = true
22
22
  window.isJingGouMiniViewState = true
23
23
  console.log('进入了 iwx?.miniProgram then 但是没有继续跳转的逻辑 ')
24
24
  global.info.isJingGouMiniViewState = true
25
25
  console.log('进入了 isH5AndJingGouMini && this.isH5OpenToWxapp 的esle')
26
26
  }