@conecli/cone-render 0.10.1-isv2.4 → 0.10.1-isv3.1

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.
Files changed (105) hide show
  1. package/README.md +1 -1
  2. package/dist/api/index.ts +1 -1
  3. package/dist/common/accessibility.h5.ts +1 -0
  4. package/dist/common/accessibility.ts +1 -0
  5. package/dist/common/const.ts +1 -1
  6. package/dist/common/index.h5.ts +1 -1
  7. package/dist/common/index.jd.ts +1 -1
  8. package/dist/common/index.ts +1 -1
  9. package/dist/common/index.weapp.ts +1 -1
  10. package/dist/common/jdplayerSdk.weapp.tsx +1 -0
  11. package/dist/common/jssdk.weapp.ts +1 -0
  12. package/dist/common/pageType.ts +1 -1
  13. package/dist/common/token/index.h5.ts +1 -1
  14. package/dist/common/token/token.jd.ts +1 -1
  15. package/dist/common/wxappApi.ascf.ts +1 -0
  16. package/dist/components/ErrorBoundary.tsx +1 -1
  17. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  18. package/dist/components/base/CountDown/index.tsx +1 -1
  19. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  20. package/dist/components/base/CustomVideo/index.tsx +1 -1
  21. package/dist/components/base/CustomVideo/index.weapp.tsx +1 -0
  22. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  23. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  24. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  25. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  26. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  27. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  28. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  29. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  30. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  31. package/dist/components/base/NetworkDataError/const.ts +1 -1
  32. package/dist/components/base/NetworkDataError/index.module.scss +118 -72
  33. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  34. package/dist/components/base/Price/Base/index.module.scss +12 -0
  35. package/dist/components/base/Price/Base/index.tsx +1 -1
  36. package/dist/components/base/Price/Double/index.module.scss +25 -1
  37. package/dist/components/base/Price/Double/index.tsx +1 -1
  38. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  39. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  40. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  41. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  42. package/dist/components/floorItem.tsx +1 -1
  43. package/dist/components/isv/Floor/index.tsx +1 -1
  44. package/dist/components/remoteFloorItem.tsx +1 -1
  45. package/dist/config/env.ts +1 -1
  46. package/dist/interface/common.ts +1 -1
  47. package/dist/interface/component.ts +1 -1
  48. package/dist/interface/jumpEventReport.ts +1 -1
  49. package/dist/interface/service.ts +1 -1
  50. package/dist/jumpEventReport/base.ts +1 -1
  51. package/dist/jumpEventReport/const.ts +1 -1
  52. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  53. package/dist/jumpEventReport/index.h5.ts +1 -1
  54. package/dist/jumpEventReport/index.jd.ts +1 -1
  55. package/dist/jumpEventReport/index.weapp.ts +1 -1
  56. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  57. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  58. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  59. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  60. package/dist/jumpEventReport/web/report.ts +1 -1
  61. package/dist/jumpEventReport/web.base.ts +1 -1
  62. package/dist/jumpEventReport/web.jd.ts +1 -1
  63. package/dist/jumpEventReport/web.pc.ts +1 -1
  64. package/dist/jumpEventReport/web.tjm.ts +1 -1
  65. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  66. package/dist/language/en_US.json +395 -0
  67. package/dist/language/zh_CN.json +395 -0
  68. package/dist/language/zh_HK.json +395 -0
  69. package/dist/libs/openShopBridge.js +161 -0
  70. package/dist/libs/openShopBridge.min.js +1 -0
  71. package/dist/libs/taroAppReport.js +2 -2
  72. package/dist/modules/ContainerFloorList/index.h5.module.scss +16 -2
  73. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  74. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  75. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  76. package/dist/open/api/shopMember.ts +1 -1
  77. package/dist/open/api/shopMember.weapp.ts +1 -0
  78. package/dist/open/api/track.ts +1 -1
  79. package/dist/open/api/util.ts +1 -1
  80. package/dist/open/components/index.ts +1 -1
  81. package/dist/open/index.ts +1 -1
  82. package/dist/sass/app.h5.scss +6 -1
  83. package/dist/sass/base.scss +8 -4
  84. package/dist/service/fetchGateway.ts +1 -1
  85. package/dist/service/fetchGateway.weapp.ts +1 -1
  86. package/dist/service/fetchJsonp.weapp.ts +1 -0
  87. package/dist/service/http/h5Http.ts +1 -1
  88. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  89. package/dist/service/requestServer.h5.ts +1 -1
  90. package/dist/service/requestServer.ts +1 -1
  91. package/dist/service/requestServer.weapp.ts +1 -1
  92. package/dist/utils/connectNativeJsBridge.ts +1 -1
  93. package/dist/utils/h5Utils.ts +1 -1
  94. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  95. package/dist/utils/harmonyCallRouter.ts +0 -0
  96. package/dist/utils/index.h5.ts +1 -1
  97. package/dist/utils/index.ts +1 -1
  98. package/dist/utils/index.weapp.ts +1 -1
  99. package/dist/utils/jumpExtMapUtil.weapp.ts +1 -0
  100. package/dist/utils/sColor.weapp.ts +1 -0
  101. package/dist/utils/utils.ts +1 -1
  102. package/package.json +42 -36
  103. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  104. package/dist/utils/priceUtils.js +0 -1
  105. /package/dist/utils/{sColor.js → sColor.ts} +0 -0
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro';
2
1
  WXAPP_LOGIN,
