@conecli/cone-render 0.10.1-shop3.87 → 0.10.1-shop3.89

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.
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro';
2
1
  isH5AndJdShopView,
3
2
  isJdApp,
4
3
  isIosDevice,
5
4
  isAndroidDevice,
6
5
  isJdAndIosDevice,
7
6
  isJdAndAndroidDevice,
8
7
  jdAppVersionCompare,
9
8
  isAppStowShop,
10
9
  isJdAndHarmonyDevice,
11
10
  isInJdShopView,
12
11
  (window.JDJshopViewInfo = {
13
12
  androidTouchSlop: 5,
14
13
  getAndroidTouchSlopState: false,
15
14
  });
16
15
  (state) => {
17
16
  console.log('document trigger PAGE_DOCUMENT_VISIBILITY_CHANGE state:', state);
18
17
  Taro.eventCenter.trigger(TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE, state ? 0 : 1);
19
18
  },
20
19
  1500,
21
20
  { leading: false, trailing: true },
22
21
  (state) => {
23
22
  console.log('IOS Android trigger PAGE_DOCUMENT_VISIBILITY_CHANGE state:', state);
24
23
  Taro.eventCenter.trigger(TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE, state);
25
24
  },
26
25
  1500,
27
26
  { leading: true, trailing: false },
28
27
  if (!isJdApp) {
29
28
  if (isH5) {
30
29
 
31
30
  const documentHandleVisibilityChange = () => {
32
31
  const state = document.hidden;
33
32
  window.startDocumentVisibilityChange && documentThrottledTrigger(state);
34
33
  };
35
34
  document.removeEventListener('visibilitychange', documentHandleVisibilityChange);
36
35
  console.log('每次进入页面先清除浏览器visibilitychange监听事件');
37
36
  setTimeout(() => {
38
37
  document.addEventListener('visibilitychange', documentHandleVisibilityChange, false);
39
38
  window.startDocumentVisibilityChange = true;
40
39
  }, 3000);
41
40
  }
42
41
  } else {
43
42
 
44
43
  !window.webviewVisible &&
45
44
  (window.webviewVisible = (state) => {
46
45
  if (window.startDocumentVisibilityChange) {
47
46
  webviewThrottledTrigger(state);
48
47
  } else {
49
48
  Taro.eventCenter.trigger(
50
49
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE_INIT_NOW_TIME,
51
50
  state,
52
51
  );
53
52
  }
54
53
  state === 1 && taroEventSendPageScrollInfo();
55
54
  });
56
55
  setTimeout(() => {
57
56
  window.startDocumentVisibilityChange = true;
58
57
  }, 3000);
59
58
  !window.floatReceiveData && (window.floatReceiveData = () => {});
60
59
  }
61
60
  MESSAGE_HOME_INIT: 'messageHomeInitPageData',
62
61
  [Message_CallBack_Name.MESSAGE_HOME_INIT]: {},
63
62
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = {
64
63
  displayHeight: 1920,
65
64
  offSetY: 0,
66
65
  };
67
66
  if (options) {
68
67
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = options;
69
68
  }
70
69
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {};
71
70
  Taro.eventCenter.trigger(TaroEventType.PAGE_SCROLL, options || latestRes);
72
71
  console.log('PageScrollEnd fire');
73
72
  Taro.eventCenter.trigger(TaroEventType.PAGE_SCROLL_END, options);
74
73
  const { businessType } = options;
75
74
  switch (businessType) {
76
75
  case H5_MSG_TO_H5_BUSINESSTYPE.JOIN_MEMBER_SUCCESS:
77
76
  Taro.eventCenter.trigger(TaroEventType.JOIN_MEMBER_SUCCESS, options);
78
77
  break;
79
78
  case H5_MSG_TO_H5_BUSINESSTYPE.h5BaseDataChange:
80
79
  Taro.eventCenter.trigger(TaroEventType.H5_BASE_DATA_CHANGE_REGISTER, options);
81
80
  break;
82
81
  default:
83
82
  break;
84
83
  }
85
84
  const { shopHomeExtendInfo } = options;
86
85
  if (shopHomeExtendInfo) {
87
86
  Taro.eventCenter.trigger(TaroEventType.UPDATE_SHOP_HOME_EXTEND_DATA, shopHomeExtendInfo);
88
87
  }
89
88
  window && window.scrollTo(0, 0);
90
89
  Taro.eventCenter.trigger(TaroEventType.PAGE_INIT_EXPOSURE, options);
91
90
  const { action, params } = options;
92
91
  console.log('taroEventShopStowSend', options);
93
92
  if (action) {
94
93
  Taro.eventCenter.trigger(action, params);
95
94
  }
96
95
  NATIVE_PAGE_READ: 'pageReady',
97
96
  NATIVE_PAGE_FINISH: 'pageFinish',
98
97
  NATIVE_INFO_DATA: 'nativeInfoData',
99
98
  NATIVE_PAGE_SCROLL: 'pageScroll',
100
99
  NATIVE_PAGE_SCROLL_END: 'pageScrollEnd',
101
100
  NATIVE_GET_SCROLL_TOP: 'nativeGetScrollTop',
102
101
  NATIVE_TO_SCROLL_TOP: 'nativeToScrollTop',
103
102
  NATIVE_CLOSE_SCROLL_MESSAGE: 'nativeCloseScrollMessage',
104
103
  NATIVE_MOBILE_CONFIG: 'getMobileConfig',
105
104
  NATIVE_SHOW_TOAST: 'showToast',
106
105
  NATIVE_SHOW_DIALOG: 'showDialog',
107
106
  NATIVE_PAGE_LAYOUT_CHANGE: 'pageLayoutChange',
108
107
  NATIVE_HOME_PAGING_ENABLE: 'homePagingEnable',
109
108
  NATIVE_GET_SCALED_TOUCH_SLOP: 'getScaledTouchSlop',
110
109
  NATIVE_ADD_CART: 'addCart',
111
110
  NATIVE_JUMP_TAB_BAR: 'jumpTabBar',
112
111
  NATIVE_OPEN_FLOAT: 'openFloat',
113
112
  NATIVE_INJECT_JS_FILE: 'needIsvPackage',
114
113
  NAVTIVE_FLOAT_READY: 'floatReady',
115
114
  NATIVE_REFRESH_PAGE: 'refreshPage',
116
115
  PAGE_PV_PARAM: 'pagePvParam',
117
116
  NATIVE_SCORLL_VIEW: 'nativeScrollControl',
118
117
  NATIVE_POP_WEBVIEW: 'popWebview',
119
118
  NATIVE_H5_SEND_MSG_TO_H5: 'h5SendMsgToH5',
120
119
  NATIVE_PUSH_NATIVE_PAGE: 'pushNativePage',
121
120
  UPDATE_NATIVE_DATA: 'updateNativeData',
122
121
  H5_TO_SCROLL_TOP: 'h5ToScrollTop',
123
122
  LUXURY_INFORM_CHANGE_HEIGHT: 'sendImmersionStatus',
124
123
  NATIVE_SHOPSTOW_SEND: 'sendMsgToShopStow',
125
124
  NATIVE_UPDATE_PAGE_INFO: 'pageCountInfo',
126
125
  NATIVE_TO_BUYER_SHOW_DETAIL: 'jumpBuyerShowDetail',
127
126
  NATIVE_TO_HIDE_JD_SHOP_HEADER: 'hideNativeHeader',
128
127
  NATIVE_TO_SHOW_CART_BTN: 'showCartButton',
129
128
  NATIVE_IMMERSIVEHEADER_STATE_CHANGE: 'immersiveHeaderStateChange',
130
129
  SHOP_FOLLOW_STATE_REGISTER: 'shopFollowStateRegister',
131
130
  SHOP_FOLLOW_STATE_SYNC: 'shopFollowStateSync',
132
131
  NATIVE_GET_SHOP_FOLLOW_STATE: 'getShopFollowState',
133
132
  H5_TO_NATIVE_LIVE_RESERVE_STATE: 'shopLiveReserveStateSync',
134
133
  H5_TO_NATIVE_SCROLL_TO_TOP: 'expertShopScrollToTop',
135
134
  OPEN: 'open',
136
135
  CLOSE: 'close',
137
136
  JOIN_MEMBER_SUCCESS: 'joinMemberSuccess',
138
137
  h5BaseDataChange: 'h5BaseDataChange',
139
138
  type = Message_Type.NATIVE_PAGE_READ,
140
139
  sendData: null | object = null,
141
140
  callBackName = Message_CallBack_Name.MESSAGE_HOME_INIT,
142
141
  console.log(
143
142
  '初始化nativePageRegisterMessage-isAppStowShop-type-sendData-isJdApp-isH5AndJdShopView',
144
143
  isAppStowShop,
145
144
  type,
146
145
  sendData,
147
146
  isJdApp,
148
147
  isH5AndJdShopView,
149
148
  callBackName,
150
149
  );
