@conecli/cone-render 0.9.1-shop2.7 → 0.9.1-shop2.8
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.ts +1 -1
- package/dist/common/token/token.ts +1 -1
- package/dist/components/base/CountDown/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +5 -0
- package/dist/components/base/Dialog/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/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/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/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/const.ts +1 -1
- package/dist/jumpEventReport/createReportFloorData.ts +1 -1
- package/dist/jumpEventReport/index.weapp.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.ts +1 -1
- package/dist/jumpEventReport/web/report.ts +1 -1
- package/dist/jumpEventReport/web.base.ts +1 -1
- package/dist/jumpEventReport/web.jd.ts +1 -1
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/open/api/jump copy.ts +1 -1
- package/dist/open/api/shopMember.ts +1 -1
- package/dist/open/api/track.ts +1 -1
- package/dist/open/api/util.ts +1 -1
- package/dist/sass/app.h5.scss +39 -3
- package/dist/service/requestServer.ts +1 -1
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/connectNativeJsBridge.weapp.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/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, '/')
|
|
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 customObj
|
|
619
618
|
if (data && typeof data === 'object') {
|
|
620
619
|
let getOpenAppData = { ...data }
|
|
621
620
|
try {
|
|
622
621
|
const { sourceInfo, designerId, templateId, source } = getOpenAppData
|
|
623
622
|
if (designerId && templateId) {
|
|
624
623
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
625
624
|
sourceInfo: {
|
|
626
625
|
entrance: '设计师预览',
|
|
627
626
|
},
|
|
628
627
|
})
|
|
629
628
|
} else if (sourceInfo) {
|
|
630
629
|
const { entrance } = sourceInfo
|
|
631
630
|
getOpenAppData.sourceInfo.entrance =
|
|
632
631
|
entrance && entrance.length > 0 ? entrance : '其他'
|
|
633
632
|
} else if (source && !sourceInfo) {
|
|
634
633
|
if (typeof source === 'object') {
|
|
635
634
|
const { sourceType, entrance, sourceValue, moduleId } = source
|
|
636
635
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
637
636
|
sourceInfo: {
|
|
638
637
|
entrance: sourceType || entrance || '其他',
|
|
639
638
|
moduleId: sourceValue || moduleId || '-100',
|
|
640
639
|
},
|
|
641
640
|
})
|
|
642
641
|
} else {
|
|
643
642
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
644
643
|
sourceInfo: {
|
|
645
644
|
entrance: source,
|
|
646
645
|
},
|
|
647
646
|
})
|
|
648
647
|
}
|
|
649
648
|
} else {
|
|
650
649
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
651
650
|
sourceInfo: {
|
|
652
651
|
entrance: '其他',
|
|
653
652
|
},
|
|
654
653
|
})
|
|
655
654
|
}
|
|
656
655
|
} catch (e) {
|
|
657
656
|
console.log(e)
|
|
658
657
|
}
|
|
659
658
|
return getOpenAppData
|
|
660
659
|
}
|
|
661
660
|
return data
|
|
662
661
|
return displayObj
|
|
663
662
|
isChartH5,
|
|
664
663
|
isH5AndJdShopViewH5Scroll,
|
|
665
664
|
isH5AndJdShopH5CustomScrollView,
|
|
666
665
|
isMemberPage,
|
|
667
666
|
isPc,
|
|
668
667
|
ipLoc_djd,
|
|
669
668
|
jdAppVersionCompare,
|
|
670
669
|
dealNativePixelToCssPixel,
|
|
671
670
|
isAppStowShop,
|
|
672
671
|
dealJdOpenAppData
|
|
672
|
+
import Taro from '@tarojs/taro'
|
|
673
673
|
SHOP_MENU_ID_TYPE,
|
|
674
674
|
SHOP_MENU_ID_QUERY_NAME,
|
|
675
675
|
SECTION_HOME_TAB_TYPE,
|
|
676
676
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
677
677
|
SECTION_HOME_TAB_QUERY_TYPE,
|
|
678
678
|
CHANNEL_TYPE,
|
|
679
679
|
JDShopViewBusinessPathType,
|
|
680
680
|
FloorModuleType,
|
|
681
681
|
RemoteLoadFloorList,
|
|
682
682
|
getBundleUrl,
|
|
683
683
|
getBundleFileName,
|
|
684
684
|
formatPackResult,
|
|
685
685
|
const resultList: Array<any> = [],
|
|
686
686
|
arrLen = arr.length
|
|
687
687
|
if (arrLen) {
|
|
688
688
|
if (arrLen > size) {
|
|
689
689
|
for (let i = 0; i < arrLen; i = i + size) {
|
|
690
690
|
resultList.push(arr.slice(i, i + size))
|
|
691
691
|
}
|
|
692
692
|
} else {
|
|
693
693
|
resultList.push(arr)
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
696
|
return resultList
|
|
697
697
|
let _address = ids
|
|
698
698
|
const _areaAreaSplit = ids.split('.')
|
|
699
699
|
const _areaAreaSplit2 = ids.split('_')
|
|
700
700
|
_address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address
|
|
701
701
|
_address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address
|
|
702
702
|
return _address
|
|
703
703
|
const getValue = `${obj[key]}`.replace(/undefined/,'').replace(/null/,'')
|
|
704
704
|
paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`
|
|
705
705
|
const result = {}
|
|
706
706
|
if (
|
|
707
707
|
!urlOrQueryStr ||
|
|
708
708
|
('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
|
|
709
709
|
) {
|
|
710
710
|
return result
|
|
711
711
|
}
|
|
712
712
|
if (urlOrQueryStr.indexOf('?') > -1) {
|
|
713
713
|
const queryStr = urlOrQueryStr.split('?')
|
|
714
714
|
const queryItemList =
|
|
715
715
|
queryStr && queryStr.length > 1 ? queryStr[1].split('&') : []
|
|
716
716
|
const queryItemListLen = queryItemList.length
|
|
717
717
|
queryItemListLen > 0 &&
|
|
718
718
|
queryItemList.forEach((item) => {
|
|
719
719
|
const thisItemList = item.split('=')
|
|
720
720
|
result[thisItemList[0]] = thisItemList[1]
|
|
721
721
|
})
|
|
722
722
|
} else {
|
|
723
723
|
const queryItemList =
|
|
724
724
|
urlOrQueryStr.indexOf('&') > -1
|
|
725
725
|
? urlOrQueryStr.split('&')
|
|
726
726
|
: [urlOrQueryStr]
|
|
727
727
|
const queryItemListLen = queryItemList.length
|
|
728
728
|
queryItemListLen > 0 &&
|
|
729
729
|
queryItemList.forEach((item) => {
|
|
730
730
|
const thisItemList = item.split('=')
|
|
731
731
|
result[thisItemList[0]] = thisItemList[1]
|
|
732
732
|
})
|
|
733
733
|
}
|
|
734
734
|
return result
|
|
735
735
|
url: string,
|
|
736
736
|
size?: {
|
|
737
737
|
w: number
|
|
738
738
|
h: number
|
|
739
739
|
},
|
|
740
740
|
quality?: number,
|
|
741
741
|
if (url && size) {
|
|
742
742
|
const _w = Math.floor(size.w)
|
|
743
743
|
const _h = Math.floor(size.h)
|
|
744
744
|
if (url.match(/gif$/i)) {
|
|
745
745
|
return url
|
|
746
746
|
} else {
|
|
747
747
|
if (_w > 0 && _h > 0) {
|
|
748
748
|
url = url.replace('jfs/', `s${_w}x${_h}_jfs/`)
|
|
749
749
|
}
|
|
750
750
|
url += quality != null ? `!q${quality}.dpg` : '.dpg'
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
753
|
return url
|
|
754
754
|
url: string,
|
|
755
755
|
jfsImgInfo: UtilsInterFace.getJfsImageInfo = {},
|
|
756
756
|
if (url.match(/\.(jpg|png|dpg)$/i)) {
|
|
757
757
|
const { width, height, quality } = jfsImgInfo
|
|
758
758
|
if (typeof width === 'number' || typeof height === 'number') {
|
|
759
759
|
url = url.replace(
|
|
760
760
|
'/jfs/',
|
|
761
761
|
`/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`,
|
|
762
762
|
)
|
|
763
763
|
}
|
|
764
764
|
if (
|
|
765
765
|
typeof quality === 'number' &&
|
|
766
766
|
quality > 0 &&
|
|
767
767
|
quality < 100 &&
|
|
768
768
|
url.match(/\.jpg$/i)
|
|
769
769
|
) {
|
|
770
770
|
url += `!q${quality}.dpg`
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
773
|
return addHttps(url)
|
|
774
774
|
!imgUrl.match(
|
|
775
775
|
/(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
|
|
776
776
|
)
|
|
777
777
|
if(!imgUrl.includes('360buyimg.com')){
|
|
778
778
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl
|
|
779
779
|
}
|
|
780
780
|
if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
|
|
781
781
|
count: number,
|
|
782
782
|
fixedNum = 2,
|
|
783
783
|
unit = '万',
|
|
784
784
|
maxNum = 10000,
|
|
785
785
|
count = Number(count)
|
|
786
786
|
if (count > maxNum) {
|
|
787
787
|
return (count / maxNum).toFixed(fixedNum) + unit
|
|
788
788
|
}
|
|
789
789
|
return count
|
|
790
790
|
key: string,
|
|
791
791
|
value: string | object,
|
|
792
792
|
successBack?: any,
|
|
793
793
|
failBack?: any,
|
|
794
794
|
return Taro.setStorage({
|
|
795
795
|
key: key,
|
|
796
796
|
data: value,
|
|
797
797
|
success: successBack,
|
|
798
798
|
fail: failBack,
|
|
799
799
|
})
|
|
800
800
|
return Taro.getStorageSync(key)
|
|
801
801
|
return Taro.removeStorage({
|
|
802
802
|
key: key,
|
|
803
803
|
})
|
|
804
804
|
return Taro.clearStorage()
|
|
805
805
|
if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
|
|
806
806
|
let gap = 0
|
|
807
807
|
let width = 96
|
|
808
808
|
if (systemInfo.platform === 'android') {
|
|
809
809
|
gap = 8
|
|
810
810
|
width = 96
|
|
811
811
|
} else if (systemInfo.platform === 'devtools') {
|
|
812
812
|
if (isIOS) {
|
|
813
813
|
gap = 5.5
|
|
814
814
|
} else {
|
|
815
815
|
gap = 7.5
|
|
816
816
|
}
|
|
817
817
|
} else {
|
|
818
818
|
gap = 4
|
|
819
819
|
width = 88
|
|
820
820
|
}
|
|
821
821
|
rect = {
|
|
822
822
|
bottom: systemInfo.statusBarHeight + gap + 32,
|
|
823
823
|
height: 32,
|
|
824
824
|
left: systemInfo.windowWidth - width - 10,
|
|
825
825
|
right: systemInfo.windowWidth - 10,
|
|
826
826
|
top: systemInfo.statusBarHeight + gap,
|
|
827
827
|
width,
|
|
828
828
|
}
|
|
829
829
|
}
|
|
830
830
|
const gap = rect.top - systemInfo.statusBarHeight
|
|
831
831
|
systemInfo.navBarTopToStatusBar = gap
|
|
832
832
|
systemInfo.navBarHeight = 2 * gap + rect.height
|
|
833
833
|
systemInfo.capsulePosition = rect
|
|
834
834
|
systemInfo.isIOS = isIOS
|
|
835
835
|
systemInfo.isAndroid = isAndroid
|
|
836
836
|
return systemInfo
|
|
837
837
|
if (str.match(/^\/\//)) {
|
|
838
838
|
str = 'https:' + str
|
|
839
839
|
}
|
|
840
840
|
return str
|
|
841
841
|
dateTimeOrdate: Date | string | number | null,
|
|
842
842
|
format = 'yyyy-MM-dd HH:mm:ss',
|
|
843
843
|
noPadStart = {
|
|
844
844
|
M: '0',
|
|
845
845
|
d: '0',
|
|
846
846
|
H: '0',
|
|
847
847
|
m: '0',
|
|
848
848
|
s: '0',
|
|
849
849
|
},
|
|
850
850
|
let dateResult = ''
|
|
851
851
|
const padStarts = Object.assign(
|
|
852
852
|
{
|
|
853
853
|
M: '0',
|
|
854
854
|
d: '0',
|
|
855
855
|
H: '0',
|
|
856
856
|
m: '0',
|
|
857
857
|
s: '0',
|
|
858
858
|
},
|
|
859
859
|
noPadStart,
|
|
860
860
|
)
|
|
861
861
|
if (dateTimeOrdate) {
|
|
862
862
|
let changeDateTimeOrdate = dateTimeOrdate
|
|
863
863
|
const getChangeDateTimeToNumber = Number(changeDateTimeOrdate)
|
|
864
864
|
if (getChangeDateTimeToNumber) {
|
|
865
865
|
changeDateTimeOrdate = getChangeDateTimeToNumber
|
|
866
866
|
} else {
|
|
867
867
|
changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/').replace(/\./g, '/')
|
|
868
868
|
}
|
|
869
869
|
const nowDate =
|
|
870
870
|
dateTimeOrdate instanceof Date
|
|
871
871
|
? dateTimeOrdate
|
|
872
872
|
: new Date(changeDateTimeOrdate)
|
|
873
873
|
const dateMap = {
|
|
874
874
|
y: `${nowDate.getFullYear()}`,
|
|
875
875
|
M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
|
|
876
876
|
d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
|
|
877
877
|
H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
|
|
878
878
|
m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
|
|
879
879
|
s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
|
|
880
880
|
}
|
|
881
881
|
const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g')
|
|
882
882
|
const regYear = new RegExp('y')
|
|
883
883
|
dateResult = format.replace(regDate, (v) => {
|
|
884
884
|
let changeValue = v
|
|
885
885
|
if (regYear.test(changeValue)) {
|
|
886
886
|
const thisYear = dateMap.y
|
|
887
887
|
const subValueLen = 4 - changeValue.length
|
|
888
888
|
changeValue = thisYear.substr(subValueLen)
|
|
889
889
|
} else {
|
|
890
890
|
const dateKey = v.substr(0, 1)
|
|
891
891
|
changeValue = dateMap[dateKey]
|
|
892
892
|
}
|
|
893
893
|
return changeValue
|
|
894
894
|
})
|
|
895
895
|
}
|
|
896
896
|
return dateResult
|
|
897
897
|
let timer: any = null
|
|
898
898
|
let startTime = Date.now()
|
|
899
899
|
return function () {
|
|
900
900
|
const curTime = Date.now()
|
|
901
901
|
const remaining = delay - (curTime - startTime)
|
|
902
902
|
const context = this
|
|
903
903
|
const args = arguments
|
|
904
904
|
clearTimeout(timer)
|
|
905
905
|
if (remaining <= 0) {
|
|
906
906
|
func.apply(context, args)
|
|
907
907
|
startTime = Date.now()
|
|
908
908
|
} else {
|
|
909
909
|
timer = setTimeout(func, remaining)
|
|
910
910
|
}
|
|
911
911
|
}
|
|
912
912
|
let context, args, result
|
|
913
913
|
let timeout = null
|
|
914
914
|
let previous = 0
|
|
915
915
|
if (!options) options = {}
|
|
916
916
|
const later = function () {
|
|
917
917
|
previous = options.leading === false ? 0 : Date.now()
|
|
918
918
|
timeout = null
|
|
919
919
|
result = func.apply(context, args)
|
|
920
920
|
if (!timeout) context = args = null
|
|
921
921
|
}
|
|
922
922
|
return function () {
|
|
923
923
|
const now = Date.now()
|
|
924
924
|
if (!previous && options.leading === false) previous = now
|
|
925
925
|
const remaining = wait - (now - previous)
|
|
926
926
|
context = this
|
|
927
927
|
args = arguments
|
|
928
928
|
if (remaining <= 0 || remaining > wait) {
|
|
929
929
|
if (timeout) {
|
|
930
930
|
clearTimeout(timeout)
|
|
931
931
|
timeout = null
|
|
932
932
|
}
|
|
933
933
|
previous = now
|
|
934
934
|
result = func.apply(context, args)
|
|
935
935
|
if (!timeout) context = args = null
|
|
936
936
|
} else if (!timeout && options.trailing !== false) {
|
|
937
937
|
timeout = setTimeout(later, remaining)
|
|
938
938
|
}
|
|
939
939
|
return result
|
|
940
940
|
}
|
|
941
941
|
let timer: any = null
|
|
942
942
|
return function () {
|
|
943
943
|
const context: any = this
|
|
944
944
|
const args = arguments
|
|
945
945
|
timer && clearTimeout(timer)
|
|
946
946
|
timer = setTimeout(function () {
|
|
947
947
|
fn.apply(context, args)
|
|
948
948
|
}, delay)
|
|
949
949
|
}
|
|
950
950
|
if (txt) {
|
|
951
951
|
txt = txt.trim()
|
|
952
952
|
const reg = new RegExp(/[\d-]+/)
|
|
953
953
|
const res = reg.exec(txt)
|
|
954
954
|
if (res && res.length > 0) {
|
|
955
955
|
let tel = res[0]
|
|
956
956
|
if (tel && delSeparator) {
|
|
957
957
|
tel = tel.replace(/-/g, '')
|
|
958
958
|
}
|
|
959
959
|
return tel
|
|
960
960
|
}
|
|
961
961
|
}
|
|
962
962
|
return ''
|
|
963
963
|
if (rgb) {
|
|
964
964
|
const reg = /^(rgb|RGB)/
|
|
965
965
|
const color = rgb
|
|
966
966
|
if (reg.test(color)) {
|
|
967
967
|
let strHex = '#'
|
|
968
968
|
const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
|
|
969
969
|
for (let i = 0; i < colorArr.length; i++) {
|
|
970
970
|
let hex = Number(colorArr[i]).toString(16)
|
|
971
971
|
if (hex === '0') {
|
|
972
972
|
hex += hex
|
|
973
973
|
}
|
|
974
974
|
strHex += hex
|
|
975
975
|
}
|
|
976
976
|
return strHex
|
|
977
977
|
} else {
|
|
978
978
|
return String(color)
|
|
979
979
|
}
|
|
980
980
|
} else {
|
|
981
981
|
return ''
|
|
982
982
|
}
|
|
983
983
|
if (hex) {
|
|
984
984
|
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
|
|
985
985
|
let color = hex.toLowerCase()
|
|
986
986
|
if (reg.test(color)) {
|
|
987
987
|
if (color.length === 4) {
|
|
988
988
|
let colorNew = '#'
|
|
989
989
|
for (let i = 1; i < 4; i += 1) {
|
|
990
990
|
colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1))
|
|
991
991
|
}
|
|
992
992
|
color = colorNew
|
|
993
993
|
}
|
|
994
994
|
const colorChange: number[] = []
|
|
995
995
|
for (let i = 1; i < 7; i += 2) {
|
|
996
996
|
colorChange.push(parseInt('0x' + color.slice(i, i + 2)))
|
|
997
997
|
}
|
|
998
998
|
if (returnList) {
|
|
999
999
|
return colorChange
|
|
1000
1000
|
} else {
|
|
1001
1001
|
return 'RGB(' + colorChange.join(',') + ')'
|
|
1002
1002
|
}
|
|
1003
1003
|
} else {
|
|
1004
1004
|
return color
|
|
1005
1005
|
}
|
|
1006
1006
|
} else {
|
|
1007
1007
|
return ''
|
|
1008
1008
|
}
|
|
1009
1009
|
n: number,
|
|
1010
1010
|
m: number,
|
|
1011
1011
|
filterNum: number | undefined = undefined,
|
|
1012
1012
|
const c = m - n + 1
|
|
1013
1013
|
const res = Math.floor(Math.random() * c + n)
|
|
1014
1014
|
if (filterNum && filterNum == res) {
|
|
1015
1015
|
console.log('随机数二次开始', res, filterNum)
|
|
1016
1016
|
return getRandom(n, m, filterNum)
|
|
1017
1017
|
} else {
|
|
1018
1018
|
return res
|
|
1019
1019
|
}
|
|
1020
1020
|
wqCookieStr: string
|
|
1021
1021
|
wqCookie: {
|
|
1022
1022
|
pin?: string
|
|
1023
1023
|
visitkey?: string
|
|
1024
1024
|
[key: string]: any
|
|
1025
1025
|
}
|
|
1026
1026
|
const {
|
|
1027
1027
|
jdpin,
|
|
1028
1028
|
pinStatus,
|
|
1029
1029
|
visitkey,
|
|
1030
1030
|
unionid,
|
|
1031
1031
|
skey,
|
|
1032
1032
|
__jda,
|
|
1033
1033
|
__jdv,
|
|
1034
1034
|
__wga,
|
|
1035
1035
|
wxapp_type,
|
|
1036
1036
|
appType
|
|
1037
1037
|
} = cookie
|
|
1038
1038
|
const ret: string[] = []
|
|
1039
1039
|
const getUserCookieObj = {}
|
|
1040
1040
|
const createUseCookieArr = [
|
|
1041
1041
|
jdpin,
|
|
1042
1042
|
pinStatus,
|
|
1043
1043
|
visitkey,
|
|
1044
1044
|
unionid,
|
|
1045
1045
|
skey,
|
|
1046
1046
|
__jda,
|
|
1047
1047
|
__jdv,
|
|
1048
1048
|
__wga,
|
|
1049
1049
|
wid,
|
|
1050
1050
|
wq_skey,
|
|
1051
1051
|
wq_uin,
|
|
1052
1052
|
wq_auth_token,
|
|
1053
1053
|
wxapp_scene,
|
|
1054
1054
|
wq_unionid,
|
|
1055
1055
|
wxapp_openid,
|
|
1056
1056
|
wxapp_version,
|
|
1057
1057
|
wxapp_type,
|
|
1058
1058
|
appType
|
|
1059
1059
|
name = name === 'jdpin' ? 'pin' : name;
|
|
1060
1060
|
name === 'pin' && (ret.push(`pt_pin=${encodeURIComponent(value)}`))
|
|
1061
1061
|
ret.push(`${name}=${encodeURIComponent(value)}`)
|
|
1062
1062
|
getUserCookieObj[name] = value
|
|
1063
1063
|
}
|
|
1064
1064
|
})
|
|
1065
1065
|
return {
|
|
1066
1066
|
wqCookieStr: ret.join(';'),
|
|
1067
1067
|
wqCookie: getUserCookieObj,
|
|
1068
1068
|
}
|
|
1069
1069
|
num,
|
|
1070
1070
|
widthSize = 375,
|
|
1071
1071
|
layoutWidth = windowWidth,
|
|
1072
1072
|
const getNum = Number(num)
|
|
1073
1073
|
return Math.round((getNum / widthSize) * layoutWidth)
|
|
1074
1074
|
let checkState = false
|
|
1075
1075
|
const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag
|
|
1076
1076
|
if (couponFloorModuleType === FloorModuleType.COUPON) {
|
|
1077
1077
|
try {
|
|
1078
1078
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
1079
1079
|
const couponDataDefine = dataDefines
|
|
1080
1080
|
? dataDefines.filter((item) => {
|
|
1081
1081
|
return item.type === 'coupon'
|
|
1082
1082
|
})
|
|
1083
1083
|
: [],
|
|
1084
1084
|
couponList = couponDataDefine[0]?.nodeText?.data
|
|
1085
1085
|
? couponDataDefine[0]?.nodeText?.data
|
|
1086
1086
|
: [],
|
|
1087
1087
|
couponLength = couponList.length,
|
|
1088
1088
|
numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
1089
1089
|
? couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
1090
1090
|
: 0
|
|
1091
1091
|
if (numShowPerLine === 0 && couponLength > 3) {
|
|
1092
1092
|
checkState = true
|
|
1093
1093
|
}
|
|
1094
1094
|
} catch (e) {
|
|
1095
1095
|
checkState = false
|
|
1096
1096
|
}
|
|
1097
1097
|
return checkState
|
|
1098
1098
|
}
|
|
1099
1099
|
containers = [],
|
|
1100
1100
|
floors = [],
|
|
1101
1101
|
clearFirstContaierMarginTop = false,
|
|
1102
1102
|
isLuxuryShop = false,
|
|
1103
1103
|
isShowNativeImmersivePlayer=false,
|
|
1104
1104
|
screenHeight = null,
|
|
1105
1105
|
screenWidth = null,
|
|
1106
1106
|
bottomBarHeight= null
|
|
1107
1107
|
} = pageData
|
|
1108
1108
|
exceptionReportFn
|
|
1109
1109
|
)
|
|
1110
1110
|
if (getFloorData) {
|
|
1111
1111
|
containerId: item.containerId,
|
|
1112
1112
|
containerIndex: index,
|
|
1113
1113
|
...getFloorData,
|
|
1114
1114
|
}
|
|
1115
1115
|
if(getFloorData?.floorExtInfo?.floorLoadWay === 2){
|
|
1116
1116
|
const getSysFloorToLoadTypeRes = isIsvFloorUseable(getFloorData, exceptionReportFn)
|
|
1117
1117
|
!getSysFloorToLoadTypeRes && (getFloorData.floorExtInfo.floorLoadWay = 1)
|
|
1118
1118
|
}
|
|
1119
1119
|
if(isProd && isWxMinAndWxapp){
|
|
1120
1120
|
shopContentContainerListData = shopContentContainerListData.filter(
|
|
1121
1121
|
(item) =>
|
|
1122
1122
|
item.floors.length > 0 &&
|
|
1123
1123
|
!isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData)
|
|
1124
1124
|
)
|
|
1125
1125
|
}
|
|
1126
1126
|
shopContentContainerListData = [].concat(shopContentContainerListData)
|
|
1127
1127
|
return {
|
|
1128
1128
|
shopContentContainerListData,
|
|
1129
1129
|
shopContentFloorListData,
|
|
1130
1130
|
}
|
|
1131
1131
|
const changeOpts = {
|
|
1132
1132
|
title: '',
|
|
1133
1133
|
icon: 'success',
|
|
1134
1134
|
duration: 1500,
|
|
1135
1135
|
mask: true,
|
|
1136
1136
|
...options,
|
|
1137
1137
|
}
|
|
1138
1138
|
if (changeOpts.title.length > 7) {
|
|
1139
1139
|
showNormalToast(options)
|
|
1140
1140
|
} else {
|
|
1141
1141
|
Taro.showToast(changeOpts as any)
|
|
1142
1142
|
}
|
|
1143
1143
|
const changeOpts = {
|
|
1144
1144
|
title: '',
|
|
1145
1145
|
icon: 'error',
|
|
1146
1146
|
duration: 1500,
|
|
1147
1147
|
mask: true,
|
|
1148
1148
|
...options,
|
|
1149
1149
|
}
|
|
1150
1150
|
if (changeOpts.title.length > 7) {
|
|
1151
1151
|
showNormalToast(options)
|
|
1152
1152
|
} else {
|
|
1153
1153
|
Taro.showToast(changeOpts as any)
|
|
1154
1154
|
}
|
|
1155
1155
|
Taro.showToast({
|
|
1156
1156
|
title: '',
|
|
1157
1157
|
icon: 'none',
|
|
1158
1158
|
duration: 1500,
|
|
1159
1159
|
mask: true,
|
|
1160
1160
|
...options,
|
|
1161
1161
|
})
|
|
1162
1162
|
return Taro.showLoading({
|
|
1163
1163
|
title: text,
|
|
1164
1164
|
})
|
|
1165
1165
|
return new Promise(() => {
|
|
1166
1166
|
Taro.nextTick(() => {
|
|
1167
1167
|
setTimeout(() => {
|
|
1168
1168
|
Taro.hideLoading(options)
|
|
1169
1169
|
}, 300)
|
|
1170
1170
|
})
|
|
1171
1171
|
})
|
|
1172
1172
|
return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
1173
1173
|
const {
|
|
1174
1174
|
tabActive = SECTION_HOME_TAB_NAME_TYPE[
|
|
1175
1175
|
SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
|
|
1176
1176
|
],
|
|
1177
1177
|
sceneId,
|
|
1178
1178
|
} = query
|
|
1179
1179
|
let changeTabActive = tabActive
|
|
1180
1180
|
if (sceneId) {
|
|
1181
1181
|
if (isH5) {
|
|
1182
1182
|
if (sceneId == '1002') {
|
|
1183
1183
|
changeTabActive =
|
|
1184
1184
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
|
|
1185
1185
|
}
|
|
1186
1186
|
else if (sceneId == '1003') {
|
|
1187
1187
|
changeTabActive =
|
|
1188
1188
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY]
|
|
1189
1189
|
}
|
|
1190
1190
|
} else if (isWxMinAndWxapp) {
|
|
1191
1191
|
if (sceneId == '1001' || sceneId == '1002') {
|
|
1192
1192
|
changeTabActive =
|
|
1193
1193
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
|
|
1194
1194
|
}
|
|
1195
1195
|
else if (sceneId == '1003') {
|
|
1196
1196
|
changeTabActive =
|
|
1197
1197
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]
|
|
1198
1198
|
}
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
1201
1201
|
if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
|
|
1202
1202
|
return {
|
|
1203
1203
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
1204
1204
|
tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
|
|
1205
1205
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
|
|
1206
1206
|
}
|
|
1207
1207
|
} else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
|
|
1208
1208
|
return {
|
|
1209
1209
|
menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
|
|
1210
1210
|
tabActiveType: 0,
|
|
1211
1211
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
|
|
1212
1212
|
}
|
|
1213
1213
|
} else {
|
|
1214
1214
|
return {
|
|
1215
1215
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
1216
1216
|
tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
|
|
1217
1217
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
|
|
1218
1218
|
}
|
|
1219
1219
|
}
|
|
1220
1220
|
const deleteKeyList = [
|
|
1221
1221
|
'$taroTimestamp',
|
|
1222
1222
|
'cookie',
|
|
1223
1223
|
'wdref',
|
|
1224
1224
|
'navStart',
|
|
1225
1225
|
'originOpts',
|
|
1226
1226
|
'originParams',
|
|
1227
1227
|
'originUrl',
|
|
1228
1228
|
'referer',
|
|
1229
1229
|
'stamp',
|
|
1230
1230
|
]
|
|
1231
1231
|
let changeQueryData: any = { ...queryData }
|
|
1232
1232
|
const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false
|
|
1233
1233
|
const sceneQuery =
|
|
1234
1234
|
qrCodeScene && typeof qrCodeScene == 'string'
|
|
1235
1235
|
? parseQueryUrlString(decodeURIComponent(qrCodeScene))
|
|
1236
1236
|
: {}
|
|
1237
1237
|
changeQueryData = { ...changeQueryData, ...sceneQuery }
|
|
1238
1238
|
deleteKeyList.forEach((key) => {
|
|
1239
1239
|
changeQueryData[key] && delete changeQueryData[key]
|
|
1240
1240
|
})
|
|
1241
1241
|
changeQueryData['shopid'] &&
|
|
1242
1242
|
(changeQueryData['shopId'] = changeQueryData['shopid']) &&
|
|
1243
1243
|
delete changeQueryData['shopid']
|
|
1244
1244
|
changeQueryData['venderid'] &&
|
|
1245
1245
|
(changeQueryData['venderId'] = changeQueryData['venderid']) &&
|
|
1246
1246
|
delete changeQueryData['venderid']
|
|
1247
1247
|
changeQueryData['vendorId'] &&
|
|
1248
1248
|
(changeQueryData['venderId'] = changeQueryData['vendorId']) &&
|
|
1249
1249
|
delete changeQueryData['vendorId']
|
|
1250
1250
|
return changeQueryData
|
|
1251
1251
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
1252
1252
|
const modularPackResultObj = formatPackResult(modularPackResult)
|
|
1253
1253
|
const bundleUrl = getBundleUrl(modularPackResultObj)
|
|
1254
1254
|
const bundleFileName = getBundleFileName(modularPackResultObj)
|
|
1255
1255
|
if (bundleUrl && bundleFileName) {
|
|
1256
1256
|
isUsable = true
|
|
1257
1257
|
}
|
|
1258
1258
|
const objContainer = containerListData.find(
|
|
1259
1259
|
(item) => item.containerId === containerId,
|
|
1260
1260
|
)
|
|
1261
1261
|
return (
|
|
1262
1262
|
objContainer?.includeUids?.some((itemUid) => {
|
|
1263
1263
|
const objectFloor = floorListData.find(
|
|
1264
1264
|
(floorItem) => itemUid === floorItem.uid,
|
|
1265
1265
|
)
|
|
1266
1266
|
return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
|
|
1267
1267
|
}) ?? false
|
|
1268
1268
|
)
|
|
1269
1269
|
floorListData,
|
|
1270
1270
|
containerListData,
|
|
1271
1271
|
exceptionReportFn?,
|
|
1272
1272
|
const unableIsvFloorListData = floorListData.filter(
|
|
1273
1273
|
(floorItem) =>
|
|
1274
1274
|
RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
|
|
1275
1275
|
!isIsvFloorUseable(floorItem, exceptionReportFn),
|
|
1276
1276
|
)
|
|
1277
1277
|
const unableIsvFloorUidList = unableIsvFloorListData.map(
|
|
1278
1278
|
(floorItem) => floorItem.uid,
|
|
1279
1279
|
)
|
|
1280
1280
|
const unableIsvContainerListData = containerListData.filter(
|
|
1281
1281
|
(item) =>
|
|
1282
1282
|
item.includeUids &&
|
|
1283
1283
|
item.includeUids.every(
|
|
1284
1284
|
(itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1,
|
|
1285
1285
|
),
|
|
1286
1286
|
)
|
|
1287
1287
|
return unableIsvContainerListData
|
|
1288
1288
|
return -2
|
|
1289
1289
|
return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl)
|
|
1290
1290
|
let getParams = false
|
|
1291
1291
|
if (isOpenJdAppUrl(openAppUrl)) {
|
|
1292
1292
|
try {
|
|
1293
1293
|
getParams = openAppUrl.replace(
|
|
1294
1294
|
/openApp\.jdMobile:\/\/virtual\?params=/i,
|
|
1295
1295
|
'',
|
|
1296
1296
|
)
|
|
1297
1297
|
getParams = JSON.parse(String(getParams))
|
|
1298
1298
|
} catch (e) {
|
|
1299
1299
|
console.log(e)
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
1302
1302
|
return getParams
|
|
1303
1303
|
return `openapp.jdmobile://virtual?params=${JSON.stringify(Object.assign({}, openParams))}`
|
|
1304
1304
|
if (val === null || val === '' || typeof val === 'undefined') {
|
|
1305
1305
|
return true
|
|
1306
1306
|
}
|
|
1307
1307
|
return false
|
|
1308
1308
|
const {
|
|
1309
1309
|
moduleId = 'none',
|
|
1310
1310
|
entrance = 'none',
|
|
1311
1311
|
sourceType = 'none',
|
|
1312
1312
|
sourceValue = 'none',
|
|
1313
1313
|
} = params
|
|
1314
1314
|
if (isIosDevice) {
|
|
1315
1315
|
return `${moduleId}#${entrance}`
|
|
1316
1316
|
} else if (isAndroidDevice) {
|
|
1317
1317
|
return `${sourceType}#${sourceValue}`
|
|
1318
1318
|
}
|
|
1319
1319
|
return 'none#none'
|
|
1320
1320
|
if (data && typeof data === 'object') {
|
|
1321
1321
|
let getOpenAppData = { ...data }
|
|
1322
1322
|
try {
|
|
1323
1323
|
const { sourceInfo, designerId, templateId, source } = getOpenAppData
|
|
1324
1324
|
if (designerId && templateId) {
|
|
1325
1325
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
1326
1326
|
sourceInfo: {
|
|
1327
1327
|
entrance: '设计师预览',
|
|
1328
1328
|
},
|
|
1329
1329
|
})
|
|
1330
1330
|
} else if (sourceInfo) {
|
|
1331
1331
|
const { entrance } = sourceInfo
|
|
1332
1332
|
getOpenAppData.sourceInfo.entrance =
|
|
1333
1333
|
entrance && entrance.length > 0 ? entrance : '其他'
|
|
1334
1334
|
} else if (source && !sourceInfo) {
|
|
1335
1335
|
if (typeof source === 'object') {
|
|
1336
1336
|
const { sourceType, entrance, sourceValue, moduleId } = source
|
|
1337
1337
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
1338
1338
|
sourceInfo: {
|
|
1339
1339
|
entrance: sourceType || entrance || '其他',
|
|
1340
1340
|
moduleId: sourceValue || moduleId || '-100',
|
|
1341
1341
|
},
|
|
1342
1342
|
})
|
|
1343
1343
|
} else {
|
|
1344
1344
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
1345
1345
|
sourceInfo: {
|
|
1346
1346
|
entrance: source,
|
|
1347
1347
|
},
|
|
1348
1348
|
})
|
|
1349
1349
|
}
|
|
1350
1350
|
} else {
|
|
1351
1351
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
1352
1352
|
sourceInfo: {
|
|
1353
1353
|
entrance: '其他',
|
|
1354
1354
|
},
|
|
1355
1355
|
})
|
|
1356
1356
|
}
|
|
1357
1357
|
} catch (e) {
|
|
1358
1358
|
console.log(e)
|
|
1359
1359
|
}
|
|
1360
1360
|
return getOpenAppData
|
|
1361
1361
|
}
|
|
1362
1362
|
return data
|
|
1363
1363
|
return displayObj
|
|
1364
1364
|
isChartH5,
|
|
1365
1365
|
isH5AndJdShopViewH5Scroll,
|
|
1366
1366
|
isH5AndJdShopH5CustomScrollView,
|
|
1367
1367
|
isMemberPage,
|
|
1368
1368
|
sgmCustomReport,
|
|
1369
1369
|
isOpenJdAppUrl,
|
|
1370
1370
|
jdOpenAppParams,
|
|
1371
1371
|
createJdOpenAppUrl,
|
|
1372
1372
|
dealJdOpenAppData,
|
|
1373
1373
|
isEmpty,
|
|
1374
1374
|
getJdAppReportPageSource,
|
|
1375
1375
|
isPc,
|
|
1376
1376
|
ipLoc_djd,
|
|
1377
1377
|
jdAppVersionCompare,
|
|
1378
1378
|
dealNativePixelToCssPixel,
|
|
1379
1379
|
isAppStowShop
|