3
2
  WXAPP_BIZ,
4
3
  WXAPP_USER_INFO,
5
4
  WXAPP_NAVIGATOR,
6
5
  WXAPP_REPORT_GDT,
7
6
  WXAPP_PARAMS_SIGN,
8
7
  BUSINESS_TYPE,
9
8
  SHOP_MENU_ID_TYPE,
10
9
  SHOP_MENU_ID_NAME,
11
10
  SECTION_HOME_TAB_NAME_TYPE,
12
11
  SECTION_HOME_TAB_TYPE,
13
12
  WXAPP_BIZ_KEY,
14
13
  WX_BUSINESS_TYPE,
15
14
  TaroEventType,
16
15
  abTestLabels: {},
17
16
  nonSellableSkuids: {},
18
17
  loginState: jdUserLoginState,
19
18
  cookiesStr: '',
20
19
  userInfo: userPinKey,
21
20
  isImmersive: false,
22
21
  pageInfo: {
23
22
  wxBusinessType: WX_BUSINESS_TYPE.SHOP,
24
23
  address: '',
25
24
  addressCommaStr: '',
26
25
  un_area: '',
27
26
  userLbsAddress: '',
28
27
  vapptype: '1',
29
28
  pageType: 'home',
30
29
  dataType: BUSINESS_TYPE.ONLINE,
31
30
  floorExposureInfo: {},
32
31
  floorVideInfo: {},
33
32
  productVideInfo: {},
34
33
  tabsLoadAllDataInfo: {
35
34
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: false,
36
35
  [SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
37
36
  },
38
37
  updateShopInfosAllState: false,
39
38
  isVipShop: false,
40
39
  isJdShowNativeImmersivePlayer: false,
41
40
  ...shopConfig,
42
41
  pageScrollTop: 0,
43
42
  pageIdxHeightInfo: {
44
43
  list: [],
45
44
  },
46
45
  shopNavBarHeight: 0,
47
46
  },
48
47
  defaultQueryLogInfo: {
49
48
  sourceType: 'JDshop',
50
49
  sourceValue: '',
51
50
  moduleId: 'none',
52
51
  entrance: 'none',
53
52
  },
54
53
  sysInfo: {
55
54
  windowWidth: 0,
56
55
  windowHeight: 0,
57
56
  netWorkType: '4g',
58
57
  jdBottomBarHeight: 0,
59
58
  jdNativeHeaderHeight: 0,
60
59
  },
61
60
  queryInfo: {},
62
61
  shopInfo: {},
63
62
  openAppData: {},
64
63
  public info: CommonInterFace.BaseConfigInfo;
65
64
  public config: {
66
65
  [key: string]: any;
67
66
  };
68
67
  public lazyContainer: CommonInterFace.lazyContainer;
69
68
  public renderedIsvComponents: CommonInterFace.renderedIsvComponents;
70
69
  public rootEleNode: HTMLElement | null;
71
70
  public miniApplogUtil: CommonInterFace.MiniApplogUtil;
72
71
  public miniAppLogInstance: CommonInterFace.MiniAppLog | null;
73
72
  public checkStatusAndLoginPromise: object | null;
74
73
  public wxAppLoginInstance: CommonInterFace.WxAppLogin;
75
74
  public wxAppBizInstance: CommonInterFace.WxAppUserInfo;
76
75
  public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo;
77
76
  public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT;
78
77
  public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator;
79
78
  public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign;
80
79
  public loadJsSdkList: Array<any>;
81
80
  public loadJsSdkListCachePromise: any;
82
81
  constructor(opt) {
83
82
  this.info = this._getConfig(opt);
84
83
  this.config = {};
85
84
  this.lazyContainer = {
86
85
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
87
86
  appLazyContainerList: [],
88
87
  appLazyFinishContainerList: [],
89
88
  },
90
89
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
91
90
  appLazyContainerList: [],
92
91
  appLazyFinishContainerList: [],
93
92
  },
94
93
  };
95
94
  this.loadJsSdkList = [];
96
95
  this.loadJsSdkListCachePromise = {};
97
96
  this.renderedIsvComponents = {};
98
97
  this.rootEleNode = null;
99
98
  this.miniApplogUtil = MiniAppLogUtil;
100
99
  this.miniAppLogInstance = null;
101
100
  this.checkStatusAndLoginPromise = null;
102
101
  this.wxAppLoginInstance = WXAPP_LOGIN;
103
102
  this.wxAppBizInstance = WXAPP_BIZ;
104
103
  this.wxAppUserInfoInstance = WXAPP_USER_INFO;