151
150
  if (isJdApp) {
152
151
  const getCallBackName = `window.${callBackName}`;
153
152
  let getRouterParam = {
154
153
  type,
155
154
  callBackName: getCallBackName,
156
155
  };
157
156
  if (!isAppStowShop) {
158
157
  getRouterParam['newHomePage'] = true;
159
158
  }
160
159
  if (sendData) {
161
160
  getRouterParam = Object.assign({}, getRouterParam, sendData);
162
161
  }
163
162
  if (isIosDevice) {
164
163
  const routerURL = isAppStowShop
165
164
  ? 'router://JDBDecorationPlatformModule/wrtNative'
166
165
  : 'router://JDShopModule/wrtNative';
167
166
  if (versionCompare(jdAppVersionStr, MPAAS_CONFIG_APP_VERSION) >= 0) {
168
167
  callRouterIOS({
169
168
  routerURL,
170
169
  routerParam: getRouterParam,
171
170
  });
172
171
  } else {
173
172
  window?.webkit?.messageHandlers?.JDAppUnite?.postMessage({
174
173
  method: 'callRouterModuleWithParams',
175
174
  params: {
176
175
  routerURL,
177
176
  serialize: '1',
178
177
  routerParam: JSON.stringify(getRouterParam),
179
178
  callBackName: getCallBackName,
180
179
  callBackId: `${callBackName}Ios`,
181
180
  },
182
181
  });
183
182
  }
184
183
  } else if (isAndroidDevice) {
185
184
  if (type === Message_Type.NATIVE_MOBILE_CONFIG && jdAppVersionCompare('13.2.8') >= 0) {
186
185
  callRouterAndroid({
187
186
  routerURL: 'router://JDJShopModule/wrtNative',
188
187
  routerParam: getRouterParam,
189
188
  });
190
189
  } else {
191
190
  window?.JDJshop?.wrtNative(
192
191
  JSON.stringify({
193
192
  routerParam: JSON.stringify(getRouterParam),
194
193
  serialize: '1',
195
194
  callBackName: getCallBackName,
196
195
  callBackId: `${callBackName}Android`,
197
196
  }),
198
197
  );
199
198
  }
200
199
  } else if (isJdAndHarmonyDevice) {
201
200
  const plugin = 'JdShopPlugin';
202
201
  const action = type;
203
202
  const params = {
204
203
  routerURL: '',
205
204
  routerParam: getRouterParam,
206
205
  };
207
206
  window.XWebView &&
208
207
  window.XWebView.callNative(
209
208
  plugin,
210
209
  action,
211
210
  JSON.stringify(params),
212
211
  getCallBackName,
213
212
  `${callBackName}HarmonyOS`,
214
213
  );
215
214
  }
216
215
  return true;
217
216
  }
218
217
  return false;
219
218
  if (isJdApp) {
220
219
  if (isIosDevice) {
221
220
  window?.webkit?.messageHandlers?.MobileNavi?.postMessage({
222
221
  method: 'close',
223
222
  });
224
223
  } else if (isAndroidDevice) {
225
224
  window?.XView && window?.XView.close();
226
225
  } else if (isJdAndHarmonyDevice) {
227
226
  !isInLiveroomChannel && nativeClosePopWebView();
228
227
  if (isInLiveroomChannel && window?.JDLiveAppJS) {
229
228
  window?.JDLiveAppJS?.handleJs(
230
229
  JSON.stringify([
231
230
  {
232
231
  action: 'closeWeb',
233
232
  params: {},
234
233
  },
235
234
  ]),
236
235
  );
237
236
  } else {
238
237
  window?.XWebView?.callNative &&
239
238
  window.XWebView.callNative(
240
239
  'JDXViewPlugin',
241
240
  'closeLayer2',
242
241
  JSON.stringify({}),
243
242
  'shopxCloseXview',
244
243
  '1',
245
244
  );
246
245
  }
247
246
  }
248
247
  }
249
248
  console.log('showToastByRouter:', title, showType);
250
249
  if (isJdApp) {
251
250
  const routerParam = {
252
251
  message: title,
253
252
  iconType: showType,
254
253
  duration,
255
254
  };
256
255
  if (isIosDevice) {
257
256
  callRouterIOS({
258
257
  routerURL: 'router://JDShopModule/showToast',
259
258
  routerParam,
260
259
  });
261
260
  } else if (isAndroidDevice) {
262
261
  callRouterAndroid({
263
262
  routerURL: 'router://JDJShopModule/showToast',
264
263
  routerParam,
265
264
  });
266
265
  } else if (isJdAndHarmonyDevice) {
267
266
  const getHarmonyVersion = window?.shopGlobalSwitch?.useNativeHarmonyToastVersion;
268
267
  if (
269
268
  getHarmonyVersion &&
270
269
  jdAppVersionCompare(getHarmonyVersion) >= 0 &&
271
270
  !isInJdShopView &&
272
271
  window?.jmfe?.callRouter
273
272
  ) {
274
273
  const params = {
275
274
  routerURL: 'router://JDJShopxModule/showToast',
276
275
  routerParam: routerParam,
277
276
  sync: '',
278
277
  };
279
278
  window.jmfe.callRouter(params).then((res) => {
280
279
  console.log('鸿蒙调用toast成功', res);
281
280
  });
282
281
  } else {
283
282
  const plugin = 'JdShopPlugin';
284
283
  const action = 'showToast';
285
284
  const params = {
286
285
  routerURL: 'router://JDJShopModule/showToast',
287
286
  routerParam: routerParam,
288
287
  };
289
288
  window.XWebView && window.XWebView.callNative(plugin, action, JSON.stringify(params));
290
289
  }
291
290
  }
292
291
  }
293
292
  console.log('nativePageLoadReady called');
294
293
  Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
295
294
  Message_Type.NATIVE_INFO_DATA
296
295
  ] = async (data: any) => {
297
296
  console.log('nativePageLoadReady callBack:', callBack, ', data:', data);
298
297
  callBack && callBack(data);
299
298
  };
300
299
  nativePageGetMessageInitCallBack();
301
300
  nativePageRegisterMessage(
302
301
  Message_Type.NATIVE_PAGE_READ,
303
302
  sendData,
304
303
  Message_CallBack_Name.MESSAGE_HOME_INIT,
305
304
  );
306
305
  return nativePageRegisterMessage(
307
306
  Message_Type.NATIVE_PAGE_FINISH,
308
307
  null,
309
308
  Message_CallBack_Name.MESSAGE_HOME_INIT,
310
309
  );
311
310
  callBack &&
312
311
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
313
312
  Message_Type.NATIVE_GET_SCROLL_TOP
314
313
  ] = callBack);
315
314
  return nativePageRegisterMessage(
316
315
  Message_Type.NATIVE_GET_SCROLL_TOP,
317
316
  null,
318
317
  Message_CallBack_Name.MESSAGE_HOME_INIT,
319
318
  );
320
319
  callBack &&
321
320
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
322
321
  Message_Type.NATIVE_TO_SCROLL_TOP
323
322
  ] = callBack);
324
323
  nativePageRegisterMessage(
325
324
  Message_Type.NATIVE_TO_SCROLL_TOP,
326
325
  {
327
326
  data: {
328
327
  scrollTop,
329
328
  },
330
329
  },
331
330
  Message_CallBack_Name.MESSAGE_HOME_INIT,
332
331
  );
333
332
  Taro.eventCenter.trigger(TaroEventType.LUXURY_INFORM_CHANGE_HEIGHT, data);
334
333
  Taro.eventCenter.trigger(TaroEventType.SHOP_FOLLOW_STATE_REGISTER, data);
335
334
  Taro.eventCenter.trigger(TaroEventType.IMMERSIVEHEADER_STATE_CHANGE, data);
336
335
  configName: string,
337
336
  isBeforePageReady: boolean,
338
337
  return new Promise((resolve, reject) => {
339
338
  if (!isJdApp) {
340
339
  reject({
341
340
  code: -1,
342
341
  message: 'getMPaasConfigByNative 只在松果APP店铺内部调用有效。',
343
342
  });
344
343
  return;
345
344
  }
346
345
  if (
347
346
  isIosDevice &&
348
347
  isBeforePageReady &&
349
348
  versionCompare(jdAppVersionStr, MPAAS_CONFIG_APP_VERSION) < 0
350
349
  ) {
351
350
  reject({
352
351
  code: -2,
353
352
  message: `在nativePageLoadReady之前调用,低于v${MPAAS_CONFIG_APP_VERSION}不会有返回,兜底处理`,
354
353
  });
355
354
  return;
356
355
  }
357
356
  Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
358
357
  Message_Type.NATIVE_MOBILE_CONFIG
359
358
  ] = (data: any) => {
360
359
  const configData = isAndroidDevice ? data : data?.data;
361
360
  const res = JSONParse(configData);
362
361
  resolve(res);
363
362
  };
364
363
  nativePageGetMessageInitCallBack();
365
364
  nativePageRegisterMessage(
366
365
  Message_Type.NATIVE_MOBILE_CONFIG,
367
366
  {
368
367
  data: {
369
368
  space: isIosDevice ? 'JDCDSHOP' : 'JDShop',
370
369
  configName,
371
370
  },
372
371
  },
373
372
  Message_CallBack_Name.MESSAGE_HOME_INIT,
374
373
  );
375
374
  });
376
375
  bussinessKey: string,
377
376
  isBeforePageReady: boolean,
