@conecli/cone-render 0.10.1-shop-beta.24 → 0.10.1-shop-beta.26

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