105
104
  this.wxAppReportGDTInstance = WXAPP_REPORT_GDT;
106
105
  this.wxAppNavigatorInstance = WXAPP_NAVIGATOR;
107
106
  this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN;
108
107
  }
109
108
  _getConfig(opt) {
110
109
  return Object.assign({}, DefaultConfig, opt);
111
110
  }
112
111
 
113
112
  taskTimeoutPromise(callBack, timeout = 2000) {
114
113
  return new Promise((resolve) => {
115
114
  setTimeout(() => {
116
115
  const getCallBackRes = typeof callBack === 'function' && callBack();
117
116
  return resolve(getCallBackRes || false);
118
117
  }, timeout);
119
118
  });
120
119
  }
121
120
  removeJdAndroidRquestEventForTouchStart() {}
122
121
 
123
122
  updateBusinessDomainAndApi(domain, api) {
124
123
  }
125
124
 
126
125
  getFullScreenHeight(systemInfo) {
127
126
  const { screenHeight, statusBarHeight, isAndroid } = systemInfo;
128
127
  let result = screenHeight;
129
128
  if (statusBarHeight > 20 && isAndroid) {
130
129
  result = screenHeight + statusBarHeight;
131
130
  }
132
131
  return result;
133
132
  }
134
133
 
135
134
  getTabBarHeight(systemInfo) {
136
135
  const { statusBarHeight, isAndroid, isIOS } = systemInfo;
137
136
  let result = 50;
138
137
  if (statusBarHeight > 20) {
139
138
  if (isIOS) {
140
139
  result = 84;
141
140
  } else if (isAndroid) {
142
141
  result = 53;
143
142
  }
144
143
  }
145
144
  return result;
146
145
  }
147
146
 
148
147
  getSystemInfo() {
149
148
  const info: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfos() || {};
150
149
  const actualNavBarHeight = (info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0);
151
150
  const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0);
152
151
  const fullScreenHeight = this.getFullScreenHeight(info);
153
152
  const tabBarHeight = this.getTabBarHeight(info);
154
153
  const safeContentHeight = fullScreenHeight - headerHeight;
155
154
  this.info.sysInfo = {
156
155
  ...this.info.sysInfo,
157
156
  ...info,
158
157
  actualNavBarHeight,
159
158
  headerHeight,
160
159
  fullScreenHeight,
161
160
  tabBarHeight,
162
161
  safeContentHeight,
163
162
  };
164
163
  if (this.info.sysInfo['hostVersionName']) {
165
164
  this.info.sysInfo['hostAppVersion'] = Number(
166
165
  this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
167
166
  );
168
167
  }
169
168
  this.info.sysInfo['wifiVideoAutoPlay'] = false;
170
169
  this.getNetWorkType();
171
170
  }
172
171
  async updateMPaasConfig() {}
173
172
 
174
173
  getNetWorkType() {
175
174
  Taro.getNetworkType().then((getRes) => {
176
175
  getRes && getRes.networkType && (this.info.sysInfo['netWorkType'] = getRes.networkType);
177
176
  });
178
177
  }
179
178
  getAPPUseStraightCorner() {
180
179
  return Promise.resolve(false);
181
180
  }
182
181
  checkStatusAndLogin(options = {}) {
183
182
  this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
184
183
  console.log('微信小程序登录状态及获取cookie状态的promise,之前登录状态', this.info.loginState);
185
184
  this.toLogin(options)
186
185
  .then((res) => {
187
186
  console.log('微信小程序登录状态结果,成功', res);
188
187
  this.info.loginState = true;
189
188
  resolve(res);
190
189
  })
191
190
  .catch((err) => {
192
191
  console.log('微信小程序登录异常状态结果', err);
193
192
  this.doLogin(options)
194
193
  .then((res2) => {
195
194
  console.log('微信小程序wxDoLogin强制登陆成功:', res2);
196
195
  this.info.loginState = true;
197
196
  resolve(res2);
198
197
  })
199
198
  .catch((err2) => {
200
199
  console.log('微信小程序wxDoLogin强制登陆失败:', err2);
201
200
  this.checkStatusAndLoginPromise = null;
202
201
  reject(err2);
203
202
  });
204
203
  });
205
204
  });
206
205
  return this.checkStatusAndLoginPromise;
207
206
  }
208
207
 
209
208
  checkJdStatusAndLogin(options) {
210
209
  return this.checkStatusAndLogin(options);
211
210
  }
212
211
 
213
212
  toLogin(options = {}): Promise<any> {
214
213
  return this.wxAppLoginInstance
215
214
  .getLoginPromise({
216
215
  mode: 'silent',
217
216
  loginColor: {
218
217
  biz: WXAPP_BIZ_KEY,
219
218
  dpin: 0,
220
219
  },
221
220
  ...options,
222
221
  })
223
222
  .then((res) => {
224
223
  console.log('微信app登录返回信息,微信侧返回code为0表示成功', res);
225
224
  this.getLoginCookie();
226
225
  })
227
226
  .catch((err) => {
228
227
  console.log('微信app登录异常返回信息', err);
229
228
  });
230
229
  }