378
377
  if (!bussinessKey) {
379
378
  return null;
380
379
  }
381
380
  if (!isJdApp) {
382
381
  return null;
383
382
  }
384
383
  const CACHED_MPAAS_KEY = `mpaas_${CONFIG_NAME}`;
385
384
  const CACHED_MPAAS_KEY_HELPER = `${CACHED_MPAAS_KEY}_helper`;
386
385
  let configData = window[CACHED_MPAAS_KEY];
387
386
  if (configData == null) {
388
387
  configData = await getMPaasConfigByNative(CONFIG_NAME, isBeforePageReady).catch((e) => {
389
388
  console.log('getMPaasConfigByNative error:', e);
390
389
  return null;
391
390
  });
392
391
  window[CACHED_MPAAS_KEY_HELPER] = {};
393
392
  window[CACHED_MPAAS_KEY] = configData;
394
393
  }
395
394
  if (configData) {
396
395
  const originData = configData[bussinessKey];
397
396
  const hasParse = window[CACHED_MPAAS_KEY_HELPER][bussinessKey];
398
397
  try {
399
398
  if (hasParse || ['object', 'boolean', 'number'].includes(typeof originData)) {
400
399
  return originData;
401
400
  } else {
402
401
  window[CACHED_MPAAS_KEY_HELPER][bussinessKey] = true;
403
402
  const parseData = JSON.parse(configData[bussinessKey]);
404
403
  configData[bussinessKey] = parseData;
405
404
  return parseData;
406
405
  }
407
406
  } catch (e) {
408
407
  return originData;
409
408
  }
410
409
  }
411
410
  return null;
412
411
  nativePageRegisterMessage(Message_Type.NATIVE_CLOSE_SCROLL_MESSAGE);
413
412
  if (isJdAndAndroidDevice) {
414
413
  callBack &&
415
414
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
416
415
  Message_Type.NATIVE_HOME_PAGING_ENABLE
417
416
  ] = callBack);
418
417
  nativePageRegisterMessage(Message_Type.NATIVE_HOME_PAGING_ENABLE, {
419
418
  data: {
420
419
  enable: enable,
421
420
  },
422
421
  });
423
422
  }
424
423
  if (isJdAndAndroidDevice) {
425
424
  callBack &&
426
425
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
427
426
  Message_Type.NATIVE_GET_SCALED_TOUCH_SLOP
428
427
  ] = callBack);
429
428
  nativePageRegisterMessage(Message_Type.NATIVE_GET_SCALED_TOUCH_SLOP);
430
429
  }
431
430
  SUCCESS: 'success',
432
431
  FAIL: 'fail',
433
432
  NORMAL: 'normal',
434
433
  SUCCESS: 2,
435
434
  FAIL: 3,
436
435
  NORMAL: 1,
437
436
  SUCCESS: 2,
438
437
  FAIL: 3,
439
438
  NORMAL: 1,
440
439
  [ToastIosType.NORMAL]: ToastType.NORMAL,
441
440
  [ToastIosType.SUCCESS]: ToastType.SUCCESS,
442
441
  [ToastIosType.FAIL]: ToastType.FAIL,
443
442
  if (isShowNewRouterToast) {
444
443
  const changeShowType = isJdAndIosDevice
445
444
  ? toastIosTypeToNewToastType[showType] || showType
446
445
  : showType;
447
446
  showToastByRouter(title, changeShowType, duration * 1000);
448
447
  } else {
449
448
  nativePageRegisterMessage(Message_Type.NATIVE_SHOW_TOAST, {
450
449
  data: {
451
450
  message: title,
452
451
  iconType: showType,
453
452
  duration,
454
453
  },
455
454
  });
456
455
  }
457
456
  routerURL,
458
457
  routerParam,
459
458
  callBackName = Message_CallBack_Name.MESSAGE_HOME_INIT,
460
459
  isSync = false,
461
460
  const getCallBackName = `window.${callBackName}`;
462
461
  const params = {
463
462
  routerURL,
464
463
  serialize: '1',
465
464
  routerParam,
466
465
  callBackName: getCallBackName,
467
466
  callBackId: `${callBackName}Ios`,
468
467
  };
469
468
  console.log(
470
469
  'callRouterIOS routerURL:',
471
470
  routerURL,
472
471
  ',routerParam:',
473
472
  routerParam,
474
473
  'params',
475
474
  params,
476
475
  'isSync',
477
476
  isSync,
478
477
  );
479
478
  window?.webkit?.messageHandlers?.JDAppUnite?.postMessage({
480
479
  method: isSync ? 'callSyncRouterModuleWithParams' : 'callRouterModuleWithParams',
481
480
  params: JSON.stringify(params),
482
481
  });
483
482
  routerURL,
484
483
  routerParam,
485
484
  callBackName = Message_CallBack_Name.MESSAGE_HOME_INIT,
486
485
  isSync = false,
487
486
  hasJdRouter = true,
488
487
  console.log(
489
488
  'callRouterAndroid routerURL:',
490
489
  routerURL,
491
490
  ',routerParam:',
492
491
  routerParam,
493
492
  'isSync',
494
493
  isSync,
495
494
  );
496
495
  const getCallBackName = `window.${callBackName}`;
497
496
  routerParam?.data &&
498
497
  typeof routerParam?.data === 'object' &&
499
498
  (routerParam.data = JSON.stringify(routerParam?.data));
500
499
  var params = {
501
500
  serialize: '1',
502
501
  routerURL,
503
502
  routerParam,
504
503
  callBackName: getCallBackName,
505
504
  callBackId: `${callBackName}Android`,
506
505
  };
507
506
  hasJdRouter && (params['jdRouter'] = '1');
508
507
  isSync
509
508
  ? window?.JDAppUnite?.callSyncRouterModuleWithParams(JSON.stringify(params))
510
509
  : window?.JDAppUnite?.callRouterModuleWithParams(JSON.stringify(params));
511
510
  pluginName,
512
511
  action,
513
512
  routerParam,
514
513
  callBackName = Message_CallBack_Name.MESSAGE_HOME_INIT,
515
514
  isSync = false,
516
515
  const getCallBackName = `window.${callBackName}`;
517
516
  const params = {
518
517
  routerURL: '',
519
518
  routerParam: routerParam,
520
519
  };
521
520
  const outBridgeType = ['getLastAddress', 'getAddress'];
522
521
  console.log(
523
522
  'callRouterHarmony pluginName:',
524
523
  pluginName,
525
524
  'action',
526
525
  action,
527
526
  ',routerParam:',
528
527
  routerParam,
529
528
  'params',
530
529
  params,
531
530
  'isSync',
532
531
  isSync,
533
532
  );
534
533
  window?.XWebView?.callNative(
535
534
  pluginName,
536
535
  action,
537
536
  outBridgeType.includes(action) ? JSON.stringify(routerParam) : JSON.stringify(params),
538
537
  getCallBackName,
539
538
  `${callBackName}HarmonyOS`,
540
539
  );
541
540
  callRouterHarmony,
542
541
  callBack &&
543
542
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
544
543
  Message_Type.NATIVE_SHOW_DIALOG
545
544
  ] = callBack);
546
545
  return nativePageRegisterMessage(Message_Type.NATIVE_SHOW_DIALOG, {
547
546
  data: params,
548
547
  });
549
548
  if (!isJdApp) {
550
549
  return;
551
550
  }
