@conecli/cone-render 0.8.20 → 0.8.21-shop-beta.3
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/dist/api/index.ts +1 -1
- package/dist/common/const.ts +1 -1
- 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/isvStorage/index.h5.ts +1 -0
- package/dist/common/isvStorage/index.ts +1 -0
- package/dist/common/token/const.ts +1 -0
- package/dist/common/token/index.h5.ts +1 -0
- package/dist/common/token/index.ts +1 -0
- package/dist/common/token/token.jd.ts +1 -0
- package/dist/common/token/token.ts +1 -0
- package/dist/common/token/token.wxapp.ts +1 -0
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CommonFloorHead/index.module.scss +1 -1
- package/dist/components/base/CommonFloorHead/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/CustomVideo/const.ts +1 -0
- package/dist/components/base/CustomVideo/index.module.scss +40 -64
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +6 -2
- package/dist/components/base/Dialog/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/const.ts +1 -0
- package/dist/components/base/ExposureSmart/index.h5.module.scss +18 -4
- 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/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/NetworkDataError/const.ts +1 -1
- package/dist/components/base/NetworkDataError/index.module.scss +7 -1
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/{const.ts → Base/const.ts} +0 -0
- package/dist/components/base/Price/Base/index.module.scss +136 -0
- package/dist/components/base/Price/Base/index.tsx +1 -0
- package/dist/components/base/Price/Double/index.module.scss +158 -0
- package/dist/components/base/Price/Double/index.tsx +1 -0
- package/dist/components/base/Price/index.tsx +1 -1
- 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 -0
- package/dist/components/floorItem.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/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.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 -0
- package/dist/jumpEventReport/web.jdjch.ts +1 -0
- package/dist/jumpEventReport/web.wxapp.ts +1 -1
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/modules/ContainerFloorList/index.h5.module.scss +10 -1
- 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/index.ts +1 -1
- package/dist/open/api/jump/business.ts +1 -0
- package/dist/open/api/jump/index.ts +1 -0
- package/dist/open/api/jump/minPath.ts +1 -0
- package/dist/open/api/jump/side.ts +1 -0
- package/dist/open/api/jump/webUrl.ts +1 -0
- package/dist/open/api/jump copy.ts +1 -0
- package/dist/open/api/moduleUtil.ts +1 -1
- package/dist/open/api/request.ts +1 -0
- package/dist/open/api/shopMember.ts +1 -0
- package/dist/open/api/track.ts +1 -1
- package/dist/open/api/userToken.ts +1 -0
- package/dist/open/api/util.ts +1 -1
- package/dist/open/components/index.ts +1 -1
- package/dist/service/bMallConst.ts +1 -0
- package/dist/service/bMallConst.weapp.ts +1 -0
- package/dist/service/fetchGateway.ts +1 -0
- package/dist/service/fetchJsonp.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -0
- package/dist/service/http/colorSign.weapp.ts +1 -0
- package/dist/service/http/const.ts +1 -0
- package/dist/service/http/http.ts +1 -0
- package/dist/service/http/httpInterceptors.jd.ts +1 -0
- package/dist/service/http/httpInterceptors.ts +1 -0
- package/dist/service/http/index.ts +1 -0
- package/dist/service/requestServer.ts +1 -0
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/connectNativeJsBridge.weapp.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/memberFormatUtils.js +1 -0
- package/dist/utils/priceUtils.js +1 -0
- package/dist/utils/ready.ts +1 -0
- package/dist/utils/utils.ts +1 -1
- package/package.json +9 -5
- package/dist/components/base/Price/index.module.scss +0 -136
- package/dist/open/api/jump.ts +0 -1
package/dist/utils/index.h5.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
nativePageShowToast, ToastAndroidType,
|
|
3
2
|
ToastIosType
|
|
4
3
|
getAppChannelType, isAndroidDevice, isH5AndJdShopView,
|
|
5
4
|
isH5AndJdShopViewNativeScroll, isIosDevice, isJdAndAndroidDevice, isJdAndIosDevice, isJdApp,
|
|
6
5
|
isWxApp, isWxMiniH5View, isH5AndJingGouMini, urlCookie
|
|
7
6
|
addHttps, clearTaroStorageKey, countStringify, dateFormat, dealAddress, dealShopContentData as originDealShopContentData, debounce, filterUrlQueryData, formatTabActiveMenuType, getQualityImage, getTaroStorageKeyValue,
|
|
8
7
|
getWxAppCookieStr, isH5, isJdMin, isWxMin,
|
|
9
8
|
isWxMinAndWxapp, lodashThrottle, objectToUrlEncode, parseQueryUrlString, removeTaroStorageKey, setLowSmallPicUrl,
|
|
10
9
|
setTaroStorage, showFailToast,
|
|
11
10
|
showNormalToast, showSuccessToast, sliceArrToChunkList, throttle
|
|
12
11
|
<span class="d-shop-loading-icon"></span>
|
|
13
12
|
<p class="d-shop-text">${text}</p>
|
|
14
13
|
</div>`
|
|
15
14
|
return originDealShopContentData(pageData, DraJSAgentReport, isvdev)
|
|
16
15
|
isJdApp,
|
|
17
16
|
isWxApp,
|
|
18
17
|
isIosDevice,
|
|
19
18
|
isAndroidDevice,
|
|
20
19
|
isJdAndIosDevice,
|
|
21
20
|
isJdAndAndroidDevice,
|
|
22
21
|
isWxMin,
|
|
23
22
|
isWxMinAndWxapp,
|
|
24
23
|
isJdMin,
|
|
25
24
|
isH5,
|
|
26
25
|
isH5AndJdShopView,
|
|
27
26
|
isH5AndJdShopViewNativeScroll,
|
|
28
27
|
isH5AndJingGouMini,
|
|
29
28
|
isWxMiniH5View,
|
|
30
29
|
urlCookie,
|
|
31
30
|
sliceArrToChunkList,
|
|
32
31
|
dealAddress,
|
|
33
32
|
objectToUrlEncode,
|
|
34
33
|
parseQueryUrlString,
|
|
35
34
|
setLowSmallPicUrl,
|
|
36
35
|
setTaroStorage,
|
|
37
36
|
getTaroStorageKeyValue,
|
|
38
37
|
removeTaroStorageKey,
|
|
39
38
|
clearTaroStorageKey,
|
|
40
39
|
getQualityImage,
|
|
41
40
|
countStringify,
|
|
42
41
|
getWxAppCookieStr,
|
|
43
42
|
getSystemInfos,
|
|
44
43
|
pxTransformFromData,
|
|
45
44
|
dateFormat,
|
|
46
45
|
throttle,
|
|
47
46
|
lodashThrottle,
|
|
48
47
|
debounce,
|
|
49
48
|
addHttps,
|
|
50
49
|
commonShowSuccessToast as showSuccessToast,
|
|
51
50
|
commonShowFailToast as showFailToast,
|
|
52
51
|
commonShowNormalToast as showNormalToast,
|
|
53
52
|
showShopLoading,
|
|
54
53
|
hideShopLoading,
|
|
55
54
|
getAppChannelType,
|
|
56
55
|
formatTabActiveMenuType,
|
|
57
56
|
filterUrlQueryData,
|
|
57
|
+
import Taro from '@tarojs/taro'
|
|
58
58
|
nativePageShowToast, ToastAndroidType,
|
|
59
59
|
ToastIosType,
|
|
60
60
|
getAppChannelType, isAndroidDevice, isH5AndJdShopView, isChartH5,
|
|
61
61
|
isH5AndJdShopViewNativeScroll, isIosDevice, isJdAndAndroidDevice, isJdAndIosDevice, isJdApp,
|
|
62
62
|
isWxApp, isWxMiniH5View, isH5AndJingGouMini, urlCookie,
|
|
63
63
|
sgmCustomReport, isMemberPage, isH5AndJdShopViewH5Scroll
|
|
64
64
|
addHttps,
|
|
65
65
|
clearTaroStorageKey,
|
|
66
66
|
countStringify,
|
|
67
67
|
dateFormat,
|
|
68
68
|
dealAddress,
|
|
69
69
|
dealShopContentData as originDealShopContentData,
|
|
70
70
|
debounce,
|
|
71
71
|
filterUrlQueryData,
|
|
72
72
|
formatTabActiveMenuType,
|
|
73
73
|
getQualityImage,
|
|
74
74
|
getTaroStorageKeyValue,
|
|
75
75
|
getWxAppCookieStr,
|
|
76
76
|
isH5,
|
|
77
77
|
isJdMin,
|
|
78
78
|
isWxMin,
|
|
79
79
|
isWxMinAndWxapp,
|
|
80
80
|
lodashThrottle,
|
|
81
81
|
objectToUrlEncode,
|
|
82
82
|
parseQueryUrlString,
|
|
83
83
|
removeTaroStorageKey,
|
|
84
84
|
setLowSmallPicUrl,
|
|
85
85
|
setTaroStorage,
|
|
86
86
|
showFailToast,
|
|
87
87
|
showNormalToast,
|
|
88
88
|
showSuccessToast,
|
|
89
89
|
sliceArrToChunkList,
|
|
90
90
|
throttle,
|
|
91
91
|
windowWidth: window.innerWidth,
|
|
92
92
|
containerWidth: buildType === BUILD_TYPE.CLASSIFY ? window.innerWidth - 100 : window.innerWidth,
|
|
93
93
|
screenWidth: window.innerWidth,
|
|
94
94
|
platform: '',
|
|
95
95
|
model: '',
|
|
96
96
|
system: '',
|
|
97
97
|
getSystemInfo.windowWidth = getSystemInfo.screenWidth
|
|
98
98
|
const params = Object.assign(
|
|
99
99
|
{},
|
|
100
100
|
{
|
|
101
101
|
title: '',
|
|
102
102
|
duration: 1500,
|
|
103
103
|
},
|
|
104
104
|
options,
|
|
105
105
|
)
|
|
106
106
|
params.duration = params.duration / 1000
|
|
107
107
|
if (isJdApp && isH5AndJdShopView) {
|
|
108
108
|
const showSuccessType = isIosDevice
|
|
109
109
|
? ToastIosType.SUCCESS
|
|
110
110
|
: ToastAndroidType.SUCCESS
|
|
111
111
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
112
112
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
113
113
|
console.log('执行原生toast success')
|
|
114
114
|
} else {
|
|
115
115
|
showSuccessToast(options)
|
|
116
116
|
}
|
|
117
117
|
const params = Object.assign(
|
|
118
118
|
{},
|
|
119
119
|
{
|
|
120
120
|
title: '',
|
|
121
121
|
duration: 1500,
|
|
122
122
|
},
|
|
123
123
|
options,
|
|
124
124
|
)
|
|
125
125
|
params.duration = params.duration / 1000
|
|
126
126
|
console.log(`isJdApp${isJdApp}`)
|
|
127
127
|
if (isJdApp && isH5AndJdShopView) {
|
|
128
128
|
const showSuccessType = isIosDevice
|
|
129
129
|
? ToastIosType.FAIL
|
|
130
130
|
: ToastAndroidType.FAIL
|
|
131
131
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
132
132
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
133
133
|
console.log('执行原生toast fail')
|
|
134
134
|
} else {
|
|
135
135
|
console.log('执行H5 toast fail')
|
|
136
136
|
showFailToast(options)
|
|
137
137
|
}
|
|
138
138
|
const params = Object.assign(
|
|
139
139
|
{},
|
|
140
140
|
{
|
|
141
141
|
title: '',
|
|
142
142
|
duration: 1500,
|
|
143
143
|
},
|
|
144
144
|
options,
|
|
145
145
|
)
|
|
146
146
|
params.duration = params.duration / 1000
|
|
147
147
|
if (isJdApp) {
|
|
148
148
|
const showSuccessType = isIosDevice
|
|
149
149
|
? ToastIosType.NORMAL
|
|
150
150
|
: ToastAndroidType.NORMAL
|
|
151
151
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
152
152
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
153
153
|
} else {
|
|
154
154
|
showNormalToast(options)
|
|
155
155
|
}
|
|
156
156
|
const createLoadingEle = document.createElement('div')
|
|
157
157
|
createLoadingEle.id = 'J_shopLoading'
|
|
158
158
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
|
|
159
159
|
createLoadingEle.innerHTML = `<div class='d-loading-content'>
|
|
160
160
|
<span class='d-shop-loading-icon'></span>
|
|
161
161
|
<p class='d-shop-text'>${text}</p>
|
|
162
162
|
</div>`
|
|
163
163
|
const getEle = document.body ? document.body : document.getElementsByTagName('body')[0]
|
|
164
164
|
console.log('获取getEle及append及appendChild方法', getEle, getEle?.append, getEle?.appendChild)
|
|
165
165
|
getEle.appendChild(createLoadingEle)
|
|
166
166
|
const getEle = document.getElementById('J_shopLoading')
|
|
167
167
|
getEle && getEle.remove()
|
|
168
168
|
num,
|
|
169
169
|
widthSize = 375,
|
|
170
170
|
layoutWidth = getSystemInfo.windowWidth,
|
|
171
171
|
const getNum = Number(num)
|
|
172
172
|
return Math.round((getNum / widthSize) * layoutWidth)
|
|
173
173
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo
|
|
174
174
|
if (!systemInfo.system && window) {
|
|
175
175
|
systemInfo.system = window.navigator.userAgent
|
|
176
176
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
|
|
177
177
|
}
|
|
178
178
|
const isIOS = !!systemInfo?.system.match(/ios/i)
|
|
179
179
|
const isAndroid = !!systemInfo?.system.match(/android/i)
|
|
180
180
|
systemInfo.navBarHeight = 0
|
|
181
181
|
systemInfo.statusBarHeight = 0
|
|
182
182
|
systemInfo.capsulePosition = null
|
|
183
183
|
systemInfo.isIOS = isIOS
|
|
184
184
|
systemInfo.isAndroid = isAndroid
|
|
185
185
|
return systemInfo
|
|
186
186
|
return originDealShopContentData(pageData, sgmCustomReport, isvdev)
|
|
187
187
|
isJdApp,
|
|
188
188
|
isWxApp,
|
|
189
189
|
isIosDevice,
|
|
190
190
|
isAndroidDevice,
|
|
191
191
|
isJdAndIosDevice,
|
|
192
192
|
isJdAndAndroidDevice,
|
|
193
193
|
isWxMin,
|
|
194
194
|
isWxMinAndWxapp,
|
|
195
195
|
isJdMin,
|
|
196
196
|
isH5,
|
|
197
197
|
isH5AndJdShopView,
|
|
198
198
|
isChartH5,
|
|
199
199
|
isH5AndJdShopViewNativeScroll,
|
|
200
200
|
isH5AndJdShopViewH5Scroll,
|
|
201
201
|
isH5AndJingGouMini,
|
|
202
202
|
isWxMiniH5View,
|
|
203
203
|
urlCookie,
|
|
204
204
|
sliceArrToChunkList,
|
|
205
205
|
dealAddress,
|
|
206
206
|
objectToUrlEncode,
|
|
207
207
|
parseQueryUrlString,
|
|
208
208
|
setLowSmallPicUrl,
|
|
209
209
|
setTaroStorage,
|
|
210
210
|
getTaroStorageKeyValue,
|
|
211
211
|
removeTaroStorageKey,
|
|
212
212
|
clearTaroStorageKey,
|
|
213
213
|
getQualityImage,
|
|
214
214
|
countStringify,
|
|
215
215
|
getWxAppCookieStr,
|
|
216
216
|
getSystemInfos,
|
|
217
217
|
pxTransformFromData,
|
|
218
218
|
dealShopContentDataAndReport as dealShopContentData,
|
|
219
219
|
dateFormat,
|
|
220
220
|
throttle,
|
|
221
221
|
lodashThrottle,
|
|
222
222
|
debounce,
|
|
223
223
|
addHttps,
|
|
224
224
|
commonShowSuccessToast as showSuccessToast,
|
|
225
225
|
commonShowFailToast as showFailToast,
|
|
226
226
|
commonShowNormalToast as showNormalToast,
|
|
227
227
|
showShopLoading,
|
|
228
228
|
hideShopLoading,
|
|
229
229
|
getAppChannelType,
|
|
230
230
|
formatTabActiveMenuType,
|
|
231
231
|
filterUrlQueryData,
|
|
232
232
|
sgmCustomReport,
|
|
233
233
|
isMemberPage,
|
|
234
234
|
memberFormatUtils,
|
|
235
235
|
getFloorDataToDataDefines
|
package/dist/utils/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
1
|
+
import Taro from '@tarojs/taro'
|
package/dist/utils/jm-common.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var splitOnFirst = function splitOnFirst(string, separator) {
|
|
2
1
|
return Object.prototype.toString.call(obj);
|
|
3
2
|
return typeof obj === 'function';
|
|
4
3
|
return '[object Object]' === getType(obj);
|
|
5
4
|
return '[object Array]' == getType(obj);
|
|
6
5
|
return '[object Undefined]' === getType(obj);
|
|
7
6
|
return '[object Null]' == getType(obj);
|
|
8
7
|
return typeof obj === 'string';
|
|
9
8
|
return typeof obj === 'boolean';
|
|
10
9
|
return '[object Number]' === getType(num);
|
|
11
10
|
ua = ua || navigator.userAgent;
|
|
12
11
|
if (name === 'wx') return (/micromessenger/i.test(ua)
|
|
13
12
|
);
|
|
14
13
|
if (name === 'qq') return (/qq\//i.test(ua)
|
|
15
14
|
);
|
|
16
15
|
if (name === 'weibo') return (/weibo/i.test(ua)
|
|
17
16
|
);
|
|
18
17
|
if (name === 'jd') return (/^jdapp/i.test(ua)
|
|
19
18
|
);
|
|
20
19
|
if (name === 'jdlittle') return (/^jdltapp/i.test(ua)
|
|
21
20
|
);
|
|
22
21
|
if (name === 'mp') return navigator.userAgent.match(/micromessenger/i) && navigator.userAgent.match(/miniprogram/i) || window.__wxjs_environment === 'miniprogram';
|
|
23
22
|
return false;
|
|
24
23
|
ua = ua || navigator.userAgent;
|
|
25
24
|
return (/android/i.test(ua) && !isIOS()
|
|
26
25
|
);
|
|
27
26
|
ua = ua || navigator.userAgent;
|
|
28
27
|
return (/ip(hone|od)|ipad/i.test(ua)
|
|
29
28
|
);
|
|
30
29
|
ua = ua || navigator.userAgent;
|
|
31
30
|
return (/ipad/i.test(ua) || /android/i.test(ua) && !/mobi|mini|fennec/i.test(ua)
|
|
32
31
|
);
|
|
33
32
|
ua = ua || navigator.userAgent;
|
|
34
33
|
return !!ua.match(/ip(hone|od)|android.+mobile|windows (ce|phone)|blackberry|bb10|symbian|webos|firefox.+fennec|opera m(ob|in)i|polaris|iemobile|lgtelecom|nokia|sonyericsson|dolfin|uzard|natebrowser|ktf;|skt;/i);
|
|
35
34
|
ua = ua || navigator.userAgent;
|
|
36
35
|
return !!ua.match(/iphone/i);
|
|
37
36
|
ua = ua || navigator.userAgent;
|
|
38
37
|
return !!ua.match(/ipad/i);
|
|
39
38
|
ua = ua || navigator.userAgent;
|
|
40
39
|
if (name === 'xview') return typeof window.XView !== 'undefined';
|
|
41
40
|
if (name === 'wk') return !!ua.match(/supportjdshwk/i) || window._is_jdsh_wkwebview == 1;
|
|
42
41
|
return false;
|
|
43
42
|
ua = ua || navigator.userAgent;
|
|
44
43
|
var re = /nettype\/([\S]*)/i;
|
|
45
44
|
if (isApp('jd', ua)) re = /network\/([^;]*)/i;
|
|
46
45
|
return re.test(ua) ? RegExp.$1.toLowerCase() : 'unknown';
|
|
47
46
|
ua = ua || navigator.userAgent;
|
|
48
47
|
if (!isApp('jd', ua)) return null;
|
|
49
48
|
return ua.split(';')[4];
|
|
50
49
|
ua = ua || navigator.userAgent;
|
|
51
50
|
if (appName === 'jd') return ua.split(';')[2] || null;
|
|
52
51
|
if (appName === 'wx') return (/micromessenger\/([\S]*)/i.test(ua) ? RegExp.$1 : null
|
|
53
52
|
);
|
|
54
53
|
if (appName === 'qq') return (/qq\/([\S]*)/i.test(ua) ? RegExp.$1 : null
|
|
55
54
|
);
|
|
56
55
|
return null;
|
|
57
56
|
ua = ua || navigator.userAgent;
|
|
58
57
|
var match = ua.match(/android\s([0-9\.]*)/i);
|
|
59
58
|
return match ? match[1] : 'unknown';
|
|
60
59
|
ua = ua || navigator.userAgent;
|
|
61
60
|
var match = ua.match(/OS ((\d+_?){2,3})\s/i);
|
|
62
61
|
return match ? match[1].replace(/_/g, '.') : 'unknown';
|
|
62
|
+
var splitOnFirst = function splitOnFirst(string, separator) {
|
|
63
63
|
return Object.prototype.toString.call(obj);
|
|
64
64
|
return typeof obj === 'function';
|
|
65
65
|
return '[object Object]' === getType(obj);
|
|
66
66
|
return '[object Array]' == getType(obj);
|
|
67
67
|
return '[object Undefined]' === getType(obj);
|
|
68
68
|
return '[object Null]' == getType(obj);
|
|
69
69
|
return typeof obj === 'string';
|
|
70
70
|
return typeof obj === 'boolean';
|
|
71
71
|
return '[object Number]' === getType(num);
|
|
72
72
|
ua = ua || navigator.userAgent;
|
|
73
73
|
if (name === 'wx') return (/micromessenger/i.test(ua)
|
|
74
74
|
);
|
|
75
75
|
if (name === 'qq') return (/qq\//i.test(ua)
|
|
76
76
|
);
|
|
77
77
|
if (name === 'weibo') return (/weibo/i.test(ua)
|
|
78
78
|
);
|
|
79
79
|
if (name === 'jd') return (/^jdapp/i.test(ua)
|
|
80
80
|
);
|
|
81
81
|
if (name === 'jdlittle') return (/^jdltapp/i.test(ua)
|
|
82
82
|
);
|
|
83
83
|
if (name === 'mp') return navigator.userAgent.match(/micromessenger/i) && navigator.userAgent.match(/miniprogram/i) || window.__wxjs_environment === 'miniprogram';
|
|
84
84
|
if (name === 'jdb') return (/JDBmall/i.test(ua) && /shop\.m\.jd\.com\/shop\/bhome/i.test(window.location.href));
|
|
85
85
|
if(name === 'jdjch') return (/jdjchshopapp/i.test(ua) || (/shop\.m\.jd\.com\/shop\/bhome/i.test(window.location.href)) && window.location.href.includes('channel')) ;
|
|
86
86
|
return false;
|
|
87
87
|
ua = ua || navigator.userAgent;
|
|
88
88
|
return (/android/i.test(ua) && !isIOS()
|
|
89
89
|
);
|
|
90
90
|
ua = ua || navigator.userAgent;
|
|
91
91
|
return (/ip(hone|od)|ipad/i.test(ua)
|
|
92
92
|
);
|
|
93
93
|
ua = ua || navigator.userAgent;
|
|
94
94
|
return (/ipad/i.test(ua) || /android/i.test(ua) && !/mobi|mini|fennec/i.test(ua)
|
|
95
95
|
);
|
|
96
96
|
ua = ua || navigator.userAgent;
|
|
97
97
|
return !!ua.match(/ip(hone|od)|android.+mobile|windows (ce|phone)|blackberry|bb10|symbian|webos|firefox.+fennec|opera m(ob|in)i|polaris|iemobile|lgtelecom|nokia|sonyericsson|dolfin|uzard|natebrowser|ktf;|skt;/i);
|
|
98
98
|
ua = ua || navigator.userAgent;
|
|
99
99
|
return !!ua.match(/iphone/i);
|
|
100
100
|
ua = ua || navigator.userAgent;
|
|
101
101
|
return !!ua.match(/ipad/i);
|
|
102
102
|
ua = ua || navigator.userAgent;
|
|
103
103
|
if (name === 'xview') return typeof window.XView !== 'undefined';
|
|
104
104
|
if (name === 'wk') return !!ua.match(/supportjdshwk/i) || window._is_jdsh_wkwebview == 1;
|
|
105
105
|
return false;
|
|
106
106
|
ua = ua || navigator.userAgent;
|
|
107
107
|
var re = /nettype\/([\S]*)/i;
|
|
108
108
|
if (isApp('jd', ua)) re = /network\/([^;]*)/i;
|
|
109
109
|
return re.test(ua) ? RegExp.$1.toLowerCase() : 'unknown';
|
|
110
110
|
ua = ua || navigator.userAgent;
|
|
111
111
|
if (!isApp('jd', ua)) return null;
|
|
112
112
|
return ua.split(';')[4];
|
|
113
113
|
ua = ua || navigator.userAgent;
|
|
114
114
|
if (appName === 'jd') return ua.split(';')[2] || null;
|
|
115
115
|
if (appName === 'wx') return (/micromessenger\/([\S]*)/i.test(ua) ? RegExp.$1 : null
|
|
116
116
|
);
|
|
117
117
|
if (appName === 'qq') return (/qq\/([\S]*)/i.test(ua) ? RegExp.$1 : null
|
|
118
118
|
);
|
|
119
119
|
return null;
|
|
120
120
|
ua = ua || navigator.userAgent;
|
|
121
121
|
var match = ua.match(/android\s([0-9\.]*)/i);
|
|
122
122
|
return match ? match[1] : 'unknown';
|
|
123
123
|
ua = ua || navigator.userAgent;
|
|
124
124
|
var match = ua.match(/OS ((\d+_?){2,3})\s/i);
|
|
125
125
|
return match ? match[1].replace(/_/g, '.') : 'unknown';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const PHONE_DECODE_ENCODE_KEY = 'myd#AlO%$*&^1dwTRwallet'
|
|
2
|
if (typeof date === 'number') {
|
|
1
3
|
date = new Date(date)
|
|
2
4
|
}
|
|
3
5
|
var o = {
|
|
4
6
|
'M+': date.getMonth() + 1,
|
|
5
7
|
'd+': date.getDate(),
|
|
6
8
|
'h+': date.getHours(),
|
|
7
9
|
'm+': date.getMinutes(),
|
|
8
10
|
's+': date.getSeconds(),
|
|
9
11
|
'q+': Math.floor((date.getMonth() + 3) / 3),
|
|
10
12
|
S: date.getMilliseconds(),
|
|
11
13
|
}
|
|
12
14
|
if (/(y+)/.test(format)) {
|
|
13
15
|
format = format.replace(
|
|
14
16
|
RegExp.$1,
|
|
15
17
|
(date.getFullYear() + '').substr(4 - RegExp.$1.length),
|
|
16
18
|
)
|
|
17
19
|
}
|
|
18
20
|
for (var k in o) {
|
|
19
21
|
if (new RegExp('(' + k + ')').test(format)) {
|
|
20
22
|
format = format.replace(
|
|
21
23
|
RegExp.$1,
|
|
22
24
|
RegExp.$1.length === 1
|
|
23
25
|
? o[k]
|
|
24
26
|
: ('00' + o[k]).substr(('' + o[k]).length),
|
|
25
27
|
)
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
return format
|
|
29
31
|
if (isEmpty(timestamp)) {
|
|
30
32
|
return
|
|
31
33
|
}
|
|
32
34
|
return formatData(timestamp, 'yyyy-MM-dd hh:mm:ss')
|
|
33
35
|
if (isEmpty(value)) {
|
|
34
36
|
return
|
|
35
37
|
}
|
|
36
38
|
value = value.toString()
|
|
37
39
|
value = value.replace(/\s/g, '')
|
|
38
40
|
return value && value.length === 11 && /^1\d{10}$/g.test(value)
|
|
39
41
|
if (isEmpty(value)) {
|
|
40
42
|
return false
|
|
41
43
|
}
|
|
42
44
|
const pattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/
|
|
43
45
|
value = value.toString()
|
|
44
46
|
value = value.replace(/\s/g, '')
|
|
45
47
|
return value && pattern.test(value)
|
|
46
48
|
return value.toString().replace(/\s/g, '')
|
|
47
49
|
var reg = /^\d$/
|
|
48
50
|
return value && reg.test(value)
|
|
49
51
|
var reg = /^\d{6}$/
|
|
50
52
|
return value && reg.test(value)
|
|
51
53
|
var result = []
|
|
52
54
|
for (var i = 0; i < arr.length; i++) {
|
|
53
55
|
if (result.indexOf(arr[i]) == -1) {
|
|
54
56
|
result.push(arr[i])
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
return result
|
|
58
60
|
var arr = result
|
|
59
61
|
for (var i = 0; i < arr.length; i++) {
|
|
60
62
|
for (var j = i + 1; j < arr.length; j++) {
|
|
61
63
|
if (arr[i] < arr[j]) {
|
|
62
64
|
var tmp = arr[i]
|
|
63
65
|
arr[i] = arr[j]
|
|
64
66
|
arr[j] = tmp
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
return arr
|
|
69
71
|
if (isEmpty(number)) {
|
|
70
72
|
return number
|
|
71
73
|
}
|
|
72
74
|
number = number.toString()
|
|
73
75
|
number = number.replace(/\s/g, '')
|
|
74
76
|
number = number.replace(' ', '').replace('-', '').replace('—', '')
|
|
75
77
|
if (number.indexOf('+86') == 0) {
|
|
76
78
|
number = number.substring(3)
|
|
77
79
|
}
|
|
78
80
|
if (number.length > 11) {
|
|
79
81
|
return number.substring(number.length - 11, number.length)
|
|
80
82
|
}
|
|
81
83
|
return number
|
|
82
84
|
if (val === null || val === '' || typeof val === 'undefined') {
|
|
83
85
|
return true
|
|
84
86
|
}
|
|
85
87
|
return false
|
|
86
88
|
if (isEmpty(number)) {
|
|
87
89
|
return
|
|
88
90
|
}
|
|
89
91
|
number = number.toString()
|
|
90
92
|
if (!isPhone(number)) {
|
|
91
93
|
return
|
|
92
94
|
}
|
|
93
95
|
return number.substring(0, 3) + '****' + number.substring(7, 11)
|
|
94
96
|
if (isEmpty(value)) {
|
|
95
97
|
return
|
|
96
98
|
}
|
|
97
99
|
value = value.toString()
|
|
98
100
|
if (!isPhone(value)) {
|
|
99
101
|
return
|
|
100
102
|
}
|
|
101
103
|
return (
|
|
102
104
|
value.substring(0, 3) +
|
|
103
105
|
' ' +
|
|
104
106
|
value.substring(3, 7) +
|
|
105
107
|
' ' +
|
|
106
108
|
value.substring(7, 11)
|
|
107
109
|
)
|
|
108
110
|
if (isEmpty(value)) {
|
|
109
111
|
return ''
|
|
110
112
|
}
|
|
111
113
|
value = value.toString()
|
|
112
114
|
var tempValue = ''
|
|
113
115
|
for (var i = 0; i < value.length; i = i + 3) {
|
|
114
116
|
tempValue += value.substr(i, 3) + ' '
|
|
115
117
|
}
|
|
116
118
|
return tempValue
|
|
117
119
|
var chnNumChar = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九']
|
|
118
120
|
var chnUnitSection = ['', '万', '亿', '万亿', '亿亿']
|
|
119
121
|
var chnUnitChar = ['', '十', '百', '千']
|
|
120
122
|
var strIns = '',
|
|
121
123
|
chnStr = ''
|
|
122
124
|
var unitPos = 0
|
|
123
125
|
var zero = true
|
|
124
126
|
while (section > 0) {
|
|
125
127
|
var v = section % 10
|
|
126
128
|
if (v === 0) {
|
|
127
129
|
if (!zero) {
|
|
128
130
|
zero = true
|
|
129
131
|
chnStr = chnNumChar[v] + chnStr
|
|
130
132
|
}
|
|
131
133
|
} else {
|
|
132
134
|
zero = false
|
|
133
135
|
strIns = chnNumChar[v]
|
|
134
136
|
strIns += chnUnitChar[unitPos]
|
|
135
137
|
chnStr = strIns + chnStr
|
|
136
138
|
}
|
|
137
139
|
unitPos++
|
|
138
140
|
section = Math.floor(section / 10)
|
|
139
141
|
}
|
|
140
142
|
return chnStr
|
|
141
143
|
const uri = src.replace(/^(https?:)?\/\//, 'https:');
|
|
142
144
|
return { uri }
|
|
143
145
|
if (!url) {
|
|
144
146
|
return url
|
|
145
147
|
}
|
|
146
148
|
if (url.indexOf('jfs') == 0) {
|
|
147
149
|
url = `https://${DOMAIN}/zx/${url}`
|
|
148
150
|
} else {
|
|
149
151
|
url = url.replace(/^(https?:)?\/\//, 'https:')
|
|
150
152
|
}
|
|
151
153
|
if (!width || !height) {
|
|
152
154
|
return url
|
|
153
155
|
}
|
|
154
156
|
const jsfImageDomainRegexp =
|
|
155
157
|
/(m|img10|img11|img12|img13|img14|img20|img30)\.360buyimg\.com/
|
|
156
158
|
if (!jsfImageDomainRegexp.test(url)) {
|
|
157
159
|
return url
|
|
158
160
|
}
|
|
159
161
|
try {
|
|
160
162
|
const widthPx = PixelRatio.getPixelSizeForLayoutSize(width)
|
|
161
163
|
const heightPx = PixelRatio.getPixelSizeForLayoutSize(height)
|
|
162
164
|
const reg = /\/s\d{1,}x\d{1,}_/
|
|
163
165
|
if (reg.test(url)) {
|
|
164
166
|
return url.replace(reg, `/s${widthPx}x${heightPx}_`)
|
|
165
167
|
}
|
|
166
168
|
let arr = url.split('.')
|
|
167
169
|
let businessPath = arr[2].split('/')
|
|
168
170
|
let businessName = businessPath[2]
|
|
169
171
|
businessPath[2] = ['s', widthPx, 'x', heightPx, '_' + businessName].join('')
|
|
170
172
|
arr[2] = businessPath.join('/')
|
|
171
173
|
return arr.join('.')
|
|
172
174
|
} catch (e) {
|
|
173
175
|
return url
|
|
174
176
|
}
|
|
175
177
|
let getParams = false
|
|
176
178
|
if (isOpenJdAppUrl(openAppUrl)) {
|
|
177
179
|
try {
|
|
178
180
|
getParams = openAppUrl.replace(
|
|
179
181
|
/openApp\.jdMobile:\/\/virtual\?params=/i,
|
|
180
182
|
'',
|
|
181
183
|
)
|
|
182
184
|
getParams = JSON.parse(String(getParams))
|
|
183
185
|
} catch (e) {
|
|
184
186
|
console.log(e)
|
|
185
187
|
}
|
|
186
188
|
}
|
|
187
189
|
return getParams
|
|
188
190
|
return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl)
|
|
189
191
|
formatData,
|
|
190
192
|
formatDateToSec,
|
|
191
193
|
formatPhoneNumber,
|
|
192
194
|
isEmpty,
|
|
193
195
|
isPhone,
|
|
194
196
|
isEmail,
|
|
195
197
|
unique,
|
|
196
198
|
isNumeric,
|
|
197
199
|
isMsgCode,
|
|
198
200
|
formatPhone,
|
|
199
201
|
formatCardNumber,
|
|
200
202
|
sort,
|
|
201
203
|
delSpace,
|
|
202
204
|
enCodeMobile,
|
|
203
205
|
PHONE_DECODE_ENCODE_KEY,
|
|
204
206
|
SectionToChinese,
|
|
205
207
|
formatToImageSource,
|
|
206
208
|
formatImageUrl,
|
|
207
209
|
jdOpenAppParams,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const reg = /([\d|\.]+)/;
|
|
2
|
const newPrice = (price + '').match(reg);
|
|
1
3
|
if (Array.isArray(newPrice) && newPrice.length > 0) {
|
|
2
4
|
return newPrice[0];
|
|
3
5
|
}
|
|
4
6
|
return '0';
|
|
5
7
|
const tmpPrice = parseFloat(price);
|
|
6
8
|
return tmpPrice.toFixed(2);
|
|
7
9
|
const tmpPrice = formatPrice(price);
|
|
8
10
|
const priceArray = tmpPrice.split('.');
|
|
9
11
|
let decPart;
|
|
10
12
|
if (tmpPrice.length > 1) {
|
|
11
13
|
decPart = priceArray[1];
|
|
12
14
|
} else {
|
|
13
15
|
decPart = '00';
|
|
14
16
|
}
|
|
15
17
|
return {
|
|
16
18
|
intPart: priceArray[0],
|
|
17
19
|
decPart
|
|
18
20
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function checkExpression(expression: any, context: any = window) {
|
|
2
|
let isExist = false
|
|
1
3
|
const isFunction = typeof expression === 'function'
|
|
2
4
|
if (isFunction) {
|
|
3
5
|
if (expression()) {
|
|
4
6
|
isExist = true
|
|
5
7
|
}
|
|
6
8
|
} else {
|
|
7
9
|
if (context[expression] !== undefined) {
|
|
8
10
|
isExist = true
|
|
9
11
|
}
|
|
10
12
|
}
|
|
11
13
|
return isExist
|
|
12
14
|
expression: any,
|
|
13
15
|
timeout: number = 1000,
|
|
14
16
|
context: any = window,
|
|
15
17
|
return new Promise((resolve, reject) => {
|
|
16
18
|
const interval = 16 * 5
|
|
17
19
|
const endTime = Date.now() + timeout
|
|
18
20
|
function checkReady() {
|
|
19
21
|
if (checkExpression(expression, context)) {
|
|
20
22
|
resolve()
|
|
21
23
|
} else if (Date.now() < endTime) {
|
|
22
24
|
setTimeout(checkReady, interval)
|
|
23
25
|
} else {
|
|
24
26
|
reject('ready check timeout')
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
checkReady()
|
|
28
30
|
})
|