231
230
 
232
231
  doLogin(options = {}) {
233
232
  return this.wxAppLoginInstance
234
233
  .doLogin({
235
234
  loginColor: {
236
235
  biz: WXAPP_BIZ_KEY,
237
236
  dpin: 0,
238
237
  },
239
238
  ...options,
240
239
  })
241
240
  .then((res) => {
242
241
  this.getLoginCookie();
243
242
  console.log('微信小程序强制登录返回信息,微信侧返回code为0表示成功', res);
244
243
  return res;
245
244
  });
246
245
  }
247
246
 
248
247
  doLoginForJdPin(options = {}) {
249
248
  return this.doLogin(options);
250
249
  }
251
250
 
252
251
  getLoginCookie(updateKey = 'wxapp') {
253
252
  return new Promise((resolve) => {
254
253
  console.log('开始获取更新wxapp中的cookie信息', updateKey);
255
254
  if (
256
255
  this.config.wqCookie &&
257
256
  this.config.wqCookieStr &&
258
257
  this.config.getWqCookieKey === updateKey
259
258
  ) {
260
259
  console.log('已有存储wxapp中的cookie信息,直接返回', this.config);
261
260
  resolve({
262
261
  wqCookie: this.config.wqCookie,
263
262
  wqCookieStr: this.config.wqCookieStr,
264
263
  });
265
264
  } else {
266
265
  if (isPublishToWxapp) {
267
266
  const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null;
268
267
  if (getWxappCookieObj) {
269
268
  const getCookieObj = getWxappCookieObj['_data'];
270
269
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
271
270
  const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie;
272
271
  this.info.loginState = true;
273
272
  this.info.userInfo.wqCookie = wqCookieStr;
274
273
  this.info.userInfo.wqVisitkey = visitkey;
275
274
  console.log('获取用户完整cookie信息', getCookieObj);
276
275
  const getUserAddress = this.wxAppUserInfoInstance.getAddress();
277
276
  console.log('获取微信用户地址信息', getUserAddress);
278
277
  if (getUserAddress) {
279
278
  this.info.pageInfo.address = getUserAddress?.areaId;
280
279
  this.info.pageInfo.addressCommaStr = this.info.pageInfo.address
281
280
  ? this.info.pageInfo.address.replace(/_/g, ',')
282
281
  : '';
283
282
  this.info.pageInfo.un_area = this.info.pageInfo.address;
284
283
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
285
284
  area: this.info.pageInfo.address,
286
285
  });
287
286
  }
288
287
  if (this.miniAppLogInstance) {
289
288
  this.miniAppLogInstance.set({
290
289
  account: pin,
291
290
  unionid: wq_unionid,
292
291
  openid: wxapp_openid,
293
292
  });
294
293
  }
295
294
  this.config.wqCookie = wqCookie;
296
295
  this.config.wqCookieStr = wqCookieStr;
297
296
  this.config.getWqCookieKey = updateKey;
298
297
  console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
299
298
  resolve({
300
299
  wqCookie,
301
300
  wqCookieStr,
302
301
  });
303
302
  } else {
304
303
  console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
305
304
  resolve({
306
305
  wqCookie: false,
307
306
  wqCookieStr: false,
308
307
  });
309
308
  }
310
309
  } else {
311
310
  resolve({
312
311
  wqCookie: false,
313
312
  wqCookieStr: false,
314
313
  });
315
314
  }
316
315
  }
317
316
  });
318
317
  }
319
318
 
320
319
 
321
320
  checkLoginStatus() {
322
321
  return this.getLoginCookie();
323
322
  }
324
323
 
325
324
  getAddressCachePromise() {
326
325
  return Promise.reject('该方法只在APP内适用');
327
326
  }
328
327
 
329
328
  getLbsAddressCachePromise() {
330
329
  return Promise.resolve({
331
330
  status: '-1005',
332
331
  msg: '暂未实现,获取失败',
333
332
  });
334
333
  }
335
334
 
336
335
  getDynamicConfig(key: string) {
337
336
  console.warn('调用默认的 getDynamicConfig(),注意,此方法还未实现!');
338
337
  return null;
339
338
  }
340
339
 
