@conecli/cone-render 0.8.20-beta.0 → 0.8.20-beta.2
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/README.md +7 -1
- package/dist/api/index.ts +1 -1
- package/dist/assets/icon_blue_info.svg +1 -0
- package/dist/common/const.ts +1 -1
- package/dist/common/environmentType.ts +1 -0
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/common/index.weapp.ts +1 -1
- package/dist/common/jdplayerSdk.ts +1 -0
- package/dist/common/jssdk.ts +1 -0
- package/dist/common/pageType.ts +1 -0
- package/dist/common/sgmCustomCode.ts +1 -0
- package/dist/common/token/index.h5.ts +1 -1
- package/dist/common/token/token.jd.ts +1 -1
- package/dist/common/token/token.ts +1 -1
- package/dist/common/wxappApi.jd.ts +1 -0
- package/dist/common/wxappApi.ts +1 -1
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
- package/dist/components/base/CommonFloorHead/index.tsx +1 -1
- package/dist/components/base/CountDown/index.module.scss +49 -44
- package/dist/components/base/CountDown/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
- package/dist/components/base/CustomScrollView/index.module.scss +7 -0
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/CustomVideo/common.ts +1 -0
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +16 -0
- package/dist/components/base/Dialog/index.tsx +1 -1
- package/dist/components/base/Exposure/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/const.ts +1 -0
- package/dist/components/base/ExposureSmart/index.h5.module.scss +30 -6
- package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/index.module.scss +20 -9
- package/dist/components/base/ExposureSmart/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
- package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
- package/dist/components/base/InViewRender/index.tsx +1 -1
- package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
- package/dist/components/base/ItemViewExposureSmart/index.module.scss +8 -0
- package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -0
- package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
- package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
- package/dist/components/base/LazyLoadImage/const.ts +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.module.scss +24 -20
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
- package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
- package/dist/components/base/NetworkDataError/const.ts +1 -1
- package/dist/components/base/NetworkDataError/index.module.scss +125 -69
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/Base/index.module.scss +12 -0
- package/dist/components/base/Price/Base/index.tsx +1 -1
- package/dist/components/base/Price/Double/index.module.scss +32 -0
- package/dist/components/base/Price/Double/index.tsx +1 -1
- package/dist/components/base/Price/index.tsx +1 -1
- package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
- package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
- package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
- package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
- package/dist/components/base/Skeleton/index.tsx +1 -1
- package/dist/components/debug/DebugLayout/index.module.scss +67 -0
- package/dist/components/debug/DebugLayout/index.tsx +1 -0
- package/dist/components/debug/DebugLayout/utils.ts +1 -0
- package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
- package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
- package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
- package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
- package/dist/components/floorItem.jd.tsx +1 -1
- package/dist/components/floorItem.tsx +1 -1
- package/dist/components/floorItem.weapp.tsx +1 -1
- package/dist/components/isv/Floor/index.tsx +1 -1
- package/dist/components/remoteFloorItem.tsx +1 -0
- package/dist/interface/common.ts +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/interface/jumpEventReport.ts +1 -1
- package/dist/interface/service.ts +1 -1
- package/dist/interface/utils.ts +1 -1
- package/dist/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/const.ts +1 -1
- package/dist/jumpEventReport/createReportFloorData.ts +1 -1
- package/dist/jumpEventReport/index.h5.ts +1 -1
- package/dist/jumpEventReport/index.jd.ts +1 -1
- package/dist/jumpEventReport/index.ts +1 -1
- package/dist/jumpEventReport/index.weapp.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.ts +1 -1
- package/dist/jumpEventReport/web/report.ts +1 -1
- package/dist/jumpEventReport/web.base.ts +1 -1
- package/dist/jumpEventReport/web.jd.ts +1 -1
- package/dist/jumpEventReport/web.jdb.ts +1 -1
- package/dist/jumpEventReport/web.jdjch.ts +1 -0
- package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
- package/dist/jumpEventReport/web.pc.ts +1 -0
- package/dist/jumpEventReport/web.tjapp.ts +1 -0
- package/dist/jumpEventReport/web.tjm.ts +1 -0
- package/dist/jumpEventReport/web.wxapp.ts +1 -1
- package/dist/language/en_US.json +231 -0
- package/dist/language/zh_CN.json +231 -0
- package/dist/language/zh_HK.json +231 -0
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -27
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/modules/ContainerFloorList/index.tsx +1 -1
- package/dist/open/api/device.ts +1 -1
- package/dist/open/api/environment.ts +1 -1
- package/dist/open/api/index.ts +1 -1
- package/dist/open/api/jump copy.ts +1 -1
- package/dist/open/api/request.ts +1 -1
- package/dist/open/api/shopMember.ts +1 -1
- package/dist/open/api/track.ts +1 -1
- package/dist/open/api/util.ts +1 -1
- package/dist/open/components/index.ts +1 -1
- package/dist/sass/app.h5.scss +294 -212
- package/dist/sass/base.scss +195 -137
- package/dist/service/bMallConst.ts +1 -1
- package/dist/service/fetchGateway.ts +1 -1
- package/dist/service/fetchGateway.weapp.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -1
- package/dist/service/http/const.ts +1 -1
- package/dist/service/http/h5Http.ts +1 -0
- package/dist/service/http/index.h5.ts +1 -0
- package/dist/service/requestServer.h5.ts +1 -0
- package/dist/service/requestServer.ts +1 -1
- package/dist/service/requestServer.weapp.ts +1 -0
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
- package/dist/utils/draExceptionAndProfile.ts +1 -1
- package/dist/utils/h5Utils.ts +1 -1
- package/dist/utils/index.h5.ts +1 -1
- package/dist/utils/index.ts +1 -1
- package/dist/utils/index.weapp.ts +1 -1
- package/dist/utils/intersectionObserver.ts +1 -1
- package/dist/utils/jm-common.js +1 -1
- package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
- package/dist/utils/jumpExtMapUtil.ts +1 -0
- package/dist/utils/sColor.js +1 -0
- package/dist/utils/sgmCodeUtils.ts +1 -0
- package/dist/utils/taroRenderUtil.ts +1 -0
- package/dist/utils/utils.ts +1 -1
- package/dist/wxapp/api/helper.js +1 -0
- package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
- package/dist/wxapp/common/user_info.js +1 -1
- package/dist/wxapp/components/launch-app/index.js +1 -0
- package/dist/wxapp/components/launch-app/index.json +5 -0
- package/dist/wxapp/components/launch-app/index.wxml +0 -0
- package/dist/wxapp/components/launch-app/index.wxss +0 -0
- package/dist/wxapp/components/subscribe-guider/helper.js +1 -0
- package/dist/wxapp/components/subscribe-guider/index.js +1 -0
- package/dist/wxapp/components/subscribe-guider/index.json +5 -0
- package/dist/wxapp/components/subscribe-guider/index.wxml +0 -0
- package/dist/wxapp/components/subscribe-guider/index.wxss +0 -0
- package/package.json +145 -115
- package/dist/components/base/Skeleton/old.tsx +0 -1
- package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
- package/dist/utils/memberFormatUtils.js +0 -1
- /package/dist/service/{bMallConst.wxapp.ts → bMallConst.weapp.ts} +0 -0
- /package/dist/service/http/{colorSign.wxapp.ts → colorSign.weapp.ts} +0 -0
|
@@ -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
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
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
|
TaroEventType,
|
|
82
82
|
const styleSheets = document.styleSheets
|
|
83
83
|
const internalStyleSheets = []
|
|
84
84
|
for (let i = 0; i < styleSheets.length; i++) {
|
|
85
85
|
const sheet = styleSheets[i]
|
|
86
86
|
const ownerNode = sheet.ownerNode
|
|
87
87
|
if (ownerNode && ownerNode.nodeName === 'STYLE') {
|
|
88
88
|
internalStyleSheets.push(sheet)
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
for(let i = 0; i < internalStyleSheets.length; i++){
|
|
92
92
|
try {
|
|
93
93
|
const sheet = internalStyleSheets[i]
|
|
94
94
|
const rules = sheet.cssRules || sheet.rules
|
|
95
95
|
for (const rule of rules) {
|
|
96
96
|
if (rule?.selectorText?.match(new RegExp(selector + '$'))) {
|
|
97
97
|
return rule
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
} catch (e) {
|
|
101
101
|
console.warn('因安全限制无法访问样式表:', e)
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
return null
|
|
105
105
|
const {
|
|
106
106
|
src,
|
|
107
107
|
lazyLoad,
|
|
108
108
|
imagRenderingSet,
|
|
109
109
|
width,
|
|
110
110
|
height,
|
|
111
111
|
className,
|
|
112
112
|
isSkuImage,
|
|
113
113
|
hideErrorImage,
|
|
114
114
|
style,
|
|
115
115
|
backgroundColor,
|
|
116
116
|
errorSrc,
|
|
117
117
|
onLoad,
|
|
118
118
|
onError,
|
|
119
119
|
...otherOption
|
|
120
120
|
} = props
|
|
121
121
|
getNetWorkType === NetWorkTypeQuality.default &&
|
|
122
122
|
(getNetWorkType = global.info.sysInfo.netWorkType)
|
|
123
123
|
const [loadSuccess, setLoadSuccess] = useState(false)
|
|
124
124
|
const [imageErrState, setImageErrState] = useState(false)
|
|
125
125
|
const [componentShowState, setComponentShowState] = useState(false)
|
|
126
126
|
const measureRef = useRef < HTMLElement | null > (null)
|
|
127
127
|
const [measureComplete, setMeasureComplete] = useState(false)
|
|
128
128
|
const [imgSrc, setImgSrc] = useState(src)
|
|
129
129
|
const [hasRetrySuccess, setHasRetrySuccess] = useState(false)
|
|
130
130
|
const hasRetryRef = useRef(false)
|
|
131
131
|
const componentShowStateRef = useRef(false)
|
|
132
132
|
const requestSrcRef = useRef(src)
|
|
133
133
|
const needShowHighVersion = isH5AndJdShopViewH5Scroll && !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === "true")
|
|
134
134
|
const enableAvifOptimize = isImageOptimizeEnable()
|
|
135
135
|
const avifSupport = getAvifSupport()
|
|
136
136
|
const webpSupport = getWebpSupport()
|
|
137
137
|
|
|
138
138
|
|
|
139
139
|
const getRequestSrc = useCallback((src) => {
|
|
140
140
|
const requestSrc = getQualityImage(
|
|
141
141
|
imgSrc,
|
|
142
142
|
{ isSkuImage, size: measureRef?.current?.getBoundingClientRect()?.width }
|
|
143
143
|
)
|
|
144
144
|
requestSrcRef.current = requestSrc
|
|
145
145
|
return requestSrc
|
|
146
146
|
}, [src])
|
|
147
147
|
const imageErrorRetry = (src) => {
|
|
148
148
|
return new Promise((resolve, reject) => {
|
|
149
149
|
if(fetch && window && window.Image){
|
|
150
150
|
fetch(src)
|
|
151
151
|
.then(response => {
|
|
152
152
|
const {ok, status} = response
|
|
153
153
|
if (ok) {
|
|
154
154
|
const originUrl = src.replace(/\.(jpe?g|png).*/, '.$1')
|
|
155
155
|
response.blob().then(blob => {
|
|
156
156
|
if(URL){
|
|
157
157
|
const url = URL.createObjectURL(blob)
|
|
158
158
|
const img = new window.Image()
|
|
159
159
|
img.src = url;
|
|
160
160
|
img.onload = () => {
|
|
161
161
|
reportSGM({status, text: '再次请求并且onload了', type: 'retryAndOnload', requestSrc: src, resolveUrl: url})
|
|
162
162
|
resolve({
|
|
163
163
|
ok: true,
|
|
164
164
|
url
|
|
165
165
|
})
|
|
166
166
|
setTimeout(() => {
|
|
167
167
|
URL.revokeObjectURL(url)
|
|
168
168
|
}, 2000)
|
|
169
169
|
};
|
|
170
170
|
img.onerror = () => {
|
|
171
171
|
reportSGM({status, text: '图片解析异常', type: 'imageParseError', requestSrc: src})
|
|
172
172
|
URL.revokeObjectURL(url)
|
|
173
173
|
resolve({
|
|
174
174
|
ok: true,
|
|
175
175
|
url: originUrl
|
|
176
176
|
})
|
|
177
177
|
};
|
|
178
178
|
}else{
|
|
179
179
|
resolve({
|
|
180
180
|
ok: true,
|
|
181
181
|
url: originUrl
|
|
182
182
|
})
|
|
183
183
|
}
|
|
184
184
|
}).catch(error => {
|
|
185
185
|
resolve({
|
|
186
186
|
ok: true,
|
|
187
187
|
url: originUrl
|
|
188
188
|
})
|
|
189
189
|
console.error('LazyLoadImage imageErrorRetry() error:', error)
|
|
190
190
|
});
|
|
191
191
|
}else {
|
|
192
192
|
if(status === 404){
|
|
193
193
|
resolve({
|
|
194
194
|
ok: false,
|
|
195
195
|
text: '访问图片不存在',
|
|
196
196
|
type: 'noSuchUrlImage',
|
|
197
197
|
})
|
|
198
198
|
}else{
|
|
199
199
|
resolve({
|
|
200
200
|
ok: false,
|
|
201
201
|
status: status,
|
|
202
202
|
text: '其它图片问题',
|
|
203
203
|
type: 'otherImageError',
|
|
204
204
|
})
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
})
|
|
208
208
|
.catch(error => {
|
|
209
209
|
resolve({
|
|
210
210
|
ok: false,
|
|
211
211
|
text: '网络异常',
|
|
212
212
|
type: 'networkError',
|
|
213
213
|
})
|
|
214
214
|
console.error('LazyLoadImage imageErrorRetry() error:', error)
|
|
215
215
|
});
|
|
216
216
|
}else{
|
|
217
217
|
resolve({
|
|
218
218
|
ok: false,
|
|
219
219
|
text: '不支持重试',
|
|
220
220
|
type: 'notSupportRetry',
|
|
221
221
|
})
|
|
222
222
|
}
|
|
223
223
|
})
|
|
224
224
|
|
|
225
225
|
|
|
226
226
|
const reportSGM = ({status, text, type, requestSrc = imgSrc, resolveUrl = ''}) => {
|
|
227
227
|
const { shopId, venderId } = global.info.queryInfo || {}
|
|
228
228
|
sgmCustomReport({
|
|
229
229
|
code: getSgmCustomCode(`${SgmCustomCode.IMAGE_LOAD}_${type}`),
|
|
230
230
|
msg: {
|
|
231
231
|
avifSupport,
|
|
232
232
|
webpSupport,
|
|
233
233
|
shopId,
|
|
234
234
|
venderId,
|
|
235
235
|
originSrc: src,
|
|
236
236
|
requestSrc,
|
|
237
237
|
resolveUrl,
|
|
238
238
|
status,
|
|
239
239
|
text
|
|
240
240
|
},
|
|
241
241
|
})
|
|
242
242
|
}
|
|
243
243
|
const imageErrorHandle = useCallback(
|
|
244
244
|
(e) => {
|
|
245
245
|
console.log(' ==============> 图片加载错误', e)
|
|
246
246
|
if (!hasRetryRef.current) {
|
|
247
247
|
hasRetryRef.current = true
|
|
248
248
|
if(src){
|
|
249
249
|
try{
|
|
250
250
|
imageErrorRetry(requestSrcRef.current).then((result) => {
|
|
251
251
|
const { status, ok, text, type, url } = result || {}
|
|
252
252
|
if(ok){
|
|
253
253
|
setImgSrc(url)
|
|
254
254
|
setHasRetrySuccess(true)
|
|
255
255
|
}else{
|
|
256
256
|
errorSrc && setImgSrc(errorSrc)
|
|
257
257
|
hideErrorImage && setImageErrState(true)
|
|
258
258
|
typeof onError === 'function' && onError(e, src, props)
|
|
259
259
|
reportSGM({status, text, type, requestSrc: requestSrcRef.current})
|
|
260
260
|
}
|
|
261
261
|
})
|
|
262
262
|
}catch(e){
|
|
263
263
|
console.error('LazyLoadImage imageErrorHandle() error:', e)
|
|
264
264
|
errorSrc && setImgSrc(errorSrc)
|
|
265
265
|
hideErrorImage && setImageErrState(true)
|
|
266
266
|
typeof onError === 'function' && onError(e, src, props)
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
}else{
|
|
270
270
|
reportSGM({status: '', text: '渲染原始图片渲染异常', type: 'renderOriginImageError'})
|
|
271
271
|
if(imgSrc.includes('blob:')){
|
|
272
272
|
reportSGM({status: '', text: '渲染本地blob图片异常', type: 'renderBlobImageError'})
|
|
273
273
|
}else{
|
|
274
274
|
reportSGM({status: '', text: '渲染本地非blob图片异常', type: 'renderNoBlobImageError'})
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
},
|
|
278
278
|
[src, hasRetryRef.current],
|
|
279
279
|
)
|
|
280
280
|
|
|
281
281
|
|
|
282
282
|
const imageLoad = useCallback(
|
|
283
283
|
(_src, event) => {
|
|
284
284
|
setLoadSuccess(true)
|
|
285
285
|
typeof onLoad === 'function' && onLoad(event, src, props)
|
|
286
286
|
},
|
|
287
287
|
[src],
|
|
288
288
|
)
|
|
289
289
|
|
|
290
290
|
const changeStyleIncludeWidthAndHeightAndBgColor = () => {
|
|
291
291
|
const changeStyle = {}
|
|
292
292
|
width && (changeStyle['width'] = width)
|
|
293
293
|
height && (changeStyle['height'] = height)
|
|
294
294
|
backgroundColor && (changeStyle['backgroundColor'] = backgroundColor)
|
|
295
295
|
return changeStyle
|
|
296
296
|
}
|
|
297
297
|
useEffect(() => {
|
|
298
298
|
try{
|
|
299
299
|
const { mode } = otherOption
|
|
300
300
|
if(mode && mode === 'heightFix'){
|
|
301
301
|
className?.split(/\s/)?.forEach(item => {
|
|
302
302
|
const userDefinedClass = getRuleBySelector('.' + item)
|
|
303
303
|
const userDefinedHeight = userDefinedClass?.style?.height
|
|
304
304
|
if(userDefinedHeight === '' || userDefinedHeight === 'auto'){
|
|
305
305
|
console.warn("🚗 ~~ 发现一例用户使用图片组件设置了 mode='heightFix' 并且没有定义一个具体高度:", userDefinedHeight, {
|
|
306
306
|
code: getSgmCustomCode(`imageUsageCheck`),
|
|
307
307
|
msg: {
|
|
308
308
|
userDefinedClass: item,
|
|
309
309
|
userDefinedHeight
|
|
310
310
|
},
|
|
311
311
|
})
|
|
312
312
|
sgmCustomReport({
|
|
313
313
|
code: getSgmCustomCode(`imageUsageCheck`),
|
|
314
314
|
msg: {
|
|
315
315
|
userDefinedClass: item,
|
|
316
316
|
userDefinedHeight
|
|
317
317
|
},
|
|
318
318
|
})
|
|
319
319
|
}
|
|
320
320
|
})
|
|
321
321
|
}
|
|
322
322
|
}catch(e){
|
|
323
323
|
console.warn('imageUsageCheck error:', e)
|
|
324
324
|
}
|
|
325
325
|
setMeasureComplete(true)
|
|
326
326
|
if (needShowHighVersion) return
|
|
327
327
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
328
328
|
!componentShowStateRef.current && dealPageScrollInfo(latestRes)
|
|
329
329
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL, (res) => {
|
|
330
330
|
!componentShowStateRef.current && dealPageScrollInfo(res)
|
|
331
331
|
})
|
|
332
332
|
}, [])
|
|
333
333
|
|
|
334
334
|
const dealPageScrollInfo = (res) => {
|
|
335
335
|
const { displayHeight, offSetY } = getNativePageScrollRes(res) || {}
|
|
336
336
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
337
337
|
if (measureRef.current) {
|
|
338
338
|
const eleClientRect =
|
|
339
339
|
measureRef.current.getBoundingClientRect()
|
|
340
340
|
const getContainerHeightOffSetY =
|
|
341
341
|
displayHeight * 1.5 + offSetY
|
|
342
342
|
const eleOffsetTop = Math.ceil(eleClientRect.top)
|
|
343
343
|
const eleOffsetHeight = Math.ceil(eleClientRect.height)
|
|
344
344
|
if (!componentShowStateRef.current) {
|
|
345
345
|
if (getContainerHeightOffSetY > eleOffsetTop) {
|
|
346
346
|
componentShowStateRef.current = true
|
|
347
347
|
setComponentShowState(true)
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
return (
|
|
353
353
|
isH5AndJdShopView &&
|
|
354
354
|
global?.config?.needImageLazy !== false &&
|
|
355
355
|
!needShowHighVersion &&
|
|
356
356
|
!isAppStowShop ? (
|
|
357
357
|
<View
|
|
358
358
|
ref={measureRef}
|
|
359
359
|
className={classNames(
|
|
360
360
|
imageStyle["d-app-lazy-image"],
|
|
361
361
|
{
|
|
362
362
|
[imageStyle["d-lazy-sku-image"]]: isSkuImage,
|
|
363
363
|
},
|
|
364
364
|
{
|
|
365
365
|
[imageStyle["d-hide-image-error"]]: imageErrState,
|
|
366
366
|
},
|
|
367
367
|
{
|
|
368
368
|
[imageStyle["d-load-completed"]]: loadSuccess,
|
|
369
369
|
},
|
|
370
370
|
{
|
|
371
371
|
"d-imag-rendering-crisp-edges":
|
|
372
372
|
!global.info.pageInfo.isVipShop && imagRenderingSet,
|
|
373
373
|
},
|
|
374
374
|
"J_html5ImageBg",
|
|
375
375
|
className
|
|
376
376
|
)}
|
|
377
377
|
style={{
|
|
378
378
|
...style,
|
|
379
379
|
...changeStyleIncludeWidthAndHeightAndBgColor(),
|
|
380
380
|
}}
|
|
381
381
|
{...otherOption}
|
|
382
382
|
>
|
|
383
383
|
{(componentShowState || lazyLoad === false) && (
|
|
384
384
|
<img
|
|
385
385
|
src={getQualityImage(
|
|
386
386
|
imgSrc,
|
|
387
387
|
global.info.pageInfo.isVipShop
|
|
388
388
|
? NetWorkTypeQuality["perfect"]
|
|
389
389
|
: NetWorkTypeQuality[getNetWorkType]
|
|
390
390
|
)}
|
|
391
391
|
onLoad={imageLoad.bind(this, imgSrc)}
|
|
392
392
|
onError={imageErrorHandle}
|
|
393
393
|
/>
|
|
394
394
|
)}
|
|
395
395
|
</View>
|
|
396
396
|
) : enableAvifOptimize ? (
|
|
397
397
|
[
|
|
398
398
|
measureComplete ? (
|
|
399
399
|
<Image
|
|
400
400
|
key={hasRetrySuccess? "realImageRetry": "realImage"}
|
|
401
401
|
style={{
|
|
402
402
|
...style,
|
|
403
403
|
...changeStyleIncludeWidthAndHeightAndBgColor(),
|
|
404
404
|
}}
|
|
405
405
|
className={classNames(
|
|
406
406
|
imageStyle["d-lazy-image"],
|
|
407
407
|
{
|
|
408
408
|
[imageStyle["d-lazy-sku-image"]]: isSkuImage,
|
|
409
409
|
},
|
|
410
410
|
{
|
|
411
411
|
[imageStyle["d-hide-image-error"]]: imageErrState,
|
|
412
412
|
},
|
|
413
413
|
{
|
|
414
414
|
[imageStyle["d-load-completed"]]: loadSuccess,
|
|
415
415
|
},
|
|
416
416
|
{
|
|
417
417
|
"d-imag-rendering-crisp-edges": imagRenderingSet,
|
|
418
418
|
},
|
|
419
419
|
className
|
|
420
420
|
)}
|
|
421
421
|
src={hasRetrySuccess? imgSrc: getRequestSrc(imgSrc)}
|
|
422
422
|
lazyLoad={isChartH5 ? false : lazyLoad}
|
|
423
423
|
onError={imageErrorHandle}
|
|
424
424
|
onLoad={imageLoad.bind(this, imgSrc)}
|
|
425
425
|
{...otherOption}
|
|
426
426
|
/>
|
|
427
427
|
) : (
|
|
428
428
|
<Image
|
|
429
429
|
key="defaultImage"
|
|
430
430
|
style={{
|
|
431
431
|
...style,
|
|
432
432
|
...changeStyleIncludeWidthAndHeightAndBgColor(),
|
|
433
433
|
}}
|
|
434
434
|
className={classNames(
|
|
435
435
|
imageStyle["d-lazy-image"],
|
|
436
436
|
{
|
|
437
437
|
[imageStyle["d-lazy-sku-image"]]: isSkuImage,
|
|
438
438
|
},
|
|
439
439
|
{
|
|
440
440
|
[imageStyle["d-hide-image-error"]]: imageErrState,
|
|
441
441
|
},
|
|
442
442
|
{
|
|
443
443
|
[imageStyle["d-load-completed"]]: loadSuccess,
|
|
444
444
|
},
|
|
445
445
|
{
|
|
446
446
|
"d-imag-rendering-crisp-edges": imagRenderingSet,
|
|
447
447
|
},
|
|
448
448
|
className
|
|
449
449
|
)}
|
|
450
450
|
src={isSkuImage ? DEFAULT_SKU_SRC : DEFAULT_SRC}
|
|
451
451
|
/>
|
|
452
452
|
),
|
|
453
453
|
loadSuccess ? null : <View key="measureRef" ref={measureRef}></View>,
|
|
454
454
|
]
|
|
455
455
|
) : (
|
|
456
456
|
<Image
|
|
457
457
|
style={{
|
|
458
458
|
...style,
|
|
459
459
|
...changeStyleIncludeWidthAndHeightAndBgColor(),
|
|
460
460
|
}}
|
|
461
461
|
className={classNames(
|
|
462
462
|
imageStyle["d-lazy-image"],
|
|
463
463
|
{
|
|
464
464
|
[imageStyle["d-lazy-sku-image"]]: isSkuImage,
|
|
465
465
|
},
|
|
466
466
|
{
|
|
467
467
|
[imageStyle["d-hide-image-error"]]: imageErrState,
|
|
468
468
|
},
|
|
469
469
|
{
|
|
470
470
|
[imageStyle["d-load-completed"]]: loadSuccess,
|
|
471
471
|
},
|
|
472
472
|
{
|
|
473
473
|
"d-imag-rendering-crisp-edges": imagRenderingSet,
|
|
474
474
|
},
|
|
475
475
|
className
|
|
476
476
|
)}
|
|
477
477
|
src={getQualityImage(imgSrc, NetWorkTypeQuality[getNetWorkType])}
|
|
478
478
|
lazyLoad={isChartH5 ? false : lazyLoad}
|
|
479
479
|
onError={imageErrorHandle}
|
|
480
480
|
onLoad={imageLoad.bind(this, imgSrc)}
|
|
481
481
|
{...otherOption}
|
|
482
482
|
/>
|
|
483
483
|
)
|
|
484
484
|
)
|
|
485
485
|
lazyLoad: true,
|
|
486
486
|
isSkuImage: false,
|
|
487
487
|
hideErrorImage: false,
|
|
488
488
|
imagRenderingSet: true,
|
|
489
489
|
src: null,
|
|
490
490
|
style: null,
|
|
491
491
|
width: null,
|
|
492
492
|
height: null,
|
|
493
493
|
backgroundColor: null,
|
|
494
494
|
className: null,
|
|
495
495
|
errorSrc: null,
|
|
496
496
|
onLoad: null,
|
|
497
497
|
onError: null,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
.d-mobile-header-layout {
|
|
3
|
+
position: relative;
|
|
4
|
+
z-index: 12;
|
|
5
|
+
.d-mobile-common-tip,
|
|
6
|
+
.d-mobile-common-header {
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
:global {
|
|
11
|
+
.d-mobile-header-sticky {
|
|
12
|
+
position: fixed;
|
|
13
|
+
top: 0;
|
|
14
|
+
width: 100%;
|
|
15
|
+
z-index: 999;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -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
|
No_Data_Bmall:'no-data-bmall',
|
|
2
|
+
import { NETWORK_DATA_TYPE } from '../../../common/const';
|
|
3
3
|
[NETWORK_DATA_TYPE.NO_NET_WORK]: global?.languageJsonData?.loseNetwork || '网络连接已断开',
|
|
4
4
|
[NETWORK_DATA_TYPE.DATA_ERROR]:
|
|
5
5
|
global?.languageJsonData?.highTraffic || '活动太火爆,访问人数较多',
|
|
6
6
|
[NETWORK_DATA_TYPE.NO_DATA]: global?.languageJsonData?.highTraffic || '活动太火爆,访问人数较多',
|
|
7
7
|
[NETWORK_DATA_TYPE.RISK]: global?.languageJsonData?.highTraffic || '活动太火爆,访问人数较多',
|
|
8
8
|
[NETWORK_DATA_TYPE.NO_NET_WORK]: global?.languageJsonData?.checkNetwork || '请检查您的网络设置',
|
|
9
9
|
[NETWORK_DATA_TYPE.DATA_ERROR]:
|
|
10
10
|
global?.languageJsonData?.pageLoadFailed || '排队进场中,请稍后再试',
|
|
11
11
|
[NETWORK_DATA_TYPE.NO_DATA]: global?.languageJsonData?.pageLoadFailed || '排队进场中,请稍后再试',
|
|
12
12
|
[NETWORK_DATA_TYPE.RISK]: `${global?.languageJsonData?.pageLoadFailed || '排队进场中,请稍后再试'}。`,
|
|
13
13
|
NETWORK_DATA_TYPE.NO_NET_WORK,
|
|
14
14
|
NETWORK_DATA_TYPE.DATA_ERROR,
|
|
15
15
|
NETWORK_DATA_TYPE.NO_DATA,
|
|
16
16
|
NETWORK_DATA_TYPE.RISK,
|
|
17
17
|
PART: 'part',
|
|
18
18
|
FULL: 'full',
|
|
19
19
|
No_Data_Default_Tip: 'no-data-default-tip',
|
|
20
20
|
No_Data_Tip_1: 'no-data-tip-1',
|
|
21
21
|
No_Data_Tip_2: 'no-data-tip-2',
|
|
22
22
|
No_Network_Err_Tip: 'no-network',
|
|
23
23
|
No_Data_Bmall: 'no-data-bmall',
|
|
24
24
|
OLD: 'old',
|
|
25
25
|
NEW: 'new',
|