@conecli/cone-render 0.9.1-shop2.2 → 0.9.1-shop2.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import { isApp, getUrlQuery } from '../utils/jm-common'
|
|
2
1
|
console.log('h5', isReflexToH5, getUrlQuery(window.location.href, 'reflex'))
|
|
3
2
|
return new Promise((resolve, reject) => {
|
|
4
3
|
if (isReflexToH5) {
|
|
5
4
|
import('./web.base')
|
|
6
5
|
.then(({ JumpEventWebReport }) => {
|
|
7
6
|
if (JumpEventWebReport) {
|
|
8
7
|
console.log('加载普通浏览器h5相关跳转事件js')
|
|
9
8
|
JumpEventReport = new JumpEventWebReport({})
|
|
10
9
|
resolve(JumpEventReport)
|
|
11
10
|
}
|
|
12
11
|
})
|
|
13
12
|
.catch((err) => {
|
|
14
13
|
reject(err)
|
|
15
14
|
})
|
|
16
15
|
} else {
|
|
17
16
|
if (isApp('wx') && isApp('mp')) {
|
|
18
17
|
import('./web.wxapp')
|
|
19
18
|
.then(({ JdJumpWebToWxapp }) => {
|
|
20
19
|
if (JdJumpWebToWxapp) {
|
|
21
20
|
JumpEventReport = new JdJumpWebToWxapp({})
|
|
22
21
|
resolve(JumpEventReport)
|
|
23
22
|
}
|
|
24
23
|
})
|
|
25
24
|
.catch((err) => {
|
|
26
25
|
reject(err)
|
|
27
26
|
})
|
|
28
27
|
} else if (isApp('jd')) {
|
|
29
28
|
import('./web.jd')
|
|
30
29
|
.then(({ JdJumpWebToJdApp }) => {
|
|
31
30
|
if (JdJumpWebToJdApp) {
|
|
32
31
|
JumpEventReport = new JdJumpWebToJdApp({})
|
|
33
32
|
resolve(JumpEventReport)
|
|
34
33
|
}
|
|
35
34
|
})
|
|
36
35
|
.catch((err) => {
|
|
37
36
|
reject(err)
|
|
38
37
|
})
|
|
39
38
|
} else if (isApp('jdb')) {
|
|
40
39
|
import('./web.jdb')
|
|
41
40
|
.then(({ JdbJumpWebToJdbApp }) => {
|
|
42
41
|
if (JdbJumpWebToJdbApp) {
|
|
43
42
|
JumpEventReport = new JdbJumpWebToJdbApp({})
|
|
44
43
|
resolve(JumpEventReport)
|
|
45
44
|
}
|
|
46
45
|
})
|
|
47
46
|
.catch((err) => {
|
|
48
47
|
reject(err)
|
|
49
48
|
})
|
|
50
49
|
} else if (isApp('jdjch')) {
|
|
51
50
|
import('./web.jdjch')
|
|
52
51
|
.then(({ JdbJumpWebToJdbApp }) => {
|
|
53
52
|
if (JdbJumpWebToJdbApp) {
|
|
54
53
|
JumpEventReport = new JdbJumpWebToJdbApp({})
|
|
55
54
|
resolve(JumpEventReport)
|
|
56
55
|
}
|
|
57
56
|
})
|
|
58
57
|
.catch((err) => {
|
|
59
58
|
reject(err)
|
|
60
59
|
})
|
|
61
60
|
} else if (isPc) {
|
|
62
61
|
import('./web.pc')
|
|
63
62
|
.then(({ JumpEventWebReport }) => {
|
|
64
63
|
if (JumpEventWebReport) {
|
|
65
64
|
JumpEventReport = new JumpEventWebReport({})
|
|
66
65
|
resolve(JumpEventReport)
|
|
67
66
|
}
|
|
68
67
|
})
|
|
69
68
|
.catch((err) => {
|
|
70
69
|
reject(err)
|
|
71
70
|
})
|
|
72
71
|
} else {
|
|
73
72
|
import('./web.base')
|
|
74
73
|
.then(({ JumpEventWebReport }) => {
|
|
75
74
|
if (JumpEventWebReport) {
|
|
76
75
|
JumpEventReport = new JumpEventWebReport({})
|
|
77
76
|
resolve(JumpEventReport)
|
|
78
77
|
}
|
|
79
78
|
})
|
|
80
79
|
.catch((err) => {
|
|
81
80
|
reject(err)
|
|
82
81
|
})
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
84
|
})
|
|
85
|
+
import { isApp, getUrlQuery } from '../utils/jm-common'
|
|
86
86
|
console.log('h5', isReflexToH5, getUrlQuery(window.location.href, 'reflex'))
|
|
87
87
|
return new Promise((resolve, reject) => {
|
|
88
88
|
if (isReflexToH5) {
|
|
89
89
|
import('./web.base')
|
|
90
90
|
.then(({ JumpEventWebReport }) => {
|
|
91
91
|
if (JumpEventWebReport) {
|
|
92
92
|
console.log('加载普通浏览器h5相关跳转事件js')
|
|
93
93
|
JumpEventReport = new JumpEventWebReport({})
|
|
94
94
|
resolve(JumpEventReport)
|
|
95
95
|
}
|
|
96
96
|
})
|
|
97
97
|
.catch((err) => {
|
|
98
98
|
reject(err)
|
|
99
99
|
})
|
|
100
100
|
} else {
|
|
101
101
|
if (isApp('wx') && isApp('mp')) {
|
|
102
102
|
import('./web.wxapp')
|
|
103
103
|
.then(({ JdJumpWebToWxapp }) => {
|
|
104
104
|
if (JdJumpWebToWxapp) {
|
|
105
105
|
JumpEventReport = new JdJumpWebToWxapp({})
|
|
106
106
|
resolve(JumpEventReport)
|
|
107
107
|
}
|
|
108
108
|
})
|
|
109
109
|
.catch((err) => {
|
|
110
110
|
reject(err)
|
|
111
111
|
})
|
|
112
112
|
} else if (isApp('jd') && !isApp('jdharmony')) {
|
|
113
113
|
import('./web.jd')
|
|
114
114
|
.then(({ JdJumpWebToJdApp }) => {
|
|
115
115
|
if (JdJumpWebToJdApp) {
|
|
116
116
|
JumpEventReport = new JdJumpWebToJdApp({})
|
|
117
117
|
resolve(JumpEventReport)
|
|
118
118
|
}
|
|
119
119
|
})
|
|
120
120
|
.catch((err) => {
|
|
121
121
|
reject(err)
|
|
122
122
|
})
|
|
123
123
|
} else if (isApp('jdb')) {
|
|
124
124
|
import('./web.jdb')
|
|
125
125
|
.then(({ JdbJumpWebToJdbApp }) => {
|
|
126
126
|
if (JdbJumpWebToJdbApp) {
|
|
127
127
|
JumpEventReport = new JdbJumpWebToJdbApp({})
|
|
128
128
|
resolve(JumpEventReport)
|
|
129
129
|
}
|
|
130
130
|
})
|
|
131
131
|
.catch((err) => {
|
|
132
132
|
reject(err)
|
|
133
133
|
})
|
|
134
134
|
} else if (isApp('jdjch')) {
|
|
135
135
|
import('./web.jdjch')
|
|
136
136
|
.then(({ JdbJumpWebToJdbApp }) => {
|
|
137
137
|
if (JdbJumpWebToJdbApp) {
|
|
138
138
|
JumpEventReport = new JdbJumpWebToJdbApp({})
|
|
139
139
|
resolve(JumpEventReport)
|
|
140
140
|
}
|
|
141
141
|
})
|
|
142
142
|
.catch((err) => {
|
|
143
143
|
reject(err)
|
|
144
144
|
})
|
|
145
145
|
} else if (isPc) {
|
|
146
146
|
import('./web.pc')
|
|
147
147
|
.then(({ JumpEventWebReport }) => {
|
|
148
148
|
if (JumpEventWebReport) {
|
|
149
149
|
JumpEventReport = new JumpEventWebReport({})
|
|
150
150
|
resolve(JumpEventReport)
|
|
151
151
|
}
|
|
152
152
|
})
|
|
153
153
|
.catch((err) => {
|
|
154
154
|
reject(err)
|
|
155
155
|
})
|
|
156
156
|
} else {
|
|
157
157
|
import('./web.base')
|
|
158
158
|
.then(({ JumpEventWebReport }) => {
|
|
159
159
|
if (JumpEventWebReport) {
|
|
160
160
|
JumpEventReport = new JumpEventWebReport({})
|
|
161
161
|
resolve(JumpEventReport)
|
|
162
162
|
}
|
|
163
163
|
})
|
|
164
164
|
.catch((err) => {
|
|
165
165
|
reject(err)
|
|
166
166
|
})
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
})
|
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, versionCompare,
|
|
13
12
|
CHANNEL_TYPE,
|
|
14
13
|
JDShopViewBusinessPathType,
|
|
15
14
|
JDShopViewBusinessPathList,
|
|
16
15
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
17
16
|
SECTION_HOME_TAB_TYPE,
|
|
18
17
|
parseQueryUrlString(window?.location?.href ?? ''),
|
|
19
18
|
try {
|
|
20
19
|
return JSON.parse(decodeURIComponent(getUrlQuery('cookie')))
|
|
21
20
|
} catch (e) {
|
|
22
21
|
return {}
|
|
23
22
|
}
|
|
24
23
|
isWxMiniH5View && urlCookie['wxapp_type'] == '1'
|
|
25
24
|
if (isJdApp) {
|
|
26
25
|
isIosDevice
|
|
27
26
|
? e && e.stopPropagation()
|
|
28
27
|
: androidDeviceStopNativeScrollEvent(state)
|
|
29
28
|
}
|
|
30
29
|
isJdApp &&
|
|
31
30
|
isAndroidDevice &&
|
|
32
31
|
window?.JdAndroid &&
|
|
33
32
|
window?.JdAndroid.requestEvent(state)
|
|
34
33
|
if (isH5AndJdShopView) {
|
|
35
34
|
return (
|
|
36
35
|
CHANNEL_TYPE[currentChannel] ||
|
|
37
36
|
CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
38
37
|
)
|
|
39
38
|
}
|
|
40
39
|
return null
|
|
41
40
|
isH5 && ['/app/home', '/app/classify', '/app/newProduct', '/member/shopcard'].includes(urlPathname)
|
|
42
41
|
const getCustomObj = {
|
|
43
42
|
type: 1,
|
|
44
43
|
code: 'all',
|
|
45
44
|
cost1: 1,
|
|
46
45
|
...customObj
|
|
47
46
|
}
|
|
48
47
|
try {
|
|
49
48
|
window.__sgm__.custom(getCustomObj, '9HwAEg@fTtWBB3EnwA5VgLT')
|
|
50
49
|
} catch (e) {}
|
|
50
|
+
import {
|
|
51
51
|
isApp,
|
|
52
52
|
isIOS,
|
|
53
53
|
getAppVersion,
|
|
54
54
|
version,
|
|
55
55
|
getUUID,
|
|
56
56
|
getUrlQuery,
|
|
57
57
|
assign,
|
|
58
58
|
isString,
|
|
59
59
|
isObject,
|
|
60
60
|
serialize,
|
|
61
61
|
isAndroid, versionCompare,
|
|
62
62
|
CHANNEL_TYPE,
|
|
63
63
|
JDShopViewBusinessPathType,
|
|
64
64
|
JDShopViewBusinessPathList,
|
|
65
65
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
66
66
|
SECTION_HOME_TAB_TYPE,
|
|
67
67
|
parseQueryUrlString(window?.location?.href ?? ''),
|
|
68
68
|
try {
|
|
69
69
|
return JSON.parse(decodeURIComponent(getUrlQuery('cookie')))
|
|
70
70
|
} catch (e) {
|
|
71
71
|
return {}
|
|
72
72
|
}
|
|
73
73
|
isWxMiniH5View && urlCookie['wxapp_type'] == '1'
|
|
74
74
|
if (isJdApp) {
|
|
75
75
|
isIosDevice
|
|
76
76
|
? e && e.stopPropagation()
|
|
77
77
|
: androidDeviceStopNativeScrollEvent(state)
|
|
78
78
|
}
|
|
79
79
|
isJdApp &&
|
|
80
80
|
isAndroidDevice &&
|
|
81
81
|
window?.JdAndroid &&
|
|
82
82
|
window?.JdAndroid.requestEvent(state)
|
|
83
83
|
if (isH5AndJdShopView) {
|
|
84
84
|
return (
|
|
85
85
|
CHANNEL_TYPE[currentChannel] ||
|
|
86
86
|
CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
87
87
|
)
|
|
88
88
|
}
|
|
89
89
|
return null
|
|
90
90
|
isH5 && ['/app/home', '/app/classify', '/app/newProduct', '/member/shopcard'].includes(urlPathname)
|
|
91
91
|
const getCustomObj = {
|
|
92
92
|
type: 1,
|
|
93
93
|
code: 'all',
|
|
94
94
|
cost1: 1,
|
|
95
95
|
...customObj
|
|
96
96
|
}
|
|
97
97
|
try {
|
|
98
98
|
window.__sgm__.custom(getCustomObj, '9HwAEg@fTtWBB3EnwA5VgLT')
|
|
99
99
|
} 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, isChartH5,
|
|
5
4
|
isH5AndJdShopViewNativeScroll, isIosDevice, isJdAndAndroidDevice, isJdAndIosDevice, isJdApp,
|
|
6
5
|
isWxApp, isWxMiniH5View, isH5AndJingGouMini, urlCookie,
|
|
7
6
|
sgmCustomReport, isMemberPage, isH5AndJdShopViewH5Scroll, isAppClassifyPage, isPc, ipLoc_djd
|
|
8
7
|
addHttps,
|
|
9
8
|
clearTaroStorageKey,
|
|
10
9
|
countStringify,
|
|
11
10
|
dateFormat,
|
|
12
11
|
dealAddress,
|
|
13
12
|
dealShopContentData as originDealShopContentData,
|
|
14
13
|
debounce,
|
|
15
14
|
filterUrlQueryData,
|
|
16
15
|
formatTabActiveMenuType,
|
|
17
16
|
getQualityImage,
|
|
18
17
|
getTaroStorageKeyValue,
|
|
19
18
|
getWxAppCookieStr,
|
|
20
19
|
isH5,
|
|
21
20
|
isJdMin,
|
|
22
21
|
isWxMin,
|
|
23
22
|
isWxMinAndWxapp,
|
|
24
23
|
lodashThrottle,
|
|
25
24
|
objectToUrlEncode,
|
|
26
25
|
parseQueryUrlString,
|
|
27
26
|
removeTaroStorageKey,
|
|
28
27
|
setLowSmallPicUrl,
|
|
29
28
|
setTaroStorage,
|
|
30
29
|
showFailToast,
|
|
31
30
|
showNormalToast,
|
|
32
31
|
showSuccessToast,
|
|
33
32
|
sliceArrToChunkList,
|
|
34
33
|
throttle,
|
|
35
34
|
windowWidth: window.innerWidth,
|
|
36
35
|
containerWidth: buildType === BUILD_TYPE.CLASSIFY ? window.innerWidth - 100 : window.innerWidth,
|
|
37
36
|
screenWidth: window.innerWidth,
|
|
38
37
|
platform: '',
|
|
39
38
|
model: '',
|
|
40
39
|
system: '',
|
|
41
40
|
getSystemInfo.windowWidth = getSystemInfo.screenWidth
|
|
42
41
|
getSystemInfo['containerWidth'] = buildType === BUILD_TYPE.CLASSIFY ? getSystemInfo.screenWidth - 100 : getSystemInfo.screenWidth
|
|
43
42
|
const params = Object.assign(
|
|
44
43
|
{},
|
|
45
44
|
{
|
|
46
45
|
title: '',
|
|
47
46
|
duration: 1500,
|
|
48
47
|
},
|
|
49
48
|
options,
|
|
50
49
|
)
|
|
51
50
|
params.duration = params.duration / 1000
|
|
52
51
|
if (isJdApp && isH5AndJdShopView) {
|
|
53
52
|
const showSuccessType = isIosDevice
|
|
54
53
|
? ToastIosType.SUCCESS
|
|
55
54
|
: ToastAndroidType.SUCCESS
|
|
56
55
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
57
56
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
58
57
|
console.log('执行原生toast success')
|
|
59
58
|
} else {
|
|
60
59
|
showSuccessToast(options)
|
|
61
60
|
}
|
|
62
61
|
const params = Object.assign(
|
|
63
62
|
{},
|
|
64
63
|
{
|
|
65
64
|
title: '',
|
|
66
65
|
duration: 1500,
|
|
67
66
|
},
|
|
68
67
|
options,
|
|
69
68
|
)
|
|
70
69
|
params.duration = params.duration / 1000
|
|
71
70
|
console.log(`isJdApp${isJdApp}`)
|
|
72
71
|
if (isJdApp && isH5AndJdShopView) {
|
|
73
72
|
const showSuccessType = isIosDevice
|
|
74
73
|
? ToastIosType.FAIL
|
|
75
74
|
: ToastAndroidType.FAIL
|
|
76
75
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
77
76
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
78
77
|
console.log('执行原生toast fail')
|
|
79
78
|
} else {
|
|
80
79
|
console.log('执行H5 toast fail')
|
|
81
80
|
showFailToast(options)
|
|
82
81
|
}
|
|
83
82
|
const params = Object.assign(
|
|
84
83
|
{},
|
|
85
84
|
{
|
|
86
85
|
title: '',
|
|
87
86
|
duration: 1500,
|
|
88
87
|
},
|
|
89
88
|
options,
|
|
90
89
|
)
|
|
91
90
|
params.duration = params.duration / 1000
|
|
92
91
|
if (isJdApp) {
|
|
93
92
|
const showSuccessType = isIosDevice
|
|
94
93
|
? ToastIosType.NORMAL
|
|
95
94
|
: ToastAndroidType.NORMAL
|
|
96
95
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
97
96
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
98
97
|
} else {
|
|
99
98
|
showNormalToast(options)
|
|
100
99
|
}
|
|
101
100
|
const createLoadingEle = document.createElement('div')
|
|
102
101
|
createLoadingEle.id = 'J_shopLoading'
|
|
103
102
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
|
|
104
103
|
createLoadingEle.innerHTML = `<div class='d-loading-content'>
|
|
105
104
|
<span class='d-shop-loading-icon'></span>
|
|
106
105
|
<p class='d-shop-text'>${text}</p>
|
|
107
106
|
</div>`
|
|
108
107
|
const getEle = document.body ? document.body : document.getElementsByTagName('body')[0]
|
|
109
108
|
console.log('获取getEle及append及appendChild方法', getEle, getEle?.append, getEle?.appendChild)
|
|
110
109
|
getEle.appendChild(createLoadingEle)
|
|
111
110
|
const getEle = document.getElementById('J_shopLoading')
|
|
112
111
|
getEle && getEle.remove()
|
|
113
112
|
num,
|
|
114
113
|
widthSize = 375,
|
|
115
114
|
layoutWidth = getSystemInfo.windowWidth,
|
|
116
115
|
const getNum = Number(num)
|
|
117
116
|
return Math.round((getNum / widthSize) * layoutWidth)
|
|
118
117
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo
|
|
119
118
|
if (!systemInfo.system && window) {
|
|
120
119
|
systemInfo.system = window.navigator.userAgent
|
|
121
120
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
|
|
122
121
|
}
|
|
123
122
|
const isIOS = !!systemInfo?.system.match(/ios/i)
|
|
124
123
|
const isAndroid = !!systemInfo?.system.match(/android/i)
|
|
125
124
|
systemInfo.navBarHeight = 0
|
|
126
125
|
systemInfo.statusBarHeight = 0
|
|
127
126
|
systemInfo.capsulePosition = null
|
|
128
127
|
systemInfo.isIOS = isIOS
|
|
129
128
|
systemInfo.isAndroid = isAndroid
|
|
130
129
|
return systemInfo
|
|
131
130
|
return originDealShopContentData(pageData, sgmCustomReport, isvdev)
|
|
132
131
|
isJdApp,
|
|
133
132
|
isWxApp,
|
|
134
133
|
isIosDevice,
|
|
135
134
|
isAndroidDevice,
|
|
136
135
|
isJdAndIosDevice,
|
|
137
136
|
isJdAndAndroidDevice,
|
|
138
137
|
isWxMin,
|
|
139
138
|
isWxMinAndWxapp,
|
|
140
139
|
isJdMin,
|
|
141
140
|
isH5,
|
|
142
141
|
isH5AndJdShopView,
|
|
143
142
|
isChartH5,
|
|
144
143
|
isH5AndJdShopViewNativeScroll,
|
|
145
144
|
isH5AndJdShopViewH5Scroll,
|
|
146
145
|
isH5AndJingGouMini,
|
|
147
146
|
isWxMiniH5View,
|
|
148
147
|
urlCookie,
|
|
149
148
|
sliceArrToChunkList,
|
|
150
149
|
dealAddress,
|
|
151
150
|
objectToUrlEncode,
|
|
152
151
|
parseQueryUrlString,
|
|
153
152
|
setLowSmallPicUrl,
|
|
154
153
|
setTaroStorage,
|
|
155
154
|
getTaroStorageKeyValue,
|
|
156
155
|
removeTaroStorageKey,
|
|
157
156
|
clearTaroStorageKey,
|
|
158
157
|
getQualityImage,
|
|
159
158
|
countStringify,
|
|
160
159
|
getWxAppCookieStr,
|
|
161
160
|
getSystemInfos,
|
|
162
161
|
pxTransformFromData,
|
|
163
162
|
dealShopContentDataAndReport as dealShopContentData,
|
|
164
163
|
dateFormat,
|
|
165
164
|
throttle,
|
|
166
165
|
lodashThrottle,
|
|
167
166
|
debounce,
|
|
168
167
|
addHttps,
|
|
169
168
|
commonShowSuccessToast as showSuccessToast,
|
|
170
169
|
commonShowFailToast as showFailToast,
|
|
171
170
|
commonShowNormalToast as showNormalToast,
|
|
172
171
|
showShopLoading,
|
|
173
172
|
hideShopLoading,
|
|
174
173
|
getAppChannelType,
|
|
175
174
|
formatTabActiveMenuType,
|
|
176
175
|
filterUrlQueryData,
|
|
177
176
|
sgmCustomReport,
|
|
178
177
|
isMemberPage,
|
|
179
178
|
memberFormatUtils,
|
|
180
179
|
getFloorDataToDataDefines,
|
|
181
180
|
isAppClassifyPage,
|
|
182
181
|
isPc,
|
|
183
182
|
ipLoc_djd,
|
|
183
|
+
import Taro from '@tarojs/taro'
|
|
184
184
|
nativePageShowToast, ToastAndroidType,
|
|
185
185
|
ToastIosType,
|
|
186
186
|
getAppChannelType, isAndroidDevice, isH5AndJdShopView, isChartH5,
|
|
187
187
|
isH5AndJdShopViewNativeScroll, isIosDevice, isJdAndAndroidDevice, isJdAndIosDevice, isJdAndHarmonyDevice, isJdApp,
|
|
188
188
|
isWxApp, isWxMiniH5View, isH5AndJingGouMini, urlCookie,
|
|
189
189
|
sgmCustomReport, isMemberPage, isH5AndJdShopViewH5Scroll, isAppClassifyPage, isPc, ipLoc_djd
|
|
190
190
|
addHttps,
|
|
191
191
|
clearTaroStorageKey,
|
|
192
192
|
countStringify,
|
|
193
193
|
dateFormat,
|
|
194
194
|
dealAddress,
|
|
195
195
|
dealShopContentData as originDealShopContentData,
|
|
196
196
|
debounce,
|
|
197
197
|
filterUrlQueryData,
|
|
198
198
|
formatTabActiveMenuType,
|
|
199
199
|
getQualityImage,
|
|
200
200
|
getTaroStorageKeyValue,
|
|
201
201
|
getWxAppCookieStr,
|
|
202
202
|
isH5,
|
|
203
203
|
isJdMin,
|
|
204
204
|
isWxMin,
|
|
205
205
|
isWxMinAndWxapp,
|
|
206
206
|
lodashThrottle,
|
|
207
207
|
objectToUrlEncode,
|
|
208
208
|
parseQueryUrlString,
|
|
209
209
|
removeTaroStorageKey,
|
|
210
210
|
setLowSmallPicUrl,
|
|
211
211
|
setTaroStorage,
|
|
212
212
|
showFailToast,
|
|
213
213
|
showNormalToast,
|
|
214
214
|
showSuccessToast,
|
|
215
215
|
sliceArrToChunkList,
|
|
216
216
|
throttle,
|
|
217
217
|
windowWidth: window.innerWidth,
|
|
218
218
|
containerWidth: buildType === BUILD_TYPE.CLASSIFY ? window.innerWidth - 100 : window.innerWidth,
|
|
219
219
|
screenWidth: window.innerWidth,
|
|
220
220
|
platform: '',
|
|
221
221
|
model: '',
|
|
222
222
|
system: '',
|
|
223
223
|
getSystemInfo.windowWidth = getSystemInfo.screenWidth
|
|
224
224
|
getSystemInfo['containerWidth'] = buildType === BUILD_TYPE.CLASSIFY ? getSystemInfo.screenWidth - 100 : getSystemInfo.screenWidth
|
|
225
225
|
const params = Object.assign(
|
|
226
226
|
{},
|
|
227
227
|
{
|
|
228
228
|
title: '',
|
|
229
229
|
duration: 1500,
|
|
230
230
|
},
|
|
231
231
|
options,
|
|
232
232
|
)
|
|
233
233
|
params.duration = params.duration / 1000
|
|
234
234
|
if (isJdApp && isH5AndJdShopView) {
|
|
235
235
|
const showSuccessType = isIosDevice
|
|
236
236
|
? ToastIosType.SUCCESS
|
|
237
237
|
: ToastAndroidType.SUCCESS
|
|
238
238
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
239
239
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
240
240
|
console.log('执行原生toast success')
|
|
241
241
|
} else {
|
|
242
242
|
showSuccessToast(options)
|
|
243
243
|
}
|
|
244
244
|
const params = Object.assign(
|
|
245
245
|
{},
|
|
246
246
|
{
|
|
247
247
|
title: '',
|
|
248
248
|
duration: 1500,
|
|
249
249
|
},
|
|
250
250
|
options,
|
|
251
251
|
)
|
|
252
252
|
params.duration = params.duration / 1000
|
|
253
253
|
console.log(`isJdApp${isJdApp}`)
|
|
254
254
|
if (isJdApp && isH5AndJdShopView) {
|
|
255
255
|
const showSuccessType = isIosDevice
|
|
256
256
|
? ToastIosType.FAIL
|
|
257
257
|
: ToastAndroidType.FAIL
|
|
258
258
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
259
259
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
260
260
|
console.log('执行原生toast fail')
|
|
261
261
|
} else {
|
|
262
262
|
console.log('执行H5 toast fail')
|
|
263
263
|
showFailToast(options)
|
|
264
264
|
}
|
|
265
265
|
const params = Object.assign(
|
|
266
266
|
{},
|
|
267
267
|
{
|
|
268
268
|
title: '',
|
|
269
269
|
duration: 1500,
|
|
270
270
|
},
|
|
271
271
|
options,
|
|
272
272
|
)
|
|
273
273
|
params.duration = params.duration / 1000
|
|
274
274
|
if (isJdApp) {
|
|
275
275
|
const showSuccessType = isIosDevice
|
|
276
276
|
? ToastIosType.NORMAL
|
|
277
277
|
: ToastAndroidType.NORMAL
|
|
278
278
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
279
279
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
280
280
|
} else {
|
|
281
281
|
showNormalToast(options)
|
|
282
282
|
}
|
|
283
283
|
const createLoadingEle = document.createElement('div')
|
|
284
284
|
createLoadingEle.id = 'J_shopLoading'
|
|
285
285
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
|
|
286
286
|
createLoadingEle.innerHTML = `<div class='d-loading-content'>
|
|
287
287
|
<span class='d-shop-loading-icon'></span>
|
|
288
288
|
<p class='d-shop-text'>${text}</p>
|
|
289
289
|
</div>`
|
|
290
290
|
const getEle = document.body ? document.body : document.getElementsByTagName('body')[0]
|
|
291
291
|
console.log('获取getEle及append及appendChild方法', getEle, getEle?.append, getEle?.appendChild)
|
|
292
292
|
getEle.appendChild(createLoadingEle)
|
|
293
293
|
const getEle = document.getElementById('J_shopLoading')
|
|
294
294
|
getEle && getEle.remove()
|
|
295
295
|
num,
|
|
296
296
|
widthSize = 375,
|
|
297
297
|
layoutWidth = getSystemInfo.windowWidth,
|
|
298
298
|
const getNum = Number(num)
|
|
299
299
|
return Math.round((getNum / widthSize) * layoutWidth)
|
|
300
300
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo
|
|
301
301
|
if (!systemInfo.system && window) {
|
|
302
302
|
systemInfo.system = window.navigator.userAgent
|
|
303
303
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
|
|
304
304
|
}
|
|
305
305
|
const isIOS = !!systemInfo?.system.match(/ios/i)
|
|
306
306
|
const isAndroid = !!systemInfo?.system.match(/android/i)
|
|
307
307
|
systemInfo.navBarHeight = 0
|
|
308
308
|
systemInfo.statusBarHeight = 0
|
|
309
309
|
systemInfo.capsulePosition = null
|
|
310
310
|
systemInfo.isIOS = isIOS
|
|
311
311
|
systemInfo.isAndroid = isAndroid
|
|
312
312
|
return systemInfo
|
|
313
313
|
return originDealShopContentData(pageData, sgmCustomReport, isvdev)
|
|
314
314
|
isJdApp,
|
|
315
315
|
isWxApp,
|
|
316
316
|
isIosDevice,
|
|
317
317
|
isAndroidDevice,
|
|
318
318
|
isJdAndIosDevice,
|
|
319
319
|
isJdAndAndroidDevice,
|
|
320
320
|
isJdAndHarmonyDevice,
|
|
321
321
|
isWxMin,
|
|
322
322
|
isWxMinAndWxapp,
|
|
323
323
|
isJdMin,
|
|
324
324
|
isH5,
|
|
325
325
|
isH5AndJdShopView,
|
|
326
326
|
isChartH5,
|
|
327
327
|
isH5AndJdShopViewNativeScroll,
|
|
328
328
|
isH5AndJdShopViewH5Scroll,
|
|
329
329
|
isH5AndJingGouMini,
|
|
330
330
|
isWxMiniH5View,
|
|
331
331
|
urlCookie,
|
|
332
332
|
sliceArrToChunkList,
|
|
333
333
|
dealAddress,
|
|
334
334
|
objectToUrlEncode,
|
|
335
335
|
parseQueryUrlString,
|
|
336
336
|
setLowSmallPicUrl,
|
|
337
337
|
setTaroStorage,
|
|
338
338
|
getTaroStorageKeyValue,
|
|
339
339
|
removeTaroStorageKey,
|
|
340
340
|
clearTaroStorageKey,
|
|
341
341
|
getQualityImage,
|
|
342
342
|
countStringify,
|
|
343
343
|
getWxAppCookieStr,
|
|
344
344
|
getSystemInfos,
|
|
345
345
|
pxTransformFromData,
|
|
346
346
|
dealShopContentDataAndReport as dealShopContentData,
|
|
347
347
|
dateFormat,
|
|
348
348
|
throttle,
|
|
349
349
|
lodashThrottle,
|
|
350
350
|
debounce,
|
|
351
351
|
addHttps,
|
|
352
352
|
commonShowSuccessToast as showSuccessToast,
|
|
353
353
|
commonShowFailToast as showFailToast,
|
|
354
354
|
commonShowNormalToast as showNormalToast,
|
|
355
355
|
showShopLoading,
|
|
356
356
|
hideShopLoading,
|
|
357
357
|
getAppChannelType,
|
|
358
358
|
formatTabActiveMenuType,
|
|
359
359
|
filterUrlQueryData,
|
|
360
360
|
sgmCustomReport,
|
|
361
361
|
isMemberPage,
|
|
362
362
|
memberFormatUtils,
|
|
363
363
|
getFloorDataToDataDefines,
|
|
364
364
|
isAppClassifyPage,
|
|
365
365
|
isPc,
|
|
366
366
|
ipLoc_djd,
|
package/dist/utils/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {
|
|
2
1
|
isChartH5,
|
|
3
2
|
isH5AndJdShopViewH5Scroll,
|
|
4
3
|
isMemberPage,
|
|
5
4
|
isPc,
|
|
6
5
|
ipLoc_djd,
|
|
7
6
|
isChartH5,
|
|
8
7
|
isH5AndJdShopViewH5Scroll,
|
|
9
8
|
isH5AndJingGouMini,
|
|
10
9
|
urlCookie,
|
|
11
10
|
isMemberPage,
|
|
12
11
|
isPc,
|
|
13
12
|
ipLoc_djd,
|
|
13
|
+
import {
|
|
14
14
|
isChartH5,
|
|
15
15
|
isH5AndJdShopViewH5Scroll,
|
|
16
16
|
isMemberPage,
|
|
17
17
|
isPc,
|
|
18
18
|
ipLoc_djd,
|
|
19
19
|
isJdAndHarmonyDevice,
|
|
20
20
|
isChartH5,
|
|
21
21
|
isH5AndJdShopViewH5Scroll,
|
|
22
22
|
isH5AndJingGouMini,
|
|
23
23
|
urlCookie,
|
|
24
24
|
isMemberPage,
|
|
25
25
|
isPc,
|
|
26
26
|
ipLoc_djd,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {
|
|
2
1
|
isChartH5,
|
|
3
2
|
isH5AndJdShopViewH5Scroll,
|
|
4
3
|
sgmCustomReport,
|
|
5
4
|
isMemberPage,
|
|
6
5
|
isAppClassifyPage
|
|
7
6
|
isH5AndJdShopViewH5Scroll,
|
|
8
7
|
isH5AndJingGouMini,
|
|
9
8
|
urlCookie,
|
|
10
9
|
isMemberPage,
|
|
11
10
|
isAppClassifyPage
|
|
11
|
+
import {
|
|
12
12
|
isChartH5,
|
|
13
13
|
isH5AndJdShopViewH5Scroll,
|
|
14
14
|
sgmCustomReport,
|
|
15
15
|
isMemberPage,
|
|
16
16
|
isAppClassifyPage
|
|
17
17
|
isJdAndHarmonyDevice,
|
|
18
18
|
isH5AndJdShopViewH5Scroll,
|
|
19
19
|
isH5AndJingGouMini,
|
|
20
20
|
urlCookie,
|
|
21
21
|
isMemberPage,
|
|
22
22
|
isAppClassifyPage
|
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) && /shop\.m\.jd\.com\/shop\/bhome/i.test(window.location.href));
|
|
24
23
|
if(name === 'jdjch') return (/jdjchshopapp/i.test(ua) || (/shop\.m\.jd\.com\/shop\/bhome/i.test(window.location.href)) && window.location.href.includes('channel')) ;
|
|
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 === 'jdharmony') return (/^jdapp;harmony/i.test(ua)
|
|
84
84
|
);
|
|
85
85
|
if (name === 'jdlittle') return (/^jdltapp/i.test(ua)
|
|
86
86
|
);
|
|
87
87
|
if (name === 'mp') return navigator.userAgent.match(/micromessenger/i) && navigator.userAgent.match(/miniprogram/i) || window.__wxjs_environment === 'miniprogram';
|
|
88
88
|
if (name === 'jdb') return (/JDBmall/i.test(ua) && /shop\.m\.jd\.com\/shop\/bhome/i.test(window.location.href));
|
|
89
89
|
if(name === 'jdjch') return (/jdjchshopapp/i.test(ua) || (/shop\.m\.jd\.com\/shop\/bhome/i.test(window.location.href)) && window.location.href.includes('channel')) ;
|
|
90
90
|
return false;
|
|
91
91
|
ua = ua || navigator.userAgent;
|
|
92
92
|
return (/android/i.test(ua) && !isIOS()
|
|
93
93
|
);
|
|
94
94
|
ua = ua || navigator.userAgent;
|
|
95
95
|
return (/ip(hone|od)|ipad/i.test(ua)
|
|
96
96
|
);
|
|
97
97
|
ua = ua || navigator.userAgent;
|
|
98
98
|
return (/ipad/i.test(ua) || /android/i.test(ua) && !/mobi|mini|fennec/i.test(ua)
|
|
99
99
|
);
|
|
100
100
|
ua = ua || navigator.userAgent;
|
|
101
101
|
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);
|
|
102
102
|
ua = ua || navigator.userAgent;
|
|
103
103
|
return !!ua.match(/iphone/i);
|
|
104
104
|
ua = ua || navigator.userAgent;
|
|
105
105
|
return !!ua.match(/ipad/i);
|
|
106
106
|
ua = ua || navigator.userAgent;
|
|
107
107
|
if (name === 'xview') return typeof window.XView !== 'undefined';
|
|
108
108
|
if (name === 'wk') return !!ua.match(/supportjdshwk/i) || window._is_jdsh_wkwebview == 1;
|
|
109
109
|
return false;
|
|
110
110
|
ua = ua || navigator.userAgent;
|
|
111
111
|
var re = /nettype\/([\S]*)/i;
|
|
112
112
|
if (isApp('jd', ua)) re = /network\/([^;]*)/i;
|
|
113
113
|
return re.test(ua) ? RegExp.$1.toLowerCase() : 'unknown';
|
|
114
114
|
ua = ua || navigator.userAgent;
|
|
115
115
|
if (!isApp('jd', ua)) return null;
|
|
116
116
|
return ua.split(';')[4];
|
|
117
117
|
ua = ua || navigator.userAgent;
|
|
118
118
|
if (appName === 'jd') return ua.split(';')[2] || null;
|
|
119
119
|
if (appName === 'wx') return (/micromessenger\/([\S]*)/i.test(ua) ? RegExp.$1 : null
|
|
120
120
|
);
|
|
121
121
|
if (appName === 'qq') return (/qq\/([\S]*)/i.test(ua) ? RegExp.$1 : null
|
|
122
122
|
);
|
|
123
123
|
return null;
|
|
124
124
|
ua = ua || navigator.userAgent;
|
|
125
125
|
var match = ua.match(/android\s([0-9\.]*)/i);
|
|
126
126
|
return match ? match[1] : 'unknown';
|
|
127
127
|
ua = ua || navigator.userAgent;
|
|
128
128
|
var match = ua.match(/OS ((\d+_?){2,3})\s/i);
|
|
129
129
|
return match ? match[1].replace(/_/g, '.') : 'unknown';
|