@conecli/cone-render 0.10.1-shop3.89 → 0.10.1-shop3.90

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 React, {useEffect, useRef} from 'react'
2
1
  const { title, openAppParams, style, hasCommonHeader = true, hasDownloadTips = true, headerParams } = props
3
2
  const headerRef:any = useRef(null)
4
3
  useEffect(() => {
5
4
  hasCommonHeader && initCommonHeader()
6
5
  hasDownloadTips && initDownloadAppLayerConfigData()
7
6
  }, [])
8
7
  const isScrolledToTop = () => {
9
8
  return window.scrollY !== undefined ? window.scrollY === 0 :
10
9
  document.documentElement.scrollTop === 0 || document.body.scrollTop === 0;
11
10
  }
12
11
  const scrollEventFunc = () => {
13
12
  if(!headerRef.current) return
14
13
  const stickyTop = headerRef.current?.getBoundingClientRect()?.top || 0;
15
14
  if(Math.trunc(stickyTop) <= 0 && !isScrolledToTop()) {
16
15
  console.log('scroll 添加class',Math.trunc(stickyTop), isScrolledToTop())
17
16
  headerRef.current.classList.add('d-mobile-header-sticky');
18
17
  }else {
19
18
  console.log('scroll 移除class',Math.trunc(stickyTop), isScrolledToTop())
20
19
  headerRef.current.classList.remove('d-mobile-header-sticky');
21
20
  }
22
21
  }
23
22
  useEffect(() => {
24
23
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL,() => {
25
24
  scrollEventFunc()
26
25
  })
27
26
  },[])
28
27
  const initCommonHeader = () => {
29
28
  if (window?.MCommonHeaderBottom) {
30
29
  const mchb = new MCommonHeaderBottom()
31
30
  const headerArg = {
32
31
  moduleName: 'shop',
33
32
  hrederId: 'm_common_header',
34
33
  title,
35
34
  stype: 1,
36
35
  onClickJdkey: function () {
37
36
  console.log('==>m_common_header jdkey click.')
38
37
  },
39
38
  ...headerParams
40
39
  }
41
40
  mchb.header(headerArg)
42
41
  }
43
42
  }
44
43
  const initDownloadAppLayerConfigData = () => {
45
44
  const getEle = document.getElementById('m_common_tip')
46
45
  getEle &&
47
46
  window.$ &&
48
47
  window.$.downloadAppLayerConfigData &&
49
48
  window.$.downloadAppLayerConfigData({
50
49
  tipId: 'm_common_tip',
51
50
  M_sourceFrom: 'jshop',
52
51
  bottom: 74,
53
52
  onClickTipX: () => {
54
53
  Taro.eventCenter.trigger(
55
54
  TaroEventType.DOWN_LOAD_APP_CLOSE_CHANGE,
56
55
  true,
57
56
  )
58
57
  },
59
58
  downloadAppPlugIn: {
60
59
  M_sourceFrom: 'jshop',
61
60
  openAppBtnId: 'download_openapp',
62
61
  downAppURl: '//conecli.com/downloadApp/download.html?channel=jd-m',
63
62
  inteneUrl: 'openapp.jdmobile://virtual?',
64
63
  inteneUrlParams: {
65
64
  category: 'jump',
66
65
  des: 'jshopMain',
67
66
  shopId: `${global.info.queryInfo.shopId || ''}`,
68
67
  venderId: `${global.info.queryInfo.venderId || ''}`,
69
68
  sourceType: global.info.queryInfo?.sourceType || 'M-H5',
70
69
  sourceValue: global.info.queryInfo?.sourceValue || 'Mshop',
71
70
  ...openAppParams,
72
71
  },
73
72
  },
74
73
  })
75
74
  }
76
75
  return !isWxMiniH5View && !isJdApp ? (
77
76
  <View
78
77
  className={mobileCommonHeaderStyle['d-mobile-header-layout']}
79
78
  style={style}
80
79
  ref={headerRef}
81
80
  >
82
81
  <View
83
82
  id="m_common_tip"
84
83
  className={mobileCommonHeaderStyle['d-mobile-common-tip']}
85
84
  />
86
85
  {hasCommonHeader && (
87
86
  <View
88
87
  id="m_common_header"
89
88
  className={mobileCommonHeaderStyle['d-mobile-common-header']}
90
89
  />
91
90
  )}
92
91
  </View>
93
92
  ) : null
94
93
  title: '店铺',
95
94
  openAppParams: {},
95
+ import Taro from '@tarojs/taro'
96
96
  const { title, openAppParams, style, hasCommonHeader = true, hasDownloadTips = true, headerParams } = props