341
340
  updatePageAndLogInfo(updateQuery = {}) {
342
341
  const createUpdateQueryInfo: {
343
342
  query: {
344
343
  shopId?: string | number;
345
344
  venderId?: string | number;
346
345
  };
347
346
  updateShopInfoState: boolean;
348
347
  } = Object.assign(
349
348
  {},
350
349
  {
351
350
  query: {},
352
351
  updateShopInfoState: false,
353
352
  },
354
353
  updateQuery,
355
354
  );
356
355
  console.log(
357
356
  '获取当前下发的店铺查询参数',
358
357
  updateQuery,
359
358
  '获取之前保存的shopInfo店铺查询参数',
360
359
  this.info?.shopInfo,
361
360
  );
362
361
  const { query, updateShopInfoState } = createUpdateQueryInfo;
363
362
  const { shopId, venderId } = query;
364
363
  if (updateShopInfoState) {
365
364
  this.info.queryInfo = {
366
365
  ...this.info.queryInfo,
367
366
  ...query,
368
367
  };
369
368
  if (shopId && venderId) {
370
369
  this.info.shopInfo = {
371
370
  shopId: `${shopId}`,
372
371
  venderId: `${venderId}`,
373
372
  };
374
373
  }
375
374
  } else {
376
375
  this.info.queryInfo = {
377
376
  ...query,
378
377
  };
379
378
  if (
380
379
  this.info.shopInfo?.shopId &&
381
380
  this.info.shopInfo?.venderId &&
382
381
  (this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
383
382
  ) {
384
383
  this.info.queryInfo.shopId = this.info.shopInfo.shopId;
385
384
  this.info.queryInfo.venderId = this.info.shopInfo.venderId;
386
385
  console.log(
387
386
  '当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
388
387
  this.info.queryInfo,
389
388
  );
390
389
  }
391
390
  }
392
391
  this.info.queryInfo['shopId'] &&
393
392
  (this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
394
393
  this.info.queryInfo['venderId'] &&
395
394
  (this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
396
395
  console.log(
397
396
  '默认==获取店铺下发查询参数\n',
398
397
  query,
399
398
  '\n获取店铺最后查询参数\n',
400
399
  this.info.queryInfo,
401
400
  '\n是否为更新店铺状态\n',
402
401
  updateShopInfoState,
403
402
  );
404
403
  }
405
404
 
406
405
  checkJingGouWxappEnv() {
407
406
  return false;
408
407
  }
409
408
  renderNextTickLoadSdk() {
410
409
  console.warn('暂未实现 index.ts');
411
410
  }
412
411
  loadOtherSdk() {
413
412
  console.warn('暂未实现 index.ts');
414
413
  }
415
414
  loadItemSdkPromise(jsInfo = {}) {
416
415
  console.warn('暂未实现 index.ts');
417
416
  }
417
+ import Taro from '@tarojs/taro';
418
418
  WXAPP_LOGIN,
419
419
  WXAPP_BIZ,
420
420
  WXAPP_USER_INFO,
421
421
  WXAPP_NAVIGATOR,
422
422
  WXAPP_REPORT_GDT,
423
423
  WXAPP_PARAMS_SIGN,
424
424
  BUSINESS_TYPE,
425
425
  SHOP_MENU_ID_TYPE,
426
426
  SHOP_MENU_ID_NAME,
427
427
  SECTION_HOME_TAB_NAME_TYPE,
428
428
  SECTION_HOME_TAB_TYPE,
429
429
  WXAPP_BIZ_KEY,
430
430
  WX_BUSINESS_TYPE,
431
431
  TaroEventType,
432
432
  getSystemInfos,
433
433
  getTaroStorageKeyValue,
434
434
  getWxAppCookieStr,
435
435
  languageNowType,
436
436
  abTestLabels: {},
437
437
  nonSellableSkuids: {},
438
438
  loginState: jdUserLoginState,
439
439
  cookiesStr: '',
440
440
  userInfo: userPinKey,
441
441
  isImmersive: false,
442
442
  baseAddCartSwitch: true,
443
443
  pageInfo: {
444
444
  wxBusinessType: WX_BUSINESS_TYPE.SHOP,
445
445
  address: '',
446
446
  addressCommaStr: '',
447
447
  fullAddress: '',
448
448
  un_area: '',
449
449
  userLbsAddress: '',
450
450
  vapptype: '1',
451
451
  pageType: 'home',
452
452
  dataType: BUSINESS_TYPE.ONLINE,
453
453
  floorExposureInfo: {},
454
454
  floorVideInfo: {},
455
455
  productVideInfo: {},
456
456
  tabsLoadAllDataInfo: {
457
457
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: false,
458
458
  [SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
459
459
  },
460
460
  updateShopInfosAllState: false,
461
461
  isVipShop: false,
462
462
  isJdShowNativeImmersivePlayer: false,
463
463
  isSuperBrandShop: false,
464
464
  ...shopConfig,
465
465
  pageScrollTop: 0,
466
466
  pageIdxHeightInfo: {
467
467
  list: [],
468
468
  },
469
469
  shopNavBarHeight: 0,
470
470
  },
471
471
  defaultQueryLogInfo: {
472
472
  sourceType: 'JDshop',
473
473
  sourceValue: '',
474
474
  moduleId: 'none',
475
475
  entrance: 'none',
476
476
  },
477
477
  sysInfo: {
478
478
  windowWidth: 0,
479
479
  windowHeight: 0,
480
480
  netWorkType: '4g',
481
481
  jdBottomBarHeight: 0,
482
482
  jdNativeHeaderHeight: 0,
483
483
  },
484
484
  queryInfo: {},
485
485
  shopInfo: {},
486
486
  openAppData: {},
487
487
  public info: CommonInterFace.BaseConfigInfo;
488
488
  public config: {
489
489
  [key: string]: any;
490
490
  };
491
491
  public lazyContainer: CommonInterFace.lazyContainer;
492
492
  public renderedIsvComponents: CommonInterFace.renderedIsvComponents;
493
493
  public rootEleNode: HTMLElement | null;
494
494
  public miniApplogUtil: CommonInterFace.MiniApplogUtil;
495
495
  public miniAppLogInstance: CommonInterFace.MiniAppLog | null;
496
496
  public checkStatusAndLoginPromise: object | null;
497
497
  public wxAppLoginInstance: CommonInterFace.WxAppLogin;
498
498
  public wxAppBizInstance: CommonInterFace.WxAppUserInfo;
499
499
  public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo;
500
500
  public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT;
501
501
  public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator;
502
502
  public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign;
503
503
  public loadJsSdkList: Array<any>;
504
504
  public loadJsSdkListCachePromise: any;
505
505
  public languageJsonData: any | null;
506
506
  public businessWorkerReady: boolean;
507
507
  public jdWorkerReadyPromise: any | null;
508
508
  constructor(opt) {
509
509
  this.info = this._getConfig(opt);
510
510
  this.config = {};
511
511
  this.lazyContainer = {
512
512
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
513
513
  appLazyContainerList: [],
514
514
  appLazyFinishContainerList: [],
515
515
  },
516
516
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
517
517
  appLazyContainerList: [],
518
518
  appLazyFinishContainerList: [],
519
519
  },
520
520
  };
521
521
  this.loadJsSdkList = [];
522
522
  this.loadJsSdkListCachePromise = {};
523
523
  this.renderedIsvComponents = {};
524
524
  this.rootEleNode = null;
525
525
  this.miniApplogUtil = MiniAppLogUtil;
526
526
  this.miniAppLogInstance = null;
527
527
  this.checkStatusAndLoginPromise = null;
528
528
  this.wxAppLoginInstance = WXAPP_LOGIN;
529
529
  this.wxAppBizInstance = WXAPP_BIZ;
530
530
  this.wxAppUserInfoInstance = WXAPP_USER_INFO;
531
531
  this.wxAppReportGDTInstance = WXAPP_REPORT_GDT;
532
532
  this.wxAppNavigatorInstance = WXAPP_NAVIGATOR;
533
533
  this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN;
534
534
  this.languageJsonData = langeJsonDataForCn;
535
535
  this.businessWorkerReady = false;
536
536
  this.jdWorkerReadyPromise = Promise.resolve(false);
537
537
  }
538
538
  _getConfig(opt) {
539
539
  return Object.assign({}, DefaultConfig, opt);
540
540
  }
541
541
  loadApiSafeSteadyReayPromise() {
542
542
  return Promise.resolve(true);
543
543
  }
544
544
  loadH5tagReayPromise() {
545
545
  return Promise.resolve(true);
546
546
  }
547
547
 
548
548
  jmfeReayPromise(): Promise<any> {
549
549
  return Promise.reject(false);
550
550
  }
551
551
 
552
552
  taskTimeoutPromise(callBack, timeout = 2000) {
553
553
  return new Promise((resolve) => {
554
554
  setTimeout(() => {
555
555
  const getCallBackRes = typeof callBack === 'function' && callBack();
556
556
  return resolve(getCallBackRes || false);
557
557
  }, timeout);
558
558
  });
559
559
  }
560
560
  removeJdAndroidRquestEventForTouchStart() {}
561
561
 
562
562
  updateBusinessDomainAndApi(domain, api) {
563
563
  }
564
564
 
565
565
  getFullScreenHeight(systemInfo) {
566
566
  const { screenHeight, statusBarHeight, isAndroid } = systemInfo;
567
567
  let result = screenHeight;
568
568
  if (statusBarHeight > 20 && isAndroid) {
569
569
  result = screenHeight + statusBarHeight;
570
570
  }
571
571
  return result;
572
572
  }
573
573
 
574
574
  getTabBarHeight(systemInfo) {
575
575
  const { statusBarHeight, isAndroid, isIOS } = systemInfo;
576
576
  let result = 50;
577
577
  if (statusBarHeight > 20) {
578
578
  if (isIOS) {
579
579
  result = 84;
580
580
  } else if (isAndroid) {
581
581
  result = 53;
582
582
  }
583
583
  }
584
584
  return result;
585
585
  }
586
586
 
587
587
  getSystemInfo() {
588
588
  const info: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfos() || {};
589
589
  const actualNavBarHeight = (info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0);
590
590
  const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0);
591
591
  const fullScreenHeight = this.getFullScreenHeight(info);
592
592
  const tabBarHeight = this.getTabBarHeight(info);
593
593
  const safeContentHeight = fullScreenHeight - headerHeight;
594
594
  this.info.sysInfo = {
595
595
  ...this.info.sysInfo,
596
596
  ...info,
597
597
  actualNavBarHeight,
598
598
  headerHeight,
599
599
  fullScreenHeight,
600
600
  tabBarHeight,
601
601
  safeContentHeight,
602
602
  languageType: languageNowType,
603
603
  };
604
604
  if (this.info.sysInfo['hostVersionName']) {
605
605
  this.info.sysInfo['hostAppVersion'] = Number(
606
606
  this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
607
607
  );
608
608
  }
609
609
  this.info.sysInfo['wifiVideoAutoPlay'] = false;
610
610
  this.getNetWorkType();
611
611
  }
612
612
  async updateMPaasConfig() {}
613
613
 
614
614
  getNetWorkType() {
615
615
  Taro.getNetworkType().then((getRes) => {
616
616
  getRes && getRes.networkType && (this.info.sysInfo['netWorkType'] = getRes.networkType);
617
617
  });
618
618
  }
619
619
  getAPPUseStraightCorner() {
620
620
  return Promise.resolve(false);
621
621
  }
622
622
  checkStatusAndLogin(options = {}) {
623
623
  this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
624
624
  console.log('微信小程序登录状态及获取cookie状态的promise,之前登录状态', this.info.loginState);
625
625
  this.toLogin(options)
626
626
  .then((res) => {
627
627
  console.log('微信小程序登录状态结果,成功', res);
628
628
  this.info.loginState = true;
629
629
  resolve(res);
630
630
  })
631
631
  .catch((err) => {
632
632
  console.log('微信小程序登录异常状态结果', err);
633
633
  this.doLogin(options)
634
634
  .then((res2) => {
635
635
  console.log('微信小程序wxDoLogin强制登陆成功:', res2);
636
636
  this.info.loginState = true;
637
637
  resolve(res2);
638
638
  })
639
639
  .catch((err2) => {
640
640
  console.log('微信小程序wxDoLogin强制登陆失败:', err2);
641
641
  this.checkStatusAndLoginPromise = null;
642
642
  reject(err2);
643
643
  });
644
644
  });
645
645
  });