552
551
  if (!window[Message_CallBack_Name.MESSAGE_HOME_INIT]) {
553
552
  window[Message_CallBack_Name.MESSAGE_HOME_INIT] = (messageData) => {
554
553
  try {
555
554
  console.log('接收到原生通知返回的原始数据nativePageGetMessageInitCallBack', messageData);
556
555
  const getMessageJsonData = JSONParse(messageData);
557
556
  const { status } = getMessageJsonData;
558
557
  if (status == '0') {
559
558
  const { type, data } = getMessageJsonData?.data;
560
559
  const getSendJsonData = JSONParse(data);
561
560
  switch (type) {
562
561
  case Message_Type.NATIVE_INFO_DATA:
563
562
  case Message_Type.NATIVE_PAGE_FINISH:
564
563
  case Message_Type.NATIVE_GET_SCROLL_TOP:
565
564
  case Message_Type.NATIVE_TO_SCROLL_TOP:
566
565
  case Message_Type.NATIVE_CLOSE_SCROLL_MESSAGE:
567
566
  case Message_Type.NATIVE_GET_SCALED_TOUCH_SLOP:
568
567
  case Message_Type.NATIVE_MOBILE_CONFIG:
569
568
  case Message_Type.NATIVE_GET_SHOP_FOLLOW_STATE:
570
569
  const getTypeCallBack =
571
570
  Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][type];
572
571
  if (getTypeCallBack) {
573
572
  const isCallBackFunc = typeof getTypeCallBack === 'function';
574
573
  console.log('接收到原生通知 NATIVE_SHOPSTOW_SEND getSendJsonData', getSendJsonData);
575
574
  isCallBackFunc && getTypeCallBack(getSendJsonData);
576
575
  }
577
576
  break;
578
577
  case Message_Type.NATIVE_SHOW_DIALOG:
579
578
  const showDialogCallBack =
580
579
  Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][type];
581
580
  if (showDialogCallBack) {
582
581
  const isCallBackFunc = typeof showDialogCallBack === 'function';
583
582
  console.log(
584
583
  `获取${type}类型数据数据type isCallBackFunc getMessageJsonData `,
585
584
  type,
586
585
  isCallBackFunc,
587
586
  getMessageJsonData,
588
587
  );
589
588
  isCallBackFunc && showDialogCallBack(getMessageJsonData?.data);
590
589
  }
591
590
  break;
592
591
  case Message_Type.NATIVE_PAGE_SCROLL:
593
592
  taroEventSendPageScrollInfo(data);
594
593
  break;
595
594
  case Message_Type.NATIVE_PAGE_SCROLL_END:
596
595
  taroEventSendPageScrollEndInfo(data);
597
596
  break;
598
597
  case Message_Type.NATIVE_H5_SEND_MSG_TO_H5:
599
598
  console.log('接收到原生通知 NATIVE_H5_SEND_MSG_TO_H5', data);
600
599
  taroEventH5SendMsgToH5(getSendJsonData);
601
600
  break;
602
601
  case Message_Type.UPDATE_NATIVE_DATA:
603
602
  taroEventUpdateNativeData(getSendJsonData);
604
603
  break;
605
604
  case Message_Type.H5_TO_SCROLL_TOP:
606
605
  taroEventH5ToScrollTop();
607
606
  break;
608
607
  case Message_Type.NATIVE_SHOPSTOW_SEND:
609
608
  console.log('接收到原生通知 NATIVE_SHOPSTOW_SEND', messageData);
610
609
  console.log('接收到原生通知 NATIVE_SHOPSTOW_SEND getSendJsonData', getSendJsonData);
611
610
  taroEventShopStowSend(getSendJsonData);
612
611
  break;
613
612
  case Message_Type.LUXURY_INFORM_CHANGE_HEIGHT:
614
613
  taroEventSendImmersionStatus(data);
615
614
  break;
616
615
  case Message_Type.NATIVE_IMMERSIVEHEADER_STATE_CHANGE:
617
616
  taroEventSendImmersiveHeaderChange(data);
618
617
  break;
619
618
  case Message_Type.SHOP_FOLLOW_STATE_REGISTER:
620
619
  taroEventSendShopFollowStateChange(data);
621
620
  break;
622
621
  default:
623
622
  }
624
623
  } else {
625
624
  console.log('传递数据获取异常', getMessageJsonData);
626
625
  }
627
626
  } catch (e) {
628
627
  console.log('获取转换异常结果', e);
629
628
  }
630
629
  };
631
630
  }
632
631
  console.warn('🚀 ~~ JumpTabBarInCurrentShop() ~~ params:', params);
633
632
  nativePageRegisterMessage(Message_Type.NATIVE_JUMP_TAB_BAR, {
634
633
  data: params,
635
634
  });
636
635
  nativePageRegisterMessage(Message_Type.NATIVE_OPEN_FLOAT, {
637
636
  data: params,
638
637
  });
639
638
  const changeData = {
640
639
  type: NATIVE_POP_WEBVIEW_TYPE.OPEN,
641
640
  height: DEFAULT_POP_WEBVIEW_HEIGHT,
642
641
  };
643
642
  if (isChangeDefaultPopViewHeight && !params?.height) {
644
643
  changeData.height = Math.round(window.screen.height * 0.8);
645
644
  changeData.borderRadius = 12;
646
645
  }
647
646
  nativePageRegisterMessage(Message_Type.NATIVE_POP_WEBVIEW, {
648
647
  data: {
649
648
  ...changeData,
650
649
  ...params,
651
650
  },
652
651
  });
653
652
  nativePageRegisterMessage(Message_Type.NATIVE_POP_WEBVIEW, {
654
653
  data: {
655
654
  type: NATIVE_POP_WEBVIEW_TYPE.CLOSE,
656
655
  ...params,
657
656
  },
658
657
  });
659
658
  Taro.eventCenter.off(TaroEventType.JOIN_MEMBER_SUCCESS);
660
659
  console.log('popWebview关闭');
661
660
  nativePageRegisterMessage(Message_Type.NATIVE_H5_SEND_MSG_TO_H5, {
662
661
  data: params,
663
662
  });
664
663
  nativePageRegisterMessage(Message_Type.NATIVE_PUSH_NATIVE_PAGE, {
665
664
  data: params,
666
665
  });
667
666
  window &&
668
667
  (window.location.href = `xview://search?request={"action":"${Message_Type.NAVTIVE_FLOAT_READY}"}`);
669
668
  const { displayHeight, offSetY } = res;
670
669
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return;
671
670
  if (isIosDevice) return res;
672
671
  if (isAndroidDevice) {
673
672
  const deviceRatio = window.devicePixelRatio;
674
673
  const cssDisplayHeight = Math.ceil(displayHeight / deviceRatio);
675
674
  const cssOffsetY = Math.ceil(offSetY / deviceRatio);
676
675
  return {
677
676
  displayHeight: cssDisplayHeight,
678
677
  offSetY: cssOffsetY,
679
678
  };
680
679
  }
681
680
  nativePageRegisterMessage(Message_Type.NATIVE_UPDATE_PAGE_INFO, {
682
681
  data: params,
683
682
  });
684
683
  nativePageRegisterMessage(Message_Type.NATIVE_TO_BUYER_SHOW_DETAIL, {
685
684
  data: params,
686
685
  });
687
686
  nativePageRegisterMessage(Message_Type.NATIVE_TO_HIDE_JD_SHOP_HEADER, {
688
687
  data: params,
689
688
  });
690
689
  nativePageRegisterMessage(Message_Type.NATIVE_TO_SHOW_CART_BTN, {
691
690
  data: params,
692
691
  });
693
692
  nativePageRegisterMessage(Message_Type.SHOP_FOLLOW_STATE_REGISTER, {
694
693
  data: params,
695
694
  });
696
695
  callBack &&
697
696
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
698
697
  Message_Type.NATIVE_GET_SHOP_FOLLOW_STATE
699
698
  ] = callBack);
700
699
  nativePageRegisterMessage(Message_Type.NATIVE_GET_SHOP_FOLLOW_STATE, {
701
700
  data: {},
702
701
  });
703
702
  nativePageRegisterMessage(Message_Type.SHOP_FOLLOW_STATE_SYNC, {
704
703
  data: {
705
704
  followed: followState,
706
705
  },
707
706
  });
708
707
  nativePageRegisterMessage(Message_Type.H5_TO_NATIVE_LIVE_RESERVE_STATE, {
709
708
  data: params,
710
709
  });
711
710
  Taro.eventCenter.on('SEND_MSG_TO_NATIVE', (key, params) => {
712
711
  nativePageRegisterMessage(key, {
713
712
  data: params,
714
713
  });
715
714
  });
716
715
  nativePageRegisterMessage(Message_Type.H5_TO_NATIVE_SCROLL_TO_TOP, {
717
716
  data: params,
718
717
  });
718
+ import Taro from '@tarojs/taro';
719
719
  isH5AndJdShopView,
720
720
  isJdApp,
721
721
  isIosDevice,
722
722
  isAndroidDevice,
723
723
  isJdAndIosDevice,
724
724
  isJdAndAndroidDevice,
725
725
  jdAppVersionCompare,
726
726
  isAppStowShop,
727
727
  isJdAndHarmonyDevice,
728
728
  isInJdShopView,
729
729
  (window.JDJshopViewInfo = {
730
730
  androidTouchSlop: 5,
731
731
  getAndroidTouchSlopState: false,
732
732
  });
733
733
  (state) => {
734
734
  console.log('document trigger PAGE_DOCUMENT_VISIBILITY_CHANGE state:', state);
735
735
  Taro.eventCenter.trigger(TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE, state ? 0 : 1);
736
736
  },
737
737
  1500,
738
738
  { leading: false, trailing: true },
739
739
  (state) => {
740
740
  console.log('IOS Android trigger PAGE_DOCUMENT_VISIBILITY_CHANGE state:', state);
741
741
  Taro.eventCenter.trigger(TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE, state);
742
742
  },
743
743
  1500,
744
744
  { leading: true, trailing: false },
745
745
  if (!isJdApp) {
746
746
  if (isH5) {
747
747
 
748
748
  const documentHandleVisibilityChange = () => {
749
749
  const state = document.hidden;
750
750
  window.startDocumentVisibilityChange && documentThrottledTrigger(state);
751
751
  };
752
752
  document.removeEventListener('visibilitychange', documentHandleVisibilityChange);
753
753
  console.log('每次进入页面先清除浏览器visibilitychange监听事件');
754
754
  setTimeout(() => {
755
755
  document.addEventListener('visibilitychange', documentHandleVisibilityChange, false);
756
756
  window.startDocumentVisibilityChange = true;
757
757
  }, 3000);
758
758
  }
759
759
  } else {
760
760
 
761
761
  !window.webviewVisible &&
762
762
  (window.webviewVisible = (state) => {
763
763
  if (window.startDocumentVisibilityChange) {
764
764
  webviewThrottledTrigger(state);
765
765
  } else {
766
766
  Taro.eventCenter.trigger(
767
767
  TaroEventType.PAGE_DOCUMENT_VISIBILITY_CHANGE_INIT_NOW_TIME,
768
768
  state,
769
769
  );
770
770
  }
771
771
  state === 1 && taroEventSendPageScrollInfo();
772
772
  });
773
773
  setTimeout(() => {
774
774
  window.startDocumentVisibilityChange = true;
775
775
  }, 3000);
776
776
  !window.floatReceiveData && (window.floatReceiveData = () => {});
777
777
  }
