@conecli/cone-render 0.10.1-shop3.52 → 0.10.1-shop3.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.ts +1 -1
- package/dist/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/components/base/ExposureSmart/index.h5.tsx +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/interface/jumpEventReport.ts +1 -1
- package/dist/interface/service.ts +1 -1
- package/dist/jumpEventReport/base.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.h5.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.wxapp.ts +1 -1
- package/dist/language/en_US.json +4 -0
- package/dist/language/zh_CN.json +4 -0
- package/dist/language/zh_HK.json +4 -0
- 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
|
SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY,
|
|
8
7
|
CHANNEL_TYPE,
|
|
9
8
|
JDShopViewBusinessPathType,
|
|
10
9
|
FloorModuleType,
|
|
11
10
|
RemoteLoadFloorList,
|
|
12
11
|
FLOOR_KIND,
|
|
13
12
|
getBundleUrl,
|
|
14
13
|
getBundleFileName,
|
|
15
14
|
formatPackResult,
|
|
16
15
|
getTaroVersion,
|
|
17
16
|
/ipad/i.test(system) || (/android/i.test(system) && !/mobi|mini|fennec/i.test(system));
|
|
18
17
|
key: string,
|
|
19
18
|
value: string | object,
|
|
20
19
|
successBack?: any,
|
|
21
20
|
failBack?: any,
|
|
22
21
|
try {
|
|
23
22
|
if (isH5 && window && !window.localStorage) {
|
|
24
23
|
console.log(`setTaroStorage key:${key} window.localStorage不存在:`);
|
|
25
24
|
return Promise.resolve(null);
|
|
26
25
|
}
|
|
27
26
|
return Taro.setStorage({
|
|
28
27
|
key: key,
|
|
29
28
|
data: value,
|
|
30
29
|
success: successBack,
|
|
31
30
|
fail: failBack,
|
|
32
31
|
}).catch((e) => {
|
|
33
32
|
console.log(`setTaroStorage key:${key} 报错:`, e);
|
|
34
33
|
return null;
|
|
35
34
|
});
|
|
36
35
|
} catch (e) {
|
|
37
36
|
console.log(`setTaroStorage key:${key} 报错:`, e);
|
|
38
37
|
return Promise.resolve(null);
|
|
39
38
|
}
|
|
40
39
|
try {
|
|
41
40
|
if (isH5 && window && !window.localStorage) {
|
|
42
41
|
console.log(`getTaroStorageKeyValue key:${key} window.localStorage不存在:`);
|
|
43
42
|
return Promise.resolve(null);
|
|
44
43
|
}
|
|
45
44
|
return Taro.getStorageSync(key);
|
|
46
45
|
} catch (e) {
|
|
47
46
|
console.log(`getTaroStorageKeyValue key:${key} 报错:`, e);
|
|
48
47
|
return null;
|
|
49
48
|
}
|
|
50
49
|
try {
|
|
51
50
|
if (isH5 && window && !window.localStorage) {
|
|
52
51
|
console.log(`removeTaroStorageKey key:${key} window.localStorage不存在:`);
|
|
53
52
|
return Promise.resolve(null);
|
|
54
53
|
}
|
|
55
54
|
return Taro.removeStorage({
|
|
56
55
|
key: key,
|
|
57
56
|
}).catch((e) => {
|
|
58
57
|
console.log(`removeTaroStorageKey key:${key} 报错:`, e);
|
|
59
58
|
});
|
|
60
59
|
} catch (e) {
|
|
61
60
|
console.log(`removeTaroStorageKey key:${key} 报错:`, e);
|
|
62
61
|
}
|
|
63
62
|
try {
|
|
64
63
|
if (isH5 && window && !window.localStorage) {
|
|
65
64
|
console.log(`clearTaroStorageKey window.localStorage不存在`);
|
|
66
65
|
return Promise.resolve(null);
|
|
67
66
|
}
|
|
68
67
|
return Taro.clearStorage().catch((e) => {
|
|
69
68
|
console.log('clearTaroStorageKey报错:', e);
|
|
70
69
|
});
|
|
71
70
|
} catch (e) {
|
|
72
71
|
console.log('clearTaroStorageKey报错:', e);
|
|
73
72
|
}
|
|
74
73
|
let hasChecked = false;
|
|
75
74
|
if (isH5) {
|
|
76
75
|
const avifCache = getTaroStorageKeyValue(KEY_AVIF);
|
|
77
76
|
if (avifCache === null || avifCache === '' || forceUpdate) {
|
|
78
77
|
hasChecked = true;
|
|
79
78
|
const img = new Image();
|
|
80
79
|
img.onload = function () {
|
|
81
80
|
if (img.height > 0 && img.width > 0) {
|
|
82
81
|
setTaroStorage(KEY_AVIF, '1');
|
|
83
82
|
} else {
|
|
84
83
|
setTaroStorage(KEY_AVIF, '0');
|
|
85
84
|
}
|
|
86
85
|
};
|
|
87
86
|
img.onerror = () => {
|
|
88
87
|
setTaroStorage(KEY_AVIF, '0');
|
|
89
88
|
};
|
|
90
89
|
img.src =
|
|
91
90
|
'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=';
|
|
92
91
|
}
|
|
93
92
|
const webpCache = getTaroStorageKeyValue(KEY_WEBP);
|
|
94
93
|
if (webpCache === null || webpCache === '' || forceUpdate) {
|
|
95
94
|
hasChecked = true;
|
|
96
95
|
const img = new Image();
|
|
97
96
|
img.onload = function () {
|
|
98
97
|
if (img.height > 0 && img.width > 0) {
|
|
99
98
|
setTaroStorage(KEY_WEBP, '1');
|
|
100
99
|
} else {
|
|
101
100
|
setTaroStorage(KEY_WEBP, '0');
|
|
102
101
|
}
|
|
103
102
|
};
|
|
104
103
|
img.onerror = () => {
|
|
105
104
|
setTaroStorage(KEY_WEBP, '0');
|
|
106
105
|
};
|
|
107
106
|
img.src =
|
|
108
107
|
'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAUAmJaQAA3AA/vz0AAA=';
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
110
|
return hasChecked;
|
|
112
111
|
const hasChecked = imageFormatSupport(false);
|
|
113
112
|
if (!hasChecked) {
|
|
114
113
|
setTimeout(imageFormatSupport, 5000);
|
|
115
114
|
}
|
|
116
115
|
const resultList: Array<any> = [],
|
|
117
116
|
arrLen = arr.length;
|
|
118
117
|
if (arrLen) {
|
|
119
118
|
if (arrLen > size) {
|
|
120
119
|
for (let i = 0; i < arrLen; i = i + size) {
|
|
121
120
|
resultList.push(arr.slice(i, i + size));
|
|
122
121
|
}
|
|
123
122
|
} else {
|
|
124
123
|
resultList.push(arr);
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
126
|
return resultList;
|
|
128
127
|
let _address = ids;
|
|
129
128
|
const _areaAreaSplit = ids.split('.');
|
|
130
129
|
const _areaAreaSplit2 = ids.split('_');
|
|
131
130
|
_address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address;
|
|
132
131
|
_address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address;
|
|
133
132
|
return _address;
|
|
134
133
|
let paramStr = '';
|
|
135
134
|
obj &&
|
|
136
135
|
Object.keys(obj).forEach((key, index) => {
|
|
137
136
|
const getValue = `${obj[key]}`.replace(/undefined/, '').replace(/null/, '');
|
|
138
137
|
paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`;
|
|
139
138
|
});
|
|
140
139
|
return paramStr;
|
|
141
140
|
const result = {};
|
|
142
141
|
if (
|
|
143
142
|
!urlOrQueryStr ||
|
|
144
143
|
('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
|
|
145
144
|
) {
|
|
146
145
|
return result;
|
|
147
146
|
}
|
|
148
147
|
if(urlOrQueryStr && urlOrQueryStr.indexOf('channelSource=appShop') > -1) {
|
|
149
148
|
result['channelSource'] = 'appShop'
|
|
150
149
|
}
|
|
151
150
|
if (urlOrQueryStr.indexOf('?') > -1) {
|
|
152
151
|
const queryStr = urlOrQueryStr.split('?');
|
|
153
152
|
const queryItemList = queryStr && queryStr.length > 1 ? queryStr[1].split('&') : [];
|
|
154
153
|
const queryItemListLen = queryItemList.length;
|
|
155
154
|
queryItemListLen > 0 &&
|
|
156
155
|
queryItemList.forEach((item) => {
|
|
157
156
|
const thisItemList = item.split('=');
|
|
158
157
|
result[thisItemList[0]] = thisItemList[1];
|
|
159
158
|
});
|
|
160
159
|
} else {
|
|
161
160
|
const queryItemList =
|
|
162
161
|
urlOrQueryStr.indexOf('&') > -1 ? urlOrQueryStr.split('&') : [urlOrQueryStr];
|
|
163
162
|
const queryItemListLen = queryItemList.length;
|
|
164
163
|
queryItemListLen > 0 &&
|
|
165
164
|
queryItemList.forEach((item) => {
|
|
166
165
|
const thisItemList = item.split('=');
|
|
167
166
|
result[thisItemList[0]] = thisItemList[1];
|
|
168
167
|
});
|
|
169
168
|
}
|
|
170
169
|
return result;
|
|
171
170
|
url: string,
|
|
172
171
|
size?: {
|
|
173
172
|
w: number;
|
|
174
173
|
h: number;
|
|
175
174
|
},
|
|
176
175
|
quality?: number,
|
|
177
176
|
if (url && size) {
|
|
178
177
|
const _w = Math.floor(size.w);
|
|
179
178
|
const _h = Math.floor(size.h);
|
|
180
179
|
if (url.match(/gif$/i)) {
|
|
181
180
|
return url;
|
|
182
181
|
} else {
|
|
183
182
|
if (_w > 0 && _h > 0) {
|
|
184
183
|
url = url.replace('jfs/', `s${_w}x${_h}_jfs/`);
|
|
185
184
|
}
|
|
186
185
|
url += quality != null ? `!q${quality}.dpg` : '.dpg';
|
|
187
186
|
}
|
|
188
187
|
}
|
|
189
188
|
return url;
|
|
190
189
|
if (url.match(/\.(jpg|png|dpg)$/i)) {
|
|
191
190
|
const { width, height, quality } = jfsImgInfo;
|
|
192
191
|
if (typeof width === 'number' || typeof height === 'number') {
|
|
193
192
|
url = url.replace('/jfs/', `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`);
|
|
194
193
|
}
|
|
195
194
|
if (typeof quality === 'number' && quality > 0 && quality < 100 && url.match(/\.jpg$/i)) {
|
|
196
195
|
url += `!q${quality}.dpg`;
|
|
197
196
|
}
|
|
198
197
|
}
|
|
199
198
|
return addHttps(url);
|
|
200
199
|
if (imgUrl) {
|
|
201
200
|
if (
|
|
202
201
|
!imgUrl.match(
|
|
203
202
|
/(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
|
|
204
203
|
)
|
|
205
204
|
) {
|
|
206
205
|
if (!imgUrl.includes('360buyimg.com')) {
|
|
207
206
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
|
|
208
207
|
}
|
|
209
208
|
if (quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`;
|
|
210
209
|
}
|
|
211
210
|
imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
|
|
212
211
|
}
|
|
213
212
|
return imgUrl;
|
|
214
213
|
const result = value % step;
|
|
215
214
|
return result === 0 ? value : Math.ceil(value / step) * step;
|
|
216
215
|
const MAX = 3.5;
|
|
217
216
|
return Math.min(window?.devicePixelRatio ?? 2, MAX);
|
|
218
217
|
isSkuImage: boolean;
|
|
219
218
|
size: number;
|
|
220
219
|
imgUrl: string,
|
|
221
220
|
options: QualityOptions,
|
|
222
221
|
isIgnoreOptimizeFromServer: boolean = false,
|
|
223
222
|
if (!imgUrl) {
|
|
224
223
|
console.error('The input parameter imageUrl for the getQualityImage() cannot be empty!');
|
|
225
224
|
return imgUrl;
|
|
226
225
|
}
|
|
227
226
|
if (isIgnoreOptimizeFromServer) {
|
|
228
227
|
imgUrl = imgUrl.replace(/\.(jpe?g|png).*/, '.$1');
|
|
229
228
|
}
|
|
230
229
|
if (!/^((https?):)?\/\//.test(imgUrl)) {
|
|
231
230
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
|
|
232
231
|
}
|
|
233
232
|
const imgServerRegExp = /(img|m)\d{0,2}\.360buyimg\.com\/.*\.(jpe?g|png)/i;
|
|
234
233
|
if (!imgServerRegExp.test(imgUrl)) {
|
|
235
234
|
return imgUrl;
|
|
236
235
|
}
|
|
237
236
|
imgUrl = /^\/\//.test(imgUrl) ? `https:${imgUrl}` : imgUrl;
|
|
238
237
|
const { isSkuImage, size } = options || {};
|
|
239
238
|
const needReduceSize = isSkuImage && size;
|
|
240
239
|
if (needReduceSize) {
|
|
241
240
|
const devicePixelRatio = getDevicePixelRatio();
|
|
242
241
|
const useWidth = getValueByStep(size * devicePixelRatio, 40);
|
|
243
242
|
imgUrl = imgUrl.replace(/\/[^\/]*jfs\//, `/s${useWidth}x${useWidth}_jfs/`);
|
|
244
243
|
}
|
|
245
244
|
const needCompress = !global?.info?.pageInfo?.isVipShop;
|
|
246
245
|
const result = imgUrl.match(/\/\w+\.(jpe?g|png)$/);
|
|
247
246
|
if (needCompress && result) {
|
|
248
247
|
if (getAvifSupport() === '1') {
|
|
249
248
|
imgUrl += '.avif';
|
|
250
249
|
} else if (getWebpSupport() === '1') {
|
|
251
250
|
imgUrl += '.webp';
|
|
252
251
|
} else if (/jpe?g/.test(result[1])) {
|
|
253
252
|
imgUrl += '!q80';
|
|
254
253
|
}
|
|
255
254
|
}
|
|
256
255
|
if (needReduceSize) {
|
|
257
256
|
imgUrl += '!z2';
|
|
258
257
|
}
|
|
259
258
|
return imgUrl;
|
|
260
259
|
if (imgUrl) {
|
|
261
260
|
if (
|
|
262
261
|
!imgUrl.match(
|
|
263
262
|
/(storage\.360buyimg\.com)|(jdcloud-oss\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
|
|
264
263
|
)
|
|
265
264
|
) {
|
|
266
265
|
if (!imgUrl.includes('360buyimg.com')) {
|
|
267
266
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
|
|
268
267
|
}
|
|
269
268
|
if (quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`;
|
|
270
269
|
}
|
|
271
270
|
imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
|
|
272
271
|
}
|
|
273
272
|
return imgUrl;
|
|
274
273
|
return getTaroStorageKeyValue(KEY_AVIF) || '0';
|
|
275
274
|
return getTaroStorageKeyValue(KEY_WEBP) || '0';
|
|
276
275
|
count: number,
|
|
277
276
|
fixedNum = 1,
|
|
278
277
|
unit = '万',
|
|
279
278
|
maxNum = 10000,
|
|
280
279
|
count = Number(count);
|
|
281
280
|
const getMaxNum = count > 100000000 ? 100000000 : maxNum;
|
|
282
281
|
const getUnit = count > 100000000 ? '亿' : unit;
|
|
283
282
|
if (count >= getMaxNum) {
|
|
284
283
|
return (count / getMaxNum).toFixed(fixedNum) + getUnit;
|
|
285
284
|
}
|
|
286
285
|
return count;
|
|
287
286
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
|
|
288
287
|
platform: '',
|
|
289
288
|
model: '',
|
|
290
289
|
system: '',
|
|
291
290
|
};
|
|
292
291
|
const isIOS = !!systemInfo.system.match(/ios/i);
|
|
293
292
|
const isAndroid = !!systemInfo.system.match(/android/i);
|
|
294
293
|
if (!systemInfo.statusBarHeight) {
|
|
295
294
|
systemInfo.statusBarHeight = screenHeight - windowHeight - 20;
|
|
296
295
|
systemInfo.navBarExtendHeight = 0;
|
|
297
296
|
} else {
|
|
298
297
|
if (isIOS) {
|
|
299
298
|
systemInfo.navBarExtendHeight = 4;
|
|
300
299
|
} else {
|
|
301
300
|
systemInfo.navBarExtendHeight = 0;
|
|
302
301
|
}
|
|
303
302
|
}
|
|
304
303
|
let rect = Taro.getMenuButtonBoundingClientRect ? Taro.getMenuButtonBoundingClientRect() : null;
|
|
305
304
|
if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
|
|
306
305
|
let gap = 0;
|
|
307
306
|
let width = 96;
|
|
308
307
|
if (systemInfo.platform === 'android') {
|
|
309
308
|
gap = 8;
|
|
310
309
|
width = 96;
|
|
311
310
|
} else if (systemInfo.platform === 'devtools') {
|
|
312
311
|
if (isIOS) {
|
|
313
312
|
gap = 5.5;
|
|
314
313
|
} else {
|
|
315
314
|
gap = 7.5;
|
|
316
315
|
}
|
|
317
316
|
} else {
|
|
318
317
|
gap = 4;
|
|
319
318
|
width = 88;
|
|
320
319
|
}
|
|
321
320
|
rect = {
|
|
322
321
|
bottom: systemInfo.statusBarHeight + gap + 32,
|
|
323
322
|
height: 32,
|
|
324
323
|
left: systemInfo.windowWidth - width - 10,
|
|
325
324
|
right: systemInfo.windowWidth - 10,
|
|
326
325
|
top: systemInfo.statusBarHeight + gap,
|
|
327
326
|
width,
|
|
328
327
|
};
|
|
329
328
|
}
|
|
330
329
|
const gap = rect.top - systemInfo.statusBarHeight;
|
|
331
330
|
systemInfo.navBarTopToStatusBar = gap;
|
|
332
331
|
systemInfo.navBarHeight = 2 * gap + rect.height;
|
|
333
332
|
systemInfo.capsulePosition = rect;
|
|
334
333
|
systemInfo.isIOS = isIOS;
|
|
335
334
|
systemInfo.isAndroid = isAndroid;
|
|
336
335
|
return systemInfo;
|
|
337
336
|
if (str.match(/^\/\//)) {
|
|
338
337
|
str = 'https:' + str;
|
|
339
338
|
}
|
|
340
339
|
return str;
|
|
341
340
|
dateTimeOrdate: Date | string | number | null,
|
|
342
341
|
format = 'yyyy-MM-dd HH:mm:ss',
|
|
343
342
|
noPadStart = {
|
|
344
343
|
M: '0',
|
|
345
344
|
d: '0',
|
|
346
345
|
H: '0',
|
|
347
346
|
m: '0',
|
|
348
347
|
s: '0',
|
|
349
348
|
},
|
|
350
349
|
let dateResult = '';
|
|
351
350
|
const padStarts = Object.assign(
|
|
352
351
|
{
|
|
353
352
|
M: '0',
|
|
354
353
|
d: '0',
|
|
355
354
|
H: '0',
|
|
356
355
|
m: '0',
|
|
357
356
|
s: '0',
|
|
358
357
|
},
|
|
359
358
|
noPadStart,
|
|
360
359
|
);
|
|
361
360
|
if (dateTimeOrdate) {
|
|
362
361
|
let changeDateTimeOrdate = dateTimeOrdate;
|
|
363
362
|
const getChangeDateTimeToNumber = Number(changeDateTimeOrdate);
|
|
364
363
|
if (getChangeDateTimeToNumber) {
|
|
365
364
|
changeDateTimeOrdate = getChangeDateTimeToNumber;
|
|
366
365
|
} else {
|
|
367
366
|
changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/').replace(/\./g, '/');
|
|
368
367
|
}
|
|
369
368
|
const nowDate =
|
|
370
369
|
dateTimeOrdate instanceof Date ? dateTimeOrdate : new Date(changeDateTimeOrdate);
|
|
371
370
|
const dateMap = {
|
|
372
371
|
y: `${nowDate.getFullYear()}`,
|
|
373
372
|
M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
|
|
374
373
|
d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
|
|
375
374
|
H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
|
|
376
375
|
m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
|
|
377
376
|
s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
|
|
378
377
|
};
|
|
379
378
|
const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g');
|
|
380
379
|
const regYear = new RegExp('y');
|
|
381
380
|
dateResult = format.replace(regDate, (v) => {
|
|
382
381
|
let changeValue = v;
|
|
383
382
|
if (regYear.test(changeValue)) {
|
|
384
383
|
const thisYear = dateMap.y;
|
|
385
384
|
const subValueLen = 4 - changeValue.length;
|
|
386
385
|
changeValue = thisYear.substr(subValueLen);
|
|
387
386
|
} else {
|
|
388
387
|
const dateKey = v.substr(0, 1);
|
|
389
388
|
changeValue = dateMap[dateKey];
|
|
390
389
|
}
|
|
391
390
|
return changeValue;
|
|
392
391
|
});
|
|
393
392
|
}
|
|
394
393
|
return dateResult;
|
|
395
394
|
let timer: any = null;
|
|
396
395
|
let startTime = Date.now();
|
|
397
396
|
return function () {
|
|
398
397
|
const curTime = Date.now();
|
|
399
398
|
const remaining = delay - (curTime - startTime);
|
|
400
399
|
const context = this;
|
|
401
400
|
const args = arguments;
|
|
402
401
|
clearTimeout(timer);
|
|
403
402
|
if (remaining <= 0) {
|
|
404
403
|
func.apply(context, args);
|
|
405
404
|
startTime = Date.now();
|
|
406
405
|
} else {
|
|
407
406
|
timer = setTimeout(func, remaining);
|
|
408
407
|
}
|
|
409
408
|
};
|
|
410
409
|
let context, args, result;
|
|
411
410
|
let timeout = null;
|
|
412
411
|
let previous = 0;
|
|
413
412
|
if (!options) options = {};
|
|
414
413
|
const later = function () {
|
|
415
414
|
previous = options.leading === false ? 0 : Date.now();
|
|
416
415
|
timeout = null;
|
|
417
416
|
result = func.apply(context, args);
|
|
418
417
|
if (!timeout) context = args = null;
|
|
419
418
|
};
|
|
420
419
|
return function () {
|
|
421
420
|
const now = Date.now();
|
|
422
421
|
if (!previous && options.leading === false) previous = now;
|
|
423
422
|
const remaining = wait - (now - previous);
|
|
424
423
|
context = this;
|
|
425
424
|
args = arguments;
|
|
426
425
|
if (remaining <= 0 || remaining > wait) {
|
|
427
426
|
if (timeout) {
|
|
428
427
|
clearTimeout(timeout);
|
|
429
428
|
timeout = null;
|
|
430
429
|
}
|
|
431
430
|
previous = now;
|
|
432
431
|
result = func.apply(context, args);
|
|
433
432
|
if (!timeout) context = args = null;
|
|
434
433
|
} else if (!timeout && options.trailing !== false) {
|
|
435
434
|
timeout = setTimeout(later, remaining);
|
|
436
435
|
}
|
|
437
436
|
return result;
|
|
438
437
|
};
|
|
439
438
|
let timer: any = null;
|
|
440
439
|
return function () {
|
|
441
440
|
const context: any = this;
|
|
442
441
|
const args = arguments;
|
|
443
442
|
timer && clearTimeout(timer);
|
|
444
443
|
timer = setTimeout(function () {
|
|
445
444
|
fn.apply(context, args);
|
|
446
445
|
}, delay);
|
|
447
446
|
};
|
|
448
447
|
if (txt) {
|
|
449
448
|
txt = txt.trim();
|
|
450
449
|
const reg = new RegExp(/[\d-]+/);
|
|
451
450
|
const res = reg.exec(txt);
|
|
452
451
|
if (res && res.length > 0) {
|
|
453
452
|
let tel = res[0];
|
|
454
453
|
if (tel && delSeparator) {
|
|
455
454
|
tel = tel.replace(/-/g, '');
|
|
456
455
|
}
|
|
457
456
|
return tel;
|
|
458
457
|
}
|
|
459
458
|
}
|
|
460
459
|
return '';
|
|
461
460
|
if (rgb) {
|
|
462
461
|
const reg = /^(rgb|RGB)/;
|
|
463
462
|
const color = rgb;
|
|
464
463
|
if (reg.test(color)) {
|
|
465
464
|
let strHex = '#';
|
|
466
465
|
const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
|
|
467
466
|
for (let i = 0; i < colorArr.length; i++) {
|
|
468
467
|
let hex = Number(colorArr[i]).toString(16);
|
|
469
468
|
if (hex === '0') {
|
|
470
469
|
hex += hex;
|
|
471
470
|
}
|
|
472
471
|
strHex += hex;
|
|
473
472
|
}
|
|
474
473
|
return strHex;
|
|
475
474
|
} else {
|
|
476
475
|
return String(color);
|
|
477
476
|
}
|
|
478
477
|
} else {
|
|
479
478
|
return '';
|
|
480
479
|
}
|
|
481
480
|
if (hex) {
|
|
482
481
|
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
483
482
|
let color = hex.toLowerCase();
|
|
484
483
|
if (reg.test(color)) {
|
|
485
484
|
if (color.length === 4) {
|
|
486
485
|
let colorNew = '#';
|
|
487
486
|
for (let i = 1; i < 4; i += 1) {
|
|
488
487
|
colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
|
|
489
488
|
}
|
|
490
489
|
color = colorNew;
|
|
491
490
|
}
|
|
492
491
|
const colorChange: number[] = [];
|
|
493
492
|
for (let i = 1; i < 7; i += 2) {
|
|
494
493
|
colorChange.push(parseInt('0x' + color.slice(i, i + 2)));
|
|
495
494
|
}
|
|
496
495
|
if (returnList) {
|
|
497
496
|
return colorChange;
|
|
498
497
|
} else {
|
|
499
498
|
return 'RGB(' + colorChange.join(',') + ')';
|
|
500
499
|
}
|
|
501
500
|
} else {
|
|
502
501
|
return color;
|
|
503
502
|
}
|
|
504
503
|
} else {
|
|
505
504
|
return '';
|
|
506
505
|
}
|
|
507
506
|
const c = m - n + 1;
|
|
508
507
|
const res = Math.floor(Math.random() * c + n);
|
|
509
508
|
if (filterNum && filterNum == res) {
|
|
510
509
|
console.log('随机数二次开始', res, filterNum);
|
|
511
510
|
return getRandom(n, m, filterNum);
|
|
512
511
|
} else {
|
|
513
512
|
return res;
|
|
514
513
|
}
|
|
515
514
|
wqCookieStr: string;
|
|
516
515
|
wqCookie: {
|
|
517
516
|
pin?: string;
|
|
518
517
|
visitkey?: string;
|
|
519
518
|
[key: string]: any;
|
|
520
519
|
};
|
|
521
520
|
|
|
522
521
|
const {
|
|
523
522
|
jdpin,
|
|
524
523
|
pinStatus,
|
|
525
524
|
visitkey,
|
|
526
525
|
unionid,
|
|
527
526
|
skey,
|
|
528
527
|
__jda,
|
|
529
528
|
__jdv,
|
|
530
529
|
__wga,
|
|
531
530
|
wid,
|
|
532
531
|
wq_skey,
|
|
533
532
|
wq_uin,
|
|
534
533
|
wq_auth_token,
|
|
535
534
|
wxapp_scene,
|
|
536
535
|
wq_unionid,
|
|
537
536
|
wxapp_openid,
|
|
538
537
|
wxapp_version,
|
|
539
538
|
wxapp_type,
|
|
540
539
|
appType,
|
|
541
540
|
lbs_addr,
|
|
542
541
|
} = cookie;
|
|
543
542
|
const ret: string[] = [];
|
|
544
543
|
const getUserCookieObj = {};
|
|
545
544
|
const createUseCookieArr = [
|
|
546
545
|
jdpin,
|
|
547
546
|
pinStatus,
|
|
548
547
|
visitkey,
|
|
549
548
|
unionid,
|
|
550
549
|
skey,
|
|
551
550
|
__jda,
|
|
552
551
|
__jdv,
|
|
553
552
|
__wga,
|
|
554
553
|
wid,
|
|
555
554
|
wq_skey,
|
|
556
555
|
wq_uin,
|
|
557
556
|
wq_auth_token,
|
|
558
557
|
wxapp_scene,
|
|
559
558
|
wq_unionid,
|
|
560
559
|
wxapp_openid,
|
|
561
560
|
wxapp_version,
|
|
562
561
|
wxapp_type,
|
|
563
562
|
appType,
|
|
564
563
|
lbs_addr,
|
|
565
564
|
];
|
|
566
565
|
|
|
567
566
|
createUseCookieArr.forEach((keyItem) => {
|
|
568
567
|
if (keyItem && keyItem['name']) {
|
|
569
568
|
let { name, value } = keyItem;
|
|
570
569
|
name = name === 'jdpin' ? 'pin' : name;
|
|
571
570
|
name === 'pin' && ret.push(`pt_pin=${encodeURIComponent(value)}`);
|
|
572
571
|
ret.push(`${name}=${encodeURIComponent(value)}`);
|
|
573
572
|
getUserCookieObj[name] = value;
|
|
574
573
|
}
|
|
575
574
|
});
|
|
576
575
|
return {
|
|
577
576
|
wqCookieStr: ret.join(';'),
|
|
578
577
|
wqCookie: getUserCookieObj,
|
|
579
578
|
};
|
|
580
579
|
const getLayoutWidth = layoutWidth || global.info?.sysInfo?.windowWidth || windowWidth;
|
|
581
580
|
const getNum = Number(num);
|
|
582
581
|
return Math.round((getNum / widthSize) * getLayoutWidth);
|
|
583
582
|
let checkState = false;
|
|
584
583
|
const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag;
|
|
585
584
|
if (couponFloorModuleType === FloorModuleType.COUPON) {
|
|
586
585
|
try {
|
|
587
586
|
const dataDefines = getFloorDataToDataDefines(floorData);
|
|
588
587
|
const couponDataDefine = dataDefines
|
|
589
588
|
? dataDefines.filter((item) => {
|
|
590
589
|
return item.type === 'coupon';
|
|
591
590
|
})
|
|
592
591
|
: [],
|
|
593
592
|
couponList = couponDataDefine[0]?.nodeText?.data ? couponDataDefine[0]?.nodeText?.data : [],
|
|
594
593
|
couponLength = couponList.length,
|
|
595
594
|
numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
596
595
|
? couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
597
596
|
: 0;
|
|
598
597
|
if (numShowPerLine === 0 && couponLength > 3) {
|
|
599
598
|
checkState = true;
|
|
600
599
|
}
|
|
601
600
|
} catch (e) {
|
|
602
601
|
checkState = false;
|
|
603
602
|
}
|
|
604
603
|
return checkState;
|
|
605
604
|
}
|
|
606
605
|
const {
|
|
607
606
|
containers = [],
|
|
608
607
|
floors = [],
|
|
609
608
|
clearFirstContaierMarginTop = false,
|
|
610
609
|
} = pageData;
|
|
611
610
|
console.log('dealShopContentData:', pageData, 'isvdev:', isvdev);
|
|
612
611
|
const getThisTimeKey = Date.now();
|
|
613
612
|
let shopContentContainerListData = containers?.filter(
|
|
614
613
|
(item) => (!isvdev && item.typeCode !== 'mShopHeader') || isvdev,
|
|
615
614
|
);
|
|
616
615
|
const shopContentFloorListData = floors?.filter(
|
|
617
616
|
({ floorPosition }) =>
|
|
618
617
|
(!isvdev && floorPosition !== 'header' && floorPosition !== 'footer') || isvdev,
|
|
619
618
|
);
|
|
620
619
|
const unableIsvContainerListData = getUnableIsvContainerListData(
|
|
621
620
|
shopContentFloorListData,
|
|
622
621
|
shopContentContainerListData,
|
|
623
622
|
exceptionReportFn,
|
|
624
623
|
);
|
|
625
624
|
shopContentContainerListData.forEach((item, index) => {
|
|
626
625
|
item.key = `${getThisTimeKey + index}`;
|
|
627
626
|
item.floors = [];
|
|
628
627
|
item.includeUids &&
|
|
629
628
|
item.includeUids.forEach((floorUid) => {
|
|
630
629
|
const getFloorData = shopContentFloorListData.find(
|
|
631
630
|
(floorItem) => floorItem.uid === floorUid,
|
|
632
631
|
);
|
|
633
632
|
if (getFloorData) {
|
|
634
633
|
const changeFloorData = {
|
|
635
634
|
containerId: item.containerId,
|
|
636
635
|
containerIndex: index,
|
|
637
636
|
...getFloorData,
|
|
638
637
|
};
|
|
639
638
|
const getCheckMoreCouponState = checkCouponAndChangeContainerSetData(getFloorData);
|
|
640
639
|
if (getCheckMoreCouponState) {
|
|
641
640
|
item.marginLeft && (item.marginLeft = 0);
|
|
642
641
|
item.marginRight && (item.marginRight = 0);
|
|
643
642
|
item.borderRadius && (item.borderRadius = 0);
|
|
644
643
|
}
|
|
645
644
|
if (getFloorData?.floorExtInfo?.floorLoadWay === 2) {
|
|
646
645
|
const getSysFloorToLoadTypeRes = isIsvFloorUseable(getFloorData, exceptionReportFn);
|
|
647
646
|
!getSysFloorToLoadTypeRes && (getFloorData.floorExtInfo.floorLoadWay = 1);
|
|
648
647
|
}
|
|
649
648
|
item.floors.push(changeFloorData);
|
|
650
649
|
}
|
|
651
650
|
});
|
|
652
651
|
if (
|
|
653
652
|
((!isvdev && index === 0) || (isvdev && index === 1)) &&
|
|
654
653
|
item?.containerPosition == 'content' &&
|
|
655
654
|
item?.marginBottom > 0 &&
|
|
656
655
|
!clearFirstContaierMarginTop
|
|
657
656
|
) {
|
|
658
657
|
item.marginTop = item.marginBottom;
|
|
659
658
|
}
|
|
660
659
|
});
|
|
661
660
|
shopContentContainerListData = shopContentContainerListData.filter(
|
|
662
661
|
(item) =>
|
|
663
662
|
item.floors.length > 0 &&
|
|
664
663
|
unableIsvContainerListData.every(
|
|
665
664
|
(containerItem) => containerItem.containerId != item.containerId,
|
|
666
665
|
),
|
|
667
666
|
);
|
|
668
667
|
console.log(
|
|
669
668
|
'dealShopContentData isWxMinAndWxapp:',
|
|
670
669
|
isWxMinAndWxapp,
|
|
671
670
|
'weappJumpToH5:',
|
|
672
671
|
pageData?.homeExtInfo?.weappJumpToH5,
|
|
673
672
|
);
|
|
674
673
|
if (isProd && isWxMinAndWxapp) {
|
|
675
674
|
shopContentContainerListData = shopContentContainerListData.filter(
|
|
676
675
|
(item) =>
|
|
677
676
|
item.floors.length > 0 &&
|
|
678
677
|
!isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData),
|
|
679
678
|
);
|
|
680
679
|
}
|
|
681
680
|
shopContentContainerListData = [].concat(shopContentContainerListData);
|
|
682
681
|
return {
|
|
683
682
|
shopContentContainerListData,
|
|
684
683
|
shopContentFloorListData,
|
|
685
684
|
};
|
|
686
685
|
const changeOpts = {
|
|
687
686
|
title: '',
|
|
688
687
|
icon: 'success',
|
|
689
688
|
duration: 1500,
|
|
690
689
|
mask: true,
|
|
691
690
|
...options,
|
|
692
691
|
};
|
|
693
692
|
if (changeOpts.title.length > 7) {
|
|
694
693
|
showNormalToast(options);
|
|
695
694
|
} else {
|
|
696
695
|
Taro.showToast(changeOpts as any);
|
|
697
696
|
}
|
|
698
697
|
const changeOpts = {
|
|
699
698
|
title: '',
|
|
700
699
|
icon: 'error',
|
|
701
700
|
duration: 1500,
|
|
702
701
|
mask: true,
|
|
703
702
|
...options,
|
|
704
703
|
};
|
|
705
704
|
if (changeOpts.title.length > 7) {
|
|
706
705
|
showNormalToast(options);
|
|
707
706
|
} else {
|
|
708
707
|
Taro.showToast(changeOpts as any);
|
|
709
708
|
}
|
|
710
709
|
Taro.showToast({
|
|
711
710
|
title: '',
|
|
712
711
|
icon: 'none',
|
|
713
712
|
duration: 1500,
|
|
714
713
|
mask: true,
|
|
715
714
|
...options,
|
|
716
715
|
});
|
|
717
716
|
return Taro.showLoading({
|
|
718
717
|
title: text,
|
|
719
718
|
});
|
|
720
719
|
return new Promise(() => {
|
|
721
720
|
Taro.nextTick(() => {
|
|
722
721
|
setTimeout(() => {
|
|
723
722
|
Taro.hideLoading(options);
|
|
724
723
|
}, 300);
|
|
725
724
|
});
|
|
726
725
|
});
|
|
727
726
|
return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME];
|
|
728
727
|
const {
|
|
729
728
|
tabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
|
|
730
729
|
sceneId,
|
|
731
730
|
currentTabType,
|
|
732
731
|
} = query;
|
|
733
732
|
let changeTabActive = tabActive;
|
|
734
733
|
if (sceneId) {
|
|
735
734
|
if (isH5) {
|
|
736
735
|
if (sceneId == '1002') {
|
|
737
736
|
changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
|
|
738
737
|
}
|
|
739
738
|
else if (sceneId == '1003') {
|
|
740
739
|
changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY];
|
|
741
740
|
}
|
|
742
741
|
} else if (isWxMinAndWxapp) {
|
|
743
742
|
if (sceneId == '1001' || sceneId == '1002') {
|
|
744
743
|
changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
|
|
745
744
|
}
|
|
746
745
|
else if (sceneId == '1003') {
|
|
747
746
|
changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION];
|
|
748
747
|
}
|
|
749
748
|
}
|
|
750
749
|
}
|
|
751
750
|
if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
|
|
752
751
|
if (
|
|
753
752
|
!isNaN(currentTabType) &&
|
|
754
753
|
SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY.indexOf(currentTabType) !== -1
|
|
755
754
|
) {
|
|
756
755
|
return {
|
|
757
756
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
758
757
|
tabActiveType: currentTabType,
|
|
759
758
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${currentTabType}`,
|
|
760
759
|
};
|
|
761
760
|
}
|
|
762
761
|
return {
|
|
763
762
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
764
763
|
tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
|
|
765
764
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
|
|
766
765
|
};
|
|
767
766
|
} else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
|
|
768
767
|
return {
|
|
769
768
|
menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
|
|
770
769
|
tabActiveType: 0,
|
|
771
770
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
|
|
772
771
|
};
|
|
773
772
|
} else {
|
|
774
773
|
const defaultMenuType = {
|
|
775
774
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
776
775
|
tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
|
|
777
776
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
|
|
778
777
|
};
|
|
779
778
|
const isCustomTab = tabActive.indexOf(SECTION_HOME_TAB_NAME_TYPE.HOME_CUSTOM) !== -1;
|
|
780
779
|
if (isCustomTab) {
|
|
781
780
|
const customTabType = Number(tabActive.split('-')[2]);
|
|
782
781
|
if (
|
|
783
782
|
!isNaN(customTabType) &&
|
|
784
783
|
SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY.indexOf(customTabType) !== -1
|
|
785
784
|
) {
|
|
786
785
|
return {
|
|
787
786
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
788
787
|
tabActiveType: customTabType,
|
|
789
788
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${customTabType}`,
|
|
790
789
|
};
|
|
791
790
|
} else {
|
|
792
791
|
return defaultMenuType;
|
|
793
792
|
}
|
|
794
793
|
} else {
|
|
795
794
|
if (
|
|
796
795
|
!isNaN(currentTabType) &&
|
|
797
796
|
SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY.indexOf(currentTabType) !== -1
|
|
798
797
|
) {
|
|
799
798
|
return {
|
|
800
799
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
801
800
|
tabActiveType: currentTabType,
|
|
802
801
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${currentTabType}`,
|
|
803
802
|
};
|
|
804
803
|
}
|
|
805
804
|
return defaultMenuType;
|
|
806
805
|
}
|
|
807
806
|
}
|
|
808
807
|
const deleteKeyList = [
|
|
809
808
|
'$taroTimestamp',
|
|
810
809
|
'cookie',
|
|
811
810
|
'wdref',
|
|
812
811
|
'navStart',
|
|
813
812
|
'originOpts',
|
|
814
813
|
'originParams',
|
|
815
814
|
'originUrl',
|
|
816
815
|
'referer',
|
|
817
816
|
'stamp',
|
|
818
817
|
'hybrid',
|
|
819
818
|
'sr',
|
|
820
819
|
'navh',
|
|
821
820
|
'stath',
|
|
822
821
|
];
|
|
823
822
|
let changeQueryData: any = { ...queryData };
|
|
824
823
|
const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false;
|
|
825
824
|
const sceneQuery =
|
|
826
825
|
qrCodeScene && typeof qrCodeScene === 'string'
|
|
827
826
|
? parseQueryUrlString(decodeURIComponent(qrCodeScene))
|
|
828
827
|
: {};
|
|
829
828
|
changeQueryData = { ...changeQueryData, ...sceneQuery };
|
|
830
829
|
deleteKeyList.forEach((key) => {
|
|
831
830
|
changeQueryData[key] && delete changeQueryData[key];
|
|
832
831
|
});
|
|
833
832
|
Object.keys(changeQueryData).forEach((key) => {
|
|
834
833
|
if (changeQueryData[key] && Array.isArray(changeQueryData[key])) {
|
|
835
834
|
changeQueryData[key] = changeQueryData[key][0] || '';
|
|
836
835
|
}
|
|
837
836
|
});
|
|
838
837
|
changeQueryData['shopid'] &&
|
|
839
838
|
(changeQueryData['shopId'] = changeQueryData['shopid']) &&
|
|
840
839
|
delete changeQueryData['shopid'];
|
|
841
840
|
changeQueryData['venderid'] &&
|
|
842
841
|
(changeQueryData['venderId'] = changeQueryData['venderid']) &&
|
|
843
842
|
delete changeQueryData['venderid'];
|
|
844
843
|
changeQueryData['vendorId'] &&
|
|
845
844
|
(changeQueryData['venderId'] = changeQueryData['vendorId']) &&
|
|
846
845
|
delete changeQueryData['vendorId'];
|
|
847
846
|
changeQueryData['shopId'] &&
|
|
848
847
|
changeQueryData['shopId'] === 'undefined' &&
|
|
849
848
|
delete changeQueryData['shopId'];
|
|
850
849
|
changeQueryData['venderId'] &&
|
|
851
850
|
changeQueryData['venderId'] === 'undefined' &&
|
|
852
851
|
delete changeQueryData['venderId'];
|
|
853
852
|
return changeQueryData;
|
|
854
853
|
let isUsable = false;
|
|
855
854
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult;
|
|
856
855
|
const modularPackResultObj = formatPackResult(modularPackResult);
|
|
857
856
|
const bundleUrl = getBundleUrl(modularPackResultObj);
|
|
858
857
|
const bundleFileName = getBundleFileName(modularPackResultObj);
|
|
859
858
|
const taroVersion = getTaroVersion(modularPackResultObj);
|
|
860
859
|
if (bundleUrl && bundleFileName) {
|
|
861
860
|
isUsable = true;
|
|
862
861
|
}
|
|
863
862
|
if (!isUsable && typeof exceptionReportFn === 'function') {
|
|
864
863
|
exceptionReportFn({
|
|
865
864
|
code: `${NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG}${
|
|
866
865
|
floorData?.floorExtInfo?.floorKind === FLOOR_KIND.PDC_SYSTEM_MODULE
|
|
867
866
|
? SgmCustomCode.SYSTEMPDCMODULE_DATA
|
|
868
867
|
: SgmCustomCode.REMOTEMODULE_DATA
|
|
869
868
|
}`,
|
|
870
869
|
msg: {
|
|
871
870
|
msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
|
|
872
871
|
floorIdx: floorData?.floorIdx,
|
|
873
872
|
uid: floorData?.uid,
|
|
874
873
|
shopId: floorData?.floorExtInfo?.shopId,
|
|
875
874
|
moduleId: floorData?.moduleId,
|
|
876
875
|
moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
|
|
877
876
|
floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
|
|
878
877
|
floorKind: floorData?.floorExtInfo?.floorKind,
|
|
879
878
|
middleTemplateId: floorData?.middleTemplateId,
|
|
880
879
|
modularPackResult: {
|
|
881
880
|
bundleUrl,
|
|
882
881
|
taroVersion,
|
|
883
882
|
},
|
|
884
883
|
},
|
|
885
884
|
});
|
|
886
885
|
}
|
|
887
886
|
return isUsable;
|
|
888
887
|
const containerObj = containerList.find((item) => item.containerId === containerId);
|
|
889
888
|
const blacklistModules = ['chatgroup'];
|
|
890
889
|
return blacklistModules.includes(containerObj?.typeCode);
|
|
891
890
|
const objContainer = containerListData.find((item) => item.containerId === containerId);
|
|
892
891
|
return (
|
|
893
892
|
objContainer?.includeUids?.some((itemUid) => {
|
|
894
893
|
const objectFloor = floorListData.find((floorItem) => itemUid === floorItem.uid);
|
|
895
894
|
return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag);
|
|
896
895
|
}) ?? false
|
|
897
896
|
);
|
|
898
897
|
const unableIsvFloorListData = floorListData.filter(
|
|
899
898
|
(floorItem) =>
|
|
900
899
|
RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
|
|
901
900
|
!isIsvFloorUseable(floorItem, exceptionReportFn),
|
|
902
901
|
);
|
|
903
902
|
const unableIsvFloorUidList = unableIsvFloorListData.map((floorItem) => floorItem.uid);
|
|
904
903
|
const unableIsvContainerListData = containerListData.filter(
|
|
905
904
|
(item) =>
|
|
906
905
|
item.includeUids &&
|
|
907
906
|
item.includeUids.every((itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1),
|
|
908
907
|
);
|
|
909
908
|
return unableIsvContainerListData;
|
|
910
909
|
console.log('暂无对应渠道比较', compareVersion, nowVersion);
|
|
911
910
|
return -2;
|
|
912
911
|
return customObj;
|
|
913
912
|
return customObj;
|
|
914
913
|
return customObj;
|
|
915
914
|
return customObj;
|
|
916
915
|
return customObj;
|
|
917
916
|
return customObj;
|
|
918
917
|
return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl);
|
|
919
918
|
let getParams = false;
|
|
920
919
|
if (isOpenJdAppUrl(openAppUrl)) {
|
|
921
920
|
try {
|
|
922
921
|
getParams = openAppUrl.replace(/openApp\.jdMobile:\/\/virtual\?params=/i, '');
|
|
923
922
|
getParams = JSON.parse(String(getParams));
|
|
924
923
|
} catch (e) {
|
|
925
924
|
console.log(e);
|
|
926
925
|
}
|
|
927
926
|
}
|
|
928
927
|
return getParams;
|
|
929
928
|
const getLastParams = Object.assign({}, openParams);
|
|
930
929
|
return `openapp.jdmobile://virtual?params=${JSON.stringify(getLastParams)}`;
|
|
931
930
|
if (val === null || val === '' || typeof val === 'undefined') {
|
|
932
931
|
return true;
|
|
933
932
|
}
|
|
934
933
|
return false;
|
|
935
934
|
const {
|
|
936
935
|
moduleId = 'none',
|
|
937
936
|
entrance = 'none',
|
|
938
937
|
sourceType = 'none',
|
|
939
938
|
sourceValue = 'none',
|
|
940
939
|
} = params;
|
|
941
940
|
if (isIosDevice) {
|
|
942
941
|
return `${moduleId}#${entrance}`;
|
|
943
942
|
} else if (isAndroidDevice) {
|
|
944
943
|
return `${sourceType}#${sourceValue}`;
|
|
945
944
|
}
|
|
946
945
|
return 'none#none';
|
|
947
946
|
if (data && typeof data === 'object') {
|
|
948
947
|
let getOpenAppData = { ...data };
|
|
949
948
|
try {
|
|
950
949
|
const { sourceInfo, designerId, templateId, source } = getOpenAppData;
|
|
951
950
|
if (designerId && templateId) {
|
|
952
951
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
953
952
|
sourceInfo: {
|
|
954
953
|
entrance: '设计师预览',
|
|
955
954
|
},
|
|
956
955
|
});
|
|
957
956
|
} else if (sourceInfo) {
|
|
958
957
|
const { entrance } = sourceInfo;
|
|
959
958
|
getOpenAppData.sourceInfo.entrance = entrance && entrance.length > 0 ? entrance : '其他';
|
|
960
959
|
} else if (source && !sourceInfo) {
|
|
961
960
|
if (typeof source === 'object') {
|
|
962
961
|
const { sourceType, entrance, sourceValue, moduleId } = source;
|
|
963
962
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
964
963
|
sourceInfo: {
|
|
965
964
|
entrance: sourceType || entrance || '其他',
|
|
966
965
|
moduleId: sourceValue || moduleId || '-100',
|
|
967
966
|
},
|
|
968
967
|
});
|
|
969
968
|
if (sourceType === 'shop_from_product_detail' && sourceValue) {
|
|
970
969
|
getOpenAppData.sourceSku = sourceValue;
|
|
971
970
|
}
|
|
972
971
|
} else {
|
|
973
972
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
974
973
|
sourceInfo: {
|
|
975
974
|
entrance: source,
|
|
976
975
|
},
|
|
977
976
|
});
|
|
978
977
|
}
|
|
979
978
|
} else {
|
|
980
979
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
981
980
|
sourceInfo: {
|
|
982
981
|
entrance: '其他',
|
|
983
982
|
},
|
|
984
983
|
});
|
|
985
984
|
}
|
|
986
985
|
} catch (e) {
|
|
987
986
|
console.log(e);
|
|
988
987
|
}
|
|
989
988
|
return getOpenAppData;
|
|
990
989
|
}
|
|
991
990
|
return data;
|
|
992
991
|
return displayObj;
|
|
993
992
|
if (typeof input === 'string') {
|
|
994
993
|
try {
|
|
995
994
|
return JSON.parse(input);
|
|
996
995
|
} catch (e) {
|
|
997
996
|
console.error('JSON解析失败', e);
|
|
998
997
|
return {};
|
|
999
998
|
}
|
|
1000
999
|
}
|
|
1001
1000
|
return input || {};
|
|
1002
1001
|
return false;
|
|
1003
1002
|
const borderStyle: { [key: string]: any } = {};
|
|
1004
1003
|
if (item?.borderRadius) {
|
|
1005
1004
|
let borderTopRadius = 0;
|
|
1006
1005
|
let borderBottomRadius = 0;
|
|
1007
1006
|
if (index === 0) {
|
|
1008
1007
|
borderTopRadius = item.borderRadius;
|
|
1009
1008
|
borderBottomRadius = floorDataLen === 1 || item?.marginBottom !== 0 ? item.borderRadius : 0;
|
|
1010
1009
|
} else if (index === floorDataLen - 1) {
|
|
1011
1010
|
borderTopRadius = floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius;
|
|
1012
1011
|
borderBottomRadius = item.borderRadius;
|
|
1013
1012
|
} else {
|
|
1014
1013
|
borderTopRadius = floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius;
|
|
1015
1014
|
borderBottomRadius = item?.marginBottom === 0 ? 0 : item.borderRadius;
|
|
1016
1015
|
}
|
|
1017
1016
|
borderStyle.borderTopLeftRadius = item?.borderTopLeftRadius
|
|
1018
1017
|
? `${item?.borderTopLeftRadius}px`
|
|
1019
1018
|
: `${borderTopRadius}px`;
|
|
1020
1019
|
borderStyle.borderTopRightRadius = item?.borderTopRightRadius
|
|
1021
1020
|
? `${item?.borderTopRightRadius}px`
|
|
1022
1021
|
: `${borderTopRadius}px`;
|
|
1023
1022
|
borderStyle.borderBottomLeftRadius = `${borderBottomRadius}px`;
|
|
1024
1023
|
borderStyle.borderBottomRightRadius = `${borderBottomRadius}px`;
|
|
1025
1024
|
} else {
|
|
1026
1025
|
borderStyle.borderTopLeftRadius = borderStyle?.borderTopLeftRadius || '0px';
|
|
1027
1026
|
borderStyle.borderTopRightRadius = borderStyle?.borderTopRightRadius || '0px';
|
|
1028
1027
|
borderStyle.borderBottomRightRadius = borderStyle?.borderBottomRightRadius || '0px';
|
|
1029
1028
|
borderStyle.borderBottomLeftRadius = borderStyle?.borderBottomLeftRadius || '0px';
|
|
1030
1029
|
}
|
|
1031
1030
|
return borderStyle;
|
|
1032
1031
|
return customObj;
|
|
1033
1032
|
isJdApp,
|
|
1034
1033
|
isWxApp,
|
|
1035
1034
|
isIosDevice,
|
|
1036
1035
|
isAndroidDevice,
|
|
1037
1036
|
isJdAndIosDevice,
|
|
1038
1037
|
isJdAndAndroidDevice,
|
|
1039
1038
|
isWxMin,
|
|
1040
1039
|
isWxMinAndWxapp,
|
|
1041
1040
|
isJdMin,
|
|
1042
1041
|
isMin,
|
|
1043
1042
|
isJdMinAndHarmony,
|
|
1044
1043
|
isH5,
|
|
1045
1044
|
isH5AndJdShopView,
|
|
1046
1045
|
isImageOptimizeEnable,
|
|
1047
1046
|
isChartH5,
|
|
1048
1047
|
isH5AndJdShopViewNativeScroll,
|
|
1049
1048
|
isH5AndJdShopViewH5Scroll,
|
|
1050
1049
|
isH5AndJdShopH5CustomScrollView,
|
|
1051
1050
|
isWxMiniH5View,
|
|
1052
1051
|
sliceArrToChunkList,
|
|
1053
1052
|
dealAddress,
|
|
1054
1053
|
objectToUrlEncode,
|
|
1055
1054
|
parseQueryUrlString,
|
|
1056
1055
|
setLowSmallPicUrl,
|
|
1057
1056
|
getJfsImage,
|
|
1058
1057
|
getQualityImage,
|
|
1059
1058
|
countStringify,
|
|
1060
1059
|
setTaroStorage,
|
|
1061
1060
|
getTaroStorageKeyValue,
|
|
1062
1061
|
removeTaroStorageKey,
|
|
1063
1062
|
clearTaroStorageKey,
|
|
1064
1063
|
getSystemInfos,
|
|
1065
1064
|
addHttps,
|
|
1066
1065
|
dateFormat,
|
|
1067
1066
|
throttle,
|
|
1068
1067
|
lodashThrottle,
|
|
1069
1068
|
debounce,
|
|
1070
1069
|
getTelephone,
|
|
1071
1070
|
rgbToHex,
|
|
1072
1071
|
hexToRgb,
|
|
1073
1072
|
getRandom,
|
|
1074
1073
|
getWxAppCookieStr,
|
|
1075
1074
|
pxTransformFromData,
|
|
1076
1075
|
dealShopContentData,
|
|
1077
1076
|
showSuccessToast,
|
|
1078
1077
|
showFailToast,
|
|
1079
1078
|
showNormalToast,
|
|
1080
1079
|
showShopLoading,
|
|
1081
1080
|
hideShopLoading,
|
|
1082
1081
|
getAppChannelType,
|
|
1083
1082
|
formatTabActiveMenuType,
|
|
1084
1083
|
filterUrlQueryData,
|
|
1085
1084
|
getAvifSupport,
|
|
1086
1085
|
getWebpSupport,
|
|
1087
1086
|
isMemberPage,
|
|
1088
1087
|
sgmCustomReport,
|
|
1089
1088
|
draCustomReport,
|
|
1090
1089
|
remoteCustomReport,
|
|
1091
1090
|
draInterfaceCustomReport,
|
|
1092
1091
|
draBusinessCustomReport,
|
|
1093
1092
|
draBusinessCustomLogReport,
|
|
1094
1093
|
isOpenJdAppUrl,
|
|
1095
1094
|
jdOpenAppParams,
|
|
1096
1095
|
createJdOpenAppUrl,
|
|
1097
1096
|
dealJdOpenAppData,
|
|
1098
1097
|
isEmpty,
|
|
1099
1098
|
getJdAppReportPageSource,
|
|
1100
1099
|
isAppClassifyPage,
|
|
1101
1100
|
getQualityImageNew,
|
|
1102
1101
|
getQualityImageOld,
|
|
1103
1102
|
isPc,
|
|
1104
1103
|
ipLoc_djd,
|
|
1105
1104
|
jdAppVersionCompare,
|
|
1106
1105
|
dealNativePixelToCssPixel,
|
|
1107
1106
|
isAppStowShop,
|
|
1108
1107
|
isIpadDevice,
|
|
1109
1108
|
getBorderStyle,
|
|
1110
1109
|
isLanguageForEn,
|
|
1111
1110
|
sColor,
|
|
1112
1111
|
draInterfaceDSMCustomReport,
|
|
1113
1112
|
isTabletDevice,
|
|
1114
1113
|
isInHarmonyBlacklistByModuleFlag,
|
|
1114
|
+
import Taro from '@tarojs/taro';
|
|
1115
1115
|
SHOP_MENU_ID_TYPE,
|
|
1116
1116
|
SHOP_MENU_ID_QUERY_NAME,
|
|
1117
1117
|
SECTION_HOME_TAB_TYPE,
|
|
1118
1118
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
1119
1119
|
SECTION_HOME_TAB_QUERY_TYPE,
|
|
1120
1120
|
SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY,
|
|
1121
1121
|
CHANNEL_TYPE,
|
|
1122
1122
|
JDShopViewBusinessPathType,
|
|
1123
1123
|
FloorModuleType,
|
|
1124
1124
|
RemoteLoadFloorList,
|
|
1125
1125
|
FLOOR_KIND,
|
|
1126
1126
|
getBundleUrl,
|
|
1127
1127
|
getBundleFileName,
|
|
1128
1128
|
formatPackResult,
|
|
1129
1129
|
getTaroVersion,
|
|
1130
1130
|
/ipad/i.test(system) || (/android/i.test(system) && !/mobi|mini|fennec/i.test(system));
|
|
1131
1131
|
key: string,
|
|
1132
1132
|
value: string | object,
|
|
1133
1133
|
successBack?: any,
|
|
1134
1134
|
failBack?: any,
|
|
1135
1135
|
try {
|
|
1136
1136
|
if (isH5 && window && !window.localStorage) {
|
|
1137
1137
|
console.log(`setTaroStorage key:${key} window.localStorage不存在:`);
|
|
1138
1138
|
return Promise.resolve(null);
|
|
1139
1139
|
}
|
|
1140
1140
|
return Taro.setStorage({
|
|
1141
1141
|
key: key,
|
|
1142
1142
|
data: value,
|
|
1143
1143
|
success: successBack,
|
|
1144
1144
|
fail: failBack,
|
|
1145
1145
|
}).catch((e) => {
|
|
1146
1146
|
console.log(`setTaroStorage key:${key} 报错:`, e);
|
|
1147
1147
|
return null;
|
|
1148
1148
|
});
|
|
1149
1149
|
} catch (e) {
|
|
1150
1150
|
console.log(`setTaroStorage key:${key} 报错:`, e);
|
|
1151
1151
|
return Promise.resolve(null);
|
|
1152
1152
|
}
|
|
1153
1153
|
try {
|
|
1154
1154
|
if (isH5 && window && !window.localStorage) {
|
|
1155
1155
|
console.log(`getTaroStorageKeyValue key:${key} window.localStorage不存在:`);
|
|
1156
1156
|
return Promise.resolve(null);
|
|
1157
1157
|
}
|
|
1158
1158
|
return Taro.getStorageSync(key);
|
|
1159
1159
|
} catch (e) {
|
|
1160
1160
|
console.log(`getTaroStorageKeyValue key:${key} 报错:`, e);
|
|
1161
1161
|
return null;
|
|
1162
1162
|
}
|
|
1163
1163
|
try {
|
|
1164
1164
|
if (isH5 && window && !window.localStorage) {
|
|
1165
1165
|
console.log(`removeTaroStorageKey key:${key} window.localStorage不存在:`);
|
|
1166
1166
|
return Promise.resolve(null);
|
|
1167
1167
|
}
|
|
1168
1168
|
return Taro.removeStorage({
|
|
1169
1169
|
key: key,
|
|
1170
1170
|
}).catch((e) => {
|
|
1171
1171
|
console.log(`removeTaroStorageKey key:${key} 报错:`, e);
|
|
1172
1172
|
});
|
|
1173
1173
|
} catch (e) {
|
|
1174
1174
|
console.log(`removeTaroStorageKey key:${key} 报错:`, e);
|
|
1175
1175
|
}
|
|
1176
1176
|
try {
|
|
1177
1177
|
if (isH5 && window && !window.localStorage) {
|
|
1178
1178
|
console.log(`clearTaroStorageKey window.localStorage不存在`);
|
|
1179
1179
|
return Promise.resolve(null);
|
|
1180
1180
|
}
|
|
1181
1181
|
return Taro.clearStorage().catch((e) => {
|
|
1182
1182
|
console.log('clearTaroStorageKey报错:', e);
|
|
1183
1183
|
});
|
|
1184
1184
|
} catch (e) {
|
|
1185
1185
|
console.log('clearTaroStorageKey报错:', e);
|
|
1186
1186
|
}
|
|
1187
1187
|
let hasChecked = false;
|
|
1188
1188
|
if (isH5) {
|
|
1189
1189
|
const avifCache = getTaroStorageKeyValue(KEY_AVIF);
|
|
1190
1190
|
if (avifCache === null || avifCache === '' || forceUpdate) {
|
|
1191
1191
|
hasChecked = true;
|
|
1192
1192
|
const img = new Image();
|
|
1193
1193
|
img.onload = function () {
|
|
1194
1194
|
if (img.height > 0 && img.width > 0) {
|
|
1195
1195
|
setTaroStorage(KEY_AVIF, '1');
|
|
1196
1196
|
} else {
|
|
1197
1197
|
setTaroStorage(KEY_AVIF, '0');
|
|
1198
1198
|
}
|
|
1199
1199
|
};
|
|
1200
1200
|
img.onerror = () => {
|
|
1201
1201
|
setTaroStorage(KEY_AVIF, '0');
|
|
1202
1202
|
};
|
|
1203
1203
|
img.src =
|
|
1204
1204
|
'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=';
|
|
1205
1205
|
}
|
|
1206
1206
|
const webpCache = getTaroStorageKeyValue(KEY_WEBP);
|
|
1207
1207
|
if (webpCache === null || webpCache === '' || forceUpdate) {
|
|
1208
1208
|
hasChecked = true;
|
|
1209
1209
|
const img = new Image();
|
|
1210
1210
|
img.onload = function () {
|
|
1211
1211
|
if (img.height > 0 && img.width > 0) {
|
|
1212
1212
|
setTaroStorage(KEY_WEBP, '1');
|
|
1213
1213
|
} else {
|
|
1214
1214
|
setTaroStorage(KEY_WEBP, '0');
|
|
1215
1215
|
}
|
|
1216
1216
|
};
|
|
1217
1217
|
img.onerror = () => {
|
|
1218
1218
|
setTaroStorage(KEY_WEBP, '0');
|
|
1219
1219
|
};
|
|
1220
1220
|
img.src =
|
|
1221
1221
|
'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAUAmJaQAA3AA/vz0AAA=';
|
|
1222
1222
|
}
|
|
1223
1223
|
}
|
|
1224
1224
|
return hasChecked;
|
|
1225
1225
|
const hasChecked = imageFormatSupport(false);
|
|
1226
1226
|
if (!hasChecked) {
|
|
1227
1227
|
setTimeout(imageFormatSupport, 5000);
|
|
1228
1228
|
}
|
|
1229
1229
|
const resultList: Array<any> = [],
|
|
1230
1230
|
arrLen = arr.length;
|
|
1231
1231
|
if (arrLen) {
|
|
1232
1232
|
if (arrLen > size) {
|
|
1233
1233
|
for (let i = 0; i < arrLen; i = i + size) {
|
|
1234
1234
|
resultList.push(arr.slice(i, i + size));
|
|
1235
1235
|
}
|
|
1236
1236
|
} else {
|
|
1237
1237
|
resultList.push(arr);
|
|
1238
1238
|
}
|
|
1239
1239
|
}
|
|
1240
1240
|
return resultList;
|
|
1241
1241
|
let _address = ids;
|
|
1242
1242
|
const _areaAreaSplit = ids.split('.');
|
|
1243
1243
|
const _areaAreaSplit2 = ids.split('_');
|
|
1244
1244
|
_address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address;
|
|
1245
1245
|
_address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address;
|
|
1246
1246
|
return _address;
|
|
1247
1247
|
let paramStr = '';
|
|
1248
1248
|
obj &&
|
|
1249
1249
|
Object.keys(obj).forEach((key, index) => {
|
|
1250
1250
|
const getValue = `${obj[key]}`.replace(/undefined/, '').replace(/null/, '');
|
|
1251
1251
|
paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`;
|
|
1252
1252
|
});
|
|
1253
1253
|
return paramStr;
|
|
1254
1254
|
const result = {};
|
|
1255
1255
|
if (
|
|
1256
1256
|
!urlOrQueryStr ||
|
|
1257
1257
|
('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
|
|
1258
1258
|
) {
|
|
1259
1259
|
return result;
|
|
1260
1260
|
}
|
|
1261
1261
|
if(urlOrQueryStr && urlOrQueryStr.indexOf('channelSource=appShop') > -1) {
|
|
1262
1262
|
result['channelSource'] = 'appShop'
|
|
1263
1263
|
}
|
|
1264
1264
|
if (urlOrQueryStr.indexOf('?') > -1) {
|
|
1265
1265
|
const queryStr = urlOrQueryStr.split('?');
|
|
1266
1266
|
const queryItemList = queryStr && queryStr.length > 1 ? queryStr[1].split('&') : [];
|
|
1267
1267
|
const queryItemListLen = queryItemList.length;
|
|
1268
1268
|
queryItemListLen > 0 &&
|
|
1269
1269
|
queryItemList.forEach((item) => {
|
|
1270
1270
|
const thisItemList = item.split('=');
|
|
1271
1271
|
result[thisItemList[0]] = thisItemList[1];
|
|
1272
1272
|
});
|
|
1273
1273
|
} else {
|
|
1274
1274
|
const queryItemList =
|
|
1275
1275
|
urlOrQueryStr.indexOf('&') > -1 ? urlOrQueryStr.split('&') : [urlOrQueryStr];
|
|
1276
1276
|
const queryItemListLen = queryItemList.length;
|
|
1277
1277
|
queryItemListLen > 0 &&
|
|
1278
1278
|
queryItemList.forEach((item) => {
|
|
1279
1279
|
const thisItemList = item.split('=');
|
|
1280
1280
|
result[thisItemList[0]] = thisItemList[1];
|
|
1281
1281
|
});
|
|
1282
1282
|
}
|
|
1283
1283
|
return result;
|
|
1284
1284
|
url: string,
|
|
1285
1285
|
size?: {
|
|
1286
1286
|
w: number;
|
|
1287
1287
|
h: number;
|
|
1288
1288
|
},
|
|
1289
1289
|
quality?: number,
|
|
1290
1290
|
if (url && size) {
|
|
1291
1291
|
const _w = Math.floor(size.w);
|
|
1292
1292
|
const _h = Math.floor(size.h);
|
|
1293
1293
|
if (url.match(/gif$/i)) {
|
|
1294
1294
|
return url;
|
|
1295
1295
|
} else {
|
|
1296
1296
|
if (_w > 0 && _h > 0) {
|
|
1297
1297
|
url = url.replace('jfs/', `s${_w}x${_h}_jfs/`);
|
|
1298
1298
|
}
|
|
1299
1299
|
url += quality != null ? `!q${quality}.dpg` : '.dpg';
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
1302
1302
|
return url;
|
|
1303
1303
|
if (url.match(/\.(jpg|png|dpg)$/i)) {
|
|
1304
1304
|
const { width, height, quality } = jfsImgInfo;
|
|
1305
1305
|
if (typeof width === 'number' || typeof height === 'number') {
|
|
1306
1306
|
url = url.replace('/jfs/', `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`);
|
|
1307
1307
|
}
|
|
1308
1308
|
if (typeof quality === 'number' && quality > 0 && quality < 100 && url.match(/\.jpg$/i)) {
|
|
1309
1309
|
url += `!q${quality}.dpg`;
|
|
1310
1310
|
}
|
|
1311
1311
|
}
|
|
1312
1312
|
return addHttps(url);
|
|
1313
1313
|
if (imgUrl) {
|
|
1314
1314
|
if (
|
|
1315
1315
|
!imgUrl.match(
|
|
1316
1316
|
/(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
|
|
1317
1317
|
)
|
|
1318
1318
|
) {
|
|
1319
1319
|
if (!imgUrl.includes('360buyimg.com')) {
|
|
1320
1320
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
|
|
1321
1321
|
}
|
|
1322
1322
|
if (quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`;
|
|
1323
1323
|
}
|
|
1324
1324
|
imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
|
|
1325
1325
|
}
|
|
1326
1326
|
return imgUrl;
|
|
1327
1327
|
const result = value % step;
|
|
1328
1328
|
return result === 0 ? value : Math.ceil(value / step) * step;
|
|
1329
1329
|
const MAX = 3.5;
|
|
1330
1330
|
return Math.min(window?.devicePixelRatio ?? 2, MAX);
|
|
1331
1331
|
isSkuImage: boolean;
|
|
1332
1332
|
size: number;
|
|
1333
1333
|
sizeScale: number;
|
|
1334
1334
|
imgUrl: string,
|
|
1335
1335
|
options: QualityOptions,
|
|
1336
1336
|
isIgnoreOptimizeFromServer: boolean = false,
|
|
1337
1337
|
if (!imgUrl) {
|
|
1338
1338
|
console.error('The input parameter imageUrl for the getQualityImage() cannot be empty!');
|
|
1339
1339
|
return imgUrl;
|
|
1340
1340
|
}
|
|
1341
1341
|
if (isIgnoreOptimizeFromServer) {
|
|
1342
1342
|
imgUrl = imgUrl.replace(/\.(jpe?g|png).*/, '.$1');
|
|
1343
1343
|
}
|
|
1344
1344
|
if (!/^((https?):)?\/\//.test(imgUrl)) {
|
|
1345
1345
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
|
|
1346
1346
|
}
|
|
1347
1347
|
const imgServerRegExp = /(img|m)\d{0,2}\.360buyimg\.com\/.*\.(jpe?g|png)/i;
|
|
1348
1348
|
if (!imgServerRegExp.test(imgUrl)) {
|
|
1349
1349
|
return imgUrl;
|
|
1350
1350
|
}
|
|
1351
1351
|
imgUrl = /^\/\//.test(imgUrl) ? `https:${imgUrl}` : imgUrl;
|
|
1352
1352
|
const { isSkuImage, size, sizeScale = 1 } = options || {};
|
|
1353
1353
|
const getSizeScale = Number(sizeScale)
|
|
1354
1354
|
const needReduceSize = isSkuImage && size;
|
|
1355
1355
|
if (needReduceSize) {
|
|
1356
1356
|
const devicePixelRatio = getDevicePixelRatio();
|
|
1357
1357
|
const useWidth = getValueByStep(size * devicePixelRatio, 40);
|
|
1358
1358
|
const useHeight = getSizeScale > 0 && getSizeScale !== 1 ? Math.round(useWidth * Number(sizeScale)) : useWidth;
|
|
1359
1359
|
imgUrl = imgUrl.replace(/\/[^\/]*jfs\//, `/s${useWidth}x${useHeight}_jfs/`);
|
|
1360
1360
|
}
|
|
1361
1361
|
const needCompress = !global?.info?.pageInfo?.isVipShop;
|
|
1362
1362
|
const result = imgUrl.match(/\/\w+\.(jpe?g|png)$/);
|
|
1363
1363
|
if (needCompress && result) {
|
|
1364
1364
|
if (getAvifSupport() === '1') {
|
|
1365
1365
|
imgUrl += '.avif';
|
|
1366
1366
|
} else if (getWebpSupport() === '1') {
|
|
1367
1367
|
imgUrl += '.webp';
|
|
1368
1368
|
} else if (/jpe?g/.test(result[1])) {
|
|
1369
1369
|
imgUrl += '!q80';
|
|
1370
1370
|
}
|
|
1371
1371
|
}
|
|
1372
1372
|
if (needReduceSize) {
|
|
1373
1373
|
imgUrl += '!z2';
|
|
1374
1374
|
}
|
|
1375
1375
|
return imgUrl;
|
|
1376
1376
|
if (imgUrl) {
|
|
1377
1377
|
if (
|
|
1378
1378
|
!imgUrl.match(
|
|
1379
1379
|
/(storage\.360buyimg\.com)|(jdcloud-oss\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
|
|
1380
1380
|
)
|
|
1381
1381
|
) {
|
|
1382
1382
|
if (!imgUrl.includes('360buyimg.com')) {
|
|
1383
1383
|
imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
|
|
1384
1384
|
}
|
|
1385
1385
|
if (quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`;
|
|
1386
1386
|
}
|
|
1387
1387
|
imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
|
|
1388
1388
|
}
|
|
1389
1389
|
return imgUrl;
|
|
1390
1390
|
return getTaroStorageKeyValue(KEY_AVIF) || '0';
|
|
1391
1391
|
return getTaroStorageKeyValue(KEY_WEBP) || '0';
|
|
1392
1392
|
count: number,
|
|
1393
1393
|
fixedNum = 1,
|
|
1394
1394
|
unit = '万',
|
|
1395
1395
|
maxNum = 10000,
|
|
1396
1396
|
count = Number(count);
|
|
1397
1397
|
const getMaxNum = count > 100000000 ? 100000000 : maxNum;
|
|
1398
1398
|
const getUnit = count > 100000000 ? '亿' : unit;
|
|
1399
1399
|
if (count >= getMaxNum) {
|
|
1400
1400
|
return (count / getMaxNum).toFixed(fixedNum) + getUnit;
|
|
1401
1401
|
}
|
|
1402
1402
|
return count;
|
|
1403
1403
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
|
|
1404
1404
|
platform: '',
|
|
1405
1405
|
model: '',
|
|
1406
1406
|
system: '',
|
|
1407
1407
|
};
|
|
1408
1408
|
const isIOS = !!systemInfo.system.match(/ios/i);
|
|
1409
1409
|
const isAndroid = !!systemInfo.system.match(/android/i);
|
|
1410
1410
|
if (!systemInfo.statusBarHeight) {
|
|
1411
1411
|
systemInfo.statusBarHeight = screenHeight - windowHeight - 20;
|
|
1412
1412
|
systemInfo.navBarExtendHeight = 0;
|
|
1413
1413
|
} else {
|
|
1414
1414
|
if (isIOS) {
|
|
1415
1415
|
systemInfo.navBarExtendHeight = 4;
|
|
1416
1416
|
} else {
|
|
1417
1417
|
systemInfo.navBarExtendHeight = 0;
|
|
1418
1418
|
}
|
|
1419
1419
|
}
|
|
1420
1420
|
let rect = Taro.getMenuButtonBoundingClientRect ? Taro.getMenuButtonBoundingClientRect() : null;
|
|
1421
1421
|
if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
|
|
1422
1422
|
let gap = 0;
|
|
1423
1423
|
let width = 96;
|
|
1424
1424
|
if (systemInfo.platform === 'android') {
|
|
1425
1425
|
gap = 8;
|
|
1426
1426
|
width = 96;
|
|
1427
1427
|
} else if (systemInfo.platform === 'devtools') {
|
|
1428
1428
|
if (isIOS) {
|
|
1429
1429
|
gap = 5.5;
|
|
1430
1430
|
} else {
|
|
1431
1431
|
gap = 7.5;
|
|
1432
1432
|
}
|
|
1433
1433
|
} else {
|
|
1434
1434
|
gap = 4;
|
|
1435
1435
|
width = 88;
|
|
1436
1436
|
}
|
|
1437
1437
|
rect = {
|
|
1438
1438
|
bottom: systemInfo.statusBarHeight + gap + 32,
|
|
1439
1439
|
height: 32,
|
|
1440
1440
|
left: systemInfo.windowWidth - width - 10,
|
|
1441
1441
|
right: systemInfo.windowWidth - 10,
|
|
1442
1442
|
top: systemInfo.statusBarHeight + gap,
|
|
1443
1443
|
width,
|
|
1444
1444
|
};
|
|
1445
1445
|
}
|
|
1446
1446
|
const gap = rect.top - systemInfo.statusBarHeight;
|
|
1447
1447
|
systemInfo.navBarTopToStatusBar = gap;
|
|
1448
1448
|
systemInfo.navBarHeight = 2 * gap + rect.height;
|
|
1449
1449
|
systemInfo.capsulePosition = rect;
|
|
1450
1450
|
systemInfo.isIOS = isIOS;
|
|
1451
1451
|
systemInfo.isAndroid = isAndroid;
|
|
1452
1452
|
return systemInfo;
|
|
1453
1453
|
if (str.match(/^\/\//)) {
|
|
1454
1454
|
str = 'https:' + str;
|
|
1455
1455
|
}
|
|
1456
1456
|
return str;
|
|
1457
1457
|
dateTimeOrdate: Date | string | number | null,
|
|
1458
1458
|
format = 'yyyy-MM-dd HH:mm:ss',
|
|
1459
1459
|
noPadStart = {
|
|
1460
1460
|
M: '0',
|
|
1461
1461
|
d: '0',
|
|
1462
1462
|
H: '0',
|
|
1463
1463
|
m: '0',
|
|
1464
1464
|
s: '0',
|
|
1465
1465
|
},
|
|
1466
1466
|
let dateResult = '';
|
|
1467
1467
|
const padStarts = Object.assign(
|
|
1468
1468
|
{
|
|
1469
1469
|
M: '0',
|
|
1470
1470
|
d: '0',
|
|
1471
1471
|
H: '0',
|
|
1472
1472
|
m: '0',
|
|
1473
1473
|
s: '0',
|
|
1474
1474
|
},
|
|
1475
1475
|
noPadStart,
|
|
1476
1476
|
);
|
|
1477
1477
|
if (dateTimeOrdate) {
|
|
1478
1478
|
let changeDateTimeOrdate = dateTimeOrdate;
|
|
1479
1479
|
const getChangeDateTimeToNumber = Number(changeDateTimeOrdate);
|
|
1480
1480
|
if (getChangeDateTimeToNumber) {
|
|
1481
1481
|
changeDateTimeOrdate = getChangeDateTimeToNumber;
|
|
1482
1482
|
} else {
|
|
1483
1483
|
changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/').replace(/\./g, '/');
|
|
1484
1484
|
}
|
|
1485
1485
|
const nowDate =
|
|
1486
1486
|
dateTimeOrdate instanceof Date ? dateTimeOrdate : new Date(changeDateTimeOrdate);
|
|
1487
1487
|
const dateMap = {
|
|
1488
1488
|
y: `${nowDate.getFullYear()}`,
|
|
1489
1489
|
M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
|
|
1490
1490
|
d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
|
|
1491
1491
|
H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
|
|
1492
1492
|
m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
|
|
1493
1493
|
s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
|
|
1494
1494
|
};
|
|
1495
1495
|
const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g');
|
|
1496
1496
|
const regYear = new RegExp('y');
|
|
1497
1497
|
dateResult = format.replace(regDate, (v) => {
|
|
1498
1498
|
let changeValue = v;
|
|
1499
1499
|
if (regYear.test(changeValue)) {
|
|
1500
1500
|
const thisYear = dateMap.y;
|
|
1501
1501
|
const subValueLen = 4 - changeValue.length;
|
|
1502
1502
|
changeValue = thisYear.substr(subValueLen);
|
|
1503
1503
|
} else {
|
|
1504
1504
|
const dateKey = v.substr(0, 1);
|
|
1505
1505
|
changeValue = dateMap[dateKey];
|
|
1506
1506
|
}
|
|
1507
1507
|
return changeValue;
|
|
1508
1508
|
});
|
|
1509
1509
|
}
|
|
1510
1510
|
return dateResult;
|
|
1511
1511
|
let timer: any = null;
|
|
1512
1512
|
let startTime = Date.now();
|
|
1513
1513
|
return function () {
|
|
1514
1514
|
const curTime = Date.now();
|
|
1515
1515
|
const remaining = delay - (curTime - startTime);
|
|
1516
1516
|
const context = this;
|
|
1517
1517
|
const args = arguments;
|
|
1518
1518
|
clearTimeout(timer);
|
|
1519
1519
|
if (remaining <= 0) {
|
|
1520
1520
|
func.apply(context, args);
|
|
1521
1521
|
startTime = Date.now();
|
|
1522
1522
|
} else {
|
|
1523
1523
|
timer = setTimeout(func, remaining);
|
|
1524
1524
|
}
|
|
1525
1525
|
};
|
|
1526
1526
|
let context, args, result;
|
|
1527
1527
|
let timeout = null;
|
|
1528
1528
|
let previous = 0;
|
|
1529
1529
|
if (!options) options = {};
|
|
1530
1530
|
const later = function () {
|
|
1531
1531
|
previous = options.leading === false ? 0 : Date.now();
|
|
1532
1532
|
timeout = null;
|
|
1533
1533
|
result = func.apply(context, args);
|
|
1534
1534
|
if (!timeout) context = args = null;
|
|
1535
1535
|
};
|
|
1536
1536
|
return function () {
|
|
1537
1537
|
const now = Date.now();
|
|
1538
1538
|
if (!previous && options.leading === false) previous = now;
|
|
1539
1539
|
const remaining = wait - (now - previous);
|
|
1540
1540
|
context = this;
|
|
1541
1541
|
args = arguments;
|
|
1542
1542
|
if (remaining <= 0 || remaining > wait) {
|
|
1543
1543
|
if (timeout) {
|
|
1544
1544
|
clearTimeout(timeout);
|
|
1545
1545
|
timeout = null;
|
|
1546
1546
|
}
|
|
1547
1547
|
previous = now;
|
|
1548
1548
|
result = func.apply(context, args);
|
|
1549
1549
|
if (!timeout) context = args = null;
|
|
1550
1550
|
} else if (!timeout && options.trailing !== false) {
|
|
1551
1551
|
timeout = setTimeout(later, remaining);
|
|
1552
1552
|
}
|
|
1553
1553
|
return result;
|
|
1554
1554
|
};
|
|
1555
1555
|
let timer: any = null;
|
|
1556
1556
|
return function () {
|
|
1557
1557
|
const context: any = this;
|
|
1558
1558
|
const args = arguments;
|
|
1559
1559
|
timer && clearTimeout(timer);
|
|
1560
1560
|
timer = setTimeout(function () {
|
|
1561
1561
|
fn.apply(context, args);
|
|
1562
1562
|
}, delay);
|
|
1563
1563
|
};
|
|
1564
1564
|
if (txt) {
|
|
1565
1565
|
txt = txt.trim();
|
|
1566
1566
|
const reg = new RegExp(/[\d-]+/);
|
|
1567
1567
|
const res = reg.exec(txt);
|
|
1568
1568
|
if (res && res.length > 0) {
|
|
1569
1569
|
let tel = res[0];
|
|
1570
1570
|
if (tel && delSeparator) {
|
|
1571
1571
|
tel = tel.replace(/-/g, '');
|
|
1572
1572
|
}
|
|
1573
1573
|
return tel;
|
|
1574
1574
|
}
|
|
1575
1575
|
}
|
|
1576
1576
|
return '';
|
|
1577
1577
|
if (rgb) {
|
|
1578
1578
|
const reg = /^(rgb|RGB)/;
|
|
1579
1579
|
const color = rgb;
|
|
1580
1580
|
if (reg.test(color)) {
|
|
1581
1581
|
let strHex = '#';
|
|
1582
1582
|
const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
|
|
1583
1583
|
for (let i = 0; i < colorArr.length; i++) {
|
|
1584
1584
|
let hex = Number(colorArr[i]).toString(16);
|
|
1585
1585
|
if (hex === '0') {
|
|
1586
1586
|
hex += hex;
|
|
1587
1587
|
}
|
|
1588
1588
|
strHex += hex;
|
|
1589
1589
|
}
|
|
1590
1590
|
return strHex;
|
|
1591
1591
|
} else {
|
|
1592
1592
|
return String(color);
|
|
1593
1593
|
}
|
|
1594
1594
|
} else {
|
|
1595
1595
|
return '';
|
|
1596
1596
|
}
|
|
1597
1597
|
if (hex) {
|
|
1598
1598
|
const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
1599
1599
|
let color = hex.toLowerCase();
|
|
1600
1600
|
if (reg.test(color)) {
|
|
1601
1601
|
if (color.length === 4) {
|
|
1602
1602
|
let colorNew = '#';
|
|
1603
1603
|
for (let i = 1; i < 4; i += 1) {
|
|
1604
1604
|
colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
|
|
1605
1605
|
}
|
|
1606
1606
|
color = colorNew;
|
|
1607
1607
|
}
|
|
1608
1608
|
const colorChange: number[] = [];
|
|
1609
1609
|
for (let i = 1; i < 7; i += 2) {
|
|
1610
1610
|
colorChange.push(parseInt('0x' + color.slice(i, i + 2)));
|
|
1611
1611
|
}
|
|
1612
1612
|
if (returnList) {
|
|
1613
1613
|
return colorChange;
|
|
1614
1614
|
} else {
|
|
1615
1615
|
return 'RGB(' + colorChange.join(',') + ')';
|
|
1616
1616
|
}
|
|
1617
1617
|
} else {
|
|
1618
1618
|
return color;
|
|
1619
1619
|
}
|
|
1620
1620
|
} else {
|
|
1621
1621
|
return '';
|
|
1622
1622
|
}
|
|
1623
1623
|
const c = m - n + 1;
|
|
1624
1624
|
const res = Math.floor(Math.random() * c + n);
|
|
1625
1625
|
if (filterNum && filterNum == res) {
|
|
1626
1626
|
console.log('随机数二次开始', res, filterNum);
|
|
1627
1627
|
return getRandom(n, m, filterNum);
|
|
1628
1628
|
} else {
|
|
1629
1629
|
return res;
|
|
1630
1630
|
}
|
|
1631
1631
|
wqCookieStr: string;
|
|
1632
1632
|
wqCookie: {
|
|
1633
1633
|
pin?: string;
|
|
1634
1634
|
visitkey?: string;
|
|
1635
1635
|
[key: string]: any;
|
|
1636
1636
|
};
|
|
1637
1637
|
|
|
1638
1638
|
const {
|
|
1639
1639
|
jdpin,
|
|
1640
1640
|
pinStatus,
|
|
1641
1641
|
visitkey,
|
|
1642
1642
|
unionid,
|
|
1643
1643
|
skey,
|
|
1644
1644
|
__jda,
|
|
1645
1645
|
__jdv,
|
|
1646
1646
|
__wga,
|
|
1647
1647
|
wid,
|
|
1648
1648
|
wq_skey,
|
|
1649
1649
|
wq_uin,
|
|
1650
1650
|
wq_auth_token,
|
|
1651
1651
|
wxapp_scene,
|
|
1652
1652
|
wq_unionid,
|
|
1653
1653
|
wxapp_openid,
|
|
1654
1654
|
wxapp_version,
|
|
1655
1655
|
wxapp_type,
|
|
1656
1656
|
appType,
|
|
1657
1657
|
lbs_addr,
|
|
1658
1658
|
} = cookie;
|
|
1659
1659
|
const ret: string[] = [];
|
|
1660
1660
|
const getUserCookieObj = {};
|
|
1661
1661
|
const createUseCookieArr = [
|
|
1662
1662
|
jdpin,
|
|
1663
1663
|
pinStatus,
|
|
1664
1664
|
visitkey,
|
|
1665
1665
|
unionid,
|
|
1666
1666
|
skey,
|
|
1667
1667
|
__jda,
|
|
1668
1668
|
__jdv,
|
|
1669
1669
|
__wga,
|
|
1670
1670
|
wid,
|
|
1671
1671
|
wq_skey,
|
|
1672
1672
|
wq_uin,
|
|
1673
1673
|
wq_auth_token,
|
|
1674
1674
|
wxapp_scene,
|
|
1675
1675
|
wq_unionid,
|
|
1676
1676
|
wxapp_openid,
|
|
1677
1677
|
wxapp_version,
|
|
1678
1678
|
wxapp_type,
|
|
1679
1679
|
appType,
|
|
1680
1680
|
lbs_addr,
|
|
1681
1681
|
];
|
|
1682
1682
|
|
|
1683
1683
|
createUseCookieArr.forEach((keyItem) => {
|
|
1684
1684
|
if (keyItem && keyItem['name']) {
|
|
1685
1685
|
let { name, value } = keyItem;
|
|
1686
1686
|
name = name === 'jdpin' ? 'pin' : name;
|
|
1687
1687
|
name === 'pin' && ret.push(`pt_pin=${encodeURIComponent(value)}`);
|
|
1688
1688
|
ret.push(`${name}=${encodeURIComponent(value)}`);
|
|
1689
1689
|
getUserCookieObj[name] = value;
|
|
1690
1690
|
}
|
|
1691
1691
|
});
|
|
1692
1692
|
return {
|
|
1693
1693
|
wqCookieStr: ret.join(';'),
|
|
1694
1694
|
wqCookie: getUserCookieObj,
|
|
1695
1695
|
};
|
|
1696
1696
|
const getLayoutWidth = layoutWidth || global.info?.sysInfo?.windowWidth || windowWidth;
|
|
1697
1697
|
const getNum = Number(num);
|
|
1698
1698
|
return Math.round((getNum / widthSize) * getLayoutWidth);
|
|
1699
1699
|
let checkState = false;
|
|
1700
1700
|
const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag;
|
|
1701
1701
|
if (couponFloorModuleType === FloorModuleType.COUPON) {
|
|
1702
1702
|
try {
|
|
1703
1703
|
const dataDefines = getFloorDataToDataDefines(floorData);
|
|
1704
1704
|
const couponDataDefine = dataDefines
|
|
1705
1705
|
? dataDefines.filter((item) => {
|
|
1706
1706
|
return item.type === 'coupon';
|
|
1707
1707
|
})
|
|
1708
1708
|
: [],
|
|
1709
1709
|
couponList = couponDataDefine[0]?.nodeText?.data ? couponDataDefine[0]?.nodeText?.data : [],
|
|
1710
1710
|
couponLength = couponList.length,
|
|
1711
1711
|
numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
1712
1712
|
? couponDataDefine[0]?.nodeText?.numShowPerLine
|
|
1713
1713
|
: 0;
|
|
1714
1714
|
if (numShowPerLine === 0 && couponLength > 3) {
|
|
1715
1715
|
checkState = true;
|
|
1716
1716
|
}
|
|
1717
1717
|
} catch (e) {
|
|
1718
1718
|
checkState = false;
|
|
1719
1719
|
}
|
|
1720
1720
|
return checkState;
|
|
1721
1721
|
}
|
|
1722
1722
|
const {
|
|
1723
1723
|
containers = [],
|
|
1724
1724
|
floors = [],
|
|
1725
1725
|
clearFirstContaierMarginTop = false,
|
|
1726
1726
|
} = pageData;
|
|
1727
1727
|
console.log('dealShopContentData:', pageData, 'isvdev:', isvdev);
|
|
1728
1728
|
const getThisTimeKey = Date.now();
|
|
1729
1729
|
let shopContentContainerListData = containers?.filter(
|
|
1730
1730
|
(item) => (!isvdev && item.typeCode !== 'mShopHeader') || isvdev,
|
|
1731
1731
|
);
|
|
1732
1732
|
const shopContentFloorListData = floors?.filter(
|
|
1733
1733
|
({ floorPosition }) =>
|
|
1734
1734
|
(!isvdev && floorPosition !== 'header' && floorPosition !== 'footer') || isvdev,
|
|
1735
1735
|
);
|
|
1736
1736
|
const unableIsvContainerListData = getUnableIsvContainerListData(
|
|
1737
1737
|
shopContentFloorListData,
|
|
1738
1738
|
shopContentContainerListData,
|
|
1739
1739
|
exceptionReportFn,
|
|
1740
1740
|
);
|
|
1741
1741
|
shopContentContainerListData.forEach((item, index) => {
|
|
1742
1742
|
item.key = `${getThisTimeKey + index}`;
|
|
1743
1743
|
item.floors = [];
|
|
1744
1744
|
item.includeUids &&
|
|
1745
1745
|
item.includeUids.forEach((floorUid) => {
|
|
1746
1746
|
const getFloorData = shopContentFloorListData.find(
|
|
1747
1747
|
(floorItem) => floorItem.uid === floorUid,
|
|
1748
1748
|
);
|
|
1749
1749
|
if (getFloorData) {
|
|
1750
1750
|
const changeFloorData = {
|
|
1751
1751
|
containerId: item.containerId,
|
|
1752
1752
|
containerIndex: index,
|
|
1753
1753
|
...getFloorData,
|
|
1754
1754
|
};
|
|
1755
1755
|
const getCheckMoreCouponState = checkCouponAndChangeContainerSetData(getFloorData);
|
|
1756
1756
|
if (getCheckMoreCouponState) {
|
|
1757
1757
|
item.marginLeft && (item.marginLeft = 0);
|
|
1758
1758
|
item.marginRight && (item.marginRight = 0);
|
|
1759
1759
|
item.borderRadius && (item.borderRadius = 0);
|
|
1760
1760
|
}
|
|
1761
1761
|
if (getFloorData?.floorExtInfo?.floorLoadWay === 2) {
|
|
1762
1762
|
const getSysFloorToLoadTypeRes = isIsvFloorUseable(getFloorData, exceptionReportFn);
|
|
1763
1763
|
!getSysFloorToLoadTypeRes && (getFloorData.floorExtInfo.floorLoadWay = 1);
|
|
1764
1764
|
}
|
|
1765
1765
|
item.floors.push(changeFloorData);
|
|
1766
1766
|
}
|
|
1767
1767
|
});
|
|
1768
1768
|
if (
|
|
1769
1769
|
((!isvdev && index === 0) || (isvdev && index === 1)) &&
|
|
1770
1770
|
item?.containerPosition == 'content' &&
|
|
1771
1771
|
item?.marginBottom > 0 &&
|
|
1772
1772
|
!clearFirstContaierMarginTop
|
|
1773
1773
|
) {
|
|
1774
1774
|
item.marginTop = item.marginBottom;
|
|
1775
1775
|
}
|
|
1776
1776
|
});
|
|
1777
1777
|
shopContentContainerListData = shopContentContainerListData.filter(
|
|
1778
1778
|
(item) =>
|
|
1779
1779
|
item.floors.length > 0 &&
|
|
1780
1780
|
unableIsvContainerListData.every(
|
|
1781
1781
|
(containerItem) => containerItem.containerId != item.containerId,
|
|
1782
1782
|
),
|
|
1783
1783
|
);
|
|
1784
1784
|
console.log(
|
|
1785
1785
|
'dealShopContentData isWxMinAndWxapp:',
|
|
1786
1786
|
isWxMinAndWxapp,
|
|
1787
1787
|
'weappJumpToH5:',
|
|
1788
1788
|
pageData?.homeExtInfo?.weappJumpToH5,
|
|
1789
1789
|
);
|
|
1790
1790
|
if (isProd && isWxMinAndWxapp) {
|
|
1791
1791
|
shopContentContainerListData = shopContentContainerListData.filter(
|
|
1792
1792
|
(item) =>
|
|
1793
1793
|
item.floors.length > 0 &&
|
|
1794
1794
|
!isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData),
|
|
1795
1795
|
);
|
|
1796
1796
|
}
|
|
1797
1797
|
shopContentContainerListData = [].concat(shopContentContainerListData);
|
|
1798
1798
|
return {
|
|
1799
1799
|
shopContentContainerListData,
|
|
1800
1800
|
shopContentFloorListData,
|
|
1801
1801
|
};
|
|
1802
1802
|
const changeOpts = {
|
|
1803
1803
|
title: '',
|
|
1804
1804
|
icon: 'success',
|
|
1805
1805
|
duration: 1500,
|
|
1806
1806
|
mask: true,
|
|
1807
1807
|
...options,
|
|
1808
1808
|
};
|
|
1809
1809
|
if (changeOpts.title.length > 7) {
|
|
1810
1810
|
showNormalToast(options);
|
|
1811
1811
|
} else {
|
|
1812
1812
|
Taro.showToast(changeOpts as any);
|
|
1813
1813
|
}
|
|
1814
1814
|
const changeOpts = {
|
|
1815
1815
|
title: '',
|
|
1816
1816
|
icon: 'error',
|
|
1817
1817
|
duration: 1500,
|
|
1818
1818
|
mask: true,
|
|
1819
1819
|
...options,
|
|
1820
1820
|
};
|
|
1821
1821
|
if (changeOpts.title.length > 7) {
|
|
1822
1822
|
showNormalToast(options);
|
|
1823
1823
|
} else {
|
|
1824
1824
|
Taro.showToast(changeOpts as any);
|
|
1825
1825
|
}
|
|
1826
1826
|
Taro.showToast({
|
|
1827
1827
|
title: '',
|
|
1828
1828
|
icon: 'none',
|
|
1829
1829
|
duration: 1500,
|
|
1830
1830
|
mask: true,
|
|
1831
1831
|
...options,
|
|
1832
1832
|
});
|
|
1833
1833
|
return Taro.showLoading({
|
|
1834
1834
|
title: text,
|
|
1835
1835
|
});
|
|
1836
1836
|
return new Promise(() => {
|
|
1837
1837
|
Taro.nextTick(() => {
|
|
1838
1838
|
setTimeout(() => {
|
|
1839
1839
|
Taro.hideLoading(options);
|
|
1840
1840
|
}, 300);
|
|
1841
1841
|
});
|
|
1842
1842
|
});
|
|
1843
1843
|
return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME];
|
|
1844
1844
|
const {
|
|
1845
1845
|
tabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
|
|
1846
1846
|
sceneId,
|
|
1847
1847
|
currentTabType,
|
|
1848
1848
|
} = query;
|
|
1849
1849
|
let changeTabActive = tabActive;
|
|
1850
1850
|
if (sceneId) {
|
|
1851
1851
|
if (isH5) {
|
|
1852
1852
|
if (sceneId == '1002') {
|
|
1853
1853
|
changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
|
|
1854
1854
|
}
|
|
1855
1855
|
else if (sceneId == '1003') {
|
|
1856
1856
|
changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY];
|
|
1857
1857
|
}
|
|
1858
1858
|
} else if (isWxMinAndWxapp) {
|
|
1859
1859
|
if (sceneId == '1001' || sceneId == '1002') {
|
|
1860
1860
|
changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
|
|
1861
1861
|
}
|
|
1862
1862
|
else if (sceneId == '1003') {
|
|
1863
1863
|
changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION];
|
|
1864
1864
|
}
|
|
1865
1865
|
}
|
|
1866
1866
|
}
|
|
1867
1867
|
if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
|
|
1868
1868
|
if (
|
|
1869
1869
|
!isNaN(currentTabType) &&
|
|
1870
1870
|
SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY.indexOf(currentTabType) !== -1
|
|
1871
1871
|
) {
|
|
1872
1872
|
return {
|
|
1873
1873
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
1874
1874
|
tabActiveType: currentTabType,
|
|
1875
1875
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${currentTabType}`,
|
|
1876
1876
|
};
|
|
1877
1877
|
}
|
|
1878
1878
|
return {
|
|
1879
1879
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
1880
1880
|
tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
|
|
1881
1881
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
|
|
1882
1882
|
};
|
|
1883
1883
|
} else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
|
|
1884
1884
|
return {
|
|
1885
1885
|
menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
|
|
1886
1886
|
tabActiveType: 0,
|
|
1887
1887
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
|
|
1888
1888
|
};
|
|
1889
1889
|
} else {
|
|
1890
1890
|
const defaultMenuType = {
|
|
1891
1891
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
1892
1892
|
tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
|
|
1893
1893
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
|
|
1894
1894
|
};
|
|
1895
1895
|
const isCustomTab = tabActive.indexOf(SECTION_HOME_TAB_NAME_TYPE.HOME_CUSTOM) !== -1;
|
|
1896
1896
|
if (isCustomTab) {
|
|
1897
1897
|
const customTabType = Number(tabActive.split('-')[2]);
|
|
1898
1898
|
if (
|
|
1899
1899
|
!isNaN(customTabType) &&
|
|
1900
1900
|
SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY.indexOf(customTabType) !== -1
|
|
1901
1901
|
) {
|
|
1902
1902
|
return {
|
|
1903
1903
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
1904
1904
|
tabActiveType: customTabType,
|
|
1905
1905
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${customTabType}`,
|
|
1906
1906
|
};
|
|
1907
1907
|
} else {
|
|
1908
1908
|
return defaultMenuType;
|
|
1909
1909
|
}
|
|
1910
1910
|
} else {
|
|
1911
1911
|
if (
|
|
1912
1912
|
!isNaN(currentTabType) &&
|
|
1913
1913
|
SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY.indexOf(currentTabType) !== -1
|
|
1914
1914
|
) {
|
|
1915
1915
|
return {
|
|
1916
1916
|
menuType: SHOP_MENU_ID_TYPE.HOME,
|
|
1917
1917
|
tabActiveType: currentTabType,
|
|
1918
1918
|
queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${currentTabType}`,
|
|
1919
1919
|
};
|
|
1920
1920
|
}
|
|
1921
1921
|
return defaultMenuType;
|
|
1922
1922
|
}
|
|
1923
1923
|
}
|
|
1924
1924
|
const deleteKeyList = [
|
|
1925
1925
|
'$taroTimestamp',
|
|
1926
1926
|
'cookie',
|
|
1927
1927
|
'wdref',
|
|
1928
1928
|
'navStart',
|
|
1929
1929
|
'originOpts',
|
|
1930
1930
|
'originParams',
|
|
1931
1931
|
'originUrl',
|
|
1932
1932
|
'referer',
|
|
1933
1933
|
'stamp',
|
|
1934
1934
|
'hybrid',
|
|
1935
1935
|
'sr',
|
|
1936
1936
|
'navh',
|
|
1937
1937
|
'stath',
|
|
1938
1938
|
];
|
|
1939
1939
|
let changeQueryData: any = { ...queryData };
|
|
1940
1940
|
const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false;
|
|
1941
1941
|
const sceneQuery =
|
|
1942
1942
|
qrCodeScene && typeof qrCodeScene === 'string'
|
|
1943
1943
|
? parseQueryUrlString(decodeURIComponent(qrCodeScene))
|
|
1944
1944
|
: {};
|
|
1945
1945
|
changeQueryData = { ...changeQueryData, ...sceneQuery };
|
|
1946
1946
|
deleteKeyList.forEach((key) => {
|
|
1947
1947
|
changeQueryData[key] && delete changeQueryData[key];
|
|
1948
1948
|
});
|
|
1949
1949
|
Object.keys(changeQueryData).forEach((key) => {
|
|
1950
1950
|
if (changeQueryData[key] && Array.isArray(changeQueryData[key])) {
|
|
1951
1951
|
changeQueryData[key] = changeQueryData[key][0] || '';
|
|
1952
1952
|
}
|
|
1953
1953
|
});
|
|
1954
1954
|
changeQueryData['shopid'] &&
|
|
1955
1955
|
(changeQueryData['shopId'] = changeQueryData['shopid']) &&
|
|
1956
1956
|
delete changeQueryData['shopid'];
|
|
1957
1957
|
changeQueryData['venderid'] &&
|
|
1958
1958
|
(changeQueryData['venderId'] = changeQueryData['venderid']) &&
|
|
1959
1959
|
delete changeQueryData['venderid'];
|
|
1960
1960
|
changeQueryData['vendorId'] &&
|
|
1961
1961
|
(changeQueryData['venderId'] = changeQueryData['vendorId']) &&
|
|
1962
1962
|
delete changeQueryData['vendorId'];
|
|
1963
1963
|
changeQueryData['shopId'] &&
|
|
1964
1964
|
changeQueryData['shopId'] === 'undefined' &&
|
|
1965
1965
|
delete changeQueryData['shopId'];
|
|
1966
1966
|
changeQueryData['venderId'] &&
|
|
1967
1967
|
changeQueryData['venderId'] === 'undefined' &&
|
|
1968
1968
|
delete changeQueryData['venderId'];
|
|
1969
1969
|
return changeQueryData;
|
|
1970
1970
|
let isUsable = false;
|
|
1971
1971
|
const modularPackResult = floorData?.floorExtInfo?.modularPackResult;
|
|
1972
1972
|
const modularPackResultObj = formatPackResult(modularPackResult);
|
|
1973
1973
|
const bundleUrl = getBundleUrl(modularPackResultObj);
|
|
1974
1974
|
const bundleFileName = getBundleFileName(modularPackResultObj);
|
|
1975
1975
|
const taroVersion = getTaroVersion(modularPackResultObj);
|
|
1976
1976
|
if (bundleUrl && bundleFileName) {
|
|
1977
1977
|
isUsable = true;
|
|
1978
1978
|
}
|
|
1979
1979
|
if (!isUsable && typeof exceptionReportFn === 'function') {
|
|
1980
1980
|
exceptionReportFn({
|
|
1981
1981
|
code: `${NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG}${
|
|
1982
1982
|
floorData?.floorExtInfo?.floorKind === FLOOR_KIND.PDC_SYSTEM_MODULE
|
|
1983
1983
|
? SgmCustomCode.SYSTEMPDCMODULE_DATA
|
|
1984
1984
|
: SgmCustomCode.REMOTEMODULE_DATA
|
|
1985
1985
|
}`,
|
|
1986
1986
|
msg: {
|
|
1987
1987
|
msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
|
|
1988
1988
|
floorIdx: floorData?.floorIdx,
|
|
1989
1989
|
uid: floorData?.uid,
|
|
1990
1990
|
shopId: floorData?.floorExtInfo?.shopId,
|
|
1991
1991
|
moduleId: floorData?.moduleId,
|
|
1992
1992
|
moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
|
|
1993
1993
|
floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
|
|
1994
1994
|
floorKind: floorData?.floorExtInfo?.floorKind,
|
|
1995
1995
|
middleTemplateId: floorData?.middleTemplateId,
|
|
1996
1996
|
modularPackResult: {
|
|
1997
1997
|
bundleUrl,
|
|
1998
1998
|
taroVersion,
|
|
1999
1999
|
},
|
|
2000
2000
|
},
|
|
2001
2001
|
});
|
|
2002
2002
|
}
|
|
2003
2003
|
return isUsable;
|
|
2004
2004
|
const containerObj = containerList.find((item) => item.containerId === containerId);
|
|
2005
2005
|
const blacklistModules = ['chatgroup'];
|
|
2006
2006
|
return blacklistModules.includes(containerObj?.typeCode);
|
|
2007
2007
|
const objContainer = containerListData.find((item) => item.containerId === containerId);
|
|
2008
2008
|
return (
|
|
2009
2009
|
objContainer?.includeUids?.some((itemUid) => {
|
|
2010
2010
|
const objectFloor = floorListData.find((floorItem) => itemUid === floorItem.uid);
|
|
2011
2011
|
return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag);
|
|
2012
2012
|
}) ?? false
|
|
2013
2013
|
);
|
|
2014
2014
|
const unableIsvFloorListData = floorListData.filter(
|
|
2015
2015
|
(floorItem) =>
|
|
2016
2016
|
RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
|
|
2017
2017
|
!isIsvFloorUseable(floorItem, exceptionReportFn),
|
|
2018
2018
|
);
|
|
2019
2019
|
const unableIsvFloorUidList = unableIsvFloorListData.map((floorItem) => floorItem.uid);
|
|
2020
2020
|
const unableIsvContainerListData = containerListData.filter(
|
|
2021
2021
|
(item) =>
|
|
2022
2022
|
item.includeUids &&
|
|
2023
2023
|
item.includeUids.every((itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1),
|
|
2024
2024
|
);
|
|
2025
2025
|
return unableIsvContainerListData;
|
|
2026
2026
|
console.log('暂无对应渠道比较', compareVersion, nowVersion);
|
|
2027
2027
|
return -2;
|
|
2028
2028
|
return customObj;
|
|
2029
2029
|
return customObj;
|
|
2030
2030
|
return customObj;
|
|
2031
2031
|
return customObj;
|
|
2032
2032
|
return customObj;
|
|
2033
2033
|
return customObj;
|
|
2034
2034
|
return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl);
|
|
2035
2035
|
let getParams = false;
|
|
2036
2036
|
if (isOpenJdAppUrl(openAppUrl)) {
|
|
2037
2037
|
try {
|
|
2038
2038
|
getParams = openAppUrl.replace(/openApp\.jdMobile:\/\/virtual\?params=/i, '');
|
|
2039
2039
|
getParams = JSON.parse(String(getParams));
|
|
2040
2040
|
} catch (e) {
|
|
2041
2041
|
console.log(e);
|
|
2042
2042
|
}
|
|
2043
2043
|
}
|
|
2044
2044
|
return getParams;
|
|
2045
2045
|
const getLastParams = Object.assign({}, openParams);
|
|
2046
2046
|
return `openapp.jdmobile://virtual?params=${JSON.stringify(getLastParams)}`;
|
|
2047
2047
|
if (val === null || val === '' || typeof val === 'undefined') {
|
|
2048
2048
|
return true;
|
|
2049
2049
|
}
|
|
2050
2050
|
return false;
|
|
2051
2051
|
const {
|
|
2052
2052
|
moduleId = 'none',
|
|
2053
2053
|
entrance = 'none',
|
|
2054
2054
|
sourceType = 'none',
|
|
2055
2055
|
sourceValue = 'none',
|
|
2056
2056
|
} = params;
|
|
2057
2057
|
if (isIosDevice) {
|
|
2058
2058
|
return `${moduleId}#${entrance}`;
|
|
2059
2059
|
} else if (isAndroidDevice) {
|
|
2060
2060
|
return `${sourceType}#${sourceValue}`;
|
|
2061
2061
|
}
|
|
2062
2062
|
return 'none#none';
|
|
2063
2063
|
if (data && typeof data === 'object') {
|
|
2064
2064
|
let getOpenAppData = { ...data };
|
|
2065
2065
|
try {
|
|
2066
2066
|
const { sourceInfo, designerId, templateId, source } = getOpenAppData;
|
|
2067
2067
|
if (designerId && templateId) {
|
|
2068
2068
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
2069
2069
|
sourceInfo: {
|
|
2070
2070
|
entrance: '设计师预览',
|
|
2071
2071
|
},
|
|
2072
2072
|
});
|
|
2073
2073
|
} else if (sourceInfo) {
|
|
2074
2074
|
const { entrance } = sourceInfo;
|
|
2075
2075
|
getOpenAppData.sourceInfo.entrance = entrance && entrance.length > 0 ? entrance : '其他';
|
|
2076
2076
|
} else if (source && !sourceInfo) {
|
|
2077
2077
|
if (typeof source === 'object') {
|
|
2078
2078
|
const { sourceType, entrance, sourceValue, moduleId } = source;
|
|
2079
2079
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
2080
2080
|
sourceInfo: {
|
|
2081
2081
|
entrance: sourceType || entrance || '其他',
|
|
2082
2082
|
moduleId: sourceValue || moduleId || '-100',
|
|
2083
2083
|
},
|
|
2084
2084
|
});
|
|
2085
2085
|
if (sourceType === 'shop_from_product_detail' && sourceValue) {
|
|
2086
2086
|
getOpenAppData.sourceSku = sourceValue;
|
|
2087
2087
|
}
|
|
2088
2088
|
} else {
|
|
2089
2089
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
2090
2090
|
sourceInfo: {
|
|
2091
2091
|
entrance: source,
|
|
2092
2092
|
},
|
|
2093
2093
|
});
|
|
2094
2094
|
}
|
|
2095
2095
|
} else {
|
|
2096
2096
|
getOpenAppData = Object.assign({}, getOpenAppData, {
|
|
2097
2097
|
sourceInfo: {
|
|
2098
2098
|
entrance: '其他',
|
|
2099
2099
|
},
|
|
2100
2100
|
});
|
|
2101
2101
|
}
|
|
2102
2102
|
} catch (e) {
|
|
2103
2103
|
console.log(e);
|
|
2104
2104
|
}
|
|
2105
2105
|
return getOpenAppData;
|
|
2106
2106
|
}
|
|
2107
2107
|
return data;
|
|
2108
2108
|
return displayObj;
|
|
2109
2109
|
if (typeof input === 'string') {
|
|
2110
2110
|
try {
|
|
2111
2111
|
return JSON.parse(input);
|
|
2112
2112
|
} catch (e) {
|
|
2113
2113
|
console.error('JSON解析失败', e);
|
|
2114
2114
|
return {};
|
|
2115
2115
|
}
|
|
2116
2116
|
}
|
|
2117
2117
|
return input || {};
|
|
2118
2118
|
return false;
|
|
2119
2119
|
const borderStyle: { [key: string]: any } = {};
|
|
2120
2120
|
if (item?.borderRadius) {
|
|
2121
2121
|
let borderTopRadius = 0;
|
|
2122
2122
|
let borderBottomRadius = 0;
|
|
2123
2123
|
if (index === 0) {
|
|
2124
2124
|
borderTopRadius = item.borderRadius;
|
|
2125
2125
|
borderBottomRadius = floorDataLen === 1 || item?.marginBottom !== 0 ? item.borderRadius : 0;
|
|
2126
2126
|
} else if (index === floorDataLen - 1) {
|
|
2127
2127
|
borderTopRadius = floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius;
|
|
2128
2128
|
borderBottomRadius = item.borderRadius;
|
|
2129
2129
|
} else {
|
|
2130
2130
|
borderTopRadius = floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius;
|
|
2131
2131
|
borderBottomRadius = item?.marginBottom === 0 ? 0 : item.borderRadius;
|
|
2132
2132
|
}
|
|
2133
2133
|
borderStyle.borderTopLeftRadius = item?.borderTopLeftRadius
|
|
2134
2134
|
? `${item?.borderTopLeftRadius}px`
|
|
2135
2135
|
: `${borderTopRadius}px`;
|
|
2136
2136
|
borderStyle.borderTopRightRadius = item?.borderTopRightRadius
|
|
2137
2137
|
? `${item?.borderTopRightRadius}px`
|
|
2138
2138
|
: `${borderTopRadius}px`;
|
|
2139
2139
|
borderStyle.borderBottomLeftRadius = `${borderBottomRadius}px`;
|
|
2140
2140
|
borderStyle.borderBottomRightRadius = `${borderBottomRadius}px`;
|
|
2141
2141
|
} else {
|
|
2142
2142
|
borderStyle.borderTopLeftRadius = borderStyle?.borderTopLeftRadius || '0px';
|
|
2143
2143
|
borderStyle.borderTopRightRadius = borderStyle?.borderTopRightRadius || '0px';
|
|
2144
2144
|
borderStyle.borderBottomRightRadius = borderStyle?.borderBottomRightRadius || '0px';
|
|
2145
2145
|
borderStyle.borderBottomLeftRadius = borderStyle?.borderBottomLeftRadius || '0px';
|
|
2146
2146
|
}
|
|
2147
2147
|
return borderStyle;
|
|
2148
2148
|
return customObj;
|
|
2149
2149
|
isJdApp,
|
|
2150
2150
|
isWxApp,
|
|
2151
2151
|
isIosDevice,
|
|
2152
2152
|
isAndroidDevice,
|
|
2153
2153
|
isJdAndIosDevice,
|
|
2154
2154
|
isJdAndAndroidDevice,
|
|
2155
2155
|
isWxMin,
|
|
2156
2156
|
isWxMinAndWxapp,
|
|
2157
2157
|
isJdMin,
|
|
2158
2158
|
isMin,
|
|
2159
2159
|
isJdMinAndHarmony,
|
|
2160
2160
|
isH5,
|
|
2161
2161
|
isH5AndJdShopView,
|
|
2162
2162
|
isImageOptimizeEnable,
|
|
2163
2163
|
isChartH5,
|
|
2164
2164
|
isH5AndJdShopViewNativeScroll,
|
|
2165
2165
|
isH5AndJdShopViewH5Scroll,
|
|
2166
2166
|
isH5AndJdShopH5CustomScrollView,
|
|
2167
2167
|
isWxMiniH5View,
|
|
2168
2168
|
sliceArrToChunkList,
|
|
2169
2169
|
dealAddress,
|
|
2170
2170
|
objectToUrlEncode,
|
|
2171
2171
|
parseQueryUrlString,
|
|
2172
2172
|
setLowSmallPicUrl,
|
|
2173
2173
|
getJfsImage,
|
|
2174
2174
|
getQualityImage,
|
|
2175
2175
|
countStringify,
|
|
2176
2176
|
setTaroStorage,
|
|
2177
2177
|
getTaroStorageKeyValue,
|
|
2178
2178
|
removeTaroStorageKey,
|
|
2179
2179
|
clearTaroStorageKey,
|
|
2180
2180
|
getSystemInfos,
|
|
2181
2181
|
addHttps,
|
|
2182
2182
|
dateFormat,
|
|
2183
2183
|
throttle,
|
|
2184
2184
|
lodashThrottle,
|
|
2185
2185
|
debounce,
|
|
2186
2186
|
getTelephone,
|
|
2187
2187
|
rgbToHex,
|
|
2188
2188
|
hexToRgb,
|
|
2189
2189
|
getRandom,
|
|
2190
2190
|
getWxAppCookieStr,
|
|
2191
2191
|
pxTransformFromData,
|
|
2192
2192
|
dealShopContentData,
|
|
2193
2193
|
showSuccessToast,
|
|
2194
2194
|
showFailToast,
|
|
2195
2195
|
showNormalToast,
|
|
2196
2196
|
showShopLoading,
|
|
2197
2197
|
hideShopLoading,
|
|
2198
2198
|
getAppChannelType,
|
|
2199
2199
|
formatTabActiveMenuType,
|
|
2200
2200
|
filterUrlQueryData,
|
|
2201
2201
|
getAvifSupport,
|
|
2202
2202
|
getWebpSupport,
|
|
2203
2203
|
isMemberPage,
|
|
2204
2204
|
sgmCustomReport,
|
|
2205
2205
|
draCustomReport,
|
|
2206
2206
|
remoteCustomReport,
|
|
2207
2207
|
draInterfaceCustomReport,
|
|
2208
2208
|
draBusinessCustomReport,
|
|
2209
2209
|
draBusinessCustomLogReport,
|
|
2210
2210
|
isOpenJdAppUrl,
|
|
2211
2211
|
jdOpenAppParams,
|
|
2212
2212
|
createJdOpenAppUrl,
|
|
2213
2213
|
dealJdOpenAppData,
|
|
2214
2214
|
isEmpty,
|
|
2215
2215
|
getJdAppReportPageSource,
|
|
2216
2216
|
isAppClassifyPage,
|
|
2217
2217
|
getQualityImageNew,
|
|
2218
2218
|
getQualityImageOld,
|
|
2219
2219
|
isPc,
|
|
2220
2220
|
ipLoc_djd,
|
|
2221
2221
|
jdAppVersionCompare,
|
|
2222
2222
|
dealNativePixelToCssPixel,
|
|
2223
2223
|
isAppStowShop,
|
|
2224
2224
|
isIpadDevice,
|
|
2225
2225
|
getBorderStyle,
|
|
2226
2226
|
isLanguageForEn,
|
|
2227
2227
|
sColor,
|
|
2228
2228
|
draInterfaceDSMCustomReport,
|
|
2229
2229
|
isTabletDevice,
|
|
2230
2230
|
isInHarmonyBlacklistByModuleFlag,
|