@conecli/cone-render 0.8.28 → 0.8.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.
- 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/token/index.h5.ts +1 -1
- package/dist/common/token/token.ts +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/CustomVideo/index.module.scss +3 -2
- 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/InOrOutViewObserver/index.tsx +1 -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/floorItem.weapp.tsx +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/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/open/api/shopMember.ts +1 -1
- package/dist/service/bMallConst.ts +1 -1
- package/dist/service/bMallConst.wxapp.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -1
- package/dist/service/http/colorSign.wxapp.ts +1 -0
- package/dist/service/http/const.ts +1 -1
- package/dist/service/requestServer.ts +1 -1
- package/dist/utils/connectNativeJsBridge.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/jm-common.js +1 -1
- package/dist/utils/memberFormatUtils.js +1 -0
- package/dist/utils/priceUtils.js +1 -0
- package/dist/utils/utils.ts +1 -1
- package/package.json +3 -3
- package/dist/components/base/Price/index.module.scss +0 -136
package/dist/utils/h5Utils.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {
|
|
2
1
|
isApp,
|
|
3
2
|
isIOS,
|
|
4
3
|
getAppVersion,
|
|
5
4
|
version,
|
|
6
5
|
getUUID,
|
|
7
6
|
getUrlQuery,
|
|
8
7
|
assign,
|
|
9
8
|
isString,
|
|
10
9
|
isObject,
|
|
11
10
|
serialize,
|
|
12
11
|
isAndroid,
|
|
13
12
|
CHANNEL_TYPE,
|
|
14
13
|
JDShopViewBusinessPathType,
|
|
15
14
|
JDShopViewBusinessPathList,
|
|
16
15
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
17
16
|
parseQueryUrlString(window?.location?.href ?? ''),
|
|
18
17
|
try {
|
|
19
18
|
return JSON.parse(decodeURIComponent(getUrlQuery('cookie')))
|
|
20
19
|
} catch (e) {
|
|
21
20
|
return {}
|
|
22
21
|
}
|
|
23
22
|
isWxMiniH5View && urlCookie['wxapp_type'] == '1'
|
|
24
23
|
if (isJdApp) {
|
|
25
24
|
isIosDevice
|
|
26
25
|
? e && e.stopPropagation()
|
|
27
26
|
: androidDeviceStopNativeScrollEvent(state)
|
|
28
27
|
}
|
|
29
28
|
isJdApp &&
|
|
30
29
|
isAndroidDevice &&
|
|
31
30
|
window?.JdAndroid &&
|
|
32
31
|
window?.JdAndroid.requestEvent(state)
|
|
33
32
|
if (isH5AndJdShopView) {
|
|
34
33
|
return (
|
|
35
34
|
CHANNEL_TYPE[currentChannel] ||
|
|
36
35
|
CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
37
36
|
)
|
|
38
37
|
}
|
|
39
38
|
return null
|
|
40
39
|
isH5 && ['/app/home', '/app/classify'].includes(urlPathname)
|
|
40
|
+
import {
|
|
41
41
|
isApp,
|
|
42
42
|
isIOS,
|
|
43
43
|
getAppVersion,
|
|
44
44
|
version,
|
|
45
45
|
getUUID,
|
|
46
46
|
getUrlQuery,
|
|
47
47
|
assign,
|
|
48
48
|
isString,
|
|
49
49
|
isObject,
|
|
50
50
|
serialize,
|
|
51
51
|
isAndroid,
|
|
52
52
|
CHANNEL_TYPE,
|
|
53
53
|
JDShopViewBusinessPathType,
|
|
54
54
|
JDShopViewBusinessPathList,
|
|
55
55
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
56
56
|
parseQueryUrlString(window?.location?.href ?? ''),
|
|
57
57
|
try {
|
|
58
58
|
return JSON.parse(decodeURIComponent(getUrlQuery('cookie')))
|
|
59
59
|
} catch (e) {
|
|
60
60
|
return {}
|
|
61
61
|
}
|
|
62
62
|
isWxMiniH5View && urlCookie['wxapp_type'] == '1'
|
|
63
63
|
if (isJdApp) {
|
|
64
64
|
isIosDevice
|
|
65
65
|
? e && e.stopPropagation()
|
|
66
66
|
: androidDeviceStopNativeScrollEvent(state)
|
|
67
67
|
}
|
|
68
68
|
isJdApp &&
|
|
69
69
|
isAndroidDevice &&
|
|
70
70
|
window?.JdAndroid &&
|
|
71
71
|
window?.JdAndroid.requestEvent(state)
|
|
72
72
|
if (isH5AndJdShopView) {
|
|
73
73
|
return (
|
|
74
74
|
CHANNEL_TYPE[currentChannel] ||
|
|
75
75
|
CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
76
76
|
)
|
|
77
77
|
}
|
|
78
78
|
return null
|
|
79
79
|
isH5 && ['/app/home', '/app/classify', '/member/shopcard'].includes(urlPathname)
|
|
80
80
|
const getCustomObj = {
|
|
81
81
|
type: 1,
|
|
82
82
|
code: 'all',
|
|
83
83
|
cost1: 1,
|
|
84
84
|
...customObj
|
|
85
85
|
}
|
|
86
86
|
try {
|
|
87
87
|
window.__sgm__.custom(getCustomObj, '9HwAEg@fTtWBB3EnwA5VgLT')
|
|
88
88
|
} catch (e) {}
|
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,
|
|
61
61
|
isH5AndJdShopViewNativeScroll, isIosDevice, isJdAndAndroidDevice, isJdAndIosDevice, isJdApp,
|
|
62
62
|
isWxApp, isWxMiniH5View, isH5AndJingGouMini, urlCookie,
|
|
63
63
|
sgmCustomReport, isMemberPage
|
|
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
|
screenWidth: window.innerWidth,
|
|
93
93
|
platform: '',
|
|
94
94
|
model: '',
|
|
95
95
|
system: '',
|
|
96
96
|
getSystemInfo.windowWidth = getSystemInfo.screenWidth
|
|
97
97
|
const params = Object.assign(
|
|
98
98
|
{},
|
|
99
99
|
{
|
|
100
100
|
title: '',
|
|
101
101
|
duration: 1500,
|
|
102
102
|
},
|
|
103
103
|
options,
|
|
104
104
|
)
|
|
105
105
|
params.duration = params.duration / 1000
|
|
106
106
|
if (isJdApp && isH5AndJdShopView) {
|
|
107
107
|
const showSuccessType = isIosDevice
|
|
108
108
|
? ToastIosType.SUCCESS
|
|
109
109
|
: ToastAndroidType.SUCCESS
|
|
110
110
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
111
111
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
112
112
|
console.log('执行原生toast success')
|
|
113
113
|
} else {
|
|
114
114
|
showSuccessToast(options)
|
|
115
115
|
}
|
|
116
116
|
const params = Object.assign(
|
|
117
117
|
{},
|
|
118
118
|
{
|
|
119
119
|
title: '',
|
|
120
120
|
duration: 1500,
|
|
121
121
|
},
|
|
122
122
|
options,
|
|
123
123
|
)
|
|
124
124
|
params.duration = params.duration / 1000
|
|
125
125
|
console.log(`isJdApp${isJdApp}`)
|
|
126
126
|
if (isJdApp && isH5AndJdShopView) {
|
|
127
127
|
const showSuccessType = isIosDevice
|
|
128
128
|
? ToastIosType.FAIL
|
|
129
129
|
: ToastAndroidType.FAIL
|
|
130
130
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
131
131
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
132
132
|
console.log('执行原生toast fail')
|
|
133
133
|
} else {
|
|
134
134
|
console.log('执行H5 toast fail')
|
|
135
135
|
showFailToast(options)
|
|
136
136
|
}
|
|
137
137
|
const params = Object.assign(
|
|
138
138
|
{},
|
|
139
139
|
{
|
|
140
140
|
title: '',
|
|
141
141
|
duration: 1500,
|
|
142
142
|
},
|
|
143
143
|
options,
|
|
144
144
|
)
|
|
145
145
|
params.duration = params.duration / 1000
|
|
146
146
|
if (isJdApp) {
|
|
147
147
|
const showSuccessType = isIosDevice
|
|
148
148
|
? ToastIosType.NORMAL
|
|
149
149
|
: ToastAndroidType.NORMAL
|
|
150
150
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
151
151
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
152
152
|
} else {
|
|
153
153
|
showNormalToast(options)
|
|
154
154
|
}
|
|
155
155
|
const createLoadingEle = document.createElement('div')
|
|
156
156
|
createLoadingEle.id = 'J_shopLoading'
|
|
157
157
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
|
|
158
158
|
createLoadingEle.innerHTML = `<div class='d-loading-content'>
|
|
159
159
|
<span class='d-shop-loading-icon'></span>
|
|
160
160
|
<p class='d-shop-text'>${text}</p>
|
|
161
161
|
</div>`
|
|
162
162
|
const getEle = document.body ? document.body : document.getElementsByTagName('body')[0]
|
|
163
163
|
console.log('获取getEle及append及appendChild方法', getEle, getEle?.append, getEle?.appendChild)
|
|
164
164
|
getEle.appendChild(createLoadingEle)
|
|
165
165
|
const getEle = document.getElementById('J_shopLoading')
|
|
166
166
|
getEle && getEle.remove()
|
|
167
167
|
num,
|
|
168
168
|
widthSize = 375,
|
|
169
169
|
layoutWidth = getSystemInfo.windowWidth,
|
|
170
170
|
const getNum = Number(num)
|
|
171
171
|
return Math.round((getNum / widthSize) * layoutWidth)
|
|
172
172
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo
|
|
173
173
|
if (!systemInfo.system && window) {
|
|
174
174
|
systemInfo.system = window.navigator.userAgent
|
|
175
175
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
|
|
176
176
|
}
|
|
177
177
|
const isIOS = !!systemInfo?.system.match(/ios/i)
|
|
178
178
|
const isAndroid = !!systemInfo?.system.match(/android/i)
|
|
179
179
|
systemInfo.navBarHeight = 0
|
|
180
180
|
systemInfo.statusBarHeight = 0
|
|
181
181
|
systemInfo.capsulePosition = null
|
|
182
182
|
systemInfo.isIOS = isIOS
|
|
183
183
|
systemInfo.isAndroid = isAndroid
|
|
184
184
|
return systemInfo
|
|
185
185
|
return originDealShopContentData(pageData, DraJSAgentReport, isvdev)
|
|
186
186
|
isJdApp,
|
|
187
187
|
isWxApp,
|
|
188
188
|
isIosDevice,
|
|
189
189
|
isAndroidDevice,
|
|
190
190
|
isJdAndIosDevice,
|
|
191
191
|
isJdAndAndroidDevice,
|
|
192
192
|
isWxMin,
|
|
193
193
|
isWxMinAndWxapp,
|
|
194
194
|
isJdMin,
|
|
195
195
|
isH5,
|
|
196
196
|
isH5AndJdShopView,
|
|
197
197
|
isH5AndJdShopViewNativeScroll,
|
|
198
198
|
isH5AndJingGouMini,
|
|
199
199
|
isWxMiniH5View,
|
|
200
200
|
urlCookie,
|
|
201
201
|
sliceArrToChunkList,
|
|
202
202
|
dealAddress,
|
|
203
203
|
objectToUrlEncode,
|
|
204
204
|
parseQueryUrlString,
|
|
205
205
|
setLowSmallPicUrl,
|
|
206
206
|
setTaroStorage,
|
|
207
207
|
getTaroStorageKeyValue,
|
|
208
208
|
removeTaroStorageKey,
|
|
209
209
|
clearTaroStorageKey,
|
|
210
210
|
getQualityImage,
|
|
211
211
|
countStringify,
|
|
212
212
|
getWxAppCookieStr,
|
|
213
213
|
getSystemInfos,
|
|
214
214
|
pxTransformFromData,
|
|
215
215
|
dealShopContentDataAndReport as dealShopContentData,
|
|
216
216
|
dateFormat,
|
|
217
217
|
throttle,
|
|
218
218
|
lodashThrottle,
|
|
219
219
|
debounce,
|
|
220
220
|
addHttps,
|
|
221
221
|
commonShowSuccessToast as showSuccessToast,
|
|
222
222
|
commonShowFailToast as showFailToast,
|
|
223
223
|
commonShowNormalToast as showNormalToast,
|
|
224
224
|
showShopLoading,
|
|
225
225
|
hideShopLoading,
|
|
226
226
|
getAppChannelType,
|
|
227
227
|
formatTabActiveMenuType,
|
|
228
228
|
filterUrlQueryData,
|
|
229
229
|
sgmCustomReport,
|
|
230
230
|
isMemberPage,
|
|
231
231
|
memberFormatUtils
|
package/dist/utils/index.ts
CHANGED
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
|
if (name === 'jdb') return (/JDBmall/i.test(ua)
|
|
24
23
|
);
|
|
25
24
|
return false;
|
|
26
25
|
ua = ua || navigator.userAgent;
|
|
27
26
|
return (/android/i.test(ua) && !isIOS()
|
|
28
27
|
);
|
|
29
28
|
ua = ua || navigator.userAgent;
|
|
30
29
|
return (/ip(hone|od)|ipad/i.test(ua)
|
|
31
30
|
);
|
|
32
31
|
ua = ua || navigator.userAgent;
|
|
33
32
|
return (/ipad/i.test(ua) || /android/i.test(ua) && !/mobi|mini|fennec/i.test(ua)
|
|
34
33
|
);
|
|
35
34
|
ua = ua || navigator.userAgent;
|
|
36
35
|
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);
|
|
37
36
|
ua = ua || navigator.userAgent;
|
|
38
37
|
return !!ua.match(/iphone/i);
|
|
39
38
|
ua = ua || navigator.userAgent;
|
|
40
39
|
return !!ua.match(/ipad/i);
|
|
41
40
|
ua = ua || navigator.userAgent;
|
|
42
41
|
if (name === 'xview') return typeof window.XView !== 'undefined';
|
|
43
42
|
if (name === 'wk') return !!ua.match(/supportjdshwk/i) || window._is_jdsh_wkwebview == 1;
|
|
44
43
|
return false;
|
|
45
44
|
ua = ua || navigator.userAgent;
|
|
46
45
|
var re = /nettype\/([\S]*)/i;
|
|
47
46
|
if (isApp('jd', ua)) re = /network\/([^;]*)/i;
|
|
48
47
|
return re.test(ua) ? RegExp.$1.toLowerCase() : 'unknown';
|
|
49
48
|
ua = ua || navigator.userAgent;
|
|
50
49
|
if (!isApp('jd', ua)) return null;
|
|
51
50
|
return ua.split(';')[4];
|
|
52
51
|
ua = ua || navigator.userAgent;
|
|
53
52
|
if (appName === 'jd') return ua.split(';')[2] || null;
|
|
54
53
|
if (appName === 'wx') return (/micromessenger\/([\S]*)/i.test(ua) ? RegExp.$1 : null
|
|
55
54
|
);
|
|
56
55
|
if (appName === 'qq') return (/qq\/([\S]*)/i.test(ua) ? RegExp.$1 : null
|
|
57
56
|
);
|
|
58
57
|
return null;
|
|
59
58
|
ua = ua || navigator.userAgent;
|
|
60
59
|
var match = ua.match(/android\s([0-9\.]*)/i);
|
|
61
60
|
return match ? match[1] : 'unknown';
|
|
62
61
|
ua = ua || navigator.userAgent;
|
|
63
62
|
var match = ua.match(/OS ((\d+_?){2,3})\s/i);
|
|
64
63
|
return match ? match[1].replace(/_/g, '.') : 'unknown';
|
|
64
|
+
var splitOnFirst = function splitOnFirst(string, separator) {
|
|
65
65
|
return Object.prototype.toString.call(obj);
|
|
66
66
|
return typeof obj === 'function';
|
|
67
67
|
return '[object Object]' === getType(obj);
|
|
68
68
|
return '[object Array]' == getType(obj);
|
|
69
69
|
return '[object Undefined]' === getType(obj);
|
|
70
70
|
return '[object Null]' == getType(obj);
|
|
71
71
|
return typeof obj === 'string';
|
|
72
72
|
return typeof obj === 'boolean';
|
|
73
73
|
return '[object Number]' === getType(num);
|
|
74
74
|
ua = ua || navigator.userAgent;
|
|
75
75
|
if (name === 'wx') return (/micromessenger/i.test(ua)
|
|
76
76
|
);
|
|
77
77
|
if (name === 'qq') return (/qq\//i.test(ua)
|
|
78
78
|
);
|
|
79
79
|
if (name === 'weibo') return (/weibo/i.test(ua)
|
|
80
80
|
);
|
|
81
81
|
if (name === 'jd') return (/^jdapp/i.test(ua)
|
|
82
82
|
);
|
|
83
83
|
if (name === 'jdlittle') return (/^jdltapp/i.test(ua)
|
|
84
84
|
);
|
|
85
85
|
if (name === 'mp') return navigator.userAgent.match(/micromessenger/i) && navigator.userAgent.match(/miniprogram/i) || window.__wxjs_environment === 'miniprogram';
|
|
86
86
|
if (name === 'jdb') return (/JDBmall/i.test(ua) && window.location.href.includes('shop.m.conecli.com/shop/bhome'));
|
|
87
87
|
return false;
|
|
88
88
|
ua = ua || navigator.userAgent;
|
|
89
89
|
return (/android/i.test(ua) && !isIOS()
|
|
90
90
|
);
|
|
91
91
|
ua = ua || navigator.userAgent;
|
|
92
92
|
return (/ip(hone|od)|ipad/i.test(ua)
|
|
93
93
|
);
|
|
94
94
|
ua = ua || navigator.userAgent;
|
|
95
95
|
return (/ipad/i.test(ua) || /android/i.test(ua) && !/mobi|mini|fennec/i.test(ua)
|
|
96
96
|
);
|
|
97
97
|
ua = ua || navigator.userAgent;
|
|
98
98
|
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);
|
|
99
99
|
ua = ua || navigator.userAgent;
|
|
100
100
|
return !!ua.match(/iphone/i);
|
|
101
101
|
ua = ua || navigator.userAgent;
|
|
102
102
|
return !!ua.match(/ipad/i);
|
|
103
103
|
ua = ua || navigator.userAgent;
|
|
104
104
|
if (name === 'xview') return typeof window.XView !== 'undefined';
|
|
105
105
|
if (name === 'wk') return !!ua.match(/supportjdshwk/i) || window._is_jdsh_wkwebview == 1;
|
|
106
106
|
return false;
|
|
107
107
|
ua = ua || navigator.userAgent;
|
|
108
108
|
var re = /nettype\/([\S]*)/i;
|
|
109
109
|
if (isApp('jd', ua)) re = /network\/([^;]*)/i;
|
|
110
110
|
return re.test(ua) ? RegExp.$1.toLowerCase() : 'unknown';
|
|
111
111
|
ua = ua || navigator.userAgent;
|
|
112
112
|
if (!isApp('jd', ua)) return null;
|
|
113
113
|
return ua.split(';')[4];
|
|
114
114
|
ua = ua || navigator.userAgent;
|
|
115
115
|
if (appName === 'jd') return ua.split(';')[2] || null;
|
|
116
116
|
if (appName === 'wx') return (/micromessenger\/([\S]*)/i.test(ua) ? RegExp.$1 : null
|
|
117
117
|
);
|
|
118
118
|
if (appName === 'qq') return (/qq\/([\S]*)/i.test(ua) ? RegExp.$1 : null
|
|
119
119
|
);
|
|
120
120
|
return null;
|
|
121
121
|
ua = ua || navigator.userAgent;
|
|
122
122
|
var match = ua.match(/android\s([0-9\.]*)/i);
|
|
123
123
|
return match ? match[1] : 'unknown';
|
|
124
124
|
ua = ua || navigator.userAgent;
|
|
125
125
|
var match = ua.match(/OS ((\d+_?){2,3})\s/i);
|
|
126
126
|
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,
|