778
778
  MESSAGE_HOME_INIT: 'messageHomeInitPageData',
779
779
  [Message_CallBack_Name.MESSAGE_HOME_INIT]: {},
780
780
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = {
781
781
  displayHeight: 1920,
782
782
  offSetY: 0,
783
783
  };
784
784
  if (options) {
785
785
  latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] = options;
786
786
  }
787
787
  const latestRes = latestFromNativeMsgStorage[TaroEventType.PAGE_SCROLL] || {};
788
788
  Taro.eventCenter.trigger(TaroEventType.PAGE_SCROLL, options || latestRes);
789
789
  console.log('PageScrollEnd fire');
790
790
  Taro.eventCenter.trigger(TaroEventType.PAGE_SCROLL_END, options);
791
791
  const { businessType } = options;
792
792
  switch (businessType) {
793
793
  case H5_MSG_TO_H5_BUSINESSTYPE.JOIN_MEMBER_SUCCESS:
794
794
  Taro.eventCenter.trigger(TaroEventType.JOIN_MEMBER_SUCCESS, options);
795
795
  break;
796
796
  case H5_MSG_TO_H5_BUSINESSTYPE.h5BaseDataChange:
797
797
  Taro.eventCenter.trigger(TaroEventType.H5_BASE_DATA_CHANGE_REGISTER, options);
798
798
  break;
799
799
  default:
800
800
  break;
801
801
  }
802
802
  const { shopHomeExtendInfo } = options;
803
803
  if (shopHomeExtendInfo) {
804
804
  Taro.eventCenter.trigger(TaroEventType.UPDATE_SHOP_HOME_EXTEND_DATA, shopHomeExtendInfo);
805
805
  }
806
806
  window && window.scrollTo(0, 0);
807
807
  Taro.eventCenter.trigger(TaroEventType.PAGE_INIT_EXPOSURE, options);
808
808
  const { action, params } = options;
809
809
  console.log('taroEventShopStowSend', options);
810
810
  if (action) {
811
811
  Taro.eventCenter.trigger(action, params);
812
812
  }
813
813
  NATIVE_PAGE_READ: 'pageReady',
814
814
  NATIVE_PAGE_FINISH: 'pageFinish',
815
815
  NATIVE_INFO_DATA: 'nativeInfoData',
816
816
  NATIVE_PAGE_SCROLL: 'pageScroll',
817
817
  NATIVE_PAGE_SCROLL_END: 'pageScrollEnd',
818
818
  NATIVE_GET_SCROLL_TOP: 'nativeGetScrollTop',
819
819
  NATIVE_TO_SCROLL_TOP: 'nativeToScrollTop',
820
820
  NATIVE_CLOSE_SCROLL_MESSAGE: 'nativeCloseScrollMessage',
821
821
  NATIVE_MOBILE_CONFIG: 'getMobileConfig',
822
822
  NATIVE_SHOW_TOAST: 'showToast',
823
823
  NATIVE_SHOW_DIALOG: 'showDialog',
824
824
  NATIVE_PAGE_LAYOUT_CHANGE: 'pageLayoutChange',
825
825
  NATIVE_HOME_PAGING_ENABLE: 'homePagingEnable',
826
826
  NATIVE_GET_SCALED_TOUCH_SLOP: 'getScaledTouchSlop',
827
827
  NATIVE_ADD_CART: 'addCart',
828
828
  NATIVE_JUMP_TAB_BAR: 'jumpTabBar',
829
829
  NATIVE_OPEN_FLOAT: 'openFloat',
830
830
  NATIVE_INJECT_JS_FILE: 'needIsvPackage',
831
831
  NAVTIVE_FLOAT_READY: 'floatReady',
832
832
  NATIVE_REFRESH_PAGE: 'refreshPage',
833
833
  PAGE_PV_PARAM: 'pagePvParam',
834
834
  NATIVE_SCORLL_VIEW: 'nativeScrollControl',
835
835
  NATIVE_POP_WEBVIEW: 'popWebview',
836
836
  NATIVE_H5_SEND_MSG_TO_H5: 'h5SendMsgToH5',
837
837
  NATIVE_PUSH_NATIVE_PAGE: 'pushNativePage',
838
838
  UPDATE_NATIVE_DATA: 'updateNativeData',
839
839
  H5_TO_SCROLL_TOP: 'h5ToScrollTop',
840
840
  LUXURY_INFORM_CHANGE_HEIGHT: 'sendImmersionStatus',
841
841
  NATIVE_SHOPSTOW_SEND: 'sendMsgToShopStow',
842
842
  NATIVE_UPDATE_PAGE_INFO: 'pageCountInfo',
843
843
  NATIVE_TO_BUYER_SHOW_DETAIL: 'jumpBuyerShowDetail',
844
844
  NATIVE_TO_HIDE_JD_SHOP_HEADER: 'hideNativeHeader',
845
845
  NATIVE_TO_SHOW_CART_BTN: 'showCartButton',
846
846
  NATIVE_IMMERSIVEHEADER_STATE_CHANGE: 'immersiveHeaderStateChange',
847
847
  SHOP_FOLLOW_STATE_REGISTER: 'shopFollowStateRegister',
848
848
  SHOP_FOLLOW_STATE_SYNC: 'shopFollowStateSync',
849
849
  NATIVE_GET_SHOP_FOLLOW_STATE: 'getShopFollowState',
850
850
  H5_TO_NATIVE_LIVE_RESERVE_STATE: 'shopLiveReserveStateSync',
851
851
  H5_TO_NATIVE_SCROLL_TO_TOP: 'expertShopScrollToTop',
852
852
  GET_COLOR_API_DATA: 'getColorApiData',
853
853
  GET_ENTER_SHOP_OPEN_APP: 'getEnterShopOpenApp',
854
854
  OPEN: 'open',
855
855
  CLOSE: 'close',
856
856
  JOIN_MEMBER_SUCCESS: 'joinMemberSuccess',
857
857
  h5BaseDataChange: 'h5BaseDataChange',
858
858
  type = Message_Type.NATIVE_PAGE_READ,
859
859
  sendData: null | object = null,
860
860
  callBackName = Message_CallBack_Name.MESSAGE_HOME_INIT,
861
861
  console.log(
862
862
  '初始化nativePageRegisterMessage-isAppStowShop-type-sendData-isJdApp-isH5AndJdShopView',
863
863
  isAppStowShop,
864
864
  type,
865
865
  sendData,
866
866
  isJdApp,
867
867
  isH5AndJdShopView,
868
868
  callBackName,
869
869
  );
870
870
  if (isJdApp) {
871
871
  const getCallBackName = `window.${callBackName}`;
872
872
  let getRouterParam = {
873
873
  type,
874
874
  callBackName: getCallBackName,
875
875
  };
876
876
  if (!isAppStowShop) {
877
877
  getRouterParam['newHomePage'] = true;
878
878
  }
879
879
  if (sendData) {
880
880
  getRouterParam = Object.assign({}, getRouterParam, sendData);
881
881
  }
882
882
  if (isIosDevice) {
883
883
  const routerURL = isAppStowShop
884
884
  ? 'router://JDBDecorationPlatformModule/wrtNative'
885
885
  : 'router://JDShopModule/wrtNative';
886
886
  if (versionCompare(jdAppVersionStr, MPAAS_CONFIG_APP_VERSION) >= 0) {
887
887
  callRouterIOS({
888
888
  routerURL,
889
889
  routerParam: getRouterParam,
890
890
  });
891
891
  } else {
892
892
  window?.webkit?.messageHandlers?.JDAppUnite?.postMessage({
893
893
  method: 'callRouterModuleWithParams',
894
894
  params: {
895
895
  routerURL,
896
896
  serialize: '1',
897
897
  routerParam: JSON.stringify(getRouterParam),
898
898
  callBackName: getCallBackName,
899
899
  callBackId: `${callBackName}Ios`,
900
900
  },
901
901
  });
902
902
  }
903
903
  } else if (isAndroidDevice) {
904
904
  if (type === Message_Type.NATIVE_MOBILE_CONFIG && jdAppVersionCompare('13.2.8') >= 0) {
905
905
  callRouterAndroid({
906
906
  routerURL: 'router://JDJShopModule/wrtNative',
907
907
  routerParam: getRouterParam,
908
908
  });
909
909
  } else {
910
910
  window?.JDJshop?.wrtNative(
911
911
  JSON.stringify({
912
912
  routerParam: JSON.stringify(getRouterParam),
913
913
  serialize: '1',
914
914
  callBackName: getCallBackName,
915
915
  callBackId: `${callBackName}Android`,
916
916
  }),
917
917
  );
918
918
  }
919
919
  } else if (isJdAndHarmonyDevice) {
920
920
  const plugin = 'JdShopPlugin';
921
921
  const action = type;
922
922
  const params = {
923
923
  routerURL: '',
924
924
  routerParam: getRouterParam,
925
925
  };
926
926
  window.XWebView &&
927
927
  window.XWebView.callNative(
928
928
  plugin,
929
929
  action,
930
930
  JSON.stringify(params),
931
931
  getCallBackName,
932
932
  `${callBackName}HarmonyOS`,
933
933
  );
934
934
  }
935
935
  return true;
936
936
  }
