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