@conecli/cone-render 0.8.36 → 0.9.1-isv2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- 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/wxappApi.ts +1 -1
- package/dist/components/base/CustomScrollView/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/LazyLayoutLoad/index.weapp.tsx +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/Skeleton/index.tsx +1 -1
- package/dist/components/remoteFloorItem.tsx +1 -1
- package/dist/interface/common.ts +1 -1
- package/dist/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/web.base.ts +1 -1
- package/dist/jumpEventReport/web.jd.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/taroRenderUtil.ts +1 -0
- package/dist/utils/utils.ts +1 -1
- package/dist/wxapp/api/helper.js +1 -0
- package/dist/wxapp/components/launch-app/index.js +1 -0
- package/dist/wxapp/components/launch-app/index.json +5 -0
- package/dist/wxapp/components/launch-app/index.wxml +0 -0
- package/dist/wxapp/components/launch-app/index.wxss +0 -0
- package/dist/wxapp/components/subscribe-guider/helper.js +1 -0
- package/dist/wxapp/components/subscribe-guider/index.js +1 -0
- package/dist/wxapp/components/subscribe-guider/index.json +5 -0
- package/dist/wxapp/components/subscribe-guider/index.wxml +0 -0
- package/dist/wxapp/components/subscribe-guider/index.wxss +0 -0
- package/package.json +45 -32
- package/dist/components/base/Skeleton/old.tsx +0 -1
package/dist/utils/utils.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
const getValue = `${obj[key]}`.replace(/undefined/,'').replace(/null/,'')
|
|
3
2
|
paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`
|
|
4
3
|
if(!imgUrl.includes('360buyimg.com')){
|
|
5
4
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl
|
|
6
5
|
}
|
|
7
6
|
if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
|
|
8
7
|
pin?: string
|
|
9
8
|
visitkey?: string
|
|
10
9
|
[key: string]: any
|
|
11
10
|
}
|
|
12
11
|
jdpin,
|
|
13
12
|
pinStatus,
|
|
14
13
|
visitkey,
|
|
15
14
|
unionid,
|
|
16
15
|
skey,
|
|
17
16
|
__jda,
|
|
18
17
|
__jdv,
|
|
19
18
|
__wga,
|
|
20
19
|
wxapp_type,
|
|
21
20
|
appType
|
|
22
21
|
} = cookie
|
|
23
22
|
const getUserCookieObj = {}
|
|
24
23
|
jdpin,
|
|
25
24
|
pinStatus,
|
|
26
25
|
visitkey,
|
|
27
26
|
unionid,
|
|
28
27
|
skey,
|
|
29
28
|
__jda,
|
|
30
29
|
__jdv,
|
|
31
30
|
__wga,
|
|
32
31
|
wid,
|
|
33
32
|
wq_skey,
|
|
34
33
|
wq_uin,
|
|
35
34
|
wq_auth_token,
|
|
36
35
|
wxapp_scene,
|
|
37
36
|
wq_unionid,
|
|
38
37
|
wxapp_openid,
|
|
39
38
|
wxapp_version,
|
|
40
39
|
wxapp_type,
|
|
41
40
|
appType
|
|
42
41
|
name = name === 'jdpin' ? 'pin' : name;
|
|
43
42
|
name === 'pin' && (ret.push(`pt_pin=${encodeURIComponent(value)}`))
|
|
44
43
|
ret.push(`${name}=${encodeURIComponent(value)}`)
|
|
45
44
|
getUserCookieObj[name] = value
|
|
46
45
|
}
|
|
47
46
|
wqCookie: getUserCookieObj
|
|
48
47
|
exceptionReportFn
|
|
49
48
|
const isIsvContainer = (containerId, floorListData, containerListData) => {
|
|
50
49
|
const objContainer = containerListData.find(item => item.containerId === containerId)
|
|
51
50
|
(itemUid) => {
|
|
52
51
|
const objectFloor = floorListData.find(floorItem => itemUid === floorItem.uid)
|
|
53
52
|
return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
|
|
54
53
|
}
|
|
55
54
|
)?? false
|
|
56
55
|
isChartH5,
|
|
57
56
|
isH5AndJdShopViewH5Scroll,
|
|
58
57
|
isMemberPage,
|
|
59
58
|
sgmCustomReport
|
|
59
|
+
import Taro from '@tarojs/taro'
|
|
60
60
|
SHOP_MENU_ID_TYPE,
|
|
61
61
|
SHOP_MENU_ID_QUERY_NAME,
|
|
62
62
|
SECTION_HOME_TAB_TYPE,
|
|
63
63
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
64
64
|
SECTION_HOME_TAB_QUERY_TYPE,
|
|
65
65
|
CHANNEL_TYPE,
|
|
66
66
|
JDShopViewBusinessPathType,
|
|
67
67
|
FloorModuleType,
|
|
68
68
|
RemoteLoadFloorList,
|
|
69
69
|
getBundleUrl,
|
|
70
70
|
getBundleFileName,
|
|
71
71
|
formatPackResult,
|
|
72
72
|
const resultList: Array<any> = [],
|
|
73
73
|
arrLen = arr.length
|
|
74
74
|
if (arrLen) {
|
|
75
75
|
if (arrLen > size) {
|
|
76
76
|
for (let i = 0; i < arrLen; i = i + size) {
|
|
77
77
|
resultList.push(arr.slice(i, i + size))
|
|
78
78
|
}
|
|
79
79
|
} else {
|
|
80
80
|
resultList.push(arr)
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
return resultList
|
|
84
84
|
let _address = ids
|
|
85
85
|
const _areaAreaSplit = ids.split('.')
|
|
86
86
|
const _areaAreaSplit2 = ids.split('_')
|
|
87
87
|
_address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address
|
|
88
88
|
_address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address
|
|
89
89
|
return _address
|
|
90
90
|
const getValue = `${obj[key]}`.replace(/undefined/,'').replace(/null/,'')
|
|
91
91
|
paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`
|
|
92
92
|
const result = {}
|
|
93
93
|
if (
|
|
94
94
|
!urlOrQueryStr ||
|
|
95
95
|
('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
|
|
96
96
|
) {
|
|
97
97
|
return result
|
|
98
98
|
}
|
|
99
99
|
if (urlOrQueryStr.indexOf('?') > -1) {
|
|
100
100
|
const queryStr = urlOrQueryStr.split('?')
|
|
101
101
|
const queryItemList =
|
|
102
102
|
queryStr && queryStr.length > 1 ? queryStr[1].split('&') : []
|
|
103
103
|
const queryItemListLen = queryItemList.length
|
|
104
104
|
queryItemListLen > 0 &&
|
|
105
105
|
queryItemList.forEach((item) => {
|
|
106
106
|
const thisItemList = item.split('=')
|
|
107
107
|
result[thisItemList[0]] = thisItemList[1]
|
|
108
108
|
})
|
|
109
109
|
} else {
|
|
110
110
|
const queryItemList =
|
|
111
111
|
urlOrQueryStr.indexOf('&') > -1
|
|
112
112
|
? urlOrQueryStr.split('&')
|
|
113
113
|
: [urlOrQueryStr]
|
|
114
114
|
const queryItemListLen = queryItemList.length
|
|
115
115
|
queryItemListLen > 0 &&
|
|
116
116
|
queryItemList.forEach((item) => {
|
|
117
117
|
const thisItemList = item.split('=')
|
|
118
118
|
result[thisItemList[0]] = thisItemList[1]
|
|
119
119
|
})
|
|
120
120
|
}
|
|
121
121
|
return result
|
|
122
122
|
url: string,
|
|
123
123
|
size?: {
|
|
124
124
|
w: number
|
|
125
125
|
h: number
|
|
126
126
|
},
|
|
127
127
|
quality?: number,
|
|
128
128
|
if (url && size) {
|
|
129
129
|
const _w = Math.floor(size.w)
|
|
130
130
|
const _h = Math.floor(size.h)
|
|
131
131
|
if (url.match(/gif$/i)) {
|
|
132
132
|
return url
|
|
133
133
|
} else {
|
|
134
134
|
if (_w > 0 && _h > 0) {
|
|
135
135
|
url = url.replace('jfs/', `s${_w}x${_h}_jfs/`)
|
|
136
136
|
}
|
|
137
137
|
url += quality != null ? `!q${quality}.dpg` : '.dpg'
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
return url
|
|
141
141
|
url: string,
|
|
142
142
|
jfsImgInfo: UtilsInterFace.getJfsImageInfo = {},
|
|
143
143
|
if (url.match(/\.(jpg|png|dpg)$/i)) {
|
|
144
144
|
const { width, height, quality } = jfsImgInfo
|
|
145
145
|
if (typeof width === 'number' || typeof height === 'number') {
|
|
146
146
|
url = url.replace(
|
|
147
147
|
'/jfs/',
|
|
148
148
|
`/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`,
|
|
149
149
|
)
|
|
150
150
|
}
|
|
151
151
|
if (
|
|
152
152
|
typeof quality === 'number' &&
|
|
153
153
|
quality > 0 &&
|
|
154
154
|
quality < 100 &&
|
|
155
155
|
url.match(/\.jpg$/i)
|
|
156
156
|
) {
|
|
157
157
|
url += `!q${quality}.dpg`
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
return addHttps(url)
|
|
161
161
|
if(!imgUrl.includes('360buyimg.com')){
|
|
162
162
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl
|
|
163
163
|
}
|
|
164
164
|
if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
|
|
165
165
|
count: number,
|
|
166
166
|
fixedNum = 2,
|
|
167
167
|
unit = '万',
|
|
168
168
|
maxNum = 10000,
|
|
169
169
|
count = Number(count)
|
|
170
170
|
if (count > maxNum) {
|
|
171
171
|
return (count / maxNum).toFixed(fixedNum) + unit
|
|
172
172
|
}
|
|
173
173
|
return count
|
|
174
174
|
key: string,
|
|
175
175
|
value: string | object,
|
|
176
176
|
successBack?: any,
|
|
177
177
|
failBack?: any,
|
|
178
178
|
return Taro.setStorage({
|
|
179
179
|
key: key,
|
|
180
180
|
data: value,
|
|
181
181
|
success: successBack,
|
|
182
182
|
fail: failBack,
|
|
183
183
|
})
|
|
184
184
|
return Taro.getStorageSync(key)
|
|
185
185
|
return Taro.removeStorage({
|
|
186
186
|
key: key,
|
|
187
187
|
})
|
|
188
188
|
return Taro.clearStorage()
|
|
189
189
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
|
|
190
190
|
platform: '',
|
|
191
191
|
model: '',
|
|
192
192
|
system: '',
|
|
193
193
|
}
|
|
194
194
|
const isIOS = !!systemInfo.system.match(/ios/i)
|
|
195
195
|
const isAndroid = !!systemInfo.system.match(/android/i)
|
|
196
196
|
if (!systemInfo.statusBarHeight) {
|
|
197
197
|
systemInfo.statusBarHeight = screenHeight - windowHeight - 20
|
|
198
198
|
systemInfo.navBarExtendHeight = 0
|
|
199
199
|
} else {
|
|
200
200
|
if (isIOS) {
|
|
201
201
|
systemInfo.navBarExtendHeight = 4
|
|
202
202
|
} else {
|
|
203
203
|
systemInfo.navBarExtendHeight = 0
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
let rect = Taro.getMenuButtonBoundingClientRect
|
|
207
207
|
? Taro.getMenuButtonBoundingClientRect()
|
|
208
208
|
: null
|
|
209
209
|
if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
|
|
210
210
|
let gap = 0
|
|
211
211
|
let width = 96
|
|
212
212
|
if (systemInfo.platform === 'android') {
|
|
213
213
|
gap = 8
|
|
214
214
|
width = 96
|
|
215
215
|
} else if (systemInfo.platform === 'devtools') {
|
|
216
216
|
if (isIOS) {
|
|
217
217
|
gap = 5.5
|
|
218
218
|
} else {
|
|
219
219
|
gap = 7.5
|
|
220
220
|
}
|
|
221
221
|
} else {
|
|
222
222
|
gap = 4
|
|
223
223
|
width = 88
|
|
224
224
|
}
|
|
225
225
|
rect = {
|
|
226
226
|
bottom: systemInfo.statusBarHeight + gap + 32,
|
|
227
227
|
height: 32,
|
|
228
228
|
left: systemInfo.windowWidth - width - 10,
|
|
229
229
|
right: systemInfo.windowWidth - 10,
|
|
230
230
|
top: systemInfo.statusBarHeight + gap,
|
|
231
231
|
width,
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
const gap = rect.top - systemInfo.statusBarHeight
|
|
235
235
|
systemInfo.navBarTopToStatusBar = gap
|
|
236
236
|
systemInfo.navBarHeight = 2 * gap + rect.height
|
|
237
237
|
systemInfo.capsulePosition = rect
|
|
238
238
|
systemInfo.isIOS = isIOS
|
|
239
239
|
systemInfo.isAndroid = isAndroid
|
|
240
240
|
return systemInfo
|
|
241
241
|
if (str.match(/^\/\//)) {
|
|
242
242
|
str = 'https:' + str
|
|
243
243
|
}
|
|
244
244
|
return str
|
|
245
245
|
dateTimeOrdate: Date | string | number | null,
|
|
246
246
|
format = 'yyyy-MM-dd HH:mm:ss',
|
|
247
247
|
noPadStart = {
|
|
248
248
|
M: '0',
|
|
249
249
|
d: '0',
|
|
250
250
|
H: '0',
|
|
251
251
|
m: '0',
|
|
252
252
|
s: '0',
|
|
253
253
|
},
|
|
254
254
|
let dateResult = ''
|
|
255
255
|
const padStarts = Object.assign(
|
|
256
256
|
{
|
|
257
257
|
M: '0',
|
|
258
258
|
d: '0',
|
|
259
259
|
H: '0',
|
|
260
260
|
m: '0',
|
|
261
261
|
s: '0',
|
|
262
262
|
},
|
|
263
263
|
noPadStart,
|
|
264
264
|
)
|
|
265
265
|
if (dateTimeOrdate) {
|
|
266
266
|
let changeDateTimeOrdate = dateTimeOrdate
|
|
267
267
|
const getChangeDateTimeToNumber = Number(changeDateTimeOrdate)
|
|
268
268
|
if (getChangeDateTimeToNumber) {
|
|
269
269
|
changeDateTimeOrdate = getChangeDateTimeToNumber
|
|
270
270
|
} else {
|
|
271
271
|
changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/')
|
|
272
272
|
}
|
|
273
273
|
const nowDate =
|
|
274
274
|
dateTimeOrdate instanceof Date
|
|
275
275
|
? dateTimeOrdate
|
|
276
276
|
: new Date(changeDateTimeOrdate)
|
|
277
277
|
const dateMap = {
|
|
278
278
|
y: `${nowDate.getFullYear()}`,
|
|
279
279
|
M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
|
|
280
280
|
d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
|
|
281
281
|
H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
|
|
282
282
|
m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
|
|
283
283
|
s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
|
|
284
284
|
}
|
|
285
285
|
const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g')
|
|
286
286
|
const regYear = new RegExp('y')
|
|
287
287
|
dateResult = format.replace(regDate, (v) => {
|
|
288
288
|
let changeValue = v
|
|
289
289
|
if (regYear.test(changeValue)) {
|
|
290
290
|
const thisYear = dateMap.y
|
|
291
291
|
const subValueLen = 4 - changeValue.length
|
|
292
292
|
changeValue = thisYear.substr(subValueLen)
|
|
293
293
|
} else {
|
|
294
294
|
const dateKey = v.substr(0, 1)
|
|
295
295
|
changeValue = dateMap[dateKey]
|
|
296
296
|
}
|
|
297
297
|
return changeValue
|
|
298
298
|
})
|
|
299
299
|
}
|
|
300
300
|
return dateResult
|
|
301
301
|
let timer: any = null
|
|
302
302
|
let startTime = Date.now()
|
|
303
303
|
return function () {
|
|
304
304
|
const curTime = Date.now()
|
|
305
305
|
const remaining = delay - (curTime - startTime)
|
|
306
306
|
const context = this
|
|
307
307
|
const args = arguments
|
|
308
308
|
clearTimeout(timer)
|
|
309
309
|
if (remaining <= 0) {
|
|
310
310
|
func.apply(context, args)
|
|
311
311
|
startTime = Date.now()
|
|
312
312
|
} else {
|
|
313
313
|
timer = setTimeout(func, remaining)
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
let context, args, result
|
|
317
317
|
let timeout = null
|
|
318
318
|
let previous = 0
|
|
319
319
|
if (!options) options = {}
|
|
320
320
|
const later = function () {
|
|
321
321
|
previous = options.leading === false ? 0 : Date.now()
|
|
322
322
|
timeout = null
|
|
323
323
|
result = func.apply(context, args)
|
|
324
324
|
if (!timeout) context = args = null
|
|
325
325
|
}
|
|
326
326
|
return function () {
|
|
327
327
|
const now = Date.now()
|
|
328
328
|
if (!previous && options.leading === false) previous = now
|
|
329
329
|
const remaining = wait - (now - previous)
|
|
330
330
|
context = this
|
|
331
331
|
args = arguments
|
|
332
332
|
if (remaining <= 0 || remaining > wait) {
|
|
333
333
|
if (timeout) {
|
|
334
334
|
clearTimeout(timeout)
|
|
335
335
|
timeout = null
|
|
336
336
|
}
|
|
337
337
|
previous = now
|
|
338
338
|
result = func.apply(context, args)
|
|
339
339
|
if (!timeout) context = args = null
|
|
340
340
|
} else if (!timeout && options.trailing !== false) {
|
|
341
341
|
timeout = setTimeout(later, remaining)
|
|
342
342
|
}
|
|
343
343
|
return result
|
|
344
344
|
}
|
|
345
345
|
let timer: any = null
|
|
346
346
|
return function () {
|
|
347
347
|
const context: any = this
|
|
348
348
|
const args = arguments
|
|
349
349
|
timer && clearTimeout(timer)
|
|
350
350
|
timer = setTimeout(function () {
|
|
351
351
|
fn.apply(context, args)
|
|
352
352
|
}, delay)
|
|
353
353
|
}
|
|
354
354
|
if (txt) {
|
|
355
355
|
txt = txt.trim()
|
|
356
356
|
const reg = new RegExp(/[\d-]+/)
|
|
357
357
|
const res = reg.exec(txt)
|
|
358
358
|
if (res && res.length > 0) {
|
|
359
359
|
let tel = res[0]
|
|
360
360
|
if (tel && delSeparator) {
|
|
361
361
|
tel = tel.replace(/-/g, '')
|
|
362
362
|
}
|
|
363
363
|
return tel
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
return ''
|
|
367
367
|
if (rgb) {
|
|
368
368
|
const reg = /^(rgb|RGB)/
|
|
369
369
|
const color = rgb
|
|
370
370
|
if (reg.test(color)) {
|
|
371
371
|
let strHex = '#'
|
|
372
372
|
const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
|
|
373
373
|
for (let i = 0; i < colorArr.length; i++) {
|
|
374
374
|
let hex = Number(colorArr[i]).toString(16)
|
|
375
375
|
if (hex === '0') {
|
|
376
376
|
hex += hex
|
|
377
377
|
}
|
|
378
378
|
strHex += hex
|
|
379
379
|
}
|
|
380
380
|
return strHex
|
|
381
381
|
} else {
|
|
382
382
|
return String(color)
|
|
383
383
|
}
|
|
384
384
|
} else {
|
|
385
385
|
return ''
|
|
386
386
|
}
|
|
387
387
|
if (hex) {
|
|
388
388
|
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
|
|
389
389
|
let color = hex.toLowerCase()
|
|
390
390
|
if (reg.test(color)) {
|
|
391
391
|
if (color.length === 4) {
|
|
392
392
|
let colorNew = '#'
|
|
393
393
|
for (let i = 1; i < 4; i += 1) {
|
|
394
394
|
colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1))
|
|
395
395
|
}
|
|
396
396
|
color = colorNew
|
|
397
397
|
}
|
|
398
398
|
const colorChange: number[] = []
|
|
399
399
|
for (let i = 1; i < 7; i += 2) {
|
|
400
400
|
colorChange.push(parseInt('0x' + color.slice(i, i + 2)))
|
|
401
401
|
}
|
|
402
402
|
if (returnList) {
|
|
403
403
|
return colorChange
|
|
404
404
|
} else {
|
|
405
405
|
return 'RGB(' + colorChange.join(',') + ')'
|
|
406
406
|
}
|
|
407
407
|
} else {
|
|
408
408
|
return color
|
|
409
409
|
}
|
|
410
410
|
} else {
|
|
411
411
|
return ''
|
|
412
412
|
}
|
|
413
413
|
n: number,
|
|
414
414
|
m: number,
|
|
415
415
|
filterNum: number | undefined = undefined,
|
|
416
416
|
const c = m - n + 1
|
|
417
417
|
const res = Math.floor(Math.random() * c + n)
|
|
418
418
|
if (filterNum && filterNum == res) {
|
|
419
419
|
console.log('随机数二次开始', res, filterNum)
|
|
420
420
|
return getRandom(n, m, filterNum)
|
|
421
421
|
} else {
|
|
422
422
|
return res
|
|
423
423
|
}
|
|
424
424
|
wqCookieStr: string
|
|
425
425
|
wqCookie: {
|
|
426
426
|
pin?: string
|
|
427
427
|
visitkey?: string
|
|
428
428
|
[key: string]: any
|
|
429
429
|
}
|
|
430
430
|
const {
|
|
431
431
|
jdpin,
|
|
432
432
|
pinStatus,
|
|
433
433
|
visitkey,
|
|
434
434
|
unionid,
|
|
435
435
|
skey,
|
|
436
436
|
__jda,
|
|
437
437
|
__jdv,
|
|
438
438
|
__wga,
|
|
439
439
|
wxapp_type,
|
|
440
440
|
appType
|
|
441
441
|
} = cookie
|
|
442
442
|
const ret: string[] = []
|
|
443
443
|
const getUserCookieObj = {}
|
|
444
444
|
const createUseCookieArr = [
|
|
445
445
|
jdpin,
|
|
446
446
|
pinStatus,
|
|
447
447
|
visitkey,
|
|
448
448
|
unionid,
|
|
449
449
|
skey,
|
|
450
450
|
__jda,
|
|
451
451
|
__jdv,
|
|
452
452
|
__wga,
|
|
453
453
|
wid,
|
|
454
454
|
wq_skey,
|
|
455
455
|
wq_uin,
|
|
456
456
|
wq_auth_token,
|
|
457
457
|
wxapp_scene,
|
|
458
458
|
wq_unionid,
|
|
459
459
|
wxapp_openid,
|
|
460
460
|
wxapp_version,
|
|
461
461
|
wxapp_type,
|
|
462
462
|
appType
|
|
463
463
|
name = name === 'jdpin' ? 'pin' : name;
|
|
464
464
|
name === 'pin' && (ret.push(`pt_pin=${encodeURIComponent(value)}`))
|
|
465
465
|
ret.push(`${name}=${encodeURIComponent(value)}`)
|
|
466
466
|
getUserCookieObj[name] = value
|
|
467
467
|
}
|
|
468
468
|
})
|
|
469
469
|
return {
|
|
470
470
|
wqCookieStr: ret.join(';'),
|
|
471
471
|
wqCookie: getUserCookieObj,
|
|
472
472
|
}
|
|
473
473
|
num,
|
|
474
474
|
widthSize = 375,
|
|
475
475
|
layoutWidth = windowWidth,
|
|
476
476
|
const getNum = Number(num)
|
|
477
477
|
return Math.round((getNum / widthSize) * layoutWidth)
|
|
478
478
|
let checkState = false
|
|
479
479
|
const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag
|
|
480
480
|
if (couponFloorModuleType === FloorModuleType.COUPON) {
|
|
481
481
|
try {
|
|
482
482
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
483
483
|
const couponDataDefine = dataDefines
|
|
484
484
|
? dataDefines.filter((item) => {
|
|
485
485
|
return item.type === 'coupon'
|
|
486
486
|
})
|
|
487
487
|
: [],
|
|
488
488
|
couponList = couponDataDefine[0]?.nodeText?.data
|
|
489
489
|
? couponDataDefine[0]?.nodeText?.data
|
|
490
490
|
: [],
|
|
491
491
|
couponLength = couponList.length,
|
|
492
492
|
numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
493
493
|
? couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
494
494
|
: 0
|
|
495
495
|
if (numShowPerLine === 0 && couponLength > 3) {
|
|
496
496
|
checkState = true
|
|
497
497
|
}
|
|
498
498
|
} catch (e) {
|
|
499
499
|
checkState = false
|
|
500
500
|
}
|
|
501
501
|
return checkState
|
|
502
502
|
}
|
|
503
503
|
const {
|
|
504
504
|
containers = [],
|
|
505
505
|
floors = [],
|
|
506
506
|
clearFirstContaierMarginTop = false,
|
|
507
507
|
} = pageData
|
|
508
508
|
console.log('dealShopContentData:', pageData, 'isvdev:', isvdev)
|
|
509
509
|
const getThisTimeKey = Date.now()
|
|
510
510
|
let shopContentContainerListData = containers?.filter(
|
|
511
511
|
(item) => (!isvdev && item.typeCode !== 'mShopHeader') || isvdev,
|
|
512
512
|
)
|
|
513
513
|
const shopContentFloorListData = floors?.filter(
|
|
514
514
|
({ floorPosition }) =>
|
|
515
515
|
(!isvdev && floorPosition !== 'header' && floorPosition !== 'footer') ||
|
|
516
516
|
isvdev,
|
|
517
517
|
)
|
|
518
518
|
const unableIsvContainerListData = getUnableIsvContainerListData(
|
|
519
519
|
shopContentFloorListData,
|
|
520
520
|
shopContentContainerListData,
|
|
521
521
|
exceptionReportFn,
|
|
522
522
|
)
|
|
523
523
|
shopContentContainerListData.forEach((item, index) => {
|
|
524
524
|
item.key = `${getThisTimeKey + index}`
|
|
525
525
|
item.floors = []
|
|
526
526
|
item.includeUids &&
|
|
527
527
|
item.includeUids.forEach((floorUid) => {
|
|
528
528
|
const getFloorData = shopContentFloorListData.find(
|
|
529
529
|
(floorItem) => floorItem.uid === floorUid,
|
|
530
530
|
)
|
|
531
531
|
if (getFloorData) {
|
|
532
532
|
const changeFloorData = {
|
|
533
533
|
containerId: item.containerId,
|
|
534
534
|
containerIndex: index,
|
|
535
535
|
...getFloorData,
|
|
536
536
|
}
|
|
537
537
|
const getCheckMoreCouponState =
|
|
538
538
|
checkCouponAndChangeContainerSetData(getFloorData)
|
|
539
539
|
if (getCheckMoreCouponState) {
|
|
540
540
|
item.marginLeft && (item.marginLeft = 0)
|
|
541
541
|
item.marginRight && (item.marginRight = 0)
|
|
542
542
|
item.borderRadius && (item.borderRadius = 0)
|
|
543
543
|
}
|
|
544
544
|
item.floors.push(changeFloorData)
|
|
545
545
|
}
|
|
546
546
|
})
|
|
547
547
|
if (
|
|
548
548
|
((!isvdev && index === 0) || (isvdev && index === 1)) &&
|
|
549
549
|
item?.containerPosition == 'content' &&
|
|
550
550
|
item?.marginBottom > 0 &&
|
|
551
551
|
!clearFirstContaierMarginTop
|
|
552
552
|
) {
|
|
553
553
|
item.marginTop = item.marginBottom
|
|
554
554
|
}
|
|
555
555
|
})
|
|
556
556
|
if(isProd && isWxMinAndWxapp){
|
|
557
557
|
shopContentContainerListData = shopContentContainerListData.filter(
|
|
558
558
|
(item) =>
|
|
559
559
|
item.floors.length > 0 &&
|
|
560
560
|
!isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData)
|
|
561
561
|
)
|
|
562
562
|
}
|
|
563
563
|
shopContentContainerListData = [].concat(shopContentContainerListData)
|
|
564
564
|
return {
|
|
565
565
|
shopContentContainerListData,
|
|
566
566
|
shopContentFloorListData,
|
|
567
567
|
}
|
|
568
568
|
const changeOpts = {
|
|
569
569
|
title: '',
|
|
570
570
|
icon: 'success',
|
|
571
571
|
duration: 1500,
|
|
572
572
|
mask: true,
|
|
573
573
|
...options,
|
|
574
574
|
}
|
|
575
575
|
if (changeOpts.title.length > 7) {
|
|
576
576
|
showNormalToast(options)
|
|
577
577
|
} else {
|
|
578
578
|
Taro.showToast(changeOpts as any)
|
|
579
579
|
}
|
|
580
580
|
const changeOpts = {
|
|
581
581
|
title: '',
|
|
582
582
|
icon: 'error',
|
|
583
583
|
duration: 1500,
|
|
584
584
|
mask: true,
|
|
585
585
|
...options,
|
|
586
586
|
}
|
|
587
587
|
if (changeOpts.title.length > 7) {
|
|
588
588
|
showNormalToast(options)
|
|
589
589
|
} else {
|
|
590
590
|
Taro.showToast(changeOpts as any)
|
|
591
591
|
}
|
|
592
592
|
Taro.showToast({
|
|
593
593
|
title: '',
|
|
594
594
|
icon: 'none',
|
|
595
595
|
duration: 1500,
|
|
596
596
|
mask: true,
|
|
597
597
|
...options,
|
|
598
598
|
})
|
|
599
599
|
return Taro.showLoading({
|
|
600
600
|
title: text,
|
|
601
601
|
})
|
|
602
602
|
return new Promise(() => {
|
|
603
603
|
Taro.nextTick(() => {
|
|
604
604
|
setTimeout(() => {
|
|
605
605
|
Taro.hideLoading(options)
|
|
606
606
|
}, 300)
|
|
607
607
|
})
|
|
608
608
|
})
|
|
609
609
|
return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
610
610
|
const {
|
|
611
611
|
tabActive = SECTION_HOME_TAB_NAME_TYPE[
|
|
612
612
|
SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
|
|
613
613
|
],
|
|
614
614
|
sceneId,
|
|
615
615
|
} = query
|
|
616
616
|
let changeTabActive = tabActive
|
|
617
617
|
if (sceneId) {
|
|
618
618
|
if (isH5) {
|
|
619
619
|
if (sceneId == '1002') {
|
|
620
620
|
changeTabActive =
|
|
621
621
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
|
|
622
622
|
}
|
|
623
623
|
else if (sceneId == '1003') {
|
|
624
624
|
changeTabActive =
|
|
625
625
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY]
|
|
626
626
|
}
|
|
627
627
|
} else if (isWxMinAndWxapp) {
|
|
628
628
|
if (sceneId == '1001' || sceneId == '1002') {
|
|
629
629
|
changeTabActive =
|
|
630
630
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
|
|
631
631
|
}
|
|
632
632
|
else if (sceneId == '1003') {
|
|
633
633
|
changeTabActive =
|
|
634
634
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
638
|
if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
|
|
639
639
|
return {
|
|
640
640
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
641
641
|
tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
|
|
642
642
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
|
|
643
643
|
}
|
|
644
644
|
} else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
|
|
645
645
|
return {
|
|
646
646
|
menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
|
|
647
647
|
tabActiveType: 0,
|
|
648
648
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
|
|
649
649
|
}
|
|
650
650
|
} else {
|
|
651
651
|
return {
|
|
652
652
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
653
653
|
tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
|
|
654
654
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
|
|
655
655
|
}
|
|
656
656
|
}
|
|
657
657
|
const deleteKeyList = [
|
|
658
658
|
'$taroTimestamp',
|
|
659
659
|
'cookie',
|
|
660
660
|
'wdref',
|
|
661
661
|
'navStart',
|
|
662
662
|
'originOpts',
|
|
663
663
|
'originParams',
|
|
664
664
|
'originUrl',
|
|
665
665
|
'referer',
|
|
666
666
|
'stamp',
|
|
667
667
|
]
|
|
668
668
|
let changeQueryData: any = { ...queryData }
|
|
669
669
|
const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false
|
|
670
670
|
const sceneQuery =
|
|
671
671
|
qrCodeScene && typeof qrCodeScene == 'string'
|
|
672
672
|
? parseQueryUrlString(decodeURIComponent(qrCodeScene))
|
|
673
673
|
: {}
|
|
674
674
|
changeQueryData = { ...changeQueryData, ...sceneQuery }
|
|
675
675
|
deleteKeyList.forEach((key) => {
|
|
676
676
|
changeQueryData[key] && delete changeQueryData[key]
|
|
677
677
|
})
|
|
678
678
|
changeQueryData['shopid'] &&
|
|
679
679
|
(changeQueryData['shopId'] = changeQueryData['shopid']) &&
|
|
680
680
|
delete changeQueryData['shopid']
|
|
681
681
|
changeQueryData['venderid'] &&
|
|
682
682
|
(changeQueryData['venderId'] = changeQueryData['venderid']) &&
|
|
683
683
|
delete changeQueryData['venderid']
|
|
684
684
|
changeQueryData['vendorId'] &&
|
|
685
685
|
(changeQueryData['venderId'] = changeQueryData['vendorId']) &&
|
|
686
686
|
delete changeQueryData['vendorId']
|
|
687
687
|
return changeQueryData
|
|
688
688
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
689
689
|
const modularPackResultObj = formatPackResult(modularPackResult)
|
|
690
690
|
const bundleUrl = getBundleUrl(modularPackResultObj)
|
|
691
691
|
const bundleFileName = getBundleFileName(modularPackResultObj)
|
|
692
692
|
if (bundleUrl && bundleFileName) {
|
|
693
693
|
isUsable = true
|
|
694
694
|
}
|
|
695
695
|
const objContainer = containerListData.find(
|
|
696
696
|
(item) => item.containerId === containerId,
|
|
697
697
|
)
|
|
698
698
|
return (
|
|
699
699
|
objContainer?.includeUids?.some((itemUid) => {
|
|
700
700
|
const objectFloor = floorListData.find(
|
|
701
701
|
(floorItem) => itemUid === floorItem.uid,
|
|
702
702
|
)
|
|
703
703
|
return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
|
|
704
704
|
}) ?? false
|
|
705
705
|
)
|
|
706
706
|
floorListData,
|
|
707
707
|
containerListData,
|
|
708
708
|
exceptionReportFn?,
|
|
709
709
|
const unableIsvFloorListData = floorListData.filter(
|
|
710
710
|
(floorItem) =>
|
|
711
711
|
RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
|
|
712
712
|
!isIsvFloorUseable(floorItem, exceptionReportFn),
|
|
713
713
|
)
|
|
714
714
|
const unableIsvFloorUidList = unableIsvFloorListData.map(
|
|
715
715
|
(floorItem) => floorItem.uid,
|
|
716
716
|
)
|
|
717
717
|
const unableIsvContainerListData = containerListData.filter(
|
|
718
718
|
(item) =>
|
|
719
719
|
item.includeUids &&
|
|
720
720
|
item.includeUids.every(
|
|
721
721
|
(itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1,
|
|
722
722
|
),
|
|
723
723
|
)
|
|
724
724
|
return unableIsvContainerListData
|
|
725
725
|
return customObj
|
|
726
726
|
isChartH5,
|
|
727
727
|
isH5AndJdShopViewH5Scroll,
|
|
728
728
|
isMemberPage,
|