937
937
  return false;
938
938
  if (isJdApp) {
939
939
  if (isIosDevice) {
940
940
  window?.webkit?.messageHandlers?.MobileNavi?.postMessage({
941
941
  method: 'close',
942
942
  });
943
943
  } else if (isAndroidDevice) {
944
944
  window?.XView && window?.XView.close();
945
945
  } else if (isJdAndHarmonyDevice) {
946
946
  !isInLiveroomChannel && nativeClosePopWebView();
947
947
  if (isInLiveroomChannel && window?.JDLiveAppJS) {
948
948
  window?.JDLiveAppJS?.handleJs(
949
949
  JSON.stringify([
950
950
  {
951
951
  action: 'closeWeb',
952
952
  params: {},
953
953
  },
954
954
  ]),
955
955
  );
956
956
  } else {
957
957
  window?.XWebView?.callNative &&
958
958
  window.XWebView.callNative(
959
959
  'JDXViewPlugin',
960
960
  'closeLayer2',
961
961
  JSON.stringify({}),
962
962
  'shopxCloseXview',
963
963
  '1',
964
964
  );
965
965
  }
966
966
  }
967
967
  }
968
968
  console.log('showToastByRouter:', title, showType);
969
969
  if (isJdApp) {
970
970
  const routerParam = {
971
971
  message: title,
972
972
  iconType: showType,
973
973
  duration,
974
974
  };
975
975
  if (isIosDevice) {
976
976
  callRouterIOS({
977
977
  routerURL: 'router://JDShopModule/showToast',
978
978
  routerParam,
979
979
  });
980
980
  } else if (isAndroidDevice) {
981
981
  callRouterAndroid({
982
982
  routerURL: 'router://JDJShopModule/showToast',
983
983
  routerParam,
984
984
  });
985
985
  } else if (isJdAndHarmonyDevice) {
986
986
  const getHarmonyVersion = window?.shopGlobalSwitch?.useNativeHarmonyToastVersion;
987
987
  if (
988
988
  getHarmonyVersion &&
989
989
  jdAppVersionCompare(getHarmonyVersion) >= 0 &&
990
990
  !isInJdShopView &&
991
991
  window?.jmfe?.callRouter
992
992
  ) {
993
993
  const params = {
994
994
  routerURL: 'router://JDJShopxModule/showToast',
995
995
  routerParam: routerParam,
996
996
  sync: '',
997
997
  };
998
998
  window.jmfe.callRouter(params).then((res) => {
999
999
  console.log('鸿蒙调用toast成功', res);
1000
1000
  });
1001
1001
  } else {
1002
1002
  const plugin = 'JdShopPlugin';
1003
1003
  const action = 'showToast';
1004
1004
  const params = {
1005
1005
  routerURL: 'router://JDJShopModule/showToast',
1006
1006
  routerParam: routerParam,
1007
1007
  };
1008
1008
  window.XWebView && window.XWebView.callNative(plugin, action, JSON.stringify(params));
1009
1009
  }
1010
1010
  }
1011
1011
  }
1012
1012
  console.log('nativePageLoadReady called');
1013
1013
  Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
1014
1014
  Message_Type.NATIVE_INFO_DATA
1015
1015
  ] = async (data: any) => {
1016
1016
  console.log('nativePageLoadReady callBack:', callBack, ', data:', data);
1017
1017
  callBack && callBack(data);
1018
1018
  };
1019
1019
  nativePageGetMessageInitCallBack();
1020
1020
  nativePageRegisterMessage(
1021
1021
  Message_Type.NATIVE_PAGE_READ,
1022
1022
  sendData,
1023
1023
  Message_CallBack_Name.MESSAGE_HOME_INIT,
1024
1024
  );
1025
1025
  return nativePageRegisterMessage(
1026
1026
  Message_Type.NATIVE_PAGE_FINISH,
1027
1027
  null,
1028
1028
  Message_CallBack_Name.MESSAGE_HOME_INIT,
1029
1029
  );
1030
1030
  callBack &&
1031
1031
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
1032
1032
  Message_Type.NATIVE_GET_SCROLL_TOP
1033
1033
  ] = callBack);
1034
1034
  return nativePageRegisterMessage(
1035
1035
  Message_Type.NATIVE_GET_SCROLL_TOP,
1036
1036
  null,
1037
1037
  Message_CallBack_Name.MESSAGE_HOME_INIT,
1038
1038
  );
1039
1039
  callBack &&
1040
1040
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
1041
1041
  Message_Type.NATIVE_TO_SCROLL_TOP
1042
1042
  ] = callBack);
1043
1043
  nativePageRegisterMessage(
1044
1044
  Message_Type.NATIVE_TO_SCROLL_TOP,
1045
1045
  {
1046
1046
  data: {
1047
1047
  scrollTop,
1048
1048
  },
1049
1049
  },
1050
1050
  Message_CallBack_Name.MESSAGE_HOME_INIT,
1051
1051
  );
1052
1052
  Taro.eventCenter.trigger(TaroEventType.LUXURY_INFORM_CHANGE_HEIGHT, data);
1053
1053
  Taro.eventCenter.trigger(TaroEventType.SHOP_FOLLOW_STATE_REGISTER, data);
1054
1054
  Taro.eventCenter.trigger(TaroEventType.IMMERSIVEHEADER_STATE_CHANGE, data);
1055
1055
  configName: string,
1056
1056
  isBeforePageReady: boolean,
1057
1057
  return new Promise((resolve, reject) => {
1058
1058
  if (!isJdApp) {
1059
1059
  reject({
1060
1060
  code: -1,
1061
1061
  message: 'getMPaasConfigByNative 只在松果APP店铺内部调用有效。',
1062
1062
  });
1063
1063
  return;
1064
1064
  }
1065
1065
  if (
1066
1066
  isIosDevice &&
1067
1067
  isBeforePageReady &&
1068
1068
  versionCompare(jdAppVersionStr, MPAAS_CONFIG_APP_VERSION) < 0
1069
1069
  ) {
1070
1070
  reject({
1071
1071
  code: -2,
1072
1072
  message: `在nativePageLoadReady之前调用,低于v${MPAAS_CONFIG_APP_VERSION}不会有返回,兜底处理`,
1073
1073
  });
1074
1074
  return;
1075
1075
  }
1076
1076
  Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
1077
1077
  Message_Type.NATIVE_MOBILE_CONFIG
1078
1078
  ] = (data: any) => {
1079
1079
  const configData = isAndroidDevice ? data : data?.data;
1080
1080
  const res = JSONParse(configData);
1081
1081
  resolve(res);
1082
1082
  };
1083
1083
  nativePageGetMessageInitCallBack();
1084
1084
  nativePageRegisterMessage(
1085
1085
  Message_Type.NATIVE_MOBILE_CONFIG,
1086
1086
  {
1087
1087
  data: {
1088
1088
  space: isIosDevice ? 'JDCDSHOP' : 'JDShop',
1089
1089
  configName,
1090
1090
  },
1091
1091
  },
1092
1092
  Message_CallBack_Name.MESSAGE_HOME_INIT,
1093
1093
  );
1094
1094
  });
1095
1095
  bussinessKey: string,
1096
1096
  isBeforePageReady: boolean,
1097
1097
  if (!bussinessKey) {
1098
1098
  return null;
1099
1099
  }
1100
1100
  if (!isJdApp) {
1101
1101
  return null;
1102
1102
  }
1103
1103
  const CACHED_MPAAS_KEY = `mpaas_${CONFIG_NAME}`;
1104
1104
  const CACHED_MPAAS_KEY_HELPER = `${CACHED_MPAAS_KEY}_helper`;
1105
1105
  let configData = window[CACHED_MPAAS_KEY];
1106
1106
  if (configData == null) {
1107
1107
  configData = await getMPaasConfigByNative(CONFIG_NAME, isBeforePageReady).catch((e) => {
1108
1108
  console.log('getMPaasConfigByNative error:', e);
1109
1109
  return null;
1110
1110
  });
1111
1111
  window[CACHED_MPAAS_KEY_HELPER] = {};
1112
1112
  window[CACHED_MPAAS_KEY] = configData;
1113
1113
  }
