@conecli/cone-render 0.10.1-shop3.47 → 0.10.1-shop3.49

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