97
97
  const headerRef:any = useRef(null)
98
98
  useEffect(() => {
99
99
  hasCommonHeader && initCommonHeader()
100
100
  !isTjScence && hasDownloadTips && initDownloadAppLayerConfigData()
101
101
  }, [])
102
102
  const isScrolledToTop = () => {
103
103
  return window.scrollY !== undefined ? window.scrollY === 0 :
104
104
  document.documentElement.scrollTop === 0 || document.body.scrollTop === 0;
105
105
  }
106
106
  const scrollEventFunc = () => {
107
107
  if(!headerRef.current) return
108
108
  const stickyTop = headerRef.current?.getBoundingClientRect()?.top || 0;
109
109
  if(Math.trunc(stickyTop) <= 0 && !isScrolledToTop()) {
110
110
  console.log('scroll 添加class',Math.trunc(stickyTop), isScrolledToTop())
111
111
  headerRef.current.classList.add('d-mobile-header-sticky');
112
112
  }else {
113
113
  console.log('scroll 移除class',Math.trunc(stickyTop), isScrolledToTop())
114
114
  headerRef.current.classList.remove('d-mobile-header-sticky');
115
115
  }
116
116
  }
117
117
  useEffect(() => {
118
118
  Taro.eventCenter.on(TaroEventType.PAGE_SCROLL,() => {
119
119
  scrollEventFunc()
120
120
  })
121
121
  },[])
122
122
  const initCommonHeader = () => {
123
123
  if (window?.MCommonHeaderBottom) {
124
124
  const mchb = new MCommonHeaderBottom()
125
125
  const headerArg = {
126
126
  moduleName: 'shop',
127
127
  hrederId: 'm_common_header',
128
128
  title,
129
129
  stype: 1,
130
130
  onClickJdkey: function () {
131
131
  console.log('==>m_common_header jdkey click.')
132
132
  },
133
133
  ...headerParams
134
134
  }
135
135
  mchb.header(headerArg)
136
136
  }
137
137
  }
138
138
  const initDownloadAppLayerConfigData = () => {
139
139
  const getEle = document.getElementById('m_common_tip')
140
140
  getEle &&
141
141
  window.$ &&
142
142
  window.$.downloadAppLayerConfigData &&
143
143
  window.$.downloadAppLayerConfigData({
144
144
  tipId: 'm_common_tip',
145
145
  M_sourceFrom: 'jshop',
146
146
  bottom: 74,
147
147
  onClickTipX: () => {
148
148
  Taro.eventCenter.trigger(
149
149
  TaroEventType.DOWN_LOAD_APP_CLOSE_CHANGE,
150
150
  true,
151
151
  )
152
152
  },
153
153
  downloadAppPlugIn: {
154
154
  M_sourceFrom: 'jshop',
155
155
  openAppBtnId: 'download_openapp',
156
156
  downAppURl: '//conecli.com/downloadApp/download.html?channel=jd-m',
157
157
  inteneUrl: 'openapp.jdmobile://virtual?',
158
158
  inteneUrlParams: {
159
159
  category: 'jump',
160
160
  des: 'jshopMain',
161
161
  shopId: `${global.info.queryInfo.shopId || ''}`,
162
162
  venderId: `${global.info.queryInfo.venderId || ''}`,
163
163
  sourceType: global.info.queryInfo?.sourceType || 'M-H5',
164
164
  sourceValue: global.info.queryInfo?.sourceValue || 'Mshop',
165
165
  ...openAppParams,
166
166
  },
167
167
  },
168
168
  })
169
169
  }
170
170
  return !isWxMiniH5View && !isJdApp ? (
171
171
  <View
172
172
  className={mobileCommonHeaderStyle['d-mobile-header-layout']}
173
173
  style={style}
174
174
  ref={headerRef}
175
175
  >
176
176
  {hasDownloadTips && (
177
177
  <View
178
178
  id="m_common_tip"
179
179
  className={mobileCommonHeaderStyle['d-mobile-common-tip']}
180
180
  />
181
181
  )}
182
182
  {hasCommonHeader && (
183
183
  <View
184
184
  id="m_common_header"
185
185
  className={mobileCommonHeaderStyle['d-mobile-common-header']}
186
186
  />
187
187
  )}
188
188
  </View>
189
189
  ) : null
190
190
  title: '店铺',
191
191
  openAppParams: {},
@@ -91,7 +91,7 @@
91
91
  }
92
92
 
93
93
  .priceDesc {
94
- margin-left: 4px;
94
+ margin-left: 8px;
95
95
  font-family: PingFang SC;
96
96
  &.priceHiddenDesc {
97
97
  width: 0;