646
646
  return this.checkStatusAndLoginPromise;
647
647
  }
648
648
 
649
649
  checkJdStatusAndLogin(options) {
650
650
  return this.checkStatusAndLogin(options);
651
651
  }
652
652
 
653
653
  toLogin(options = {}): Promise<any> {
654
654
  return this.wxAppLoginInstance
655
655
  .getLoginPromise({
656
656
  mode: 'silent',
657
657
  loginColor: {
658
658
  biz: WXAPP_BIZ_KEY,
659
659
  dpin: 0,
660
660
  },
661
661
  ...options,
662
662
  })
663
663
  .then((res) => {
664
664
  console.log('微信app登录返回信息,微信侧返回code为0表示成功', res);
665
665
  this.getLoginCookie();
666
666
  })
667
667
  .catch((err) => {
668
668
  console.log('微信app登录异常返回信息', err);
669
669
  });
670
670
  }
671
671
 
672
672
  doLogin(options = {}) {
673
673
  return this.wxAppLoginInstance
674
674
  .doLogin({
675
675
  loginColor: {
676
676
  biz: WXAPP_BIZ_KEY,
677
677
  dpin: 0,
678
678
  },
679
679
  ...options,
680
680
  })
681
681
  .then((res) => {
682
682
  this.getLoginCookie();
683
683
  console.log('微信小程序强制登录返回信息,微信侧返回code为0表示成功', res);
684
684
  return res;
685
685
  });
686
686
  }
