@conecli/cone-render 0.9.1-shop2.8 → 0.10.1-beta.0
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/assets/icon_blue_info.svg +1 -0
- package/dist/common/const.ts +1 -1
- package/dist/common/environmentType.ts +1 -0
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/common/index.weapp.ts +1 -1
- package/dist/common/jdplayerSdk.ts +1 -0
- package/dist/common/sgmCustomCode.ts +1 -0
- package/dist/common/wxappApi.jd.ts +1 -0
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
- package/dist/components/base/CustomScrollView/index.module.scss +7 -0
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/InOrOutViewObserver/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/index.tsx +1 -1
- package/dist/components/debug/DebugLayout/index.module.scss +67 -0
- package/dist/components/debug/DebugLayout/index.tsx +1 -0
- package/dist/components/debug/DebugLayout/utils.ts +1 -0
- package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
- package/dist/components/floorItem.jd.tsx +1 -1
- package/dist/components/floorItem.weapp.tsx +1 -1
- package/dist/components/isv/Floor/index.tsx +1 -1
- package/dist/components/remoteFloorItem.tsx +1 -1
- package/dist/interface/common.ts +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/interface/jumpEventReport.ts +1 -1
- package/dist/interface/service.ts +1 -1
- package/dist/interface/utils.ts +1 -1
- package/dist/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/createReportFloorData.ts +1 -1
- package/dist/jumpEventReport/index.h5.ts +1 -1
- package/dist/jumpEventReport/index.jd.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
- package/dist/jumpEventReport/web.tjapp.ts +1 -0
- package/dist/jumpEventReport/web.tjm.ts +1 -0
- package/dist/open/api/environment.ts +1 -1
- package/dist/open/api/index.ts +1 -1
- package/dist/open/api/track.ts +1 -1
- package/dist/sass/app.h5.scss +5 -0
- package/dist/service/requestServer.ts +1 -1
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/draExceptionAndProfile.ts +1 -1
- package/dist/utils/h5Utils.ts +1 -1
- package/dist/utils/index.h5.ts +1 -1
- package/dist/utils/index.ts +1 -1
- package/dist/utils/index.weapp.ts +1 -1
- package/dist/utils/jm-common.js +1 -1
- package/dist/utils/sgmCodeUtils.ts +1 -0
- package/dist/utils/utils.ts +1 -1
- package/package.json +42 -39
- package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
package/dist/utils/utils.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
SHOP_MENU_ID_TYPE,
|
|
3
2
|
SHOP_MENU_ID_QUERY_NAME,
|
|
4
3
|
SECTION_HOME_TAB_TYPE,
|
|
5
4
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
6
5
|
SECTION_HOME_TAB_QUERY_TYPE,
|
|
7
6
|
CHANNEL_TYPE,
|
|
8
7
|
JDShopViewBusinessPathType,
|
|
9
8
|
FloorModuleType,
|
|
10
9
|
RemoteLoadFloorList,
|
|
11
10
|
getBundleUrl,
|
|
12
11
|
getBundleFileName,
|
|
13
12
|
formatPackResult,
|
|
14
13
|
const resultList: Array<any> = [],
|
|
15
14
|
arrLen = arr.length
|
|
16
15
|
if (arrLen) {
|
|
17
16
|
if (arrLen > size) {
|
|
18
17
|
for (let i = 0; i < arrLen; i = i + size) {
|
|
19
18
|
resultList.push(arr.slice(i, i + size))
|
|
20
19
|
}
|
|
21
20
|
} else {
|
|
22
21
|
resultList.push(arr)
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
return resultList
|
|
26
25
|
let _address = ids
|
|
27
26
|
const _areaAreaSplit = ids.split('.')
|
|
28
27
|
const _areaAreaSplit2 = ids.split('_')
|
|
29
28
|
_address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address
|
|
30
29
|
_address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address
|
|
31
30
|
return _address
|
|
32
31
|
const getValue = `${obj[key]}`.replace(/undefined/,'').replace(/null/,'')
|
|
33
32
|
paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`
|
|
34
33
|
const result = {}
|
|
35
34
|
if (
|
|
36
35
|
!urlOrQueryStr ||
|
|
37
36
|
('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
|
|
38
37
|
) {
|
|
39
38
|
return result
|
|
40
39
|
}
|
|
41
40
|
if (urlOrQueryStr.indexOf('?') > -1) {
|
|
42
41
|
const queryStr = urlOrQueryStr.split('?')
|
|
43
42
|
const queryItemList =
|
|
44
43
|
queryStr && queryStr.length > 1 ? queryStr[1].split('&') : []
|
|
45
44
|
const queryItemListLen = queryItemList.length
|
|
46
45
|
queryItemListLen > 0 &&
|
|
47
46
|
queryItemList.forEach((item) => {
|
|
48
47
|
const thisItemList = item.split('=')
|
|
49
48
|
result[thisItemList[0]] = thisItemList[1]
|
|
50
49
|
})
|
|
51
50
|
} else {
|
|
52
51
|
const queryItemList =
|
|
53
52
|
urlOrQueryStr.indexOf('&') > -1
|
|
54
53
|
? urlOrQueryStr.split('&')
|
|
55
54
|
: [urlOrQueryStr]
|
|
56
55
|
const queryItemListLen = queryItemList.length
|
|
57
56
|
queryItemListLen > 0 &&
|
|
58
57
|
queryItemList.forEach((item) => {
|
|
59
58
|
const thisItemList = item.split('=')
|
|
60
59
|
result[thisItemList[0]] = thisItemList[1]
|
|
61
60
|
})
|
|
62
61
|
}
|
|
63
62
|
return result
|
|
64
63
|
url: string,
|
|
65
64
|
size?: {
|
|
66
65
|
w: number
|
|
67
66
|
h: number
|
|
68
67
|
},
|
|
69
68
|
quality?: number,
|
|
70
69
|
if (url && size) {
|
|
71
70
|
const _w = Math.floor(size.w)
|
|
72
71
|
const _h = Math.floor(size.h)
|
|
73
72
|
if (url.match(/gif$/i)) {
|
|
74
73
|
return url
|
|
75
74
|
} else {
|
|
76
75
|
if (_w > 0 && _h > 0) {
|
|
77
76
|
url = url.replace('jfs/', `s${_w}x${_h}_jfs/`)
|
|
78
77
|
}
|
|
79
78
|
url += quality != null ? `!q${quality}.dpg` : '.dpg'
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
return url
|
|
83
82
|
url: string,
|
|
84
83
|
jfsImgInfo: UtilsInterFace.getJfsImageInfo = {},
|
|
85
84
|
if (url.match(/\.(jpg|png|dpg)$/i)) {
|
|
86
85
|
const { width, height, quality } = jfsImgInfo
|
|
87
86
|
if (typeof width === 'number' || typeof height === 'number') {
|
|
88
87
|
url = url.replace(
|
|
89
88
|
'/jfs/',
|
|
90
89
|
`/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`,
|
|
91
90
|
)
|
|
92
91
|
}
|
|
93
92
|
if (
|
|
94
93
|
typeof quality === 'number' &&
|
|
95
94
|
quality > 0 &&
|
|
96
95
|
quality < 100 &&
|
|
97
96
|
url.match(/\.jpg$/i)
|
|
98
97
|
) {
|
|
99
98
|
url += `!q${quality}.dpg`
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
return addHttps(url)
|
|
103
102
|
!imgUrl.match(
|
|
104
103
|
/(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
|
|
105
104
|
)
|
|
106
105
|
if(!imgUrl.includes('360buyimg.com')){
|
|
107
106
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl
|
|
108
107
|
}
|
|
109
108
|
if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
|
|
110
109
|
count: number,
|
|
111
110
|
fixedNum = 2,
|
|
112
111
|
unit = '万',
|
|
113
112
|
maxNum = 10000,
|
|
114
113
|
count = Number(count)
|
|
115
114
|
if (count > maxNum) {
|
|
116
115
|
return (count / maxNum).toFixed(fixedNum) + unit
|
|
117
116
|
}
|
|
118
117
|
return count
|
|
119
118
|
key: string,
|
|
120
119
|
value: string | object,
|
|
121
120
|
successBack?: any,
|
|
122
121
|
failBack?: any,
|
|
123
122
|
return Taro.setStorage({
|
|
124
123
|
key: key,
|
|
125
124
|
data: value,
|
|
126
125
|
success: successBack,
|
|
127
126
|
fail: failBack,
|
|
128
127
|
})
|
|
129
128
|
return Taro.getStorageSync(key)
|
|
130
129
|
return Taro.removeStorage({
|
|
131
130
|
key: key,
|
|
132
131
|
})
|
|
133
132
|
return Taro.clearStorage()
|
|
134
133
|
if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
|
|
135
134
|
let gap = 0
|
|
136
135
|
let width = 96
|
|
137
136
|
if (systemInfo.platform === 'android') {
|
|
138
137
|
gap = 8
|
|
139
138
|
width = 96
|
|
140
139
|
} else if (systemInfo.platform === 'devtools') {
|
|
141
140
|
if (isIOS) {
|
|
142
141
|
gap = 5.5
|
|
143
142
|
} else {
|
|
144
143
|
gap = 7.5
|
|
145
144
|
}
|
|
146
145
|
} else {
|
|
147
146
|
gap = 4
|
|
148
147
|
width = 88
|
|
149
148
|
}
|
|
150
149
|
rect = {
|
|
151
150
|
bottom: systemInfo.statusBarHeight + gap + 32,
|
|
152
151
|
height: 32,
|
|
153
152
|
left: systemInfo.windowWidth - width - 10,
|
|
154
153
|
right: systemInfo.windowWidth - 10,
|
|
155
154
|
top: systemInfo.statusBarHeight + gap,
|
|
156
155
|
width,
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
158
|
const gap = rect.top - systemInfo.statusBarHeight
|
|
160
159
|
systemInfo.navBarTopToStatusBar = gap
|
|
161
160
|
systemInfo.navBarHeight = 2 * gap + rect.height
|
|
162
161
|
systemInfo.capsulePosition = rect
|
|
163
162
|
systemInfo.isIOS = isIOS
|
|
164
163
|
systemInfo.isAndroid = isAndroid
|
|
165
164
|
return systemInfo
|
|
166
165
|
if (str.match(/^\/\//)) {
|
|
167
166
|
str = 'https:' + str
|
|
168
167
|
}
|
|
169
168
|
return str
|
|
170
169
|
dateTimeOrdate: Date | string | number | null,
|
|
171
170
|
format = 'yyyy-MM-dd HH:mm:ss',
|
|
172
171
|
noPadStart = {
|
|
173
172
|
M: '0',
|
|
174
173
|
d: '0',
|
|
175
174
|
H: '0',
|
|
176
175
|
m: '0',
|
|
177
176
|
s: '0',
|
|
178
177
|
},
|
|
179
178
|
let dateResult = ''
|
|
180
179
|
const padStarts = Object.assign(
|
|
181
180
|
{
|
|
182
181
|
M: '0',
|
|
183
182
|
d: '0',
|
|
184
183
|
H: '0',
|
|
185
184
|
m: '0',
|
|
186
185
|
s: '0',
|
|
187
186
|
},
|
|
188
187
|
noPadStart,
|
|
189
188
|
)
|
|
190
189
|
if (dateTimeOrdate) {
|
|
191
190
|
let changeDateTimeOrdate = dateTimeOrdate
|
|
192
191
|
const getChangeDateTimeToNumber = Number(changeDateTimeOrdate)
|
|
193
192
|
if (getChangeDateTimeToNumber) {
|
|
194
193
|
changeDateTimeOrdate = getChangeDateTimeToNumber
|
|
195
194
|
} else {
|
|
196
195
|
changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/').replace(/\./g, '/')
|
|
197
196
|
}
|
|
198
197
|
const nowDate =
|
|
199
198
|
dateTimeOrdate instanceof Date
|
|
200
199
|
? dateTimeOrdate
|
|
201
200
|
: new Date(changeDateTimeOrdate)
|
|
202
201
|
const dateMap = {
|
|
203
202
|
y: `${nowDate.getFullYear()}`,
|
|
204
203
|
M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
|
|
205
204
|
d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
|
|
206
205
|
H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
|
|
207
206
|
m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
|
|
208
207
|
s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
|
|
209
208
|
}
|
|
210
209
|
const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g')
|
|
211
210
|
const regYear = new RegExp('y')
|
|
212
211
|
dateResult = format.replace(regDate, (v) => {
|
|
213
212
|
let changeValue = v
|
|
214
213
|
if (regYear.test(changeValue)) {
|
|
215
214
|
const thisYear = dateMap.y
|
|
216
215
|
const subValueLen = 4 - changeValue.length
|
|
217
216
|
changeValue = thisYear.substr(subValueLen)
|
|
218
217
|
} else {
|
|
219
218
|
const dateKey = v.substr(0, 1)
|
|
220
219
|
changeValue = dateMap[dateKey]
|
|
221
220
|
}
|
|
222
221
|
return changeValue
|
|
223
222
|
})
|
|
224
223
|
}
|
|
225
224
|
return dateResult
|
|
226
225
|
let timer: any = null
|
|
227
226
|
let startTime = Date.now()
|
|
228
227
|
return function () {
|
|
229
228
|
const curTime = Date.now()
|
|
230
229
|
const remaining = delay - (curTime - startTime)
|
|
231
230
|
const context = this
|
|
232
231
|
const args = arguments
|
|
233
232
|
clearTimeout(timer)
|
|
234
233
|
if (remaining <= 0) {
|
|
235
234
|
func.apply(context, args)
|
|
236
235
|
startTime = Date.now()
|
|
237
236
|
} else {
|
|
238
237
|
timer = setTimeout(func, remaining)
|
|
239
238
|
}
|
|
240
239
|
}
|
|
241
240
|
let context, args, result
|
|
242
241
|
let timeout = null
|
|
243
242
|
let previous = 0
|
|
244
243
|
if (!options) options = {}
|
|
245
244
|
const later = function () {
|
|
246
245
|
previous = options.leading === false ? 0 : Date.now()
|
|
247
246
|
timeout = null
|
|
248
247
|
result = func.apply(context, args)
|
|
249
248
|
if (!timeout) context = args = null
|
|
250
249
|
}
|
|
251
250
|
return function () {
|
|
252
251
|
const now = Date.now()
|
|
253
252
|
if (!previous && options.leading === false) previous = now
|
|
254
253
|
const remaining = wait - (now - previous)
|
|
255
254
|
context = this
|
|
256
255
|
args = arguments
|
|
257
256
|
if (remaining <= 0 || remaining > wait) {
|
|
258
257
|
if (timeout) {
|
|
259
258
|
clearTimeout(timeout)
|
|
260
259
|
timeout = null
|
|
261
260
|
}
|
|
262
261
|
previous = now
|
|
263
262
|
result = func.apply(context, args)
|
|
264
263
|
if (!timeout) context = args = null
|
|
265
264
|
} else if (!timeout && options.trailing !== false) {
|
|
266
265
|
timeout = setTimeout(later, remaining)
|
|
267
266
|
}
|
|
268
267
|
return result
|
|
269
268
|
}
|
|
270
269
|
let timer: any = null
|
|
271
270
|
return function () {
|
|
272
271
|
const context: any = this
|
|
273
272
|
const args = arguments
|
|
274
273
|
timer && clearTimeout(timer)
|
|
275
274
|
timer = setTimeout(function () {
|
|
276
275
|
fn.apply(context, args)
|
|
277
276
|
}, delay)
|
|
278
277
|
}
|
|
279
278
|
if (txt) {
|
|
280
279
|
txt = txt.trim()
|
|
281
280
|
const reg = new RegExp(/[\d-]+/)
|
|
282
281
|
const res = reg.exec(txt)
|
|
283
282
|
if (res && res.length > 0) {
|
|
284
283
|
let tel = res[0]
|
|
285
284
|
if (tel && delSeparator) {
|
|
286
285
|
tel = tel.replace(/-/g, '')
|
|
287
286
|
}
|
|
288
287
|
return tel
|
|
289
288
|
}
|
|
290
289
|
}
|
|
291
290
|
return ''
|
|
292
291
|
if (rgb) {
|
|
293
292
|
const reg = /^(rgb|RGB)/
|
|
294
293
|
const color = rgb
|
|
295
294
|
if (reg.test(color)) {
|
|
296
295
|
let strHex = '#'
|
|
297
296
|
const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
|
|
298
297
|
for (let i = 0; i < colorArr.length; i++) {
|
|
299
298
|
let hex = Number(colorArr[i]).toString(16)
|
|
300
299
|
if (hex === '0') {
|
|
301
300
|
hex += hex
|
|
302
301
|
}
|
|
303
302
|
strHex += hex
|
|
304
303
|
}
|
|
305
304
|
return strHex
|
|
306
305
|
} else {
|
|
307
306
|
return String(color)
|
|
308
307
|
}
|
|
309
308
|
} else {
|
|
310
309
|
return ''
|
|
311
310
|
}
|
|
312
311
|
if (hex) {
|
|
313
312
|
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
|
|
314
313
|
let color = hex.toLowerCase()
|
|
315
314
|
if (reg.test(color)) {
|
|
316
315
|
if (color.length === 4) {
|
|
317
316
|
let colorNew = '#'
|
|
318
317
|
for (let i = 1; i < 4; i += 1) {
|
|
319
318
|
colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1))
|
|
320
319
|
}
|
|
321
320
|
color = colorNew
|
|
322
321
|
}
|
|
323
322
|
const colorChange: number[] = []
|
|
324
323
|
for (let i = 1; i < 7; i += 2) {
|
|
325
324
|
colorChange.push(parseInt('0x' + color.slice(i, i + 2)))
|
|
326
325
|
}
|
|
327
326
|
if (returnList) {
|
|
328
327
|
return colorChange
|
|
329
328
|
} else {
|
|
330
329
|
return 'RGB(' + colorChange.join(',') + ')'
|
|
331
330
|
}
|
|
332
331
|
} else {
|
|
333
332
|
return color
|
|
334
333
|
}
|
|
335
334
|
} else {
|
|
336
335
|
return ''
|
|
337
336
|
}
|
|
338
337
|
n: number,
|
|
339
338
|
m: number,
|
|
340
339
|
filterNum: number | undefined = undefined,
|
|
341
340
|
const c = m - n + 1
|
|
342
341
|
const res = Math.floor(Math.random() * c + n)
|
|
343
342
|
if (filterNum && filterNum == res) {
|
|
344
343
|
console.log('随机数二次开始', res, filterNum)
|
|
345
344
|
return getRandom(n, m, filterNum)
|
|
346
345
|
} else {
|
|
347
346
|
return res
|
|
348
347
|
}
|
|
349
348
|
wqCookieStr: string
|
|
350
349
|
wqCookie: {
|
|
351
350
|
pin?: string
|
|
352
351
|
visitkey?: string
|
|
353
352
|
[key: string]: any
|
|
354
353
|
}
|
|
355
354
|
const {
|
|
356
355
|
jdpin,
|
|
357
356
|
pinStatus,
|
|
358
357
|
visitkey,
|
|
359
358
|
unionid,
|
|
360
359
|
skey,
|
|
361
360
|
__jda,
|
|
362
361
|
__jdv,
|
|
363
362
|
__wga,
|
|
364
363
|
wxapp_type,
|
|
365
364
|
appType
|
|
366
365
|
} = cookie
|
|
367
366
|
const ret: string[] = []
|
|
368
367
|
const getUserCookieObj = {}
|
|
369
368
|
const createUseCookieArr = [
|
|
370
369
|
jdpin,
|
|
371
370
|
pinStatus,
|
|
372
371
|
visitkey,
|
|
373
372
|
unionid,
|
|
374
373
|
skey,
|
|
375
374
|
__jda,
|
|
376
375
|
__jdv,
|
|
377
376
|
__wga,
|
|
378
377
|
wid,
|
|
379
378
|
wq_skey,
|
|
380
379
|
wq_uin,
|
|
381
380
|
wq_auth_token,
|
|
382
381
|
wxapp_scene,
|
|
383
382
|
wq_unionid,
|
|
384
383
|
wxapp_openid,
|
|
385
384
|
wxapp_version,
|
|
386
385
|
wxapp_type,
|
|
387
386
|
appType
|
|
388
387
|
name = name === 'jdpin' ? 'pin' : name;
|
|
389
388
|
name === 'pin' && (ret.push(`pt_pin=${encodeURIComponent(value)}`))
|
|
390
389
|
ret.push(`${name}=${encodeURIComponent(value)}`)
|
|
391
390
|
getUserCookieObj[name] = value
|
|
392
391
|
}
|
|
393
392
|
})
|
|
394
393
|
return {
|
|
395
394
|
wqCookieStr: ret.join(';'),
|
|
396
395
|
wqCookie: getUserCookieObj,
|
|
397
396
|
}
|
|
398
397
|
num,
|
|
399
398
|
widthSize = 375,
|
|
400
399
|
layoutWidth = windowWidth,
|
|
401
400
|
const getNum = Number(num)
|
|
402
401
|
return Math.round((getNum / widthSize) * layoutWidth)
|
|
403
402
|
let checkState = false
|
|
404
403
|
const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag
|
|
405
404
|
if (couponFloorModuleType === FloorModuleType.COUPON) {
|
|
406
405
|
try {
|
|
407
406
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
408
407
|
const couponDataDefine = dataDefines
|
|
409
408
|
? dataDefines.filter((item) => {
|
|
410
409
|
return item.type === 'coupon'
|
|
411
410
|
})
|
|
412
411
|
: [],
|
|
413
412
|
couponList = couponDataDefine[0]?.nodeText?.data
|
|
414
413
|
? couponDataDefine[0]?.nodeText?.data
|
|
415
414
|
: [],
|
|
416
415
|
couponLength = couponList.length,
|
|
417
416
|
numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
418
417
|
? couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
419
418
|
: 0
|
|
420
419
|
if (numShowPerLine === 0 && couponLength > 3) {
|
|
421
420
|
checkState = true
|
|
422
421
|
}
|
|
423
422
|
} catch (e) {
|
|
424
423
|
checkState = false
|
|
425
424
|
}
|
|
426
425
|
return checkState
|
|
427
426
|
}
|
|
428
427
|
containers = [],
|
|
429
428
|
floors = [],
|
|
430
429
|
clearFirstContaierMarginTop = false,
|
|
431
430
|
isLuxuryShop = false,
|
|
432
431
|
isShowNativeImmersivePlayer=false,
|
|
433
432
|
screenHeight = null,
|
|
434
433
|
screenWidth = null,
|
|
435
434
|
bottomBarHeight= null
|
|
436
435
|
} = pageData
|
|
437
436
|
exceptionReportFn
|
|
438
437
|
)
|
|
439
438
|
if (getFloorData) {
|
|
440
439
|
containerId: item.containerId,
|
|
441
440
|
containerIndex: index,
|
|
442
441
|
...getFloorData,
|
|
443
442
|
}
|
|
444
443
|
if(getFloorData?.floorExtInfo?.floorLoadWay === 2){
|
|
445
444
|
const getSysFloorToLoadTypeRes = isIsvFloorUseable(getFloorData, exceptionReportFn)
|
|
446
445
|
!getSysFloorToLoadTypeRes && (getFloorData.floorExtInfo.floorLoadWay = 1)
|
|
447
446
|
}
|
|
448
447
|
if(isProd && isWxMinAndWxapp){
|
|
449
448
|
shopContentContainerListData = shopContentContainerListData.filter(
|
|
450
449
|
(item) =>
|
|
451
450
|
item.floors.length > 0 &&
|
|
452
451
|
!isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData)
|
|
453
452
|
)
|
|
454
453
|
}
|
|
455
454
|
shopContentContainerListData = [].concat(shopContentContainerListData)
|
|
456
455
|
return {
|
|
457
456
|
shopContentContainerListData,
|
|
458
457
|
shopContentFloorListData,
|
|
459
458
|
}
|
|
460
459
|
const changeOpts = {
|
|
461
460
|
title: '',
|
|
462
461
|
icon: 'success',
|
|
463
462
|
duration: 1500,
|
|
464
463
|
mask: true,
|
|
465
464
|
...options,
|
|
466
465
|
}
|
|
467
466
|
if (changeOpts.title.length > 7) {
|
|
468
467
|
showNormalToast(options)
|
|
469
468
|
} else {
|
|
470
469
|
Taro.showToast(changeOpts as any)
|
|
471
470
|
}
|
|
472
471
|
const changeOpts = {
|
|
473
472
|
title: '',
|
|
474
473
|
icon: 'error',
|
|
475
474
|
duration: 1500,
|
|
476
475
|
mask: true,
|
|
477
476
|
...options,
|
|
478
477
|
}
|
|
479
478
|
if (changeOpts.title.length > 7) {
|
|
480
479
|
showNormalToast(options)
|
|
481
480
|
} else {
|
|
482
481
|
Taro.showToast(changeOpts as any)
|
|
483
482
|
}
|
|
484
483
|
Taro.showToast({
|
|
485
484
|
title: '',
|
|
486
485
|
icon: 'none',
|
|
487
486
|
duration: 1500,
|
|
488
487
|
mask: true,
|
|
489
488
|
...options,
|
|
490
489
|
})
|
|
491
490
|
return Taro.showLoading({
|
|
492
491
|
title: text,
|
|
493
492
|
})
|
|
494
493
|
return new Promise(() => {
|
|
495
494
|
Taro.nextTick(() => {
|
|
496
495
|
setTimeout(() => {
|
|
497
496
|
Taro.hideLoading(options)
|
|
498
497
|
}, 300)
|
|
499
498
|
})
|
|
500
499
|
})
|
|
501
500
|
return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
502
501
|
const {
|
|
503
502
|
tabActive = SECTION_HOME_TAB_NAME_TYPE[
|
|
504
503
|
SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
|
|
505
504
|
],
|
|
506
505
|
sceneId,
|
|
507
506
|
} = query
|
|
508
507
|
let changeTabActive = tabActive
|
|
509
508
|
if (sceneId) {
|
|
510
509
|
if (isH5) {
|
|
511
510
|
if (sceneId == '1002') {
|
|
512
511
|
changeTabActive =
|
|
513
512
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
|
|
514
513
|
}
|
|
515
514
|
else if (sceneId == '1003') {
|
|
516
515
|
changeTabActive =
|
|
517
516
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY]
|
|
518
517
|
}
|
|
519
518
|
} else if (isWxMinAndWxapp) {
|
|
520
519
|
if (sceneId == '1001' || sceneId == '1002') {
|
|
521
520
|
changeTabActive =
|
|
522
521
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
|
|
523
522
|
}
|
|
524
523
|
else if (sceneId == '1003') {
|
|
525
524
|
changeTabActive =
|
|
526
525
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]
|
|
527
526
|
}
|
|
528
527
|
}
|
|
529
528
|
}
|
|
530
529
|
if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
|
|
531
530
|
return {
|
|
532
531
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
533
532
|
tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
|
|
534
533
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
|
|
535
534
|
}
|
|
536
535
|
} else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
|
|
537
536
|
return {
|
|
538
537
|
menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
|
|
539
538
|
tabActiveType: 0,
|
|
540
539
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
|
|
541
540
|
}
|
|
542
541
|
} else {
|
|
543
542
|
return {
|
|
544
543
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
545
544
|
tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
|
|
546
545
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
|
|
547
546
|
}
|
|
548
547
|
}
|
|
549
548
|
const deleteKeyList = [
|
|
550
549
|
'$taroTimestamp',
|
|
551
550
|
'cookie',
|
|
552
551
|
'wdref',
|
|
553
552
|
'navStart',
|
|
554
553
|
'originOpts',
|
|
555
554
|
'originParams',
|
|
556
555
|
'originUrl',
|
|
557
556
|
'referer',
|
|
558
557
|
'stamp',
|
|
559
558
|
]
|
|
560
559
|
let changeQueryData: any = { ...queryData }
|
|
561
560
|
const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false
|
|
562
561
|
const sceneQuery =
|
|
563
562
|
qrCodeScene && typeof qrCodeScene == 'string'
|
|
564
563
|
? parseQueryUrlString(decodeURIComponent(qrCodeScene))
|
|
565
564
|
: {}
|
|
566
565
|
changeQueryData = { ...changeQueryData, ...sceneQuery }
|
|
567
566
|
deleteKeyList.forEach((key) => {
|
|
568
567
|
changeQueryData[key] && delete changeQueryData[key]
|
|
569
568
|
})
|
|
570
569
|
changeQueryData['shopid'] &&
|
|
571
570
|
(changeQueryData['shopId'] = changeQueryData['shopid']) &&
|
|
572
571
|
delete changeQueryData['shopid']
|
|
573
572
|
changeQueryData['venderid'] &&
|
|
574
573
|
(changeQueryData['venderId'] = changeQueryData['venderid']) &&
|
|
575
574
|
delete changeQueryData['venderid']
|
|
576
575
|
changeQueryData['vendorId'] &&
|
|
577
576
|
(changeQueryData['venderId'] = changeQueryData['vendorId']) &&
|
|
578
577
|
delete changeQueryData['vendorId']
|
|
579
578
|
return changeQueryData
|
|
580
579
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
581
580
|
const modularPackResultObj = formatPackResult(modularPackResult)
|
|
582
581
|
const bundleUrl = getBundleUrl(modularPackResultObj)
|
|
583
582
|
const bundleFileName = getBundleFileName(modularPackResultObj)
|
|
584
583
|
if (bundleUrl && bundleFileName) {
|
|
585
584
|
isUsable = true
|
|
586
585
|
}
|
|
587
586
|
const objContainer = containerListData.find(
|
|
588
587
|
(item) => item.containerId === containerId,
|
|
589
588
|
)
|
|
590
589
|
return (
|
|
591
590
|
objContainer?.includeUids?.some((itemUid) => {
|
|
592
591
|
const objectFloor = floorListData.find(
|
|
593
592
|
(floorItem) => itemUid === floorItem.uid,
|
|
594
593
|
)
|
|
595
594
|
return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
|
|
596
595
|
}) ?? false
|
|
597
596
|
)
|
|
598
597
|
floorListData,
|
|
599
598
|
containerListData,
|
|
600
599
|
exceptionReportFn?,
|
|
601
600
|
const unableIsvFloorListData = floorListData.filter(
|
|
602
601
|
(floorItem) =>
|
|
603
602
|
RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
|
|
604
603
|
!isIsvFloorUseable(floorItem, exceptionReportFn),
|
|
605
604
|
)
|
|
606
605
|
const unableIsvFloorUidList = unableIsvFloorListData.map(
|
|
607
606
|
(floorItem) => floorItem.uid,
|
|
608
607
|
)
|
|
609
608
|
const unableIsvContainerListData = containerListData.filter(
|
|
610
609
|
(item) =>
|
|
611
610
|
item.includeUids &&
|
|
612
611
|
item.includeUids.every(
|
|
613
612
|
(itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1,
|
|
614
613
|
),
|
|
615
614
|
)
|
|
616
615
|
return unableIsvContainerListData
|
|
617
616
|
return -2
|
|
618
617
|
return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl)
|
|
619
618
|
let getParams = false
|
|
620
619
|
if (isOpenJdAppUrl(openAppUrl)) {
|
|
621
620
|
try {
|
|
622
621
|
getParams = openAppUrl.replace(
|
|
623
622
|
/openApp\.jdMobile:\/\/virtual\?params=/i,
|
|
624
623
|
'',
|
|
625
624
|
)
|
|
626
625
|
getParams = JSON.parse(String(getParams))
|
|
627
626
|
} catch (e) {
|
|
628
627
|
console.log(e)
|
|
629
628
|
}
|
|
630
629
|
}
|
|
631
630
|
return getParams
|
|
632
631
|
return `openapp.jdmobile://virtual?params=${JSON.stringify(Object.assign({}, openParams))}`
|
|
633
632
|
if (val === null || val === '' || typeof val === 'undefined') {
|
|
634
633
|
return true
|
|
635
634
|
}
|
|
636
635
|
return false
|
|
637
636
|
const {
|
|
638
637
|
moduleId = 'none',
|
|
639
638
|
entrance = 'none',
|
|
640
639
|
sourceType = 'none',
|
|
641
640
|
sourceValue = 'none',
|
|
642
641
|
} = params
|
|
643
642
|
if (isIosDevice) {
|
|
644
643
|
return `${moduleId}#${entrance}`
|
|
645
644
|
} else if (isAndroidDevice) {
|
|
646
645
|
return `${sourceType}#${sourceValue}`
|
|
647
646
|
}
|
|
648
647
|
return 'none#none'
|
|
649
648
|
if (data && typeof data === 'object') {
|
|
650
649
|
let getOpenAppData = { ...data }
|
|
651
650
|
try {
|
|
652
651
|
const { sourceInfo, designerId, templateId, source } = getOpenAppData
|
|
653
652
|
if (designerId && templateId) {
|
|
654
653
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
655
654
|
sourceInfo: {
|
|
656
655
|
entrance: '设计师预览',
|
|
657
656
|
},
|
|
658
657
|
})
|
|
659
658
|
} else if (sourceInfo) {
|
|
660
659
|
const { entrance } = sourceInfo
|
|
661
660
|
getOpenAppData.sourceInfo.entrance =
|
|
662
661
|
entrance && entrance.length > 0 ? entrance : '其他'
|
|
663
662
|
} else if (source && !sourceInfo) {
|
|
664
663
|
if (typeof source === 'object') {
|
|
665
664
|
const { sourceType, entrance, sourceValue, moduleId } = source
|
|
666
665
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
667
666
|
sourceInfo: {
|
|
668
667
|
entrance: sourceType || entrance || '其他',
|
|
669
668
|
moduleId: sourceValue || moduleId || '-100',
|
|
670
669
|
},
|
|
671
670
|
})
|
|
672
671
|
} else {
|
|
673
672
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
674
673
|
sourceInfo: {
|
|
675
674
|
entrance: source,
|
|
676
675
|
},
|
|
677
676
|
})
|
|
678
677
|
}
|
|
679
678
|
} else {
|
|
680
679
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
681
680
|
sourceInfo: {
|
|
682
681
|
entrance: '其他',
|
|
683
682
|
},
|
|
684
683
|
})
|
|
685
684
|
}
|
|
686
685
|
} catch (e) {
|
|
687
686
|
console.log(e)
|
|
688
687
|
}
|
|
689
688
|
return getOpenAppData
|
|
690
689
|
}
|
|
691
690
|
return data
|
|
692
691
|
return displayObj
|
|
693
692
|
isChartH5,
|
|
694
693
|
isH5AndJdShopViewH5Scroll,
|
|
695
694
|
isH5AndJdShopH5CustomScrollView,
|
|
696
695
|
isMemberPage,
|
|
697
696
|
sgmCustomReport,
|
|
698
697
|
isOpenJdAppUrl,
|
|
699
698
|
jdOpenAppParams,
|
|
700
699
|
createJdOpenAppUrl,
|
|
701
700
|
dealJdOpenAppData,
|
|
702
701
|
isEmpty,
|
|
703
702
|
getJdAppReportPageSource,
|
|
704
703
|
isPc,
|
|
705
704
|
ipLoc_djd,
|
|
706
705
|
jdAppVersionCompare,
|
|
707
706
|
dealNativePixelToCssPixel,
|
|
708
707
|
isAppStowShop
|
|
708
|
+
import Taro from '@tarojs/taro'
|
|
709
709
|
SHOP_MENU_ID_TYPE,
|
|
710
710
|
SHOP_MENU_ID_QUERY_NAME,
|
|
711
711
|
SECTION_HOME_TAB_TYPE,
|
|
712
712
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
713
713
|
SECTION_HOME_TAB_QUERY_TYPE,
|
|
714
714
|
CHANNEL_TYPE,
|
|
715
715
|
JDShopViewBusinessPathType,
|
|
716
716
|
FloorModuleType,
|
|
717
717
|
RemoteLoadFloorList,
|
|
718
718
|
MPAAS_CONFIG_APP_VERSION,
|
|
719
719
|
getBundleUrl,
|
|
720
720
|
getBundleFileName,
|
|
721
721
|
formatPackResult,
|
|
722
722
|
key: string,
|
|
723
723
|
value: string | object,
|
|
724
724
|
successBack?: any,
|
|
725
725
|
failBack?: any,
|
|
726
726
|
return Taro.setStorage({
|
|
727
727
|
key: key,
|
|
728
728
|
data: value,
|
|
729
729
|
success: successBack,
|
|
730
730
|
fail: failBack,
|
|
731
731
|
})
|
|
732
732
|
return Taro.getStorageSync(key)
|
|
733
733
|
return Taro.removeStorage({
|
|
734
734
|
key: key,
|
|
735
735
|
})
|
|
736
736
|
return Taro.clearStorage()
|
|
737
737
|
const appVersionCheckPass =
|
|
738
738
|
versionCompare(jdAppVersionStr, MPAAS_CONFIG_APP_VERSION) >= 0
|
|
739
739
|
const supportBuildType = /app-view|app-member|app-classify/
|
|
740
740
|
const scopeCheckPass = supportBuildType.test(buildType || '')
|
|
741
741
|
const enableAvifOptimize = appVersionCheckPass && scopeCheckPass
|
|
742
742
|
if (!hasOutputLog) {
|
|
743
743
|
hasOutputLog = true
|
|
744
744
|
console.log(
|
|
745
745
|
'� ~~ file: utils.ts:119 ~~ isImageOptimizeEnable ~~ jdAppVersionStr:',
|
|
746
746
|
jdAppVersionStr,
|
|
747
747
|
' MPAAS_CONFIG_APP_VERSION:',
|
|
748
748
|
MPAAS_CONFIG_APP_VERSION,
|
|
749
749
|
' scopeCheckPass:',
|
|
750
750
|
scopeCheckPass,
|
|
751
751
|
' buildType:',
|
|
752
752
|
buildType,
|
|
753
753
|
' supportBuildType:',
|
|
754
754
|
supportBuildType,
|
|
755
755
|
)
|
|
756
756
|
console.log(
|
|
757
757
|
'� ~~ file: utils.ts:119 ~~ isImageOptimizeEnable ~~ enableAvifOptimize:',
|
|
758
758
|
enableAvifOptimize,
|
|
759
759
|
' appVersionCheckPass:',
|
|
760
760
|
appVersionCheckPass,
|
|
761
761
|
' scopeCheckPass:',
|
|
762
762
|
scopeCheckPass,
|
|
763
763
|
)
|
|
764
764
|
}
|
|
765
765
|
if (enableAvifOptimize) {
|
|
766
766
|
const configData = global.getDynamicConfig('avifSwitch')
|
|
767
767
|
console.warn(
|
|
768
768
|
'� ~~ file: utils.ts:142 ~~ global.getDynamicConfig ~~ configData:',
|
|
769
769
|
configData,
|
|
770
770
|
)
|
|
771
771
|
const {
|
|
772
772
|
globalOn = true,
|
|
773
773
|
ignoreOptimizeFromServer = false,
|
|
774
774
|
page = {},
|
|
775
775
|
whiteList = [],
|
|
776
776
|
blackList = [],
|
|
777
777
|
} = configData || {}
|
|
778
778
|
const { shopId = '0', venderId = '0' } = parseQueryUrlString(
|
|
779
779
|
window?.location?.href ?? '',
|
|
780
780
|
)
|
|
781
781
|
let imageEnableResult = true
|
|
782
782
|
isIgnoreOptimizeFromServer = ignoreOptimizeFromServer
|
|
783
783
|
if (
|
|
784
784
|
blackList.find(
|
|
785
785
|
item => item.sId === Number(shopId) || item.vId === Number(venderId),
|
|
786
786
|
)
|
|
787
787
|
) {
|
|
788
788
|
imageEnableResult = false
|
|
789
789
|
console.warn('� ~~ file: utils.ts:149 命中黑名单!')
|
|
790
790
|
} else if (
|
|
791
791
|
whiteList.find(
|
|
792
792
|
item => item.sId === Number(shopId) || item.vId === Number(venderId),
|
|
793
793
|
)
|
|
794
794
|
) {
|
|
795
795
|
imageEnableResult = true
|
|
796
796
|
console.warn('� ~~ file: utils.ts:154 命中白名单!')
|
|
797
797
|
} else {
|
|
798
798
|
imageEnableResult = globalOn === true || page[buildType] === true
|
|
799
799
|
console.warn(
|
|
800
800
|
'� ~~ file: utils.ts:158 走全局开关+页面开关控制逻辑,开关结果:',
|
|
801
801
|
imageEnableResult,
|
|
802
802
|
)
|
|
803
803
|
}
|
|
804
804
|
return imageEnableResult
|
|
805
805
|
} else {
|
|
806
806
|
return false
|
|
807
807
|
}
|
|
808
808
|
if (isH5) {
|
|
809
809
|
const avifCache = getTaroStorageKeyValue(KEY_AVIF)
|
|
810
810
|
if (avifCache === null || avifCache === '') {
|
|
811
811
|
const img = new Image()
|
|
812
812
|
img.onload = function() {
|
|
813
813
|
if (img.height > 0 && img.width > 0) {
|
|
814
814
|
setTaroStorage(KEY_AVIF, '1')
|
|
815
815
|
} else {
|
|
816
816
|
setTaroStorage(KEY_AVIF, '0')
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
819
|
img.onerror = () => {
|
|
820
820
|
setTaroStorage(KEY_AVIF, '0')
|
|
821
821
|
}
|
|
822
822
|
img.src =
|
|
823
823
|
'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A='
|
|
824
824
|
}
|
|
825
825
|
const webpCache = getTaroStorageKeyValue(KEY_WEBP)
|
|
826
826
|
if (webpCache === null || webpCache === '') {
|
|
827
827
|
const img = new Image()
|
|
828
828
|
img.onload = function() {
|
|
829
829
|
if (img.height > 0 && img.width > 0) {
|
|
830
830
|
setTaroStorage(KEY_WEBP, '1')
|
|
831
831
|
} else {
|
|
832
832
|
setTaroStorage(KEY_WEBP, '0')
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
835
|
img.onerror = () => {
|
|
836
836
|
setTaroStorage(KEY_WEBP, '0')
|
|
837
837
|
}
|
|
838
838
|
img.src =
|
|
839
839
|
'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAUAmJaQAA3AA/vz0AAA='
|
|
840
840
|
}
|
|
841
841
|
}
|
|
842
842
|
const resultList: Array<any> = [],
|
|
843
843
|
arrLen = arr.length
|
|
844
844
|
if (arrLen) {
|
|
845
845
|
if (arrLen > size) {
|
|
846
846
|
for (let i = 0; i < arrLen; i = i + size) {
|
|
847
847
|
resultList.push(arr.slice(i, i + size))
|
|
848
848
|
}
|
|
849
849
|
} else {
|
|
850
850
|
resultList.push(arr)
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
853
|
return resultList
|
|
854
854
|
let _address = ids
|
|
855
855
|
const _areaAreaSplit = ids.split('.')
|
|
856
856
|
const _areaAreaSplit2 = ids.split('_')
|
|
857
857
|
_address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address
|
|
858
858
|
_address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address
|
|
859
859
|
return _address
|
|
860
860
|
let paramStr = ''
|
|
861
861
|
obj &&
|
|
862
862
|
Object.keys(obj).forEach((key, index) => {
|
|
863
863
|
const getValue = `${obj[key]}`
|
|
864
864
|
.replace(/undefined/, '')
|
|
865
865
|
.replace(/null/, '')
|
|
866
866
|
paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(
|
|
867
867
|
getValue,
|
|
868
868
|
)}`
|
|
869
869
|
})
|
|
870
870
|
return paramStr
|
|
871
871
|
const result = {}
|
|
872
872
|
if (
|
|
873
873
|
!urlOrQueryStr ||
|
|
874
874
|
('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
|
|
875
875
|
) {
|
|
876
876
|
return result
|
|
877
877
|
}
|
|
878
878
|
if (urlOrQueryStr.indexOf('?') > -1) {
|
|
879
879
|
const queryStr = urlOrQueryStr.split('?')
|
|
880
880
|
const queryItemList =
|
|
881
881
|
queryStr && queryStr.length > 1 ? queryStr[1].split('&') : []
|
|
882
882
|
const queryItemListLen = queryItemList.length
|
|
883
883
|
queryItemListLen > 0 &&
|
|
884
884
|
queryItemList.forEach(item => {
|
|
885
885
|
const thisItemList = item.split('=')
|
|
886
886
|
result[thisItemList[0]] = thisItemList[1]
|
|
887
887
|
})
|
|
888
888
|
} else {
|
|
889
889
|
const queryItemList =
|
|
890
890
|
urlOrQueryStr.indexOf('&') > -1
|
|
891
891
|
? urlOrQueryStr.split('&')
|
|
892
892
|
: [urlOrQueryStr]
|
|
893
893
|
const queryItemListLen = queryItemList.length
|
|
894
894
|
queryItemListLen > 0 &&
|
|
895
895
|
queryItemList.forEach(item => {
|
|
896
896
|
const thisItemList = item.split('=')
|
|
897
897
|
result[thisItemList[0]] = thisItemList[1]
|
|
898
898
|
})
|
|
899
899
|
}
|
|
900
900
|
return result
|
|
901
901
|
url: string,
|
|
902
902
|
size?: {
|
|
903
903
|
w: number
|
|
904
904
|
h: number
|
|
905
905
|
},
|
|
906
906
|
quality?: number,
|
|
907
907
|
if (url && size) {
|
|
908
908
|
const _w = Math.floor(size.w)
|
|
909
909
|
const _h = Math.floor(size.h)
|
|
910
910
|
if (url.match(/gif$/i)) {
|
|
911
911
|
return url
|
|
912
912
|
} else {
|
|
913
913
|
if (_w > 0 && _h > 0) {
|
|
914
914
|
url = url.replace('jfs/', `s${_w}x${_h}_jfs/`)
|
|
915
915
|
}
|
|
916
916
|
url += quality != null ? `!q${quality}.dpg` : '.dpg'
|
|
917
917
|
}
|
|
918
918
|
}
|
|
919
919
|
return url
|
|
920
920
|
url: string,
|
|
921
921
|
jfsImgInfo: UtilsInterFace.getJfsImageInfo = {},
|
|
922
922
|
if (url.match(/\.(jpg|png|dpg)$/i)) {
|
|
923
923
|
const { width, height, quality } = jfsImgInfo
|
|
924
924
|
if (typeof width === 'number' || typeof height === 'number') {
|
|
925
925
|
url = url.replace(
|
|
926
926
|
'/jfs/',
|
|
927
927
|
`/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`,
|
|
928
928
|
)
|
|
929
929
|
}
|
|
930
930
|
if (
|
|
931
931
|
typeof quality === 'number' &&
|
|
932
932
|
quality > 0 &&
|
|
933
933
|
quality < 100 &&
|
|
934
934
|
url.match(/\.jpg$/i)
|
|
935
935
|
) {
|
|
936
936
|
url += `!q${quality}.dpg`
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
939
|
return addHttps(url)
|
|
940
940
|
if (imgUrl) {
|
|
941
941
|
if (
|
|
942
942
|
!imgUrl.match(
|
|
943
943
|
/(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
|
|
944
944
|
)
|
|
945
945
|
) {
|
|
946
946
|
if (!imgUrl.includes('360buyimg.com')) {
|
|
947
947
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl
|
|
948
948
|
}
|
|
949
949
|
if (quality != 100)
|
|
950
950
|
imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
|
|
951
951
|
}
|
|
952
952
|
imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl
|
|
953
953
|
}
|
|
954
954
|
return imgUrl
|
|
955
955
|
const result = value % step
|
|
956
956
|
return result === 0 ? value : Math.ceil(value / step) * step
|
|
957
957
|
const MAX = 3.5
|
|
958
958
|
return Math.min(window?.devicePixelRatio ?? 2, MAX)
|
|
959
959
|
isSkuImage: boolean
|
|
960
960
|
size: number
|
|
961
961
|
imgUrl: string,
|
|
962
962
|
options: QualityOptions,
|
|
963
963
|
if (!imgUrl) {
|
|
964
964
|
console.error(
|
|
965
965
|
'The input parameter imageUrl for the getQualityImage() cannot be empty!',
|
|
966
966
|
)
|
|
967
967
|
return imgUrl
|
|
968
968
|
}
|
|
969
969
|
if (isIgnoreOptimizeFromServer) {
|
|
970
970
|
imgUrl = imgUrl.replace(/\.(jpe?g|png).*/, '.$1')
|
|
971
971
|
}
|
|
972
972
|
if (!/^((https?):)?\/\//.test(imgUrl)) {
|
|
973
973
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl
|
|
974
974
|
}
|
|
975
975
|
const imgServerRegExp = /(img|m)\d{0,2}\.360buyimg\.com\/.*\.(jpe?g|png)/i
|
|
976
976
|
if (!imgServerRegExp.test(imgUrl)) {
|
|
977
977
|
return imgUrl
|
|
978
978
|
}
|
|
979
979
|
imgUrl = /^\/\//.test(imgUrl) ? `https:${imgUrl}` : imgUrl
|
|
980
980
|
const { isSkuImage, size } = options || {}
|
|
981
981
|
const needReduceSize = isSkuImage && size
|
|
982
982
|
if (needReduceSize) {
|
|
983
983
|
const devicePixelRatio = getDevicePixelRatio()
|
|
984
984
|
const useWidth = getValueByStep(size * devicePixelRatio, 40)
|
|
985
985
|
imgUrl = imgUrl.replace(/\/[^\/]*jfs\//, `/s${useWidth}x${useWidth}_jfs/`)
|
|
986
986
|
}
|
|
987
987
|
const needCompress = !global?.info?.pageInfo?.isVipShop
|
|
988
988
|
const result = imgUrl.match(/\/\w+\.(jpe?g|png)$/)
|
|
989
989
|
if (needCompress && result) {
|
|
990
990
|
if (getAvifSupport() === '1') {
|
|
991
991
|
imgUrl += '.avif'
|
|
992
992
|
} else if (getWebpSupport() === '1') {
|
|
993
993
|
imgUrl += '.webp'
|
|
994
994
|
} else if (/jpe?g/.test(result[1])) {
|
|
995
995
|
imgUrl += '!q80'
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
998
|
if (needReduceSize) {
|
|
999
999
|
imgUrl += '!z2'
|
|
1000
1000
|
}
|
|
1001
1001
|
return imgUrl
|
|
1002
1002
|
if (imgUrl) {
|
|
1003
1003
|
if (
|
|
1004
1004
|
!imgUrl.match(
|
|
1005
1005
|
/(storage\.360buyimg\.com)|(jdcloud-oss\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
|
|
1006
1006
|
)
|
|
1007
1007
|
) {
|
|
1008
1008
|
if (!imgUrl.includes('360buyimg.com')) {
|
|
1009
1009
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl
|
|
1010
1010
|
}
|
|
1011
1011
|
if (quality != 100)
|
|
1012
1012
|
imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
|
|
1013
1013
|
}
|
|
1014
1014
|
imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl
|
|
1015
1015
|
}
|
|
1016
1016
|
return imgUrl
|
|
1017
1017
|
return getTaroStorageKeyValue(KEY_AVIF) || '0'
|
|
1018
1018
|
return getTaroStorageKeyValue(KEY_WEBP) || '0'
|
|
1019
1019
|
count: number,
|
|
1020
1020
|
fixedNum = 2,
|
|
1021
1021
|
unit = '万',
|
|
1022
1022
|
maxNum = 10000,
|
|
1023
1023
|
count = Number(count)
|
|
1024
1024
|
if (count > maxNum) {
|
|
1025
1025
|
return (count / maxNum).toFixed(fixedNum) + unit
|
|
1026
1026
|
}
|
|
1027
1027
|
return count
|
|
1028
1028
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
|
|
1029
1029
|
platform: '',
|
|
1030
1030
|
model: '',
|
|
1031
1031
|
system: '',
|
|
1032
1032
|
}
|
|
1033
1033
|
const isIOS = !!systemInfo.system.match(/ios/i)
|
|
1034
1034
|
const isAndroid = !!systemInfo.system.match(/android/i)
|
|
1035
1035
|
if (!systemInfo.statusBarHeight) {
|
|
1036
1036
|
systemInfo.statusBarHeight = screenHeight - windowHeight - 20
|
|
1037
1037
|
systemInfo.navBarExtendHeight = 0
|
|
1038
1038
|
} else {
|
|
1039
1039
|
if (isIOS) {
|
|
1040
1040
|
systemInfo.navBarExtendHeight = 4
|
|
1041
1041
|
} else {
|
|
1042
1042
|
systemInfo.navBarExtendHeight = 0
|
|
1043
1043
|
}
|
|
1044
1044
|
}
|
|
1045
1045
|
let rect = Taro.getMenuButtonBoundingClientRect
|
|
1046
1046
|
? Taro.getMenuButtonBoundingClientRect()
|
|
1047
1047
|
: null
|
|
1048
1048
|
if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
|
|
1049
1049
|
let gap = 0
|
|
1050
1050
|
let width = 96
|
|
1051
1051
|
if (systemInfo.platform === 'android') {
|
|
1052
1052
|
gap = 8
|
|
1053
1053
|
width = 96
|
|
1054
1054
|
} else if (systemInfo.platform === 'devtools') {
|
|
1055
1055
|
if (isIOS) {
|
|
1056
1056
|
gap = 5.5
|
|
1057
1057
|
} else {
|
|
1058
1058
|
gap = 7.5
|
|
1059
1059
|
}
|
|
1060
1060
|
} else {
|
|
1061
1061
|
gap = 4
|
|
1062
1062
|
width = 88
|
|
1063
1063
|
}
|
|
1064
1064
|
rect = {
|
|
1065
1065
|
bottom: systemInfo.statusBarHeight + gap + 32,
|
|
1066
1066
|
height: 32,
|
|
1067
1067
|
left: systemInfo.windowWidth - width - 10,
|
|
1068
1068
|
right: systemInfo.windowWidth - 10,
|
|
1069
1069
|
top: systemInfo.statusBarHeight + gap,
|
|
1070
1070
|
width,
|
|
1071
1071
|
}
|
|
1072
1072
|
}
|
|
1073
1073
|
const gap = rect.top - systemInfo.statusBarHeight
|
|
1074
1074
|
systemInfo.navBarTopToStatusBar = gap
|
|
1075
1075
|
systemInfo.navBarHeight = 2 * gap + rect.height
|
|
1076
1076
|
systemInfo.capsulePosition = rect
|
|
1077
1077
|
systemInfo.isIOS = isIOS
|
|
1078
1078
|
systemInfo.isAndroid = isAndroid
|
|
1079
1079
|
return systemInfo
|
|
1080
1080
|
if (str.match(/^\/\//)) {
|
|
1081
1081
|
str = 'https:' + str
|
|
1082
1082
|
}
|
|
1083
1083
|
return str
|
|
1084
1084
|
dateTimeOrdate: Date | string | number | null,
|
|
1085
1085
|
format = 'yyyy-MM-dd HH:mm:ss',
|
|
1086
1086
|
noPadStart = {
|
|
1087
1087
|
M: '0',
|
|
1088
1088
|
d: '0',
|
|
1089
1089
|
H: '0',
|
|
1090
1090
|
m: '0',
|
|
1091
1091
|
s: '0',
|
|
1092
1092
|
},
|
|
1093
1093
|
let dateResult = ''
|
|
1094
1094
|
const padStarts = Object.assign(
|
|
1095
1095
|
{
|
|
1096
1096
|
M: '0',
|
|
1097
1097
|
d: '0',
|
|
1098
1098
|
H: '0',
|
|
1099
1099
|
m: '0',
|
|
1100
1100
|
s: '0',
|
|
1101
1101
|
},
|
|
1102
1102
|
noPadStart,
|
|
1103
1103
|
)
|
|
1104
1104
|
if (dateTimeOrdate) {
|
|
1105
1105
|
let changeDateTimeOrdate = dateTimeOrdate
|
|
1106
1106
|
const getChangeDateTimeToNumber = Number(changeDateTimeOrdate)
|
|
1107
1107
|
if (getChangeDateTimeToNumber) {
|
|
1108
1108
|
changeDateTimeOrdate = getChangeDateTimeToNumber
|
|
1109
1109
|
} else {
|
|
1110
1110
|
changeDateTimeOrdate = `${changeDateTimeOrdate}`
|
|
1111
1111
|
.replace(/-/g, '/')
|
|
1112
1112
|
.replace(/\./g, '/')
|
|
1113
1113
|
}
|
|
1114
1114
|
const nowDate =
|
|
1115
1115
|
dateTimeOrdate instanceof Date
|
|
1116
1116
|
? dateTimeOrdate
|
|
1117
1117
|
: new Date(changeDateTimeOrdate)
|
|
1118
1118
|
const dateMap = {
|
|
1119
1119
|
y: `${nowDate.getFullYear()}`,
|
|
1120
1120
|
M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
|
|
1121
1121
|
d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
|
|
1122
1122
|
H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
|
|
1123
1123
|
m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
|
|
1124
1124
|
s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
|
|
1125
1125
|
}
|
|
1126
1126
|
const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g')
|
|
1127
1127
|
const regYear = new RegExp('y')
|
|
1128
1128
|
dateResult = format.replace(regDate, v => {
|
|
1129
1129
|
let changeValue = v
|
|
1130
1130
|
if (regYear.test(changeValue)) {
|
|
1131
1131
|
const thisYear = dateMap.y
|
|
1132
1132
|
const subValueLen = 4 - changeValue.length
|
|
1133
1133
|
changeValue = thisYear.substr(subValueLen)
|
|
1134
1134
|
} else {
|
|
1135
1135
|
const dateKey = v.substr(0, 1)
|
|
1136
1136
|
changeValue = dateMap[dateKey]
|
|
1137
1137
|
}
|
|
1138
1138
|
return changeValue
|
|
1139
1139
|
})
|
|
1140
1140
|
}
|
|
1141
1141
|
return dateResult
|
|
1142
1142
|
let timer: any = null
|
|
1143
1143
|
let startTime = Date.now()
|
|
1144
1144
|
return function() {
|
|
1145
1145
|
const curTime = Date.now()
|
|
1146
1146
|
const remaining = delay - (curTime - startTime)
|
|
1147
1147
|
const context = this
|
|
1148
1148
|
const args = arguments
|
|
1149
1149
|
clearTimeout(timer)
|
|
1150
1150
|
if (remaining <= 0) {
|
|
1151
1151
|
func.apply(context, args)
|
|
1152
1152
|
startTime = Date.now()
|
|
1153
1153
|
} else {
|
|
1154
1154
|
timer = setTimeout(func, remaining)
|
|
1155
1155
|
}
|
|
1156
1156
|
}
|
|
1157
1157
|
let context, args, result
|
|
1158
1158
|
let timeout = null
|
|
1159
1159
|
let previous = 0
|
|
1160
1160
|
if (!options) options = {}
|
|
1161
1161
|
const later = function() {
|
|
1162
1162
|
previous = options.leading === false ? 0 : Date.now()
|
|
1163
1163
|
timeout = null
|
|
1164
1164
|
result = func.apply(context, args)
|
|
1165
1165
|
if (!timeout) context = args = null
|
|
1166
1166
|
}
|
|
1167
1167
|
return function() {
|
|
1168
1168
|
const now = Date.now()
|
|
1169
1169
|
if (!previous && options.leading === false) previous = now
|
|
1170
1170
|
const remaining = wait - (now - previous)
|
|
1171
1171
|
context = this
|
|
1172
1172
|
args = arguments
|
|
1173
1173
|
if (remaining <= 0 || remaining > wait) {
|
|
1174
1174
|
if (timeout) {
|
|
1175
1175
|
clearTimeout(timeout)
|
|
1176
1176
|
timeout = null
|
|
1177
1177
|
}
|
|
1178
1178
|
previous = now
|
|
1179
1179
|
result = func.apply(context, args)
|
|
1180
1180
|
if (!timeout) context = args = null
|
|
1181
1181
|
} else if (!timeout && options.trailing !== false) {
|
|
1182
1182
|
timeout = setTimeout(later, remaining)
|
|
1183
1183
|
}
|
|
1184
1184
|
return result
|
|
1185
1185
|
}
|
|
1186
1186
|
let timer: any = null
|
|
1187
1187
|
return function() {
|
|
1188
1188
|
const context: any = this
|
|
1189
1189
|
const args = arguments
|
|
1190
1190
|
timer && clearTimeout(timer)
|
|
1191
1191
|
timer = setTimeout(function() {
|
|
1192
1192
|
fn.apply(context, args)
|
|
1193
1193
|
}, delay)
|
|
1194
1194
|
}
|
|
1195
1195
|
if (txt) {
|
|
1196
1196
|
txt = txt.trim()
|
|
1197
1197
|
const reg = new RegExp(/[\d-]+/)
|
|
1198
1198
|
const res = reg.exec(txt)
|
|
1199
1199
|
if (res && res.length > 0) {
|
|
1200
1200
|
let tel = res[0]
|
|
1201
1201
|
if (tel && delSeparator) {
|
|
1202
1202
|
tel = tel.replace(/-/g, '')
|
|
1203
1203
|
}
|
|
1204
1204
|
return tel
|
|
1205
1205
|
}
|
|
1206
1206
|
}
|
|
1207
1207
|
return ''
|
|
1208
1208
|
if (rgb) {
|
|
1209
1209
|
const reg = /^(rgb|RGB)/
|
|
1210
1210
|
const color = rgb
|
|
1211
1211
|
if (reg.test(color)) {
|
|
1212
1212
|
let strHex = '#'
|
|
1213
1213
|
const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
|
|
1214
1214
|
for (let i = 0; i < colorArr.length; i++) {
|
|
1215
1215
|
let hex = Number(colorArr[i]).toString(16)
|
|
1216
1216
|
if (hex === '0') {
|
|
1217
1217
|
hex += hex
|
|
1218
1218
|
}
|
|
1219
1219
|
strHex += hex
|
|
1220
1220
|
}
|
|
1221
1221
|
return strHex
|
|
1222
1222
|
} else {
|
|
1223
1223
|
return String(color)
|
|
1224
1224
|
}
|
|
1225
1225
|
} else {
|
|
1226
1226
|
return ''
|
|
1227
1227
|
}
|
|
1228
1228
|
if (hex) {
|
|
1229
1229
|
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
|
|
1230
1230
|
let color = hex.toLowerCase()
|
|
1231
1231
|
if (reg.test(color)) {
|
|
1232
1232
|
if (color.length === 4) {
|
|
1233
1233
|
let colorNew = '#'
|
|
1234
1234
|
for (let i = 1; i < 4; i += 1) {
|
|
1235
1235
|
colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1))
|
|
1236
1236
|
}
|
|
1237
1237
|
color = colorNew
|
|
1238
1238
|
}
|
|
1239
1239
|
const colorChange: number[] = []
|
|
1240
1240
|
for (let i = 1; i < 7; i += 2) {
|
|
1241
1241
|
colorChange.push(parseInt('0x' + color.slice(i, i + 2)))
|
|
1242
1242
|
}
|
|
1243
1243
|
if (returnList) {
|
|
1244
1244
|
return colorChange
|
|
1245
1245
|
} else {
|
|
1246
1246
|
return 'RGB(' + colorChange.join(',') + ')'
|
|
1247
1247
|
}
|
|
1248
1248
|
} else {
|
|
1249
1249
|
return color
|
|
1250
1250
|
}
|
|
1251
1251
|
} else {
|
|
1252
1252
|
return ''
|
|
1253
1253
|
}
|
|
1254
1254
|
n: number,
|
|
1255
1255
|
m: number,
|
|
1256
1256
|
filterNum: number | undefined = undefined,
|
|
1257
1257
|
const c = m - n + 1
|
|
1258
1258
|
const res = Math.floor(Math.random() * c + n)
|
|
1259
1259
|
if (filterNum && filterNum == res) {
|
|
1260
1260
|
console.log('随机数二次开始', res, filterNum)
|
|
1261
1261
|
return getRandom(n, m, filterNum)
|
|
1262
1262
|
} else {
|
|
1263
1263
|
return res
|
|
1264
1264
|
}
|
|
1265
1265
|
cookie: UtilsInterFace.wxAppCookie,
|
|
1266
1266
|
wqCookieStr: string
|
|
1267
1267
|
wqCookie: {
|
|
1268
1268
|
pin?: string
|
|
1269
1269
|
visitkey?: string
|
|
1270
1270
|
[key: string]: any
|
|
1271
1271
|
}
|
|
1272
1272
|
const {
|
|
1273
1273
|
jdpin,
|
|
1274
1274
|
pinStatus,
|
|
1275
1275
|
visitkey,
|
|
1276
1276
|
unionid,
|
|
1277
1277
|
skey,
|
|
1278
1278
|
__jda,
|
|
1279
1279
|
__jdv,
|
|
1280
1280
|
__wga,
|
|
1281
1281
|
wid,
|
|
1282
1282
|
wq_skey,
|
|
1283
1283
|
wq_uin,
|
|
1284
1284
|
wq_auth_token,
|
|
1285
1285
|
wxapp_scene,
|
|
1286
1286
|
wq_unionid,
|
|
1287
1287
|
wxapp_openid,
|
|
1288
1288
|
wxapp_version,
|
|
1289
1289
|
wxapp_type,
|
|
1290
1290
|
appType,
|
|
1291
1291
|
} = cookie
|
|
1292
1292
|
const ret: string[] = []
|
|
1293
1293
|
const getUserCookieObj = {}
|
|
1294
1294
|
const createUseCookieArr = [
|
|
1295
1295
|
jdpin,
|
|
1296
1296
|
pinStatus,
|
|
1297
1297
|
visitkey,
|
|
1298
1298
|
unionid,
|
|
1299
1299
|
skey,
|
|
1300
1300
|
__jda,
|
|
1301
1301
|
__jdv,
|
|
1302
1302
|
__wga,
|
|
1303
1303
|
wid,
|
|
1304
1304
|
wq_skey,
|
|
1305
1305
|
wq_uin,
|
|
1306
1306
|
wq_auth_token,
|
|
1307
1307
|
wxapp_scene,
|
|
1308
1308
|
wq_unionid,
|
|
1309
1309
|
wxapp_openid,
|
|
1310
1310
|
wxapp_version,
|
|
1311
1311
|
wxapp_type,
|
|
1312
1312
|
appType,
|
|
1313
1313
|
]
|
|
1314
1314
|
createUseCookieArr.forEach(keyItem => {
|
|
1315
1315
|
if (keyItem && keyItem['name']) {
|
|
1316
1316
|
let { name, value } = keyItem
|
|
1317
1317
|
name = name === 'jdpin' ? 'pin' : name
|
|
1318
1318
|
name === 'pin' && ret.push(`pt_pin=${encodeURIComponent(value)}`)
|
|
1319
1319
|
ret.push(`${name}=${encodeURIComponent(value)}`)
|
|
1320
1320
|
getUserCookieObj[name] = value
|
|
1321
1321
|
}
|
|
1322
1322
|
})
|
|
1323
1323
|
return {
|
|
1324
1324
|
wqCookieStr: ret.join(';'),
|
|
1325
1325
|
wqCookie: getUserCookieObj,
|
|
1326
1326
|
}
|
|
1327
1327
|
num,
|
|
1328
1328
|
widthSize = 375,
|
|
1329
1329
|
layoutWidth = windowWidth,
|
|
1330
1330
|
const getNum = Number(num)
|
|
1331
1331
|
return Math.round((getNum / widthSize) * layoutWidth)
|
|
1332
1332
|
let checkState = false
|
|
1333
1333
|
const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag
|
|
1334
1334
|
if (couponFloorModuleType === FloorModuleType.COUPON) {
|
|
1335
1335
|
try {
|
|
1336
1336
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
1337
1337
|
const couponDataDefine = dataDefines
|
|
1338
1338
|
? dataDefines.filter(item => {
|
|
1339
1339
|
return item.type === 'coupon'
|
|
1340
1340
|
})
|
|
1341
1341
|
: [],
|
|
1342
1342
|
couponList = couponDataDefine[0]?.nodeText?.data
|
|
1343
1343
|
? couponDataDefine[0]?.nodeText?.data
|
|
1344
1344
|
: [],
|
|
1345
1345
|
couponLength = couponList.length,
|
|
1346
1346
|
numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
1347
1347
|
? couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
1348
1348
|
: 0
|
|
1349
1349
|
if (numShowPerLine === 0 && couponLength > 3) {
|
|
1350
1350
|
checkState = true
|
|
1351
1351
|
}
|
|
1352
1352
|
} catch (e) {
|
|
1353
1353
|
checkState = false
|
|
1354
1354
|
}
|
|
1355
1355
|
return checkState
|
|
1356
1356
|
}
|
|
1357
1357
|
const {
|
|
1358
1358
|
containers = [],
|
|
1359
1359
|
floors = [],
|
|
1360
1360
|
clearFirstContaierMarginTop = false,
|
|
1361
1361
|
isLuxuryShop = false,
|
|
1362
1362
|
isShowNativeImmersivePlayer = false,
|
|
1363
1363
|
screenHeight = null,
|
|
1364
1364
|
screenWidth = null,
|
|
1365
1365
|
bottomBarHeight = null,
|
|
1366
1366
|
} = pageData
|
|
1367
1367
|
console.log('dealShopContentData:', pageData, 'isvdev:', isvdev)
|
|
1368
1368
|
const getThisTimeKey = Date.now()
|
|
1369
1369
|
let shopContentContainerListData = containers?.filter(
|
|
1370
1370
|
item => (!isvdev && item.typeCode !== 'mShopHeader') || isvdev,
|
|
1371
1371
|
)
|
|
1372
1372
|
const shopContentFloorListData = floors?.filter(
|
|
1373
1373
|
({ floorPosition }) =>
|
|
1374
1374
|
(!isvdev && floorPosition !== 'header' && floorPosition !== 'footer') ||
|
|
1375
1375
|
isvdev,
|
|
1376
1376
|
)
|
|
1377
1377
|
const unableIsvContainerListData = getUnableIsvContainerListData(
|
|
1378
1378
|
shopContentFloorListData,
|
|
1379
1379
|
shopContentContainerListData,
|
|
1380
1380
|
exceptionReportFn,
|
|
1381
1381
|
)
|
|
1382
1382
|
shopContentContainerListData.forEach((item, index) => {
|
|
1383
1383
|
item.key = `${getThisTimeKey + index}`
|
|
1384
1384
|
item.floors = []
|
|
1385
1385
|
item.includeUids &&
|
|
1386
1386
|
item.includeUids.forEach(floorUid => {
|
|
1387
1387
|
const getFloorData = shopContentFloorListData.find(
|
|
1388
1388
|
floorItem => floorItem.uid === floorUid,
|
|
1389
1389
|
)
|
|
1390
1390
|
if (getFloorData) {
|
|
1391
1391
|
const changeFloorData = {
|
|
1392
1392
|
containerId: item.containerId,
|
|
1393
1393
|
containerIndex: index,
|
|
1394
1394
|
...getFloorData,
|
|
1395
1395
|
}
|
|
1396
1396
|
const getCheckMoreCouponState = checkCouponAndChangeContainerSetData(
|
|
1397
1397
|
getFloorData,
|
|
1398
1398
|
)
|
|
1399
1399
|
if (getCheckMoreCouponState) {
|
|
1400
1400
|
item.marginLeft && (item.marginLeft = 0)
|
|
1401
1401
|
item.marginRight && (item.marginRight = 0)
|
|
1402
1402
|
item.borderRadius && (item.borderRadius = 0)
|
|
1403
1403
|
}
|
|
1404
1404
|
if (getFloorData?.floorExtInfo?.floorLoadWay === 2) {
|
|
1405
1405
|
const getSysFloorToLoadTypeRes = isIsvFloorUseable(
|
|
1406
1406
|
getFloorData,
|
|
1407
1407
|
exceptionReportFn,
|
|
1408
1408
|
)
|
|
1409
1409
|
!getSysFloorToLoadTypeRes &&
|
|
1410
1410
|
(getFloorData.floorExtInfo.floorLoadWay = 1)
|
|
1411
1411
|
}
|
|
1412
1412
|
item.floors.push(changeFloorData)
|
|
1413
1413
|
}
|
|
1414
1414
|
})
|
|
1415
1415
|
if (
|
|
1416
1416
|
((!isvdev && index === 0) || (isvdev && index === 1)) &&
|
|
1417
1417
|
item?.containerPosition == 'content' &&
|
|
1418
1418
|
item?.marginBottom > 0 &&
|
|
1419
1419
|
!clearFirstContaierMarginTop
|
|
1420
1420
|
) {
|
|
1421
1421
|
item.marginTop = item.marginBottom
|
|
1422
1422
|
}
|
|
1423
1423
|
})
|
|
1424
1424
|
shopContentContainerListData = shopContentContainerListData.filter(
|
|
1425
1425
|
item =>
|
|
1426
1426
|
item.floors.length > 0 &&
|
|
1427
1427
|
unableIsvContainerListData.every(
|
|
1428
1428
|
containerItem => containerItem.containerId != item.containerId,
|
|
1429
1429
|
),
|
|
1430
1430
|
)
|
|
1431
1431
|
console.log(
|
|
1432
1432
|
'dealShopContentData isWxMinAndWxapp:',
|
|
1433
1433
|
isWxMinAndWxapp,
|
|
1434
1434
|
'weappJumpToH5:',
|
|
1435
1435
|
pageData?.homeExtInfo?.weappJumpToH5,
|
|
1436
1436
|
)
|
|
1437
1437
|
if (isProd && isWxMinAndWxapp) {
|
|
1438
1438
|
shopContentContainerListData = shopContentContainerListData.filter(
|
|
1439
1439
|
item =>
|
|
1440
1440
|
item.floors.length > 0 &&
|
|
1441
1441
|
!isIsvContainer(
|
|
1442
1442
|
item.containerId,
|
|
1443
1443
|
shopContentFloorListData,
|
|
1444
1444
|
shopContentContainerListData,
|
|
1445
1445
|
),
|
|
1446
1446
|
)
|
|
1447
1447
|
}
|
|
1448
1448
|
shopContentContainerListData = [].concat(shopContentContainerListData)
|
|
1449
1449
|
return {
|
|
1450
1450
|
shopContentContainerListData,
|
|
1451
1451
|
shopContentFloorListData,
|
|
1452
1452
|
}
|
|
1453
1453
|
const changeOpts = {
|
|
1454
1454
|
title: '',
|
|
1455
1455
|
icon: 'success',
|
|
1456
1456
|
duration: 1500,
|
|
1457
1457
|
mask: true,
|
|
1458
1458
|
...options,
|
|
1459
1459
|
}
|
|
1460
1460
|
if (changeOpts.title.length > 7) {
|
|
1461
1461
|
showNormalToast(options)
|
|
1462
1462
|
} else {
|
|
1463
1463
|
Taro.showToast(changeOpts as any)
|
|
1464
1464
|
}
|
|
1465
1465
|
const changeOpts = {
|
|
1466
1466
|
title: '',
|
|
1467
1467
|
icon: 'error',
|
|
1468
1468
|
duration: 1500,
|
|
1469
1469
|
mask: true,
|
|
1470
1470
|
...options,
|
|
1471
1471
|
}
|
|
1472
1472
|
if (changeOpts.title.length > 7) {
|
|
1473
1473
|
showNormalToast(options)
|
|
1474
1474
|
} else {
|
|
1475
1475
|
Taro.showToast(changeOpts as any)
|
|
1476
1476
|
}
|
|
1477
1477
|
Taro.showToast({
|
|
1478
1478
|
title: '',
|
|
1479
1479
|
icon: 'none',
|
|
1480
1480
|
duration: 1500,
|
|
1481
1481
|
mask: true,
|
|
1482
1482
|
...options,
|
|
1483
1483
|
})
|
|
1484
1484
|
return Taro.showLoading({
|
|
1485
1485
|
title: text,
|
|
1486
1486
|
})
|
|
1487
1487
|
return new Promise(() => {
|
|
1488
1488
|
Taro.nextTick(() => {
|
|
1489
1489
|
setTimeout(() => {
|
|
1490
1490
|
Taro.hideLoading(options)
|
|
1491
1491
|
}, 300)
|
|
1492
1492
|
})
|
|
1493
1493
|
})
|
|
1494
1494
|
return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
1495
1495
|
const {
|
|
1496
1496
|
tabActive = SECTION_HOME_TAB_NAME_TYPE[
|
|
1497
1497
|
SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
|
|
1498
1498
|
],
|
|
1499
1499
|
sceneId,
|
|
1500
1500
|
} = query
|
|
1501
1501
|
let changeTabActive = tabActive
|
|
1502
1502
|
if (sceneId) {
|
|
1503
1503
|
if (isH5) {
|
|
1504
1504
|
if (sceneId == '1002') {
|
|
1505
1505
|
changeTabActive =
|
|
1506
1506
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
|
|
1507
1507
|
}
|
|
1508
1508
|
else if (sceneId == '1003') {
|
|
1509
1509
|
changeTabActive =
|
|
1510
1510
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY]
|
|
1511
1511
|
}
|
|
1512
1512
|
} else if (isWxMinAndWxapp) {
|
|
1513
1513
|
if (sceneId == '1001' || sceneId == '1002') {
|
|
1514
1514
|
changeTabActive =
|
|
1515
1515
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
|
|
1516
1516
|
}
|
|
1517
1517
|
else if (sceneId == '1003') {
|
|
1518
1518
|
changeTabActive =
|
|
1519
1519
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]
|
|
1520
1520
|
}
|
|
1521
1521
|
}
|
|
1522
1522
|
}
|
|
1523
1523
|
if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
|
|
1524
1524
|
return {
|
|
1525
1525
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
1526
1526
|
tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
|
|
1527
1527
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
|
|
1528
1528
|
}
|
|
1529
1529
|
} else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
|
|
1530
1530
|
return {
|
|
1531
1531
|
menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
|
|
1532
1532
|
tabActiveType: 0,
|
|
1533
1533
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
|
|
1534
1534
|
}
|
|
1535
1535
|
} else {
|
|
1536
1536
|
return {
|
|
1537
1537
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
1538
1538
|
tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
|
|
1539
1539
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
|
|
1540
1540
|
}
|
|
1541
1541
|
}
|
|
1542
1542
|
const deleteKeyList = [
|
|
1543
1543
|
'$taroTimestamp',
|
|
1544
1544
|
'cookie',
|
|
1545
1545
|
'wdref',
|
|
1546
1546
|
'navStart',
|
|
1547
1547
|
'originOpts',
|
|
1548
1548
|
'originParams',
|
|
1549
1549
|
'originUrl',
|
|
1550
1550
|
'referer',
|
|
1551
1551
|
'stamp',
|
|
1552
1552
|
]
|
|
1553
1553
|
let changeQueryData: any = { ...queryData }
|
|
1554
1554
|
const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false
|
|
1555
1555
|
const sceneQuery =
|
|
1556
1556
|
qrCodeScene && typeof qrCodeScene == 'string'
|
|
1557
1557
|
? parseQueryUrlString(decodeURIComponent(qrCodeScene))
|
|
1558
1558
|
: {}
|
|
1559
1559
|
changeQueryData = { ...changeQueryData, ...sceneQuery }
|
|
1560
1560
|
deleteKeyList.forEach(key => {
|
|
1561
1561
|
changeQueryData[key] && delete changeQueryData[key]
|
|
1562
1562
|
})
|
|
1563
1563
|
changeQueryData['shopid'] &&
|
|
1564
1564
|
(changeQueryData['shopId'] = changeQueryData['shopid']) &&
|
|
1565
1565
|
delete changeQueryData['shopid']
|
|
1566
1566
|
changeQueryData['venderid'] &&
|
|
1567
1567
|
(changeQueryData['venderId'] = changeQueryData['venderid']) &&
|
|
1568
1568
|
delete changeQueryData['venderid']
|
|
1569
1569
|
changeQueryData['vendorId'] &&
|
|
1570
1570
|
(changeQueryData['venderId'] = changeQueryData['vendorId']) &&
|
|
1571
1571
|
delete changeQueryData['vendorId']
|
|
1572
1572
|
return changeQueryData
|
|
1573
1573
|
let isUsable = false
|
|
1574
1574
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
1575
1575
|
const modularPackResultObj = formatPackResult(modularPackResult)
|
|
1576
1576
|
const bundleUrl = getBundleUrl(modularPackResultObj)
|
|
1577
1577
|
const bundleFileName = getBundleFileName(modularPackResultObj)
|
|
1578
1578
|
if (bundleUrl && bundleFileName) {
|
|
1579
1579
|
isUsable = true
|
|
1580
1580
|
}
|
|
1581
1581
|
if (!isUsable && typeof exceptionReportFn === 'function') {
|
|
1582
1582
|
exceptionReportFn({
|
|
1583
1583
|
code: getSgmCustomCode(SgmCustomCode.REMOTEMODULE_DATA),
|
|
1584
1584
|
msg: {
|
|
1585
1585
|
msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
|
|
1586
1586
|
floorIdx: floorData?.floorIdx,
|
|
1587
1587
|
uid: floorData?.uid,
|
|
1588
1588
|
shopId: floorData?.floorExtInfo?.shopId,
|
|
1589
1589
|
moduleId: floorData?.moduleId,
|
|
1590
1590
|
moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
|
|
1591
1591
|
floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
|
|
1592
1592
|
floorKind: floorData?.floorExtInfo?.floorKind,
|
|
1593
1593
|
middleTemplateId: floorData?.middleTemplateId,
|
|
1594
1594
|
modularPackResult: modularPackResult,
|
|
1595
1595
|
},
|
|
1596
1596
|
})
|
|
1597
1597
|
}
|
|
1598
1598
|
return isUsable
|
|
1599
1599
|
const objContainer = containerListData.find(
|
|
1600
1600
|
item => item.containerId === containerId,
|
|
1601
1601
|
)
|
|
1602
1602
|
return (
|
|
1603
1603
|
objContainer?.includeUids?.some(itemUid => {
|
|
1604
1604
|
const objectFloor = floorListData.find(
|
|
1605
1605
|
floorItem => itemUid === floorItem.uid,
|
|
1606
1606
|
)
|
|
1607
1607
|
return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
|
|
1608
1608
|
}) ?? false
|
|
1609
1609
|
)
|
|
1610
1610
|
floorListData,
|
|
1611
1611
|
containerListData,
|
|
1612
1612
|
exceptionReportFn?,
|
|
1613
1613
|
const unableIsvFloorListData = floorListData.filter(
|
|
1614
1614
|
floorItem =>
|
|
1615
1615
|
RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
|
|
1616
1616
|
!isIsvFloorUseable(floorItem, exceptionReportFn),
|
|
1617
1617
|
)
|
|
1618
1618
|
const unableIsvFloorUidList = unableIsvFloorListData.map(
|
|
1619
1619
|
floorItem => floorItem.uid,
|
|
1620
1620
|
)
|
|
1621
1621
|
const unableIsvContainerListData = containerListData.filter(
|
|
1622
1622
|
item =>
|
|
1623
1623
|
item.includeUids &&
|
|
1624
1624
|
item.includeUids.every(
|
|
1625
1625
|
itemUid => unableIsvFloorUidList.indexOf(itemUid) != -1,
|
|
1626
1626
|
),
|
|
1627
1627
|
)
|
|
1628
1628
|
return unableIsvContainerListData
|
|
1629
1629
|
return -2
|
|
1630
1630
|
return customObj
|
|
1631
1631
|
return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl)
|
|
1632
1632
|
let getParams = false
|
|
1633
1633
|
if (isOpenJdAppUrl(openAppUrl)) {
|
|
1634
1634
|
try {
|
|
1635
1635
|
getParams = openAppUrl.replace(
|
|
1636
1636
|
/openApp\.jdMobile:\/\/virtual\?params=/i,
|
|
1637
1637
|
'',
|
|
1638
1638
|
)
|
|
1639
1639
|
getParams = JSON.parse(String(getParams))
|
|
1640
1640
|
} catch (e) {
|
|
1641
1641
|
console.log(e)
|
|
1642
1642
|
}
|
|
1643
1643
|
}
|
|
1644
1644
|
return getParams
|
|
1645
1645
|
return `openapp.jdmobile:
|
|
1646
1646
|
Object.assign({}, openParams),
|
|
1647
1647
|
)}`
|
|
1648
1648
|
if (val === null || val === '' || typeof val === 'undefined') {
|
|
1649
1649
|
return true
|
|
1650
1650
|
}
|
|
1651
1651
|
return false
|
|
1652
1652
|
const {
|
|
1653
1653
|
moduleId = 'none',
|
|
1654
1654
|
entrance = 'none',
|
|
1655
1655
|
sourceType = 'none',
|
|
1656
1656
|
sourceValue = 'none',
|
|
1657
1657
|
} = params
|
|
1658
1658
|
if (isIosDevice) {
|
|
1659
1659
|
return `${moduleId}#${entrance}`
|
|
1660
1660
|
} else if (isAndroidDevice) {
|
|
1661
1661
|
return `${sourceType}#${sourceValue}`
|
|
1662
1662
|
}
|
|
1663
1663
|
return 'none#none'
|
|
1664
1664
|
if (data && typeof data === 'object') {
|
|
1665
1665
|
let getOpenAppData = { ...data }
|
|
1666
1666
|
try {
|
|
1667
1667
|
const { sourceInfo, designerId, templateId, source } = getOpenAppData
|
|
1668
1668
|
if (designerId && templateId) {
|
|
1669
1669
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
1670
1670
|
sourceInfo: {
|
|
1671
1671
|
entrance: '设计师预览',
|
|
1672
1672
|
},
|
|
1673
1673
|
})
|
|
1674
1674
|
} else if (sourceInfo) {
|
|
1675
1675
|
const { entrance } = sourceInfo
|
|
1676
1676
|
getOpenAppData.sourceInfo.entrance =
|
|
1677
1677
|
entrance && entrance.length > 0 ? entrance : '其他'
|
|
1678
1678
|
} else if (source && !sourceInfo) {
|
|
1679
1679
|
if (typeof source === 'object') {
|
|
1680
1680
|
const { sourceType, entrance, sourceValue, moduleId } = source
|
|
1681
1681
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
1682
1682
|
sourceInfo: {
|
|
1683
1683
|
entrance: sourceType || entrance || '其他',
|
|
1684
1684
|
moduleId: sourceValue || moduleId || '-100',
|
|
1685
1685
|
},
|
|
1686
1686
|
})
|
|
1687
1687
|
} else {
|
|
1688
1688
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
1689
1689
|
sourceInfo: {
|
|
1690
1690
|
entrance: source,
|
|
1691
1691
|
},
|
|
1692
1692
|
})
|
|
1693
1693
|
}
|
|
1694
1694
|
} else {
|
|
1695
1695
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
1696
1696
|
sourceInfo: {
|
|
1697
1697
|
entrance: '其他',
|
|
1698
1698
|
},
|
|
1699
1699
|
})
|
|
1700
1700
|
}
|
|
1701
1701
|
} catch (e) {
|
|
1702
1702
|
console.log(e)
|
|
1703
1703
|
}
|
|
1704
1704
|
return getOpenAppData
|
|
1705
1705
|
}
|
|
1706
1706
|
return data
|
|
1707
1707
|
return displayObj
|
|
1708
1708
|
if (typeof input === 'string') {
|
|
1709
1709
|
try {
|
|
1710
1710
|
return JSON.parse(input)
|
|
1711
1711
|
} catch (e) {
|
|
1712
1712
|
console.error('JSON解析失败', e)
|
|
1713
1713
|
return {}
|
|
1714
1714
|
}
|
|
1715
1715
|
}
|
|
1716
1716
|
return input || {}
|
|
1717
1717
|
isJdApp,
|
|
1718
1718
|
isWxApp,
|
|
1719
1719
|
isIosDevice,
|
|
1720
1720
|
isAndroidDevice,
|
|
1721
1721
|
isJdAndIosDevice,
|
|
1722
1722
|
isJdAndAndroidDevice,
|
|
1723
1723
|
isWxMin,
|
|
1724
1724
|
isWxMinAndWxapp,
|
|
1725
1725
|
isJdMin,
|
|
1726
1726
|
isMin,
|
|
1727
1727
|
isJdMinAndHarmony,
|
|
1728
1728
|
isH5,
|
|
1729
1729
|
isH5AndJdShopView,
|
|
1730
1730
|
isImageOptimizeEnable,
|
|
1731
1731
|
isChartH5,
|
|
1732
1732
|
isH5AndJdShopViewNativeScroll,
|
|
1733
1733
|
isH5AndJdShopViewH5Scroll,
|
|
1734
1734
|
isH5AndJdShopH5CustomScrollView,
|
|
1735
1735
|
isWxMiniH5View,
|
|
1736
1736
|
sliceArrToChunkList,
|
|
1737
1737
|
dealAddress,
|
|
1738
1738
|
objectToUrlEncode,
|
|
1739
1739
|
parseQueryUrlString,
|
|
1740
1740
|
setLowSmallPicUrl,
|
|
1741
1741
|
getJfsImage,
|
|
1742
1742
|
getQualityImage,
|
|
1743
1743
|
countStringify,
|
|
1744
1744
|
setTaroStorage,
|
|
1745
1745
|
getTaroStorageKeyValue,
|
|
1746
1746
|
removeTaroStorageKey,
|
|
1747
1747
|
clearTaroStorageKey,
|
|
1748
1748
|
getSystemInfos,
|
|
1749
1749
|
addHttps,
|
|
1750
1750
|
dateFormat,
|
|
1751
1751
|
throttle,
|
|
1752
1752
|
lodashThrottle,
|
|
1753
1753
|
debounce,
|
|
1754
1754
|
getTelephone,
|
|
1755
1755
|
rgbToHex,
|
|
1756
1756
|
hexToRgb,
|
|
1757
1757
|
getRandom,
|
|
1758
1758
|
getWxAppCookieStr,
|
|
1759
1759
|
pxTransformFromData,
|
|
1760
1760
|
dealShopContentData,
|
|
1761
1761
|
showSuccessToast,
|
|
1762
1762
|
showFailToast,
|
|
1763
1763
|
showNormalToast,
|
|
1764
1764
|
showShopLoading,
|
|
1765
1765
|
hideShopLoading,
|
|
1766
1766
|
getAppChannelType,
|
|
1767
1767
|
formatTabActiveMenuType,
|
|
1768
1768
|
filterUrlQueryData,
|
|
1769
1769
|
getAvifSupport,
|
|
1770
1770
|
getWebpSupport,
|
|
1771
1771
|
isMemberPage,
|
|
1772
1772
|
sgmCustomReport,
|
|
1773
1773
|
isOpenJdAppUrl,
|
|
1774
1774
|
jdOpenAppParams,
|
|
1775
1775
|
createJdOpenAppUrl,
|
|
1776
1776
|
dealJdOpenAppData,
|
|
1777
1777
|
isEmpty,
|
|
1778
1778
|
getJdAppReportPageSource,
|
|
1779
1779
|
isAppClassifyPage,
|
|
1780
1780
|
getQualityImageNew,
|
|
1781
1781
|
getQualityImageOld,
|
|
1782
1782
|
isPc,
|
|
1783
1783
|
ipLoc_djd,
|
|
1784
1784
|
jdAppVersionCompare,
|
|
1785
1785
|
dealNativePixelToCssPixel,
|
|
1786
1786
|
isAppStowShop,
|