1114
1114
  if (configData) {
1115
1115
  const originData = configData[bussinessKey];
1116
1116
  const hasParse = window[CACHED_MPAAS_KEY_HELPER][bussinessKey];
1117
1117
  try {
1118
1118
  if (hasParse || ['object', 'boolean', 'number'].includes(typeof originData)) {
1119
1119
  return originData;
1120
1120
  } else {
1121
1121
  window[CACHED_MPAAS_KEY_HELPER][bussinessKey] = true;
1122
1122
  const parseData = JSON.parse(configData[bussinessKey]);
1123
1123
  configData[bussinessKey] = parseData;
1124
1124
  return parseData;
1125
1125
  }
1126
1126
  } catch (e) {
1127
1127
  return originData;
1128
1128
  }
1129
1129
  }
1130
1130
  return null;
1131
1131
  nativePageRegisterMessage(Message_Type.NATIVE_CLOSE_SCROLL_MESSAGE);
1132
1132
  if (isJdAndAndroidDevice) {
1133
1133
  callBack &&
1134
1134
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
1135
1135
  Message_Type.NATIVE_HOME_PAGING_ENABLE
1136
1136
  ] = callBack);
1137
1137
  nativePageRegisterMessage(Message_Type.NATIVE_HOME_PAGING_ENABLE, {
1138
1138
  data: {
1139
1139
  enable: enable,
1140
1140
  },
1141
1141
  });
1142
1142
  }
1143
1143
  if (isJdAndAndroidDevice) {
1144
1144
  callBack &&
1145
1145
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
1146
1146
  Message_Type.NATIVE_GET_SCALED_TOUCH_SLOP
1147
1147
  ] = callBack);
1148
1148
  nativePageRegisterMessage(Message_Type.NATIVE_GET_SCALED_TOUCH_SLOP);
1149
1149
  }
1150
1150
  SUCCESS: 'success',
1151
1151
  FAIL: 'fail',
1152
1152
  NORMAL: 'normal',
1153
1153
  SUCCESS: 2,
1154
1154
  FAIL: 3,
1155
1155
  NORMAL: 1,
1156
1156
  SUCCESS: 2,
1157
1157
  FAIL: 3,
1158
1158
  NORMAL: 1,
1159
1159
  [ToastIosType.NORMAL]: ToastType.NORMAL,
1160
1160
  [ToastIosType.SUCCESS]: ToastType.SUCCESS,
1161
1161
  [ToastIosType.FAIL]: ToastType.FAIL,
1162
1162
  if (isShowNewRouterToast) {
1163
1163
  const changeShowType = isJdAndIosDevice
1164
1164
  ? toastIosTypeToNewToastType[showType] || showType
1165
1165
  : showType;
1166
1166
  showToastByRouter(title, changeShowType, duration * 1000);
1167
1167
  } else {
1168
1168
  nativePageRegisterMessage(Message_Type.NATIVE_SHOW_TOAST, {
1169
1169
  data: {
1170
1170
  message: title,
1171
1171
  iconType: showType,
1172
1172
  duration,
1173
1173
  },
1174
1174
  });
1175
1175
  }
1176
1176
  routerURL,
1177
1177
  routerParam,
1178
1178
  callBackName = Message_CallBack_Name.MESSAGE_HOME_INIT,
1179
1179
  isSync = false,
1180
1180
  const getCallBackName = `window.${callBackName}`;
1181
1181
  const params = {
1182
1182
  routerURL,
1183
1183
  serialize: '1',
1184
1184
  routerParam,
1185
1185
  callBackName: getCallBackName,
1186
1186
  callBackId: `${callBackName}Ios`,
1187
1187
  };
1188
1188
  console.log(
1189
1189
  'callRouterIOS routerURL:',
1190
1190
  routerURL,
1191
1191
  ',routerParam:',
1192
1192
  routerParam,
1193
1193
  'params',
1194
1194
  params,
1195
1195
  'isSync',
1196
1196
  isSync,
1197
1197
  );
1198
1198
  window?.webkit?.messageHandlers?.JDAppUnite?.postMessage({
1199
1199
  method: isSync ? 'callSyncRouterModuleWithParams' : 'callRouterModuleWithParams',
1200
1200
  params: JSON.stringify(params),
1201
1201
  });
1202
1202
  routerURL,
1203
1203
  routerParam,
1204
1204
  callBackName = Message_CallBack_Name.MESSAGE_HOME_INIT,
1205
1205
  isSync = false,
1206
1206
  hasJdRouter = true,
1207
1207
  console.log(
1208
1208
  'callRouterAndroid routerURL:',
1209
1209
  routerURL,
1210
1210
  ',routerParam:',
1211
1211
  routerParam,
1212
1212
  'isSync',
1213
1213
  isSync,
1214
1214
  );
1215
1215
  const getCallBackName = `window.${callBackName}`;
1216
1216
  routerParam?.data &&
1217
1217
  typeof routerParam?.data === 'object' &&
1218
1218
  (routerParam.data = JSON.stringify(routerParam?.data));
1219
1219
  var params = {
1220
1220
  serialize: '1',
1221
1221
  routerURL,
1222
1222
  routerParam,
1223
1223
  callBackName: getCallBackName,
1224
1224
  callBackId: `${callBackName}Android`,
1225
1225
  };
1226
1226
  hasJdRouter && (params['jdRouter'] = '1');
1227
1227
  isSync
1228
1228
  ? window?.JDAppUnite?.callSyncRouterModuleWithParams(JSON.stringify(params))
1229
1229
  : window?.JDAppUnite?.callRouterModuleWithParams(JSON.stringify(params));
1230
1230
  pluginName,
1231
1231
  action,
1232
1232
  routerParam,
1233
1233
  callBackName = Message_CallBack_Name.MESSAGE_HOME_INIT,
1234
1234
  isSync = false,
1235
1235
  const getCallBackName = `window.${callBackName}`;
1236
1236
  const params = {
1237
1237
  routerURL: '',
1238
1238
  routerParam: routerParam,
1239
1239
  };
1240
1240
  const outBridgeType = ['getLastAddress', 'getAddress'];
1241
1241
  console.log(
1242
1242
  'callRouterHarmony pluginName:',
1243
1243
  pluginName,
1244
1244
  'action',
1245
1245
  action,
1246
1246
  ',routerParam:',
1247
1247
  routerParam,
1248
1248
  'params',
1249
1249
  params,
1250
1250
  'isSync',
1251
1251
  isSync,
1252
1252
  );
1253
1253
  window?.XWebView?.callNative(
1254
1254
  pluginName,
1255
1255
  action,
1256
1256
  outBridgeType.includes(action) ? JSON.stringify(routerParam) : JSON.stringify(params),
1257
1257
  getCallBackName,
1258
1258
  `${callBackName}HarmonyOS`,
1259
1259
  );
1260
1260
  callRouterHarmony,
1261
1261
  callBack &&
1262
1262
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
1263
1263
  Message_Type.NATIVE_SHOW_DIALOG
1264
1264
  ] = callBack);
1265
1265
  return nativePageRegisterMessage(Message_Type.NATIVE_SHOW_DIALOG, {
1266
1266
  data: params,
1267
1267
  });
1268
1268
  if (!isJdApp) {
1269
1269
  return;
1270
1270
  }