687
687
 
688
688
  doLoginForJdPin(options = {}) {
689
689
  return this.doLogin(options);
690
690
  }
691
691
 
692
692
  getLoginCookie(updateKey = 'wxapp') {
693
693
  return new Promise((resolve) => {
694
694
  console.log('开始获取更新wxapp中的cookie信息', updateKey);
695
695
  if (
696
696
  this.config.wqCookie &&
697
697
  this.config.wqCookieStr &&
698
698
  this.config.getWqCookieKey === updateKey
699
699
  ) {
700
700
  console.log('已有存储wxapp中的cookie信息,直接返回', this.config);
701
701
  resolve({
702
702
  wqCookie: this.config.wqCookie,
703
703
  wqCookieStr: this.config.wqCookieStr,
704
704
  });
705
705
  } else {
706
706
  if (isPublishToWxapp) {
707
707
  const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null;
708
708
  if (getWxappCookieObj) {
709
709
  const getCookieObj = getWxappCookieObj['_data'];
710
710
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
711
711
  const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie;
712
712
  this.info.loginState = true;
713
713
  this.info.userInfo.wqCookie = wqCookieStr;
714
714
  this.info.userInfo.wqVisitkey = visitkey;
715
715
  console.log('获取用户完整cookie信息', getCookieObj);
716
716
  const getUserAddress = this.wxAppUserInfoInstance.getAddress();
717
717
  console.log('获取微信用户地址信息', getUserAddress);
718
718
  if (getUserAddress) {
719
719
  this.info.pageInfo.address = getUserAddress?.areaId;
720
720
  this.info.pageInfo.addressCommaStr = this.info.pageInfo.address
721
721
  ? this.info.pageInfo.address.replace(/_/g, ',')
722
722
  : '';
723
723
  this.info.pageInfo.un_area = this.info.pageInfo.address;
724
724
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
725
725
  area: this.info.pageInfo.address,
726
726
  });
727
727
  }
728
728
  if (this.miniAppLogInstance) {
729
729
  this.miniAppLogInstance.set({
730
730
  account: pin,
731
731
  unionid: wq_unionid,
732
732
  openid: wxapp_openid,
733
733
  });
734
734
  }
735
735
  this.config.wqCookie = wqCookie;
736
736
  this.config.wqCookieStr = wqCookieStr;
737
737
  this.config.getWqCookieKey = updateKey;
738
738
  console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
739
739
  resolve({
740
740
  wqCookie,
741
741
  wqCookieStr,
742
742
  });
743
743
  } else {
744
744
  console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
745
745
  resolve({
746
746
  wqCookie: false,
747
747
  wqCookieStr: false,
748
748
  });
749
749
  }
750
750
  } else {
751
751
  resolve({
752
752
  wqCookie: false,
753
753
  wqCookieStr: false,
754
754
  });
755
755
  }
756
756
  }
757
757
  });
