@conecli/cone-render 0.9.1-shop2.2 → 0.9.1-shop2.4
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/jssdk.ts +1 -0
- package/dist/common/pageType.ts +1 -0
- package/dist/common/token/index.h5.ts +1 -1
- package/dist/common/token/token.jd.ts +1 -1
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/Exposure/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
- package/dist/components/base/InViewRender/index.tsx +1 -1
- package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
- package/dist/components/base/LazyLoadImage/const.ts +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/MobileCommonHeader/index.module.scss +9 -0
- package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
- package/dist/components/base/NetworkDataError/const.ts +1 -1
- package/dist/components/base/NetworkDataError/index.module.scss +4 -0
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/Double/index.tsx +1 -1
- package/dist/components/base/Price/index.tsx +1 -1
- package/dist/components/decorate/DecorateFloorModule/index.module.scss +21 -2
- package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
- package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
- package/dist/components/isv/Floor/index.tsx +1 -1
- package/dist/components/remoteFloorItem.tsx +1 -1
- package/dist/interface/common.ts +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/jumpEventReport/const.ts +1 -1
- package/dist/jumpEventReport/createReportFloorData.ts +1 -1
- package/dist/jumpEventReport/index.h5.ts +1 -1
- package/dist/jumpEventReport/index.weapp.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.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/jumpEventReport/web.jdb.ts +1 -1
- package/dist/jumpEventReport/web.jdjch.ts +1 -1
- package/dist/jumpEventReport/web.wxapp.ts +1 -1
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/modules/ContainerFloorList/index.tsx +1 -1
- package/dist/open/api/environment.ts +1 -1
- package/dist/open/api/index.ts +1 -1
- package/dist/open/api/track.ts +1 -1
- package/dist/open/components/index.ts +1 -1
- package/dist/service/fetchGateway.ts +1 -1
- package/dist/service/http/const.ts +1 -1
- 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/jm-common.js +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
|
if(!imgUrl.includes('360buyimg.com')){
|
|
104
103
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl
|
|
105
104
|
}
|
|
106
105
|
if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
|
|
107
106
|
count: number,
|
|
108
107
|
fixedNum = 2,
|
|
109
108
|
unit = '万',
|
|
110
109
|
maxNum = 10000,
|
|
111
110
|
count = Number(count)
|
|
112
111
|
if (count > maxNum) {
|
|
113
112
|
return (count / maxNum).toFixed(fixedNum) + unit
|
|
114
113
|
}
|
|
115
114
|
return count
|
|
116
115
|
key: string,
|
|
117
116
|
value: string | object,
|
|
118
117
|
successBack?: any,
|
|
119
118
|
failBack?: any,
|
|
120
119
|
return Taro.setStorage({
|
|
121
120
|
key: key,
|
|
122
121
|
data: value,
|
|
123
122
|
success: successBack,
|
|
124
123
|
fail: failBack,
|
|
125
124
|
})
|
|
126
125
|
return Taro.getStorageSync(key)
|
|
127
126
|
return Taro.removeStorage({
|
|
128
127
|
key: key,
|
|
129
128
|
})
|
|
130
129
|
return Taro.clearStorage()
|
|
131
130
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
|
|
132
131
|
platform: '',
|
|
133
132
|
model: '',
|
|
134
133
|
system: '',
|
|
135
134
|
}
|
|
136
135
|
const isIOS = !!systemInfo.system.match(/ios/i)
|
|
137
136
|
const isAndroid = !!systemInfo.system.match(/android/i)
|
|
138
137
|
if (!systemInfo.statusBarHeight) {
|
|
139
138
|
systemInfo.statusBarHeight = screenHeight - windowHeight - 20
|
|
140
139
|
systemInfo.navBarExtendHeight = 0
|
|
141
140
|
} else {
|
|
142
141
|
if (isIOS) {
|
|
143
142
|
systemInfo.navBarExtendHeight = 4
|
|
144
143
|
} else {
|
|
145
144
|
systemInfo.navBarExtendHeight = 0
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
147
|
let rect = Taro.getMenuButtonBoundingClientRect
|
|
149
148
|
? Taro.getMenuButtonBoundingClientRect()
|
|
150
149
|
: null
|
|
151
150
|
if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
|
|
152
151
|
let gap = 0
|
|
153
152
|
let width = 96
|
|
154
153
|
if (systemInfo.platform === 'android') {
|
|
155
154
|
gap = 8
|
|
156
155
|
width = 96
|
|
157
156
|
} else if (systemInfo.platform === 'devtools') {
|
|
158
157
|
if (isIOS) {
|
|
159
158
|
gap = 5.5
|
|
160
159
|
} else {
|
|
161
160
|
gap = 7.5
|
|
162
161
|
}
|
|
163
162
|
} else {
|
|
164
163
|
gap = 4
|
|
165
164
|
width = 88
|
|
166
165
|
}
|
|
167
166
|
rect = {
|
|
168
167
|
bottom: systemInfo.statusBarHeight + gap + 32,
|
|
169
168
|
height: 32,
|
|
170
169
|
left: systemInfo.windowWidth - width - 10,
|
|
171
170
|
right: systemInfo.windowWidth - 10,
|
|
172
171
|
top: systemInfo.statusBarHeight + gap,
|
|
173
172
|
width,
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
175
|
const gap = rect.top - systemInfo.statusBarHeight
|
|
177
176
|
systemInfo.navBarTopToStatusBar = gap
|
|
178
177
|
systemInfo.navBarHeight = 2 * gap + rect.height
|
|
179
178
|
systemInfo.capsulePosition = rect
|
|
180
179
|
systemInfo.isIOS = isIOS
|
|
181
180
|
systemInfo.isAndroid = isAndroid
|
|
182
181
|
return systemInfo
|
|
183
182
|
if (str.match(/^\/\//)) {
|
|
184
183
|
str = 'https:' + str
|
|
185
184
|
}
|
|
186
185
|
return str
|
|
187
186
|
dateTimeOrdate: Date | string | number | null,
|
|
188
187
|
format = 'yyyy-MM-dd HH:mm:ss',
|
|
189
188
|
noPadStart = {
|
|
190
189
|
M: '0',
|
|
191
190
|
d: '0',
|
|
192
191
|
H: '0',
|
|
193
192
|
m: '0',
|
|
194
193
|
s: '0',
|
|
195
194
|
},
|
|
196
195
|
let dateResult = ''
|
|
197
196
|
const padStarts = Object.assign(
|
|
198
197
|
{
|
|
199
198
|
M: '0',
|
|
200
199
|
d: '0',
|
|
201
200
|
H: '0',
|
|
202
201
|
m: '0',
|
|
203
202
|
s: '0',
|
|
204
203
|
},
|
|
205
204
|
noPadStart,
|
|
206
205
|
)
|
|
207
206
|
if (dateTimeOrdate) {
|
|
208
207
|
let changeDateTimeOrdate = dateTimeOrdate
|
|
209
208
|
const getChangeDateTimeToNumber = Number(changeDateTimeOrdate)
|
|
210
209
|
if (getChangeDateTimeToNumber) {
|
|
211
210
|
changeDateTimeOrdate = getChangeDateTimeToNumber
|
|
212
211
|
} else {
|
|
213
212
|
changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/')
|
|
214
213
|
}
|
|
215
214
|
const nowDate =
|
|
216
215
|
dateTimeOrdate instanceof Date
|
|
217
216
|
? dateTimeOrdate
|
|
218
217
|
: new Date(changeDateTimeOrdate)
|
|
219
218
|
const dateMap = {
|
|
220
219
|
y: `${nowDate.getFullYear()}`,
|
|
221
220
|
M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
|
|
222
221
|
d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
|
|
223
222
|
H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
|
|
224
223
|
m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
|
|
225
224
|
s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
|
|
226
225
|
}
|
|
227
226
|
const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g')
|
|
228
227
|
const regYear = new RegExp('y')
|
|
229
228
|
dateResult = format.replace(regDate, (v) => {
|
|
230
229
|
let changeValue = v
|
|
231
230
|
if (regYear.test(changeValue)) {
|
|
232
231
|
const thisYear = dateMap.y
|
|
233
232
|
const subValueLen = 4 - changeValue.length
|
|
234
233
|
changeValue = thisYear.substr(subValueLen)
|
|
235
234
|
} else {
|
|
236
235
|
const dateKey = v.substr(0, 1)
|
|
237
236
|
changeValue = dateMap[dateKey]
|
|
238
237
|
}
|
|
239
238
|
return changeValue
|
|
240
239
|
})
|
|
241
240
|
}
|
|
242
241
|
return dateResult
|
|
243
242
|
let timer: any = null
|
|
244
243
|
let startTime = Date.now()
|
|
245
244
|
return function () {
|
|
246
245
|
const curTime = Date.now()
|
|
247
246
|
const remaining = delay - (curTime - startTime)
|
|
248
247
|
const context = this
|
|
249
248
|
const args = arguments
|
|
250
249
|
clearTimeout(timer)
|
|
251
250
|
if (remaining <= 0) {
|
|
252
251
|
func.apply(context, args)
|
|
253
252
|
startTime = Date.now()
|
|
254
253
|
} else {
|
|
255
254
|
timer = setTimeout(func, remaining)
|
|
256
255
|
}
|
|
257
256
|
}
|
|
258
257
|
let context, args, result
|
|
259
258
|
let timeout = null
|
|
260
259
|
let previous = 0
|
|
261
260
|
if (!options) options = {}
|
|
262
261
|
const later = function () {
|
|
263
262
|
previous = options.leading === false ? 0 : Date.now()
|
|
264
263
|
timeout = null
|
|
265
264
|
result = func.apply(context, args)
|
|
266
265
|
if (!timeout) context = args = null
|
|
267
266
|
}
|
|
268
267
|
return function () {
|
|
269
268
|
const now = Date.now()
|
|
270
269
|
if (!previous && options.leading === false) previous = now
|
|
271
270
|
const remaining = wait - (now - previous)
|
|
272
271
|
context = this
|
|
273
272
|
args = arguments
|
|
274
273
|
if (remaining <= 0 || remaining > wait) {
|
|
275
274
|
if (timeout) {
|
|
276
275
|
clearTimeout(timeout)
|
|
277
276
|
timeout = null
|
|
278
277
|
}
|
|
279
278
|
previous = now
|
|
280
279
|
result = func.apply(context, args)
|
|
281
280
|
if (!timeout) context = args = null
|
|
282
281
|
} else if (!timeout && options.trailing !== false) {
|
|
283
282
|
timeout = setTimeout(later, remaining)
|
|
284
283
|
}
|
|
285
284
|
return result
|
|
286
285
|
}
|
|
287
286
|
let timer: any = null
|
|
288
287
|
return function () {
|
|
289
288
|
const context: any = this
|
|
290
289
|
const args = arguments
|
|
291
290
|
timer && clearTimeout(timer)
|
|
292
291
|
timer = setTimeout(function () {
|
|
293
292
|
fn.apply(context, args)
|
|
294
293
|
}, delay)
|
|
295
294
|
}
|
|
296
295
|
if (txt) {
|
|
297
296
|
txt = txt.trim()
|
|
298
297
|
const reg = new RegExp(/[\d-]+/)
|
|
299
298
|
const res = reg.exec(txt)
|
|
300
299
|
if (res && res.length > 0) {
|
|
301
300
|
let tel = res[0]
|
|
302
301
|
if (tel && delSeparator) {
|
|
303
302
|
tel = tel.replace(/-/g, '')
|
|
304
303
|
}
|
|
305
304
|
return tel
|
|
306
305
|
}
|
|
307
306
|
}
|
|
308
307
|
return ''
|
|
309
308
|
if (rgb) {
|
|
310
309
|
const reg = /^(rgb|RGB)/
|
|
311
310
|
const color = rgb
|
|
312
311
|
if (reg.test(color)) {
|
|
313
312
|
let strHex = '#'
|
|
314
313
|
const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
|
|
315
314
|
for (let i = 0; i < colorArr.length; i++) {
|
|
316
315
|
let hex = Number(colorArr[i]).toString(16)
|
|
317
316
|
if (hex === '0') {
|
|
318
317
|
hex += hex
|
|
319
318
|
}
|
|
320
319
|
strHex += hex
|
|
321
320
|
}
|
|
322
321
|
return strHex
|
|
323
322
|
} else {
|
|
324
323
|
return String(color)
|
|
325
324
|
}
|
|
326
325
|
} else {
|
|
327
326
|
return ''
|
|
328
327
|
}
|
|
329
328
|
if (hex) {
|
|
330
329
|
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
|
|
331
330
|
let color = hex.toLowerCase()
|
|
332
331
|
if (reg.test(color)) {
|
|
333
332
|
if (color.length === 4) {
|
|
334
333
|
let colorNew = '#'
|
|
335
334
|
for (let i = 1; i < 4; i += 1) {
|
|
336
335
|
colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1))
|
|
337
336
|
}
|
|
338
337
|
color = colorNew
|
|
339
338
|
}
|
|
340
339
|
const colorChange: number[] = []
|
|
341
340
|
for (let i = 1; i < 7; i += 2) {
|
|
342
341
|
colorChange.push(parseInt('0x' + color.slice(i, i + 2)))
|
|
343
342
|
}
|
|
344
343
|
if (returnList) {
|
|
345
344
|
return colorChange
|
|
346
345
|
} else {
|
|
347
346
|
return 'RGB(' + colorChange.join(',') + ')'
|
|
348
347
|
}
|
|
349
348
|
} else {
|
|
350
349
|
return color
|
|
351
350
|
}
|
|
352
351
|
} else {
|
|
353
352
|
return ''
|
|
354
353
|
}
|
|
355
354
|
n: number,
|
|
356
355
|
m: number,
|
|
357
356
|
filterNum: number | undefined = undefined,
|
|
358
357
|
const c = m - n + 1
|
|
359
358
|
const res = Math.floor(Math.random() * c + n)
|
|
360
359
|
if (filterNum && filterNum == res) {
|
|
361
360
|
console.log('随机数二次开始', res, filterNum)
|
|
362
361
|
return getRandom(n, m, filterNum)
|
|
363
362
|
} else {
|
|
364
363
|
return res
|
|
365
364
|
}
|
|
366
365
|
wqCookieStr: string
|
|
367
366
|
wqCookie: {
|
|
368
367
|
pin?: string
|
|
369
368
|
visitkey?: string
|
|
370
369
|
[key: string]: any
|
|
371
370
|
}
|
|
372
371
|
const {
|
|
373
372
|
jdpin,
|
|
374
373
|
pinStatus,
|
|
375
374
|
visitkey,
|
|
376
375
|
unionid,
|
|
377
376
|
skey,
|
|
378
377
|
__jda,
|
|
379
378
|
__jdv,
|
|
380
379
|
__wga,
|
|
381
380
|
wxapp_type,
|
|
382
381
|
appType
|
|
383
382
|
} = cookie
|
|
384
383
|
const ret: string[] = []
|
|
385
384
|
const getUserCookieObj = {}
|
|
386
385
|
const createUseCookieArr = [
|
|
387
386
|
jdpin,
|
|
388
387
|
pinStatus,
|
|
389
388
|
visitkey,
|
|
390
389
|
unionid,
|
|
391
390
|
skey,
|
|
392
391
|
__jda,
|
|
393
392
|
__jdv,
|
|
394
393
|
__wga,
|
|
395
394
|
wid,
|
|
396
395
|
wq_skey,
|
|
397
396
|
wq_uin,
|
|
398
397
|
wq_auth_token,
|
|
399
398
|
wxapp_scene,
|
|
400
399
|
wq_unionid,
|
|
401
400
|
wxapp_openid,
|
|
402
401
|
wxapp_version,
|
|
403
402
|
wxapp_type,
|
|
404
403
|
appType
|
|
405
404
|
name = name === 'jdpin' ? 'pin' : name;
|
|
406
405
|
name === 'pin' && (ret.push(`pt_pin=${encodeURIComponent(value)}`))
|
|
407
406
|
ret.push(`${name}=${encodeURIComponent(value)}`)
|
|
408
407
|
getUserCookieObj[name] = value
|
|
409
408
|
}
|
|
410
409
|
})
|
|
411
410
|
return {
|
|
412
411
|
wqCookieStr: ret.join(';'),
|
|
413
412
|
wqCookie: getUserCookieObj,
|
|
414
413
|
}
|
|
415
414
|
num,
|
|
416
415
|
widthSize = 375,
|
|
417
416
|
layoutWidth = windowWidth,
|
|
418
417
|
const getNum = Number(num)
|
|
419
418
|
return Math.round((getNum / widthSize) * layoutWidth)
|
|
420
419
|
let checkState = false
|
|
421
420
|
const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag
|
|
422
421
|
if (couponFloorModuleType === FloorModuleType.COUPON) {
|
|
423
422
|
try {
|
|
424
423
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
425
424
|
const couponDataDefine = dataDefines
|
|
426
425
|
? dataDefines.filter((item) => {
|
|
427
426
|
return item.type === 'coupon'
|
|
428
427
|
})
|
|
429
428
|
: [],
|
|
430
429
|
couponList = couponDataDefine[0]?.nodeText?.data
|
|
431
430
|
? couponDataDefine[0]?.nodeText?.data
|
|
432
431
|
: [],
|
|
433
432
|
couponLength = couponList.length,
|
|
434
433
|
numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
435
434
|
? couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
436
435
|
: 0
|
|
437
436
|
if (numShowPerLine === 0 && couponLength > 3) {
|
|
438
437
|
checkState = true
|
|
439
438
|
}
|
|
440
439
|
} catch (e) {
|
|
441
440
|
checkState = false
|
|
442
441
|
}
|
|
443
442
|
return checkState
|
|
444
443
|
}
|
|
445
444
|
exceptionReportFn
|
|
446
445
|
if(getFloorData?.floorExtInfo?.floorLoadWay === 2){
|
|
447
446
|
const getSysFloorToLoadTypeRes = isIsvFloorUseable(getFloorData, exceptionReportFn)
|
|
448
447
|
!getSysFloorToLoadTypeRes && (getFloorData.floorExtInfo.floorLoadWay = 1)
|
|
449
448
|
}
|
|
450
449
|
if(isProd && isWxMinAndWxapp){
|
|
451
450
|
shopContentContainerListData = shopContentContainerListData.filter(
|
|
452
451
|
(item) =>
|
|
453
452
|
item.floors.length > 0 &&
|
|
454
453
|
!isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData)
|
|
455
454
|
)
|
|
456
455
|
}
|
|
457
456
|
shopContentContainerListData = [].concat(shopContentContainerListData)
|
|
458
457
|
return {
|
|
459
458
|
shopContentContainerListData,
|
|
460
459
|
shopContentFloorListData,
|
|
461
460
|
}
|
|
462
461
|
const changeOpts = {
|
|
463
462
|
title: '',
|
|
464
463
|
icon: 'success',
|
|
465
464
|
duration: 1500,
|
|
466
465
|
mask: true,
|
|
467
466
|
...options,
|
|
468
467
|
}
|
|
469
468
|
if (changeOpts.title.length > 7) {
|
|
470
469
|
showNormalToast(options)
|
|
471
470
|
} else {
|
|
472
471
|
Taro.showToast(changeOpts as any)
|
|
473
472
|
}
|
|
474
473
|
const changeOpts = {
|
|
475
474
|
title: '',
|
|
476
475
|
icon: 'error',
|
|
477
476
|
duration: 1500,
|
|
478
477
|
mask: true,
|
|
479
478
|
...options,
|
|
480
479
|
}
|
|
481
480
|
if (changeOpts.title.length > 7) {
|
|
482
481
|
showNormalToast(options)
|
|
483
482
|
} else {
|
|
484
483
|
Taro.showToast(changeOpts as any)
|
|
485
484
|
}
|
|
486
485
|
Taro.showToast({
|
|
487
486
|
title: '',
|
|
488
487
|
icon: 'none',
|
|
489
488
|
duration: 1500,
|
|
490
489
|
mask: true,
|
|
491
490
|
...options,
|
|
492
491
|
})
|
|
493
492
|
return Taro.showLoading({
|
|
494
493
|
title: text,
|
|
495
494
|
})
|
|
496
495
|
return new Promise(() => {
|
|
497
496
|
Taro.nextTick(() => {
|
|
498
497
|
setTimeout(() => {
|
|
499
498
|
Taro.hideLoading(options)
|
|
500
499
|
}, 300)
|
|
501
500
|
})
|
|
502
501
|
})
|
|
503
502
|
return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
504
503
|
const {
|
|
505
504
|
tabActive = SECTION_HOME_TAB_NAME_TYPE[
|
|
506
505
|
SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
|
|
507
506
|
],
|
|
508
507
|
sceneId,
|
|
509
508
|
} = query
|
|
510
509
|
let changeTabActive = tabActive
|
|
511
510
|
if (sceneId) {
|
|
512
511
|
if (isH5) {
|
|
513
512
|
if (sceneId == '1002') {
|
|
514
513
|
changeTabActive =
|
|
515
514
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
|
|
516
515
|
}
|
|
517
516
|
else if (sceneId == '1003') {
|
|
518
517
|
changeTabActive =
|
|
519
518
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY]
|
|
520
519
|
}
|
|
521
520
|
} else if (isWxMinAndWxapp) {
|
|
522
521
|
if (sceneId == '1001' || sceneId == '1002') {
|
|
523
522
|
changeTabActive =
|
|
524
523
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
|
|
525
524
|
}
|
|
526
525
|
else if (sceneId == '1003') {
|
|
527
526
|
changeTabActive =
|
|
528
527
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]
|
|
529
528
|
}
|
|
530
529
|
}
|
|
531
530
|
}
|
|
532
531
|
if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
|
|
533
532
|
return {
|
|
534
533
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
535
534
|
tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
|
|
536
535
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
|
|
537
536
|
}
|
|
538
537
|
} else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
|
|
539
538
|
return {
|
|
540
539
|
menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
|
|
541
540
|
tabActiveType: 0,
|
|
542
541
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
|
|
543
542
|
}
|
|
544
543
|
} else {
|
|
545
544
|
return {
|
|
546
545
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
547
546
|
tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
|
|
548
547
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
|
|
549
548
|
}
|
|
550
549
|
}
|
|
551
550
|
const deleteKeyList = [
|
|
552
551
|
'$taroTimestamp',
|
|
553
552
|
'cookie',
|
|
554
553
|
'wdref',
|
|
555
554
|
'navStart',
|
|
556
555
|
'originOpts',
|
|
557
556
|
'originParams',
|
|
558
557
|
'originUrl',
|
|
559
558
|
'referer',
|
|
560
559
|
'stamp',
|
|
561
560
|
]
|
|
562
561
|
let changeQueryData: any = { ...queryData }
|
|
563
562
|
const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false
|
|
564
563
|
const sceneQuery =
|
|
565
564
|
qrCodeScene && typeof qrCodeScene == 'string'
|
|
566
565
|
? parseQueryUrlString(decodeURIComponent(qrCodeScene))
|
|
567
566
|
: {}
|
|
568
567
|
changeQueryData = { ...changeQueryData, ...sceneQuery }
|
|
569
568
|
deleteKeyList.forEach((key) => {
|
|
570
569
|
changeQueryData[key] && delete changeQueryData[key]
|
|
571
570
|
})
|
|
572
571
|
changeQueryData['shopid'] &&
|
|
573
572
|
(changeQueryData['shopId'] = changeQueryData['shopid']) &&
|
|
574
573
|
delete changeQueryData['shopid']
|
|
575
574
|
changeQueryData['venderid'] &&
|
|
576
575
|
(changeQueryData['venderId'] = changeQueryData['venderid']) &&
|
|
577
576
|
delete changeQueryData['venderid']
|
|
578
577
|
changeQueryData['vendorId'] &&
|
|
579
578
|
(changeQueryData['venderId'] = changeQueryData['vendorId']) &&
|
|
580
579
|
delete changeQueryData['vendorId']
|
|
581
580
|
return changeQueryData
|
|
582
581
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
583
582
|
const modularPackResultObj = formatPackResult(modularPackResult)
|
|
584
583
|
const bundleUrl = getBundleUrl(modularPackResultObj)
|
|
585
584
|
const bundleFileName = getBundleFileName(modularPackResultObj)
|
|
586
585
|
if (bundleUrl && bundleFileName) {
|
|
587
586
|
isUsable = true
|
|
588
587
|
}
|
|
589
588
|
const objContainer = containerListData.find(
|
|
590
589
|
(item) => item.containerId === containerId,
|
|
591
590
|
)
|
|
592
591
|
return (
|
|
593
592
|
objContainer?.includeUids?.some((itemUid) => {
|
|
594
593
|
const objectFloor = floorListData.find(
|
|
595
594
|
(floorItem) => itemUid === floorItem.uid,
|
|
596
595
|
)
|
|
597
596
|
return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
|
|
598
597
|
}) ?? false
|
|
599
598
|
)
|
|
600
599
|
floorListData,
|
|
601
600
|
containerListData,
|
|
602
601
|
exceptionReportFn?,
|
|
603
602
|
const unableIsvFloorListData = floorListData.filter(
|
|
604
603
|
(floorItem) =>
|
|
605
604
|
RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
|
|
606
605
|
!isIsvFloorUseable(floorItem, exceptionReportFn),
|
|
607
606
|
)
|
|
608
607
|
const unableIsvFloorUidList = unableIsvFloorListData.map(
|
|
609
608
|
(floorItem) => floorItem.uid,
|
|
610
609
|
)
|
|
611
610
|
const unableIsvContainerListData = containerListData.filter(
|
|
612
611
|
(item) =>
|
|
613
612
|
item.includeUids &&
|
|
614
613
|
item.includeUids.every(
|
|
615
614
|
(itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1,
|
|
616
615
|
),
|
|
617
616
|
)
|
|
618
617
|
return unableIsvContainerListData
|
|
619
618
|
return customObj
|
|
620
619
|
isChartH5,
|
|
621
620
|
isH5AndJdShopViewH5Scroll,
|
|
622
621
|
isMemberPage,
|
|
623
622
|
isPc,
|
|
624
623
|
ipLoc_djd,
|
|
624
|
+
import Taro from '@tarojs/taro'
|
|
625
625
|
SHOP_MENU_ID_TYPE,
|
|
626
626
|
SHOP_MENU_ID_QUERY_NAME,
|
|
627
627
|
SECTION_HOME_TAB_TYPE,
|
|
628
628
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
629
629
|
SECTION_HOME_TAB_QUERY_TYPE,
|
|
630
630
|
CHANNEL_TYPE,
|
|
631
631
|
JDShopViewBusinessPathType,
|
|
632
632
|
FloorModuleType,
|
|
633
633
|
RemoteLoadFloorList,
|
|
634
634
|
getBundleUrl,
|
|
635
635
|
getBundleFileName,
|
|
636
636
|
formatPackResult,
|
|
637
637
|
const resultList: Array<any> = [],
|
|
638
638
|
arrLen = arr.length
|
|
639
639
|
if (arrLen) {
|
|
640
640
|
if (arrLen > size) {
|
|
641
641
|
for (let i = 0; i < arrLen; i = i + size) {
|
|
642
642
|
resultList.push(arr.slice(i, i + size))
|
|
643
643
|
}
|
|
644
644
|
} else {
|
|
645
645
|
resultList.push(arr)
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
648
|
return resultList
|
|
649
649
|
let _address = ids
|
|
650
650
|
const _areaAreaSplit = ids.split('.')
|
|
651
651
|
const _areaAreaSplit2 = ids.split('_')
|
|
652
652
|
_address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address
|
|
653
653
|
_address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address
|
|
654
654
|
return _address
|
|
655
655
|
const getValue = `${obj[key]}`.replace(/undefined/,'').replace(/null/,'')
|
|
656
656
|
paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`
|
|
657
657
|
const result = {}
|
|
658
658
|
if (
|
|
659
659
|
!urlOrQueryStr ||
|
|
660
660
|
('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
|
|
661
661
|
) {
|
|
662
662
|
return result
|
|
663
663
|
}
|
|
664
664
|
if (urlOrQueryStr.indexOf('?') > -1) {
|
|
665
665
|
const queryStr = urlOrQueryStr.split('?')
|
|
666
666
|
const queryItemList =
|
|
667
667
|
queryStr && queryStr.length > 1 ? queryStr[1].split('&') : []
|
|
668
668
|
const queryItemListLen = queryItemList.length
|
|
669
669
|
queryItemListLen > 0 &&
|
|
670
670
|
queryItemList.forEach((item) => {
|
|
671
671
|
const thisItemList = item.split('=')
|
|
672
672
|
result[thisItemList[0]] = thisItemList[1]
|
|
673
673
|
})
|
|
674
674
|
} else {
|
|
675
675
|
const queryItemList =
|
|
676
676
|
urlOrQueryStr.indexOf('&') > -1
|
|
677
677
|
? urlOrQueryStr.split('&')
|
|
678
678
|
: [urlOrQueryStr]
|
|
679
679
|
const queryItemListLen = queryItemList.length
|
|
680
680
|
queryItemListLen > 0 &&
|
|
681
681
|
queryItemList.forEach((item) => {
|
|
682
682
|
const thisItemList = item.split('=')
|
|
683
683
|
result[thisItemList[0]] = thisItemList[1]
|
|
684
684
|
})
|
|
685
685
|
}
|
|
686
686
|
return result
|
|
687
687
|
url: string,
|
|
688
688
|
size?: {
|
|
689
689
|
w: number
|
|
690
690
|
h: number
|
|
691
691
|
},
|
|
692
692
|
quality?: number,
|
|
693
693
|
if (url && size) {
|
|
694
694
|
const _w = Math.floor(size.w)
|
|
695
695
|
const _h = Math.floor(size.h)
|
|
696
696
|
if (url.match(/gif$/i)) {
|
|
697
697
|
return url
|
|
698
698
|
} else {
|
|
699
699
|
if (_w > 0 && _h > 0) {
|
|
700
700
|
url = url.replace('jfs/', `s${_w}x${_h}_jfs/`)
|
|
701
701
|
}
|
|
702
702
|
url += quality != null ? `!q${quality}.dpg` : '.dpg'
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
705
|
return url
|
|
706
706
|
url: string,
|
|
707
707
|
jfsImgInfo: UtilsInterFace.getJfsImageInfo = {},
|
|
708
708
|
if (url.match(/\.(jpg|png|dpg)$/i)) {
|
|
709
709
|
const { width, height, quality } = jfsImgInfo
|
|
710
710
|
if (typeof width === 'number' || typeof height === 'number') {
|
|
711
711
|
url = url.replace(
|
|
712
712
|
'/jfs/',
|
|
713
713
|
`/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`,
|
|
714
714
|
)
|
|
715
715
|
}
|
|
716
716
|
if (
|
|
717
717
|
typeof quality === 'number' &&
|
|
718
718
|
quality > 0 &&
|
|
719
719
|
quality < 100 &&
|
|
720
720
|
url.match(/\.jpg$/i)
|
|
721
721
|
) {
|
|
722
722
|
url += `!q${quality}.dpg`
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
725
|
return addHttps(url)
|
|
726
726
|
!imgUrl.match(
|
|
727
727
|
/(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
|
|
728
728
|
)
|
|
729
729
|
if(!imgUrl.includes('360buyimg.com')){
|
|
730
730
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl
|
|
731
731
|
}
|
|
732
732
|
if(quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`
|
|
733
733
|
count: number,
|
|
734
734
|
fixedNum = 2,
|
|
735
735
|
unit = '万',
|
|
736
736
|
maxNum = 10000,
|
|
737
737
|
count = Number(count)
|
|
738
738
|
if (count > maxNum) {
|
|
739
739
|
return (count / maxNum).toFixed(fixedNum) + unit
|
|
740
740
|
}
|
|
741
741
|
return count
|
|
742
742
|
key: string,
|
|
743
743
|
value: string | object,
|
|
744
744
|
successBack?: any,
|
|
745
745
|
failBack?: any,
|
|
746
746
|
return Taro.setStorage({
|
|
747
747
|
key: key,
|
|
748
748
|
data: value,
|
|
749
749
|
success: successBack,
|
|
750
750
|
fail: failBack,
|
|
751
751
|
})
|
|
752
752
|
return Taro.getStorageSync(key)
|
|
753
753
|
return Taro.removeStorage({
|
|
754
754
|
key: key,
|
|
755
755
|
})
|
|
756
756
|
return Taro.clearStorage()
|
|
757
757
|
if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
|
|
758
758
|
let gap = 0
|
|
759
759
|
let width = 96
|
|
760
760
|
if (systemInfo.platform === 'android') {
|
|
761
761
|
gap = 8
|
|
762
762
|
width = 96
|
|
763
763
|
} else if (systemInfo.platform === 'devtools') {
|
|
764
764
|
if (isIOS) {
|
|
765
765
|
gap = 5.5
|
|
766
766
|
} else {
|
|
767
767
|
gap = 7.5
|
|
768
768
|
}
|
|
769
769
|
} else {
|
|
770
770
|
gap = 4
|
|
771
771
|
width = 88
|
|
772
772
|
}
|
|
773
773
|
rect = {
|
|
774
774
|
bottom: systemInfo.statusBarHeight + gap + 32,
|
|
775
775
|
height: 32,
|
|
776
776
|
left: systemInfo.windowWidth - width - 10,
|
|
777
777
|
right: systemInfo.windowWidth - 10,
|
|
778
778
|
top: systemInfo.statusBarHeight + gap,
|
|
779
779
|
width,
|
|
780
780
|
}
|
|
781
781
|
}
|
|
782
782
|
const gap = rect.top - systemInfo.statusBarHeight
|
|
783
783
|
systemInfo.navBarTopToStatusBar = gap
|
|
784
784
|
systemInfo.navBarHeight = 2 * gap + rect.height
|
|
785
785
|
systemInfo.capsulePosition = rect
|
|
786
786
|
systemInfo.isIOS = isIOS
|
|
787
787
|
systemInfo.isAndroid = isAndroid
|
|
788
788
|
return systemInfo
|
|
789
789
|
if (str.match(/^\/\//)) {
|
|
790
790
|
str = 'https:' + str
|
|
791
791
|
}
|
|
792
792
|
return str
|
|
793
793
|
dateTimeOrdate: Date | string | number | null,
|
|
794
794
|
format = 'yyyy-MM-dd HH:mm:ss',
|
|
795
795
|
noPadStart = {
|
|
796
796
|
M: '0',
|
|
797
797
|
d: '0',
|
|
798
798
|
H: '0',
|
|
799
799
|
m: '0',
|
|
800
800
|
s: '0',
|
|
801
801
|
},
|
|
802
802
|
let dateResult = ''
|
|
803
803
|
const padStarts = Object.assign(
|
|
804
804
|
{
|
|
805
805
|
M: '0',
|
|
806
806
|
d: '0',
|
|
807
807
|
H: '0',
|
|
808
808
|
m: '0',
|
|
809
809
|
s: '0',
|
|
810
810
|
},
|
|
811
811
|
noPadStart,
|
|
812
812
|
)
|
|
813
813
|
if (dateTimeOrdate) {
|
|
814
814
|
let changeDateTimeOrdate = dateTimeOrdate
|
|
815
815
|
const getChangeDateTimeToNumber = Number(changeDateTimeOrdate)
|
|
816
816
|
if (getChangeDateTimeToNumber) {
|
|
817
817
|
changeDateTimeOrdate = getChangeDateTimeToNumber
|
|
818
818
|
} else {
|
|
819
819
|
changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/')
|
|
820
820
|
}
|
|
821
821
|
const nowDate =
|
|
822
822
|
dateTimeOrdate instanceof Date
|
|
823
823
|
? dateTimeOrdate
|
|
824
824
|
: new Date(changeDateTimeOrdate)
|
|
825
825
|
const dateMap = {
|
|
826
826
|
y: `${nowDate.getFullYear()}`,
|
|
827
827
|
M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
|
|
828
828
|
d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
|
|
829
829
|
H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
|
|
830
830
|
m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
|
|
831
831
|
s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
|
|
832
832
|
}
|
|
833
833
|
const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g')
|
|
834
834
|
const regYear = new RegExp('y')
|
|
835
835
|
dateResult = format.replace(regDate, (v) => {
|
|
836
836
|
let changeValue = v
|
|
837
837
|
if (regYear.test(changeValue)) {
|
|
838
838
|
const thisYear = dateMap.y
|
|
839
839
|
const subValueLen = 4 - changeValue.length
|
|
840
840
|
changeValue = thisYear.substr(subValueLen)
|
|
841
841
|
} else {
|
|
842
842
|
const dateKey = v.substr(0, 1)
|
|
843
843
|
changeValue = dateMap[dateKey]
|
|
844
844
|
}
|
|
845
845
|
return changeValue
|
|
846
846
|
})
|
|
847
847
|
}
|
|
848
848
|
return dateResult
|
|
849
849
|
let timer: any = null
|
|
850
850
|
let startTime = Date.now()
|
|
851
851
|
return function () {
|
|
852
852
|
const curTime = Date.now()
|
|
853
853
|
const remaining = delay - (curTime - startTime)
|
|
854
854
|
const context = this
|
|
855
855
|
const args = arguments
|
|
856
856
|
clearTimeout(timer)
|
|
857
857
|
if (remaining <= 0) {
|
|
858
858
|
func.apply(context, args)
|
|
859
859
|
startTime = Date.now()
|
|
860
860
|
} else {
|
|
861
861
|
timer = setTimeout(func, remaining)
|
|
862
862
|
}
|
|
863
863
|
}
|
|
864
864
|
let context, args, result
|
|
865
865
|
let timeout = null
|
|
866
866
|
let previous = 0
|
|
867
867
|
if (!options) options = {}
|
|
868
868
|
const later = function () {
|
|
869
869
|
previous = options.leading === false ? 0 : Date.now()
|
|
870
870
|
timeout = null
|
|
871
871
|
result = func.apply(context, args)
|
|
872
872
|
if (!timeout) context = args = null
|
|
873
873
|
}
|
|
874
874
|
return function () {
|
|
875
875
|
const now = Date.now()
|
|
876
876
|
if (!previous && options.leading === false) previous = now
|
|
877
877
|
const remaining = wait - (now - previous)
|
|
878
878
|
context = this
|
|
879
879
|
args = arguments
|
|
880
880
|
if (remaining <= 0 || remaining > wait) {
|
|
881
881
|
if (timeout) {
|
|
882
882
|
clearTimeout(timeout)
|
|
883
883
|
timeout = null
|
|
884
884
|
}
|
|
885
885
|
previous = now
|
|
886
886
|
result = func.apply(context, args)
|
|
887
887
|
if (!timeout) context = args = null
|
|
888
888
|
} else if (!timeout && options.trailing !== false) {
|
|
889
889
|
timeout = setTimeout(later, remaining)
|
|
890
890
|
}
|
|
891
891
|
return result
|
|
892
892
|
}
|
|
893
893
|
let timer: any = null
|
|
894
894
|
return function () {
|
|
895
895
|
const context: any = this
|
|
896
896
|
const args = arguments
|
|
897
897
|
timer && clearTimeout(timer)
|
|
898
898
|
timer = setTimeout(function () {
|
|
899
899
|
fn.apply(context, args)
|
|
900
900
|
}, delay)
|
|
901
901
|
}
|
|
902
902
|
if (txt) {
|
|
903
903
|
txt = txt.trim()
|
|
904
904
|
const reg = new RegExp(/[\d-]+/)
|
|
905
905
|
const res = reg.exec(txt)
|
|
906
906
|
if (res && res.length > 0) {
|
|
907
907
|
let tel = res[0]
|
|
908
908
|
if (tel && delSeparator) {
|
|
909
909
|
tel = tel.replace(/-/g, '')
|
|
910
910
|
}
|
|
911
911
|
return tel
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
914
|
return ''
|
|
915
915
|
if (rgb) {
|
|
916
916
|
const reg = /^(rgb|RGB)/
|
|
917
917
|
const color = rgb
|
|
918
918
|
if (reg.test(color)) {
|
|
919
919
|
let strHex = '#'
|
|
920
920
|
const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',')
|
|
921
921
|
for (let i = 0; i < colorArr.length; i++) {
|
|
922
922
|
let hex = Number(colorArr[i]).toString(16)
|
|
923
923
|
if (hex === '0') {
|
|
924
924
|
hex += hex
|
|
925
925
|
}
|
|
926
926
|
strHex += hex
|
|
927
927
|
}
|
|
928
928
|
return strHex
|
|
929
929
|
} else {
|
|
930
930
|
return String(color)
|
|
931
931
|
}
|
|
932
932
|
} else {
|
|
933
933
|
return ''
|
|
934
934
|
}
|
|
935
935
|
if (hex) {
|
|
936
936
|
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
|
|
937
937
|
let color = hex.toLowerCase()
|
|
938
938
|
if (reg.test(color)) {
|
|
939
939
|
if (color.length === 4) {
|
|
940
940
|
let colorNew = '#'
|
|
941
941
|
for (let i = 1; i < 4; i += 1) {
|
|
942
942
|
colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1))
|
|
943
943
|
}
|
|
944
944
|
color = colorNew
|
|
945
945
|
}
|
|
946
946
|
const colorChange: number[] = []
|
|
947
947
|
for (let i = 1; i < 7; i += 2) {
|
|
948
948
|
colorChange.push(parseInt('0x' + color.slice(i, i + 2)))
|
|
949
949
|
}
|
|
950
950
|
if (returnList) {
|
|
951
951
|
return colorChange
|
|
952
952
|
} else {
|
|
953
953
|
return 'RGB(' + colorChange.join(',') + ')'
|
|
954
954
|
}
|
|
955
955
|
} else {
|
|
956
956
|
return color
|
|
957
957
|
}
|
|
958
958
|
} else {
|
|
959
959
|
return ''
|
|
960
960
|
}
|
|
961
961
|
n: number,
|
|
962
962
|
m: number,
|
|
963
963
|
filterNum: number | undefined = undefined,
|
|
964
964
|
const c = m - n + 1
|
|
965
965
|
const res = Math.floor(Math.random() * c + n)
|
|
966
966
|
if (filterNum && filterNum == res) {
|
|
967
967
|
console.log('随机数二次开始', res, filterNum)
|
|
968
968
|
return getRandom(n, m, filterNum)
|
|
969
969
|
} else {
|
|
970
970
|
return res
|
|
971
971
|
}
|
|
972
972
|
wqCookieStr: string
|
|
973
973
|
wqCookie: {
|
|
974
974
|
pin?: string
|
|
975
975
|
visitkey?: string
|
|
976
976
|
[key: string]: any
|
|
977
977
|
}
|
|
978
978
|
const {
|
|
979
979
|
jdpin,
|
|
980
980
|
pinStatus,
|
|
981
981
|
visitkey,
|
|
982
982
|
unionid,
|
|
983
983
|
skey,
|
|
984
984
|
__jda,
|
|
985
985
|
__jdv,
|
|
986
986
|
__wga,
|
|
987
987
|
wxapp_type,
|
|
988
988
|
appType
|
|
989
989
|
} = cookie
|
|
990
990
|
const ret: string[] = []
|
|
991
991
|
const getUserCookieObj = {}
|
|
992
992
|
const createUseCookieArr = [
|
|
993
993
|
jdpin,
|
|
994
994
|
pinStatus,
|
|
995
995
|
visitkey,
|
|
996
996
|
unionid,
|
|
997
997
|
skey,
|
|
998
998
|
__jda,
|
|
999
999
|
__jdv,
|
|
1000
1000
|
__wga,
|
|
1001
1001
|
wid,
|
|
1002
1002
|
wq_skey,
|
|
1003
1003
|
wq_uin,
|
|
1004
1004
|
wq_auth_token,
|
|
1005
1005
|
wxapp_scene,
|
|
1006
1006
|
wq_unionid,
|
|
1007
1007
|
wxapp_openid,
|
|
1008
1008
|
wxapp_version,
|
|
1009
1009
|
wxapp_type,
|
|
1010
1010
|
appType
|
|
1011
1011
|
name = name === 'jdpin' ? 'pin' : name;
|
|
1012
1012
|
name === 'pin' && (ret.push(`pt_pin=${encodeURIComponent(value)}`))
|
|
1013
1013
|
ret.push(`${name}=${encodeURIComponent(value)}`)
|
|
1014
1014
|
getUserCookieObj[name] = value
|
|
1015
1015
|
}
|
|
1016
1016
|
})
|
|
1017
1017
|
return {
|
|
1018
1018
|
wqCookieStr: ret.join(';'),
|
|
1019
1019
|
wqCookie: getUserCookieObj,
|
|
1020
1020
|
}
|
|
1021
1021
|
num,
|
|
1022
1022
|
widthSize = 375,
|
|
1023
1023
|
layoutWidth = windowWidth,
|
|
1024
1024
|
const getNum = Number(num)
|
|
1025
1025
|
return Math.round((getNum / widthSize) * layoutWidth)
|
|
1026
1026
|
let checkState = false
|
|
1027
1027
|
const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag
|
|
1028
1028
|
if (couponFloorModuleType === FloorModuleType.COUPON) {
|
|
1029
1029
|
try {
|
|
1030
1030
|
const dataDefines = getFloorDataToDataDefines(floorData)
|
|
1031
1031
|
const couponDataDefine = dataDefines
|
|
1032
1032
|
? dataDefines.filter((item) => {
|
|
1033
1033
|
return item.type === 'coupon'
|
|
1034
1034
|
})
|
|
1035
1035
|
: [],
|
|
1036
1036
|
couponList = couponDataDefine[0]?.nodeText?.data
|
|
1037
1037
|
? couponDataDefine[0]?.nodeText?.data
|
|
1038
1038
|
: [],
|
|
1039
1039
|
couponLength = couponList.length,
|
|
1040
1040
|
numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
1041
1041
|
? couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
1042
1042
|
: 0
|
|
1043
1043
|
if (numShowPerLine === 0 && couponLength > 3) {
|
|
1044
1044
|
checkState = true
|
|
1045
1045
|
}
|
|
1046
1046
|
} catch (e) {
|
|
1047
1047
|
checkState = false
|
|
1048
1048
|
}
|
|
1049
1049
|
return checkState
|
|
1050
1050
|
}
|
|
1051
1051
|
exceptionReportFn
|
|
1052
1052
|
if(getFloorData?.floorExtInfo?.floorLoadWay === 2){
|
|
1053
1053
|
const getSysFloorToLoadTypeRes = isIsvFloorUseable(getFloorData, exceptionReportFn)
|
|
1054
1054
|
!getSysFloorToLoadTypeRes && (getFloorData.floorExtInfo.floorLoadWay = 1)
|
|
1055
1055
|
}
|
|
1056
1056
|
if(isProd && isWxMinAndWxapp){
|
|
1057
1057
|
shopContentContainerListData = shopContentContainerListData.filter(
|
|
1058
1058
|
(item) =>
|
|
1059
1059
|
item.floors.length > 0 &&
|
|
1060
1060
|
!isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData)
|
|
1061
1061
|
)
|
|
1062
1062
|
}
|
|
1063
1063
|
shopContentContainerListData = [].concat(shopContentContainerListData)
|
|
1064
1064
|
return {
|
|
1065
1065
|
shopContentContainerListData,
|
|
1066
1066
|
shopContentFloorListData,
|
|
1067
1067
|
}
|
|
1068
1068
|
const changeOpts = {
|
|
1069
1069
|
title: '',
|
|
1070
1070
|
icon: 'success',
|
|
1071
1071
|
duration: 1500,
|
|
1072
1072
|
mask: true,
|
|
1073
1073
|
...options,
|
|
1074
1074
|
}
|
|
1075
1075
|
if (changeOpts.title.length > 7) {
|
|
1076
1076
|
showNormalToast(options)
|
|
1077
1077
|
} else {
|
|
1078
1078
|
Taro.showToast(changeOpts as any)
|
|
1079
1079
|
}
|
|
1080
1080
|
const changeOpts = {
|
|
1081
1081
|
title: '',
|
|
1082
1082
|
icon: 'error',
|
|
1083
1083
|
duration: 1500,
|
|
1084
1084
|
mask: true,
|
|
1085
1085
|
...options,
|
|
1086
1086
|
}
|
|
1087
1087
|
if (changeOpts.title.length > 7) {
|
|
1088
1088
|
showNormalToast(options)
|
|
1089
1089
|
} else {
|
|
1090
1090
|
Taro.showToast(changeOpts as any)
|
|
1091
1091
|
}
|
|
1092
1092
|
Taro.showToast({
|
|
1093
1093
|
title: '',
|
|
1094
1094
|
icon: 'none',
|
|
1095
1095
|
duration: 1500,
|
|
1096
1096
|
mask: true,
|
|
1097
1097
|
...options,
|
|
1098
1098
|
})
|
|
1099
1099
|
return Taro.showLoading({
|
|
1100
1100
|
title: text,
|
|
1101
1101
|
})
|
|
1102
1102
|
return new Promise(() => {
|
|
1103
1103
|
Taro.nextTick(() => {
|
|
1104
1104
|
setTimeout(() => {
|
|
1105
1105
|
Taro.hideLoading(options)
|
|
1106
1106
|
}, 300)
|
|
1107
1107
|
})
|
|
1108
1108
|
})
|
|
1109
1109
|
return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME]
|
|
1110
1110
|
const {
|
|
1111
1111
|
tabActive = SECTION_HOME_TAB_NAME_TYPE[
|
|
1112
1112
|
SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
|
|
1113
1113
|
],
|
|
1114
1114
|
sceneId,
|
|
1115
1115
|
} = query
|
|
1116
1116
|
let changeTabActive = tabActive
|
|
1117
1117
|
if (sceneId) {
|
|
1118
1118
|
if (isH5) {
|
|
1119
1119
|
if (sceneId == '1002') {
|
|
1120
1120
|
changeTabActive =
|
|
1121
1121
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
|
|
1122
1122
|
}
|
|
1123
1123
|
else if (sceneId == '1003') {
|
|
1124
1124
|
changeTabActive =
|
|
1125
1125
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY]
|
|
1126
1126
|
}
|
|
1127
1127
|
} else if (isWxMinAndWxapp) {
|
|
1128
1128
|
if (sceneId == '1001' || sceneId == '1002') {
|
|
1129
1129
|
changeTabActive =
|
|
1130
1130
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT]
|
|
1131
1131
|
}
|
|
1132
1132
|
else if (sceneId == '1003') {
|
|
1133
1133
|
changeTabActive =
|
|
1134
1134
|
SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]
|
|
1135
1135
|
}
|
|
1136
1136
|
}
|
|
1137
1137
|
}
|
|
1138
1138
|
if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
|
|
1139
1139
|
return {
|
|
1140
1140
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
1141
1141
|
tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
|
|
1142
1142
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
|
|
1143
1143
|
}
|
|
1144
1144
|
} else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
|
|
1145
1145
|
return {
|
|
1146
1146
|
menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
|
|
1147
1147
|
tabActiveType: 0,
|
|
1148
1148
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
|
|
1149
1149
|
}
|
|
1150
1150
|
} else {
|
|
1151
1151
|
return {
|
|
1152
1152
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
1153
1153
|
tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
|
|
1154
1154
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
|
|
1155
1155
|
}
|
|
1156
1156
|
}
|
|
1157
1157
|
const deleteKeyList = [
|
|
1158
1158
|
'$taroTimestamp',
|
|
1159
1159
|
'cookie',
|
|
1160
1160
|
'wdref',
|
|
1161
1161
|
'navStart',
|
|
1162
1162
|
'originOpts',
|
|
1163
1163
|
'originParams',
|
|
1164
1164
|
'originUrl',
|
|
1165
1165
|
'referer',
|
|
1166
1166
|
'stamp',
|
|
1167
1167
|
]
|
|
1168
1168
|
let changeQueryData: any = { ...queryData }
|
|
1169
1169
|
const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false
|
|
1170
1170
|
const sceneQuery =
|
|
1171
1171
|
qrCodeScene && typeof qrCodeScene == 'string'
|
|
1172
1172
|
? parseQueryUrlString(decodeURIComponent(qrCodeScene))
|
|
1173
1173
|
: {}
|
|
1174
1174
|
changeQueryData = { ...changeQueryData, ...sceneQuery }
|
|
1175
1175
|
deleteKeyList.forEach((key) => {
|
|
1176
1176
|
changeQueryData[key] && delete changeQueryData[key]
|
|
1177
1177
|
})
|
|
1178
1178
|
changeQueryData['shopid'] &&
|
|
1179
1179
|
(changeQueryData['shopId'] = changeQueryData['shopid']) &&
|
|
1180
1180
|
delete changeQueryData['shopid']
|
|
1181
1181
|
changeQueryData['venderid'] &&
|
|
1182
1182
|
(changeQueryData['venderId'] = changeQueryData['venderid']) &&
|
|
1183
1183
|
delete changeQueryData['venderid']
|
|
1184
1184
|
changeQueryData['vendorId'] &&
|
|
1185
1185
|
(changeQueryData['venderId'] = changeQueryData['vendorId']) &&
|
|
1186
1186
|
delete changeQueryData['vendorId']
|
|
1187
1187
|
return changeQueryData
|
|
1188
1188
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult
|
|
1189
1189
|
const modularPackResultObj = formatPackResult(modularPackResult)
|
|
1190
1190
|
const bundleUrl = getBundleUrl(modularPackResultObj)
|
|
1191
1191
|
const bundleFileName = getBundleFileName(modularPackResultObj)
|
|
1192
1192
|
if (bundleUrl && bundleFileName) {
|
|
1193
1193
|
isUsable = true
|
|
1194
1194
|
}
|
|
1195
1195
|
const objContainer = containerListData.find(
|
|
1196
1196
|
(item) => item.containerId === containerId,
|
|
1197
1197
|
)
|
|
1198
1198
|
return (
|
|
1199
1199
|
objContainer?.includeUids?.some((itemUid) => {
|
|
1200
1200
|
const objectFloor = floorListData.find(
|
|
1201
1201
|
(floorItem) => itemUid === floorItem.uid,
|
|
1202
1202
|
)
|
|
1203
1203
|
return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag)
|
|
1204
1204
|
}) ?? false
|
|
1205
1205
|
)
|
|
1206
1206
|
floorListData,
|
|
1207
1207
|
containerListData,
|
|
1208
1208
|
exceptionReportFn?,
|
|
1209
1209
|
const unableIsvFloorListData = floorListData.filter(
|
|
1210
1210
|
(floorItem) =>
|
|
1211
1211
|
RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
|
|
1212
1212
|
!isIsvFloorUseable(floorItem, exceptionReportFn),
|
|
1213
1213
|
)
|
|
1214
1214
|
const unableIsvFloorUidList = unableIsvFloorListData.map(
|
|
1215
1215
|
(floorItem) => floorItem.uid,
|
|
1216
1216
|
)
|
|
1217
1217
|
const unableIsvContainerListData = containerListData.filter(
|
|
1218
1218
|
(item) =>
|
|
1219
1219
|
item.includeUids &&
|
|
1220
1220
|
item.includeUids.every(
|
|
1221
1221
|
(itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1,
|
|
1222
1222
|
),
|
|
1223
1223
|
)
|
|
1224
1224
|
return unableIsvContainerListData
|
|
1225
1225
|
return -2
|
|
1226
1226
|
return customObj
|
|
1227
1227
|
if (data && typeof data === 'object') {
|
|
1228
1228
|
let getOpenAppData = { ...data }
|
|
1229
1229
|
try {
|
|
1230
1230
|
const { sourceInfo, designerId, templateId, source } = getOpenAppData
|
|
1231
1231
|
if (designerId && templateId) {
|
|
1232
1232
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
1233
1233
|
sourceInfo: {
|
|
1234
1234
|
entrance: '设计师预览',
|
|
1235
1235
|
},
|
|
1236
1236
|
})
|
|
1237
1237
|
} else if (sourceInfo) {
|
|
1238
1238
|
const { entrance } = sourceInfo
|
|
1239
1239
|
getOpenAppData.sourceInfo.entrance =
|
|
1240
1240
|
entrance && entrance.length > 0 ? entrance : '其他'
|
|
1241
1241
|
} else if (source && !sourceInfo) {
|
|
1242
1242
|
if (typeof source === 'object') {
|
|
1243
1243
|
const { sourceType, entrance, sourceValue, moduleId } = source
|
|
1244
1244
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
1245
1245
|
sourceInfo: {
|
|
1246
1246
|
entrance: sourceType || entrance || '其他',
|
|
1247
1247
|
moduleId: sourceValue || moduleId || '-100',
|
|
1248
1248
|
},
|
|
1249
1249
|
})
|
|
1250
1250
|
} else {
|
|
1251
1251
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
1252
1252
|
sourceInfo: {
|
|
1253
1253
|
entrance: source,
|
|
1254
1254
|
},
|
|
1255
1255
|
})
|
|
1256
1256
|
}
|
|
1257
1257
|
} else {
|
|
1258
1258
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
1259
1259
|
sourceInfo: {
|
|
1260
1260
|
entrance: '其他',
|
|
1261
1261
|
},
|
|
1262
1262
|
})
|
|
1263
1263
|
}
|
|
1264
1264
|
} catch (e) {
|
|
1265
1265
|
console.log(e)
|
|
1266
1266
|
}
|
|
1267
1267
|
return getOpenAppData
|
|
1268
1268
|
}
|
|
1269
1269
|
return data
|
|
1270
1270
|
isChartH5,
|
|
1271
1271
|
isH5AndJdShopViewH5Scroll,
|
|
1272
1272
|
isH5AndJdShopH5CustomScrollView,
|
|
1273
1273
|
isMemberPage,
|
|
1274
1274
|
isPc,
|
|
1275
1275
|
ipLoc_djd,
|
|
1276
1276
|
jdAppVersionCompare,
|
|
1277
1277
|
dealJdOpenAppData
|