@conecli/cone-render 0.8.19-beta.0 → 0.8.19-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/networkError.png +0 -0
- 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/components/base/CustomVideo/index.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/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 +19 -14
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/interface/utils.ts +1 -1
- package/dist/jumpEventReport/index.h5.ts +1 -1
- package/dist/jumpEventReport/index.weapp.ts +1 -1
- package/dist/jumpEventReport/web.jdb.ts +1 -0
- package/dist/libs/taroAppReport.js +2 -4
- package/dist/open/api/index.ts +1 -1
- package/dist/service/http/bMallConst.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/jm-common.js +1 -1
- package/dist/utils/utils.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Taro, { RequestTask } from '@tarojs/taro'
|
|
2
|
jsonHeader = 'application/json;charset=utf-8',
|
|
1
3
|
formDataHeader = 'application/x-www-form-urlencoded',
|
|
2
4
|
public fmInfo: {
|
|
3
5
|
eid?: string
|
|
4
6
|
fp?: string
|
|
5
7
|
jsToken?: string
|
|
6
8
|
sdkToken?: string
|
|
7
9
|
}
|
|
8
10
|
public api: ServiceInterFace.HttpApi
|
|
9
11
|
constructor() {
|
|
10
12
|
this._init()
|
|
11
13
|
this.api = api
|
|
12
14
|
this.fmInfo = {}
|
|
13
15
|
}
|
|
14
16
|
_init(): void {
|
|
15
17
|
httpInterceptors.forEach((item) => {
|
|
16
18
|
Taro.addInterceptor((chain) => item(chain))
|
|
17
19
|
})
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
get(url: string, data: any = null, otherOptions = {}): Taro.RequestTask<any> {
|
|
21
23
|
return this.request({ url, data, method: 'GET', ...otherOptions })
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
post(
|
|
25
27
|
url: string,
|
|
26
28
|
data: any = null,
|
|
27
29
|
otherOptions = {},
|
|
28
30
|
): Taro.RequestTask<any> {
|
|
29
31
|
return this.request({ url, data, method: 'POST', ...otherOptions })
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
_getMobileJsToken(): Promise<{
|
|
33
35
|
ok: boolean
|
|
34
36
|
data?: any
|
|
35
37
|
error?: any
|
|
36
38
|
}> {
|
|
37
39
|
return new Promise((resolve, reject) => {
|
|
38
40
|
try {
|
|
39
41
|
if (window?.getJsToken) {
|
|
40
42
|
window.getJsToken(function (res) {
|
|
41
43
|
console.log('JS token 获取结果:', res)
|
|
42
44
|
resolve({
|
|
43
45
|
ok: true,
|
|
44
46
|
data: res,
|
|
45
47
|
})
|
|
46
48
|
}, 600)
|
|
47
49
|
} else {
|
|
48
50
|
reject({
|
|
49
51
|
ok: false,
|
|
50
52
|
error: '没有识别到getJsToken全局方法',
|
|
51
53
|
})
|
|
52
54
|
}
|
|
53
55
|
} catch (e) {
|
|
54
56
|
console.log('获取指纹JS token 异常', e)
|
|
55
57
|
reject({
|
|
56
58
|
ok: false,
|
|
57
59
|
error: e,
|
|
58
60
|
})
|
|
59
61
|
}
|
|
60
62
|
})
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
async _getFmInfo() {
|
|
64
66
|
try {
|
|
65
67
|
const { ok, data } = await this._getMobileJsToken()
|
|
66
68
|
this.fmInfo = ok && data ? data : this.fmInfo
|
|
67
69
|
return this.fmInfo
|
|
68
70
|
} catch (e) {
|
|
69
71
|
console.log('获取指纹信息异常', e)
|
|
70
72
|
return this.fmInfo
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
async request({
|
|
75
77
|
url,
|
|
76
78
|
method = 'POST',
|
|
77
79
|
timeout = 7000,
|
|
78
80
|
...otherOptions
|
|
79
81
|
}): RequestTask<any> {
|
|
80
82
|
const header = {
|
|
81
83
|
'content-type':
|
|
82
84
|
method === 'POST'
|
|
83
85
|
? RequestHeaderContentType.formDataHeader
|
|
84
86
|
: RequestHeaderContentType.jsonHeader,
|
|
85
87
|
}
|
|
86
88
|
const getReqData = otherOptions.data
|
|
87
89
|
if (url === this.api.apiFunc && typeof getReqData === 'object') {
|
|
88
90
|
const { jsToken } = await this._getFmInfo()
|
|
89
91
|
jsToken && (getReqData['x-api-eid-token'] = jsToken)
|
|
90
92
|
}
|
|
91
93
|
const requestTask = Taro.request({
|
|
92
94
|
url,
|
|
93
95
|
method,
|
|
94
96
|
timeout,
|
|
95
97
|
header,
|
|
96
98
|
credentials: 'include',
|
|
97
99
|
...otherOptions,
|
|
98
100
|
})
|
|
99
101
|
const requestTimeoutPromise =
|
|
100
102
|
new Promise<ServiceInterFace.RequestPromiseRes>((resolve) => {
|
|
101
103
|
setTimeout(() => {
|
|
102
104
|
resolve({
|
|
103
105
|
statusCode: 500,
|
|
104
106
|
resTimeoutState: true,
|
|
105
107
|
errMsg: 'request timeout',
|
|
106
108
|
})
|
|
107
109
|
}, timeout)
|
|
108
110
|
})
|
|
109
111
|
return Promise.race([requestTask, requestTimeoutPromise]).then(
|
|
110
112
|
(res: any) => {
|
|
111
113
|
if (res && res.statusCode === 500 && res.resTimeoutState) {
|
|
112
114
|
console.log('request 请求超时 url:' + url)
|
|
113
115
|
requestTask.abort && requestTask.abort()
|
|
114
116
|
}
|
|
115
117
|
return res
|
|
116
118
|
},
|
|
117
119
|
)
|
|
118
120
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Http from './http'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Taro, { RequestTask } from '@tarojs/taro'
|
|
2
|
SHOP_COLOR_APPID,
|
|
1
3
|
JshopxColorFunctionIdList,
|
|
2
4
|
PagesColorFunctionIdList,
|
|
3
5
|
JSHOPX_COLOR_APPID,
|
|
4
6
|
PAGES_COLOR_APPID,
|
|
5
7
|
PAGES_DOMAIN,
|
|
6
8
|
B2BColorFunctionIdList,
|
|
7
9
|
B2B_COLOR_APPID,
|
|
8
10
|
cookiesStr: '',
|
|
9
11
|
requestHeaderContentType: {
|
|
10
12
|
jsonHeader: {
|
|
11
13
|
'content-type': 'application/json;charset=utf-8',
|
|
12
14
|
},
|
|
13
15
|
formDataHeader: {
|
|
14
16
|
'content-type': 'application/x-www-form-urlencoded',
|
|
15
17
|
},
|
|
16
18
|
},
|
|
17
19
|
requestBaseParam: {
|
|
18
20
|
data: null,
|
|
19
21
|
header: {
|
|
20
22
|
'content-type': 'application/json;charset=utf-8',
|
|
21
23
|
},
|
|
22
24
|
},
|
|
23
25
|
timeOut: 7000,
|
|
24
26
|
apiClientParams: {
|
|
25
27
|
appid: SHOP_COLOR_APPID,
|
|
26
28
|
clientVersion:
|
|
27
29
|
isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '11.0.0',
|
|
28
30
|
client: isH5AndJdShopView ? (isIosDevice ? 'apple' : 'android') : 'wh5',
|
|
29
31
|
area: '1_72_2799_0',
|
|
30
32
|
uuid: UUID,
|
|
31
33
|
},
|
|
32
34
|
public addressFetchInfo: {
|
|
33
35
|
reqState: boolean
|
|
34
36
|
promiseInstance: null | Promise<any>
|
|
35
37
|
}
|
|
36
38
|
public getPromotionConfig: {
|
|
37
39
|
projectId: null | string | number
|
|
38
40
|
pageId: null | string | number
|
|
39
41
|
}
|
|
40
42
|
public resInfo: ServiceInterFace.HttpRequestInfo
|
|
41
43
|
public api: ServiceInterFace.HttpApi
|
|
42
44
|
public isPageDomain: boolean
|
|
43
45
|
constructor(opt) {
|
|
44
46
|
this._init()
|
|
45
47
|
this.addressFetchInfo = {
|
|
46
48
|
reqState: false,
|
|
47
49
|
promiseInstance: null,
|
|
48
50
|
}
|
|
49
51
|
this.getPromotionConfig = {
|
|
50
52
|
projectId: null,
|
|
51
53
|
pageId: null,
|
|
52
54
|
}
|
|
53
55
|
this._userAreaUpdateListen()
|
|
54
56
|
this.resInfo = this._getResConfig(opt)
|
|
55
57
|
this.api = api
|
|
56
58
|
this.isPageDomain = window.location.hostname === PAGES_DOMAIN
|
|
57
59
|
}
|
|
58
60
|
_init(): void {
|
|
59
61
|
httpInterceptors.forEach((item) => {
|
|
60
62
|
Taro.addInterceptor((chain) => item(chain))
|
|
61
63
|
})
|
|
62
64
|
}
|
|
63
65
|
_getResConfig(opt = {}): ServiceInterFace.HttpRequestInfo {
|
|
64
66
|
return Object.assign({}, DefaultConfig, opt)
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
_userAreaUpdateListen() {
|
|
68
70
|
Taro.eventCenter.on(TaroEventType.USER_AREA_UPDATE, (area) => {
|
|
69
71
|
this.updateApiClientParamsResInfo({
|
|
70
72
|
area,
|
|
71
73
|
})
|
|
72
74
|
})
|
|
73
75
|
}
|
|
74
76
|
updateApiClientParamsResInfo(opt = {}) {
|
|
75
77
|
this.resInfo.apiClientParams = {
|
|
76
78
|
...this.resInfo.apiClientParams,
|
|
77
79
|
...opt,
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
_paramsSign(data) {
|
|
82
84
|
return Promise.resolve(data)
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
checkFunctionIdToReturnAppId(functionId) {
|
|
86
88
|
if (JshopxColorFunctionIdList.includes(functionId)) {
|
|
87
89
|
return JSHOPX_COLOR_APPID
|
|
88
90
|
} else if (
|
|
89
91
|
this.isPageDomain &&
|
|
90
92
|
PagesColorFunctionIdList.includes(functionId)
|
|
91
93
|
) {
|
|
92
94
|
return PAGES_COLOR_APPID
|
|
93
95
|
} else if (B2BColorFunctionIdList.includes(functionId)) {
|
|
94
96
|
return B2B_COLOR_APPID
|
|
95
97
|
} else {
|
|
96
98
|
return SHOP_COLOR_APPID
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
gatewayReq(
|
|
101
103
|
functionId: string,
|
|
102
104
|
bodyParams = {},
|
|
103
105
|
clientParams = {},
|
|
104
106
|
): Promise<any> {
|
|
105
107
|
if (
|
|
106
108
|
functionId === 'receiveShopCoupon' &&
|
|
107
109
|
((isH5 && window.isJingGouMiniViewState) || isWxMinAndWxapp)
|
|
108
110
|
) {
|
|
109
111
|
clientParams = Object.assign(
|
|
110
112
|
{},
|
|
111
113
|
{
|
|
112
114
|
loginType: '1',
|
|
113
115
|
loginWQBiz: WXAPP_BIZ_KEY,
|
|
114
116
|
},
|
|
115
117
|
clientParams,
|
|
116
118
|
)
|
|
117
119
|
}
|
|
118
120
|
const apiClientParams = Object.assign(
|
|
119
121
|
{},
|
|
120
122
|
this.resInfo.apiClientParams,
|
|
121
123
|
clientParams,
|
|
122
124
|
)
|
|
123
125
|
apiClientParams.appid = this.checkFunctionIdToReturnAppId(functionId)
|
|
124
126
|
const getReqData = {
|
|
125
127
|
functionId: functionId,
|
|
126
128
|
body: JSON.stringify(bodyParams),
|
|
127
129
|
t: Date.now(),
|
|
128
130
|
...apiClientParams,
|
|
129
131
|
}
|
|
130
132
|
console.log(`gatewayReq:${this.api.apiFunc}`)
|
|
131
133
|
return http
|
|
132
134
|
.request({
|
|
133
135
|
url: this.api.apiFunc,
|
|
134
136
|
data: getReqData,
|
|
135
137
|
method: 'GET',
|
|
136
138
|
})
|
|
137
139
|
.then((res: ServiceInterFace.RequestPromiseRes) => {
|
|
138
140
|
const { statusCode, data } = res
|
|
139
141
|
let changeRes: ServiceInterFace.RequestResponseFormatRes = {
|
|
140
142
|
ok: true,
|
|
141
143
|
}
|
|
142
144
|
if (statusCode === 200 && data) {
|
|
143
145
|
const resCode = Object.prototype.hasOwnProperty.call(res.data, 'code')
|
|
144
146
|
? Number(res.data.code)
|
|
145
147
|
: -1
|
|
146
148
|
const subCode = Object.prototype.hasOwnProperty.call(
|
|
147
149
|
res.data,
|
|
148
150
|
'subCode',
|
|
149
151
|
)
|
|
150
152
|
? Number(res.data.subCode)
|
|
151
153
|
: -1
|
|
152
154
|
if (
|
|
153
155
|
data.success === true ||
|
|
154
156
|
data.isSuccess ||
|
|
155
157
|
resCode === 0 ||
|
|
156
158
|
resCode === 200 ||
|
|
157
159
|
subCode === 0
|
|
158
160
|
) {
|
|
159
161
|
changeRes = {
|
|
160
162
|
result: Object.prototype.hasOwnProperty.call(data, 'result')
|
|
161
163
|
? data.result
|
|
162
164
|
: Object.prototype.hasOwnProperty.call(data, 'data')
|
|
163
165
|
? data.data
|
|
164
166
|
: data,
|
|
165
167
|
code: data.code || 200,
|
|
166
168
|
ok: true,
|
|
167
169
|
source: data,
|
|
168
170
|
}
|
|
169
171
|
return changeRes
|
|
170
172
|
} else {
|
|
171
173
|
changeRes = {
|
|
172
174
|
...data,
|
|
173
175
|
ok: false,
|
|
174
176
|
statusCode: res.statusCode,
|
|
175
177
|
}
|
|
176
178
|
return changeRes
|
|
177
179
|
}
|
|
178
180
|
} else {
|
|
179
181
|
changeRes = {
|
|
180
182
|
...data,
|
|
181
183
|
ok: false,
|
|
182
184
|
statusCode: res.statusCode,
|
|
183
185
|
}
|
|
184
186
|
return changeRes
|
|
185
187
|
}
|
|
186
188
|
})
|
|
187
189
|
.catch((res) => {
|
|
188
190
|
return {
|
|
189
191
|
...res,
|
|
190
192
|
ok: false,
|
|
191
193
|
} as ServiceInterFace.RequestResponseFormatRes
|
|
192
194
|
})
|
|
193
195
|
}
|
|
194
196
|
|
|
195
197
|
async receiveCoupon(param = {}, clientParams) {
|
|
196
198
|
return await this.gatewayReq(
|
|
197
199
|
'receiveShopCoupon',
|
|
198
200
|
{
|
|
199
201
|
operation: '3',
|
|
200
202
|
...param,
|
|
201
203
|
},
|
|
202
204
|
clientParams,
|
|
203
205
|
)
|
|
204
206
|
}
|
|
205
207
|
async bMallAddCart(params = {}) {
|
|
206
208
|
return await this.gatewayReq('bmall_cartAdd', params, {
|
|
207
209
|
client: 'H5',
|
|
208
210
|
})
|
|
209
211
|
}
|
|
210
212
|
async bMallChangeCart(params = {}) {
|
|
211
213
|
return await this.gatewayReq('bmall_cartChange', params, {
|
|
212
214
|
client: 'H5',
|
|
213
215
|
})
|
|
214
216
|
}
|
|
215
217
|
async bMallRemoveCart(params = {}) {
|
|
216
218
|
return await this.gatewayReq(
|
|
217
219
|
'bmall_cartRemove',
|
|
218
220
|
params,
|
|
219
221
|
{
|
|
220
222
|
client: 'H5',
|
|
221
223
|
},
|
|
222
224
|
)
|
|
223
225
|
}
|
|
224
226
|
async bMallGetOmittedProduct(params = {}) {
|
|
225
227
|
return await this.gatewayReq('bmall_getOmittedProduct', params, {
|
|
226
228
|
client: 'H5',
|
|
227
229
|
})
|
|
228
230
|
}
|
|
229
231
|
async bMallAddCartService({ skuId, bMallTag, num }) {
|
|
230
232
|
const params = getParams({ skuId, bMallTag, num })
|
|
231
233
|
return await this.addCart(params)
|
|
232
234
|
}
|
|
233
235
|
async bMallGetSkuNumService(bMallTag = 1) {
|
|
234
236
|
const params = getParams({ bMallTag })
|
|
235
237
|
delete params.operations
|
|
236
238
|
return await this.getOmittedProduct(params)
|
|
237
239
|
}
|
|
238
240
|
async bMallRemoveCartService({ skuId, bMallTag, num, skuUuid }) {
|
|
239
241
|
let params = getParams({ skuId, bMallTag, num, skuUuid })
|
|
240
242
|
return await this.removeCart(params)
|
|
241
243
|
}
|
|
242
244
|
async bMallChangeCartService({ skuId, bMallTag, num, skuUuid }) {
|
|
243
245
|
let params = getParams({ skuId, bMallTag, num, skuUuid })
|
|
244
246
|
return await this.changeCart(params)
|
|
245
247
|
}
|
|
246
248
|
|
|
247
249
|
async bMallGetSkuNumApi(needRequest = false, bMallTag = 1) {
|
|
248
250
|
if (!needRequest && window.bMallCartData) {
|
|
249
251
|
return window.bMallCartData
|
|
250
252
|
}
|
|
251
253
|
const cartData = await this.getSkuNumService(bMallTag)
|
|
252
254
|
let items
|
|
253
255
|
if (cartData.ok && cartData.result) {
|
|
254
256
|
items = cartData?.result?.items || {}
|
|
255
257
|
}
|
|
256
258
|
window.bMallCartData = items
|
|
257
259
|
return items
|
|
258
260
|
}
|
|
259
261
|
|
|
260
262
|
async bMallCartHandle(goodItem, num) {
|
|
261
263
|
try {
|
|
262
264
|
const {
|
|
263
265
|
skuUuid,
|
|
264
266
|
limitUpper,
|
|
265
267
|
limitLower,
|
|
266
268
|
} = goodItem
|
|
267
269
|
let cartNum = Number(num)
|
|
268
270
|
if (limitLower && cartNum && cartNum < limitLower) {
|
|
269
271
|
cartNum = limitLower
|
|
270
272
|
} else if (limitUpper && cartNum && cartNum > limitUpper) {
|
|
271
273
|
cartNum = limitUpper
|
|
272
274
|
}
|
|
273
275
|
if (skuUuid && cartNum > 0) {
|
|
274
276
|
return this.changeCartService({
|
|
275
277
|
...goodItem,
|
|
276
278
|
skuUuid,
|
|
277
279
|
num: cartNum,
|
|
278
280
|
})
|
|
279
281
|
} else if (!skuUuid && cartNum > 0) {
|
|
280
282
|
return this.addCartService({ ...goodItem, num: cartNum })
|
|
281
283
|
} else if (skuUuid && !cartNum) {
|
|
282
284
|
return this.removeCartService({
|
|
283
285
|
...goodItem,
|
|
284
286
|
skuUuid,
|
|
285
287
|
num: cartNum,
|
|
286
288
|
})
|
|
287
289
|
} else {
|
|
288
290
|
console.error('参数不全')
|
|
289
291
|
return false
|
|
290
292
|
}
|
|
291
293
|
} catch (e) {
|
|
292
294
|
console.error(e)
|
|
293
295
|
}
|
|
294
296
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = {
|
|
3
2
|
displayHeight: 1920,
|
|
4
3
|
offSetY: 0
|
|
5
4
|
}
|
|
6
5
|
console.log('>>>>>>>>>>>>>>>>>>> render taroEventSendPageScrollInfo origin time:', Date.now(), 'res:', options)
|
|
7
6
|
if(options){
|
|
8
7
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = options
|
|
9
8
|
}
|
|
10
9
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
10
|
+
import Taro from '@tarojs/taro'
|
|
11
11
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = {
|
|
12
12
|
displayHeight: 1920,
|
|
13
13
|
offSetY: 0
|
|
14
14
|
}
|
|
15
15
|
console.log('>>>>>>>>>>>>>>>>>>> render taroEventSendPageScrollInfo origin time:', Date.now(), 'res:', options)
|
|
16
16
|
if(options){
|
|
17
17
|
latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = options
|
|
18
18
|
}
|
|
19
19
|
const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {}
|
|
20
20
|
const { displayHeight, offSetY } = res
|
|
21
21
|
if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return
|
|
22
22
|
|
|
23
23
|
if (isIosDevice) return res
|
|
24
24
|
|
|
25
25
|
if (isAndroidDevice) {
|
|
26
26
|
const deviceRatio = window.devicePixelRatio
|
|
27
27
|
const cssDisplayHeight = Math.ceil(displayHeight / deviceRatio)
|
|
28
28
|
const cssOffsetY = Math.ceil(offSetY / deviceRatio)
|
|
29
29
|
return {
|
|
30
30
|
displayHeight: cssDisplayHeight,
|
|
31
31
|
offSetY: cssOffsetY
|
|
32
32
|
}
|
|
33
33
|
}
|
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)
|
|
85
85
|
);
|
|
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';
|
package/dist/utils/utils.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
pinStatus,
|
|
3
2
|
visitkey,
|
|
4
3
|
unionid,
|
|
5
4
|
skey,
|
|
6
5
|
__jda,
|
|
7
6
|
__jdv,
|
|
8
7
|
__wga,
|
|
9
8
|
wxapp_type
|
|
10
9
|
} = cookie
|
|
11
10
|
pin,
|
|
12
11
|
pinStatus,
|
|
13
12
|
visitkey,
|
|
14
13
|
unionid,
|
|
15
14
|
skey,
|
|
16
15
|
__jda,
|
|
17
16
|
__jdv,
|
|
18
17
|
__wga,
|
|
19
18
|
wid,
|
|
20
19
|
wq_skey,
|
|
21
20
|
wq_uin,
|
|
22
21
|
wq_auth_token,
|
|
23
22
|
wxapp_scene,
|
|
24
23
|
wq_unionid,
|
|
25
24
|
wxapp_openid,
|
|
26
25
|
wxapp_version,
|
|
27
26
|
wxapp_type
|
|
28
27
|
exceptionReportFn
|
|
29
28
|
exceptionReportFn(
|
|
30
29
|
`店铺首页isv h5楼层隐藏不显示。原因:modularPackResult数据不完备。页面类型-buildType: ${buildType}。楼层顺序-floorIdx: ${floorData?.floorIdx}`,
|
|
31
30
|
)
|
|
32
31
|
const isIsvContainer = (containerId, floorListData, containerListData) => {
|
|
33
32
|
const objContainer = containerListData.find(item => item.containerId === containerId)
|
|
34
33
|
(itemUid) => {
|
|
35
34
|
const objectFloor = floorListData.find(floorItem => itemUid === floorItem.uid)
|
|
36
35
|
return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
|
|
37
36
|
}
|
|
38
37
|
)?? false
|
|
38
|
+
import Taro from '@tarojs/taro'
|
|
39
39
|
pin?: string
|
|
40
40
|
visitkey?: string
|
|
41
41
|
[key: string]: any
|
|
42
42
|
}
|
|
43
43
|
jdpin,
|
|
44
44
|
pinStatus,
|
|
45
45
|
visitkey,
|
|
46
46
|
unionid,
|
|
47
47
|
skey,
|
|
48
48
|
__jda,
|
|
49
49
|
__jdv,
|
|
50
50
|
__wga,
|
|
51
51
|
wxapp_type
|
|
52
52
|
} = cookie
|
|
53
53
|
const getUserCookieObj = {}
|
|
54
54
|
jdpin,
|
|
55
55
|
pinStatus,
|
|
56
56
|
visitkey,
|
|
57
57
|
unionid,
|
|
58
58
|
skey,
|
|
59
59
|
__jda,
|
|
60
60
|
__jdv,
|
|
61
61
|
__wga,
|
|
62
62
|
wid,
|
|
63
63
|
wq_skey,
|
|
64
64
|
wq_uin,
|
|
65
65
|
wq_auth_token,
|
|
66
66
|
wxapp_scene,
|
|
67
67
|
wq_unionid,
|
|
68
68
|
wxapp_openid,
|
|
69
69
|
wxapp_version,
|
|
70
70
|
wxapp_type
|
|
71
71
|
name = name === 'jdpin' ? 'pin' : name;
|
|
72
72
|
name === 'pin' && (ret.push(`pt_pin=${encodeURIComponent(value)}`))
|
|
73
73
|
ret.push(`${name}=${encodeURIComponent(value)}`)
|
|
74
74
|
getUserCookieObj[name] = value
|
|
75
75
|
}
|
|
76
76
|
wqCookie: getUserCookieObj
|
|
77
77
|
exceptionReportFn
|
|
78
78
|
exceptionReportFn(
|
|
79
79
|
`店铺首页isv h5楼层隐藏不显示。原因:modularPackResult数据不完备。页面类型-buildType: ${buildType}。楼层顺序-floorIdx: ${floorData?.floorIdx}`,
|
|
80
80
|
)
|
|
81
81
|
const isIsvContainer = (containerId, floorListData, containerListData) => {
|
|
82
82
|
const objContainer = containerListData.find(item => item.containerId === containerId)
|
|
83
83
|
(itemUid) => {
|
|
84
84
|
const objectFloor = floorListData.find(floorItem => itemUid === floorItem.uid)
|
|
85
85
|
return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
|
|
86
86
|
}
|
|
87
87
|
)?? false
|