1271
1271
  if (!window[Message_CallBack_Name.MESSAGE_HOME_INIT]) {
1272
1272
  window[Message_CallBack_Name.MESSAGE_HOME_INIT] = (messageData) => {
1273
1273
  try {
1274
1274
  console.log('message2native 接收消息:', JSON.stringify(messageData));
1275
1275
  console.log('接收到原生通知返回的原始数据nativePageGetMessageInitCallBack', messageData);
1276
1276
  const getMessageJsonData = JSONParse(messageData);
1277
1277
  const { status } = getMessageJsonData;
1278
1278
  if (status == '0') {
1279
1279
  const { type, data } = getMessageJsonData?.data;
1280
1280
  const getSendJsonData = JSONParse(data);
1281
1281
  switch (type) {
1282
1282
  case Message_Type.NATIVE_INFO_DATA:
1283
1283
  case Message_Type.NATIVE_PAGE_FINISH:
1284
1284
  case Message_Type.NATIVE_GET_SCROLL_TOP:
1285
1285
  case Message_Type.NATIVE_TO_SCROLL_TOP:
1286
1286
  case Message_Type.NATIVE_CLOSE_SCROLL_MESSAGE:
1287
1287
  case Message_Type.NATIVE_GET_SCALED_TOUCH_SLOP:
1288
1288
  case Message_Type.NATIVE_MOBILE_CONFIG:
1289
1289
  case Message_Type.NATIVE_GET_SHOP_FOLLOW_STATE:
1290
1290
  case Message_Type.GET_ENTER_SHOP_OPEN_APP:
1291
1291
  const getTypeCallBack =
1292
1292
  Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][type];
1293
1293
  if (getTypeCallBack) {
1294
1294
  const isCallBackFunc = typeof getTypeCallBack === 'function';
1295
1295
  console.log('接收到原生通知 NATIVE_SHOPSTOW_SEND getSendJsonData', getSendJsonData);
1296
1296
  isCallBackFunc && getTypeCallBack(getSendJsonData);
1297
1297
  }
1298
1298
  break;
1299
1299
  case Message_Type.GET_COLOR_API_DATA:
1300
1300
  const combinType = `${type}_${getSendJsonData.functionId}`;
1301
1301
  const getcombinTypeCallBack =
1302
1302
  Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
1303
1303
  combinType
1304
1304
  ];
1305
1305
  if (getcombinTypeCallBack) {
1306
1306
  const isCallBackFunc = typeof getcombinTypeCallBack === 'function';
1307
1307
  console.log('接收到原生通知 NATIVE_SHOPSTOW_SEND getSendJsonData', getSendJsonData);
1308
1308
  isCallBackFunc && getcombinTypeCallBack(getSendJsonData);
1309
1309
  }
1310
1310
  break;
1311
1311
  case Message_Type.NATIVE_SHOW_DIALOG:
1312
1312
  const showDialogCallBack =
1313
1313
  Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][type];
1314
1314
  if (showDialogCallBack) {
1315
1315
  const isCallBackFunc = typeof showDialogCallBack === 'function';
1316
1316
  console.log(
1317
1317
  `获取${type}类型数据数据type isCallBackFunc getMessageJsonData `,
1318
1318
  type,
1319
1319
  isCallBackFunc,
1320
1320
  getMessageJsonData,
1321
1321
  );
1322
1322
  isCallBackFunc && showDialogCallBack(getMessageJsonData?.data);
1323
1323
  }
1324
1324
  break;
1325
1325
  case Message_Type.NATIVE_PAGE_SCROLL:
1326
1326
  taroEventSendPageScrollInfo(data);
1327
1327
  break;
1328
1328
  case Message_Type.NATIVE_PAGE_SCROLL_END:
1329
1329
  taroEventSendPageScrollEndInfo(data);
1330
1330
  break;
1331
1331
  case Message_Type.NATIVE_H5_SEND_MSG_TO_H5:
1332
1332
  console.log('接收到原生通知 NATIVE_H5_SEND_MSG_TO_H5', data);
1333
1333
  taroEventH5SendMsgToH5(getSendJsonData);
1334
1334
  break;
1335
1335
  case Message_Type.UPDATE_NATIVE_DATA:
1336
1336
  taroEventUpdateNativeData(getSendJsonData);
1337
1337
  break;
1338
1338
  case Message_Type.H5_TO_SCROLL_TOP:
1339
1339
  taroEventH5ToScrollTop();
1340
1340
  break;
1341
1341
  case Message_Type.NATIVE_SHOPSTOW_SEND:
1342
1342
  console.log('接收到原生通知 NATIVE_SHOPSTOW_SEND', messageData);
1343
1343
  console.log('接收到原生通知 NATIVE_SHOPSTOW_SEND getSendJsonData', getSendJsonData);
1344
1344
  taroEventShopStowSend(getSendJsonData);
1345
1345
  break;
1346
1346
  case Message_Type.LUXURY_INFORM_CHANGE_HEIGHT:
1347
1347
  taroEventSendImmersionStatus(data);
1348
1348
  break;
1349
1349
  case Message_Type.NATIVE_IMMERSIVEHEADER_STATE_CHANGE:
1350
1350
  taroEventSendImmersiveHeaderChange(data);
1351
1351
  break;
1352
1352
  case Message_Type.SHOP_FOLLOW_STATE_REGISTER:
1353
1353
  taroEventSendShopFollowStateChange(data);
1354
1354
  break;
1355
1355
  default:
1356
1356
  }
1357
1357
  } else {
1358
1358
  console.log('传递数据获取异常', getMessageJsonData);
1359
1359
  }
1360
1360
  } catch (e) {
1361
1361
  console.log('获取转换异常结果', e);
1362
1362
  }
1363
1363
  };
1364
1364
  }
1365
1365
  console.warn('🚀 ~~ JumpTabBarInCurrentShop() ~~ params:', params);
1366
1366
  nativePageRegisterMessage(Message_Type.NATIVE_JUMP_TAB_BAR, {
1367
1367
  data: params,
1368
1368
  });
1369
1369
  nativePageRegisterMessage(Message_Type.NATIVE_OPEN_FLOAT, {
1370
1370
  data: params,
1371
1371
  });
1372
1372
  const changeData = {
1373
1373
  type: NATIVE_POP_WEBVIEW_TYPE.OPEN,
1374
1374
  height: DEFAULT_POP_WEBVIEW_HEIGHT,
1375
1375
  };
1376
1376
  if (isChangeDefaultPopViewHeight && !params?.height) {
1377
1377
  changeData.height = Math.round(window.screen.height * 0.8);
1378
1378
  changeData.borderRadius = 12;
1379
1379
  }
1380
1380
  nativePageRegisterMessage(Message_Type.NATIVE_POP_WEBVIEW, {
1381
1381
  data: {
1382
1382
  ...changeData,
1383
1383
  ...params,
1384
1384
  },
1385
1385
  });
1386
1386
  nativePageRegisterMessage(Message_Type.NATIVE_POP_WEBVIEW, {
1387
1387
  data: {
1388
1388
  type: NATIVE_POP_WEBVIEW_TYPE.CLOSE,
1389
1389
  ...params,
1390
1390
  },
1391
1391
  });
1392
1392
  Taro.eventCenter.off(TaroEventType.JOIN_MEMBER_SUCCESS);
1393
1393
  console.log('popWebview关闭');
1394
1394
  nativePageRegisterMessage(Message_Type.NATIVE_H5_SEND_MSG_TO_H5, {
1395
1395
  data: params,
1396
1396
  });
1397
1397
  nativePageRegisterMessage(Message_Type.NATIVE_PUSH_NATIVE_PAGE, {
1398
1398
  data: params,
1399
1399
  });
1400
1400
  window &&
1401
1401
  (window.location.href = `xview://search?request={"action":"${Message_Type.NAVTIVE_FLOAT_READY}"}`);
1402
1402
  const { displayHeight, offSetY } = res;
1403
1403
  if (typeof displayHeight === 'undefined' || typeof offSetY === 'undefined') return;
1404
1404
  if (isIosDevice) return res;
1405
1405
  if (isAndroidDevice) {
1406
1406
  const deviceRatio = window.devicePixelRatio;
1407
1407
  const cssDisplayHeight = Math.ceil(displayHeight / deviceRatio);
1408
1408
  const cssOffsetY = Math.ceil(offSetY / deviceRatio);
1409
1409
  return {
1410
1410
  displayHeight: cssDisplayHeight,
1411
1411
  offSetY: cssOffsetY,
1412
1412
  };
1413
1413
  }
1414
1414
  nativePageRegisterMessage(Message_Type.NATIVE_UPDATE_PAGE_INFO, {
1415
1415
  data: params,
1416
1416
  });
1417
1417
  nativePageRegisterMessage(Message_Type.NATIVE_TO_BUYER_SHOW_DETAIL, {
1418
1418
  data: params,
1419
1419
  });
1420
1420
  nativePageRegisterMessage(Message_Type.NATIVE_TO_HIDE_JD_SHOP_HEADER, {
1421
1421
  data: params,
1422
1422
  });
1423
1423
  nativePageRegisterMessage(Message_Type.NATIVE_TO_SHOW_CART_BTN, {
1424
1424
  data: params,
1425
1425
  });
1426
1426
  nativePageRegisterMessage(Message_Type.SHOP_FOLLOW_STATE_REGISTER, {
1427
1427
  data: params,
1428
1428
  });
1429
1429
  callBack &&
1430
1430
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
1431
1431
  Message_Type.NATIVE_GET_SHOP_FOLLOW_STATE
1432
1432
  ] = callBack);
1433
1433
  nativePageRegisterMessage(Message_Type.NATIVE_GET_SHOP_FOLLOW_STATE, {
1434
1434
  data: {},
1435
1435
  });
1436
1436
  nativePageRegisterMessage(Message_Type.SHOP_FOLLOW_STATE_SYNC, {
1437
1437
  data: {
1438
1438
  followed: followState,
1439
1439
  },
1440
1440
  });
1441
1441
  nativePageRegisterMessage(Message_Type.H5_TO_NATIVE_LIVE_RESERVE_STATE, {
1442
1442
  data: params,
1443
1443
  });
1444
1444
  Taro.eventCenter.on('SEND_MSG_TO_NATIVE', (key, params) => {
1445
1445
  nativePageRegisterMessage(key, {
1446
1446
  data: params,
1447
1447
  });
1448
1448
  });
1449
1449
  nativePageRegisterMessage(Message_Type.H5_TO_NATIVE_SCROLL_TO_TOP, {
1450
1450
  data: params,
1451
1451
  });
1452
1452
  functionid: string;
1453
1453
  callBack &&
1454
1454
  params.functionid &&
1455
1455
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
1456
1456
  Message_Type.GET_COLOR_API_DATA + '_' + params.functionid
1457
1457
  ] = callBack);
1458
1458
  nativePageRegisterMessage(Message_Type.GET_COLOR_API_DATA, {
1459
1459
  data: params.functionid,
1460
1460
  });
1461
1461
  callBack &&
1462
1462
  (Message_Trigger_CallBackFuncObj[Message_CallBack_Name.MESSAGE_HOME_INIT][
1463
1463
  Message_Type.GET_ENTER_SHOP_OPEN_APP
1464
1464
  ] = callBack);
1465
1465
  nativePageRegisterMessage(Message_Type.GET_ENTER_SHOP_OPEN_APP, {});