758
758
  }
759
759
 
760
760
 
761
761
  checkLoginStatus() {
762
762
  return this.getLoginCookie();
763
763
  }
764
764
 
765
765
  getAddressCachePromise() {
766
766
  return Promise.reject('该方法只在APP内适用');
767
767
  }
768
768
 
769
769
  getLbsAddressCachePromise() {
770
770
  return Promise.resolve({
771
771
  status: '-1005',
772
772
  msg: '暂未实现,获取失败',
773
773
  });
774
774
  }
775
775
 
776
776
  getDynamicConfig(key: string) {
777
777
  console.warn('调用默认的 getDynamicConfig(),注意,此方法还未实现!');
778
778
  return null;
779
779
  }
780
780
 
781
781
  updatePageAndLogInfo(updateQuery = {}) {
782
782
  const createUpdateQueryInfo: {
783
783
  query: {
784
784
  shopId?: string | number;
785
785
  venderId?: string | number;
786
786
  };
787
787
  updateShopInfoState: boolean;
788
788
  } = Object.assign(
789
789
  {},
790
790
  {
791
791
  query: {},
792
792
  updateShopInfoState: false,
793
793
  },
794
794
  updateQuery,
795
795
  );
796
796
  console.log(
797
797
  '获取当前下发的店铺查询参数',
798
798
  updateQuery,
799
799
  '获取之前保存的shopInfo店铺查询参数',
800
800
  this.info?.shopInfo,
801
801
  );
802
802
  const { query, updateShopInfoState } = createUpdateQueryInfo;
803
803
  const { shopId, venderId } = query;
804
804
  if (updateShopInfoState) {
805
805
  this.info.queryInfo = {
806
806
  ...this.info.queryInfo,
807
807
  ...query,
808
808
  };
809
809
  if (shopId && venderId) {
810
810
  this.info.shopInfo = {
811
811
  shopId: `${shopId}`,
812
812
  venderId: `${venderId}`,
813
813
  };
814
814
  }
815
815
  } else {
816
816
  this.info.queryInfo = {
817
817
  ...query,
818
818
  };
819
819
  if (
820
820
  this.info.shopInfo?.shopId &&
821
821
  this.info.shopInfo?.venderId &&
822
822
  (this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
823
823
  ) {
824
824
  this.info.queryInfo.shopId = this.info.shopInfo.shopId;
825
825
  this.info.queryInfo.venderId = this.info.shopInfo.venderId;
826
826
  console.log(
827
827
  '当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
828
828
  this.info.queryInfo,
829
829
  );
830
830
  }
831
831
  }
832
832
  this.info.queryInfo['shopId'] &&
833
833
  (this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
834
834
  this.info.queryInfo['venderId'] &&
835
835
  (this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
836
836
  console.log(
837
837
  '默认==获取店铺下发查询参数\n',
838
838
  query,
839
839
  '\n获取店铺最后查询参数\n',
840
840
  this.info.queryInfo,
841
841
  '\n是否为更新店铺状态\n',
842
842
  updateShopInfoState,
843
843
  );
844
844
  }
845
845
 
846
846
  checkJingGouWxappEnv() {
847
847
  return false;
848
848
  }
849
849
  renderNextTickLoadSdk() {
850
850
  console.warn('暂未实现 index.ts');
851
851
  }
852
852
  loadOtherSdk() {
853
853
  console.warn('暂未实现 index.ts');
854
854
  }
855
855
  loadItemSdkPromise(jsInfo = {}) {
856
856
  console.warn('暂未实现 index.ts');
857
857
  }
858
858
  createLanguageProimse() {
859
859
  return Promise.reject({
860
860
  msg: '暂未实现',
861
861
  });
862
862
  }