@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
  WXAPP_FINGER_REPORT,
9
8
  WXAPP_REPORT_MANAGE,
10
9
  WXAPP_SUBS_GUIDER,
11
10
  WXAPP_ADDRESS_V2_API,
12
11
  BUSINESS_TYPE,
13
12
  SHOP_MENU_ID_TYPE,
14
13
  SHOP_MENU_ID_NAME,
15
14
  SECTION_HOME_TAB_NAME_TYPE,
16
15
  SECTION_HOME_TAB_TYPE,
17
16
  TaroEventType,
18
17
  WX_BUSINESS_TYPE,
19
18
  WXAPP_BIZ_KEY,
20
19
  WXAPP_BIZ_SHOP_LIGHT_KEY,
21
20
  getSystemInfos,
22
21
  getTaroStorageKeyValue,
23
22
  getWxAppCookieStr,
24
23
  objectToUrlEncode,
25
24
  languageNowType,
26
25
  abTestLabels: {},
27
26
  nonSellableSkuids: {},
28
27
  loginState: jdUserLoginState,
29
28
  cookiesStr: '',
30
29
  userInfo: userPinKey,
31
30
  isImmersive: false,
32
31
  baseAddCartSwitch: true,
33
32
  pageInfo: {
34
33
  wxBusinessType: WX_BUSINESS_TYPE.SHOP,
35
34
  address: '',
36
35
  addressCommaStr: '',
37
36
  un_area: '',
38
37
  userLbsAddress: '',
39
38
  vapptype: '1',
40
39
  pageType: 'home',
41
40
  dataType: BUSINESS_TYPE.ONLINE,
42
41
  floorExposureInfo: {},
43
42
  floorVideInfo: {},
44
43
  productVideInfo: {},
45
44
  tabsLoadAllDataInfo: {
46
45
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: false,
47
46
  [SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
48
47
  },
49
48
  updateShopInfosAllState: false,
50
49
  isVipShop: false,
51
50
  isJdShowNativeImmersivePlayer: false,
52
51
  isSuperBrandShop: false,
53
52
  ...shopConfig,
54
53
  pageScrollTop: 0,
55
54
  pageIdxHeightInfo: {
56
55
  list: [],
57
56
  },
58
57
  shopNavBarHeight: 0,
59
58
  },
60
59
  defaultQueryLogInfo: {
61
60
  sourceType: 'JDshop',
62
61
  sourceValue: '',
63
62
  moduleId: 'none',
64
63
  entrance: 'none',
65
64
  },
66
65
  originQueryInfo: {},
67
66
  sysInfo: {
68
67
  windowWidth: 0,
69
68
  windowHeight: 0,
70
69
  netWorkType: '4g',
71
70
  jdBottomBarHeight: 0,
72
71
  jdNativeHeaderHeight: 0,
73
72
  },
74
73
  queryInfo: {},
75
74
  shopInfo: {},
76
75
  openAppData: {},
77
76
  public info: CommonInterFace.BaseConfigInfo;
78
77
  public config: {
79
78
  [key: string]: any;
80
79
  };
81
80
  public lazyContainer: CommonInterFace.lazyContainer;
82
81
  public rootEleNode: HTMLElement | null;
83
82
  public miniApplogUtil: CommonInterFace.MiniApplogUtil;
84
83
  public miniAppLogInstance: CommonInterFace.MiniAppLog | null;
85
84
  public checkStatusAndLoginPromise: object | null;
86
85
  public wxAppLoginInstance: CommonInterFace.WxAppLogin;
87
86
  public wxAppBizInstance: CommonInterFace.WxAppUserInfo;
88
87
  public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo;
89
88
  public wxAppReportManageInstance: CommonInterFace.wxAppReportManage;
90
89
  public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT;
91
90
  public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator;
92
91
  public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign;
93
92
  public wxAppFingerReportInstance: CommonInterFace.wxAppParamsSign;
94
93
  public wxAppSubsGuider: CommonInterFace.wxAppParamsSign;
95
94
  public wxAppAddressV2apiInstance: CommonInterFace.wxAppAddressV2api;
96
95
  public loadJsSdkList: Array<any>;
97
96
  public loadJsSdkListCachePromise: any;
98
97
  public lbsAddressCachePromise: Promise<any> | null;
99
98
  public languageJsonData: any | null;
100
99
  public businessWorkerReady: boolean;
101
100
  public jdWorkerReadyPromise: any | null;
102
101
  constructor(opt) {
103
102
  this.info = this._getConfig(opt);
104
103
  this.config = {};
105
104
  this.lazyContainer = {
106
105
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
107
106
  appLazyContainerList: [],
108
107
  appLazyFinishContainerList: [],
109
108
  },
110
109
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
111
110
  appLazyContainerList: [],
112
111
  appLazyFinishContainerList: [],
113
112
  },
114
113
  };
115
114
  this.loadJsSdkList = [];
116
115
  this.loadJsSdkListCachePromise = {};
117
116
  this.rootEleNode = null;
118
117
  this.miniApplogUtil = MiniAppLogUtil;
119
118
  this.miniAppLogInstance = null;
120
119
  this.checkStatusAndLoginPromise = null;
121
120
  this.wxAppLoginInstance = WXAPP_LOGIN;
122
121
  this.wxAppBizInstance = WXAPP_BIZ;
123
122
  this.wxAppUserInfoInstance = WXAPP_USER_INFO;
124
123
  this.wxAppReportManageInstance = WXAPP_REPORT_MANAGE;
125
124
  this.wxAppReportGDTInstance = WXAPP_REPORT_GDT;
126
125
  this.wxAppNavigatorInstance = WXAPP_NAVIGATOR;
127
126
  this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN;
128
127
  this.wxAppFingerReportInstance = WXAPP_FINGER_REPORT ? new WXAPP_FINGER_REPORT() : {};
129
128
  this.wxAppSubsGuider = WXAPP_SUBS_GUIDER;
130
129
  this.wxAppAddressV2apiInstance = WXAPP_ADDRESS_V2_API;
131
130
  this.lbsAddressCachePromise = null;
132
131
  this.languageJsonData = langeJsonDataForCn;
133
132
  this.businessWorkerReady = false;
134
133
  this.jdWorkerReadyPromise = Promise.resolve(false);
135
134
  }
136
135
  _getConfig(opt) {
137
136
  return Object.assign({}, DefaultConfig, opt);
138
137
  }
139
138
 
140
139
  jmfeReayPromise(): Promise<any> {
141
140
  return Promise.reject(false);
142
141
  }
143
142
 
144
143
  taskTimeoutPromise(callBack, timeout = 2000) {
145
144
  return new Promise((resolve) => {
146
145
  setTimeout(() => {
147
146
  const getCallBackRes = typeof callBack === 'function' && callBack();
148
147
  return resolve(getCallBackRes || false);
149
148
  }, timeout);
150
149
  });
151
150
  }
152
151
 
153
152
  updateBusinessDomainAndApi(domain, api) {
154
153
  console.log('=================>', 'updateBusinessDomainAndApi');
155
154
  }
156
155
 
157
156
  getFullScreenHeight(systemInfo) {
158
157
  const { screenHeight, statusBarHeight, isAndroid } = systemInfo;
159
158
  let result = screenHeight;
160
159
  if (statusBarHeight > 20 && isAndroid) {
161
160
  result = screenHeight + statusBarHeight;
162
161
  }
163
162
  return result;
164
163
  }
165
164
 
166
165
  getTabBarHeight(systemInfo) {
167
166
  const { statusBarHeight, isAndroid, isIOS } = systemInfo;
168
167
  let result = 50;
169
168
  if (statusBarHeight > 20) {
170
169
  if (isIOS) {
171
170
  result = 84;
172
171
  } else if (isAndroid) {
173
172
  result = 53;
174
173
  }
175
174
  }
176
175
  return result;
177
176
  }
178
177
 
179
178
  getSystemInfo() {
180
179
  const info: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfos() || {};
181
180
  const actualNavBarHeight = (info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0);
182
181
  const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0);
183
182
  const fullScreenHeight = this.getFullScreenHeight(info);
184
183
  const tabBarHeight = this.getTabBarHeight(info);
185
184
  const safeContentHeight = fullScreenHeight - headerHeight;
186
185
  this.info.sysInfo = {
187
186
  ...this.info.sysInfo,
188
187
  ...info,
189
188
  actualNavBarHeight,
190
189
  headerHeight,
191
190
  fullScreenHeight,
192
191
  tabBarHeight,
193
192
  safeContentHeight,
194
193
  languageType: languageNowType,
195
194
  };
196
195
  if (this.info.sysInfo['hostVersionName']) {
197
196
  this.info.sysInfo['hostAppVersion'] = Number(
198
197
  this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
199
198
  );
200
199
  }
201
200
  if (isPublishToWxapp) {
202
201
  this.getAddressCachePromise();
203
202
  this.getLbsAddressCachePromise();
204
203
  }
205
204
  this.info.sysInfo['wifiVideoAutoPlay'] = false;
206
205
  this.getNetWorkType();
207
206
  console.log('获取系统信息', this.info.sysInfo);
208
207
  }
209
208
  async updateMPaasConfig() {}
210
209
 
211
210
  getNetWorkType() {
212
211
  Taro.getNetworkType().then((getRes) => {
213
212
  getRes && getRes.networkType && (this.info.sysInfo['netWorkType'] = getRes.networkType);
214
213
  });
215
214
  }
216
215
  getAPPUseStraightCorner() {
217
216
  return Promise.resolve(false);
218
217
  }
219
218
 
220
219
  checkStatusAndLogin(options = {}) {
221
220
  this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
222
221
  console.log('微信小程序登录状态及获取cookie状态的promise,之前登录状态', this.info.loginState);
223
222
  this.toLogin(options)
224
223
  .then((res) => {
225
224
  console.log('微信小程序登录状态结果,成功', res);
226
225
  this.info.loginState = true;
227
226
  resolve(res);
228
227
  })
229
228
  .catch((err) => {
230
229
  console.log('微信小程序登录异常状态结果', err);
231
230
  this.doLogin(options)
232
231
  .then((res2) => {
233
232
  console.log('微信小程序wxDoLogin强制登陆成功:', res2);
234
233
  this.info.loginState = true;
235
234
  resolve(res2);
236
235
  })
237
236
  .catch((err2) => {
238
237
  console.log('微信小程序wxDoLogin强制登陆失败:', err2);
239
238
  this.checkStatusAndLoginPromise = null;
240
239
  reject(err2);
241
240
  });
242
241
  });
243
242
  });
244
243
  return this.checkStatusAndLoginPromise;
245
244
  }
246
245
 
247
246
  checkJdStatusAndLogin(
248
247
  options = {
249
248
  loginColor: {
250
249
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
251
250
  dpin: 0,
252
251
  },
253
252
  },
254
253
  ) {
255
254
  return this.checkStatusAndLogin(options);
256
255
  }
257
256
 
258
257
  toLogin(options = {}): Promise<any> {
259
258
  return this.wxAppLoginInstance
260
259
  .getLoginPromise({
261
260
  mode: 'common',
262
261
  loginColor: {
263
262
  biz: WXAPP_BIZ_KEY,
264
263
  dpin: 1,
265
264
  },
266
265
  ...options,
267
266
  })
268
267
  .then((res) => {
269
268
  console.log('微信app登录返回信息,微信侧返回code为0表示成功', res);
270
269
  setTimeout(() => {
271
270
  console.log(
272
271
  '微信app登录返回成功后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie',
273
272
  );
274
273
  this.getLoginCookie(`${Date.now()}`);
275
274
  }, 500);
276
275
  })
277
276
  .catch((err) => {
278
277
  console.log('微信app登录异常返回信息,也获取cookie', err);
279
278
  this.getLoginCookie(`${Date.now()}`);
280
279
  });
281
280
  }
282
281
 
283
282
  doLogin(options = {}) {
284
283
  const getParams = {
285
284
  loginColor: {
286
285
  biz: WXAPP_BIZ_KEY,
287
286
  dpin: 1,
288
287
  },
289
288
  ...options,
290
289
  };
291
290
  if (isPublishToWxapp) {
292
291
  getParams['returnUrl'] = `/pages/shopx/pages/index/index?${objectToUrlEncode({
293
292
  ...this.info.originQueryInfo,
294
293
  loadShopxType: 'redirect',
295
294
  })}`;
296
295
  }
297
296
  return this.wxAppLoginInstance.doLogin(getParams).then((res) => {
298
297
  console.log('微信小程序强制登录返回信息,微信侧返回code为0表示成功', res);
299
298
  setTimeout(() => {
300
299
  console.log('微信强制登录后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie');
301
300
  this.getLoginCookie(`${Date.now()}`);
302
301
  }, 500);
303
302
  return res;
304
303
  });
305
304
  }
306
305
 
307
306
  doLoginForJdPin(options = {}) {
308
307
  return this.doLogin({
309
308
  loginColor: {
310
309
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
311
310
  dpin: 0,
312
311
  },
313
312
  ...options,
314
313
  });
315
314
  }
316
315
 
317
316
  getLoginCookie(updateKey = 'wxapp') {
318
317
  return new Promise(async (resolve) => {
319
318
  console.log('开始获取更新wxapp中的cookie信息', updateKey);
320
319
  if (
321
320
  this.config.wqCookie &&
322
321
  this.config.wqCookieStr &&
323
322
  this.config.getWqCookieKey === updateKey
324
323
  ) {
325
324
  console.log('已有存储wxapp中的cookie信息,直接返回', this.config);
326
325
  resolve({
327
326
  wqCookie: this.config.wqCookie,
328
327
  wqCookieStr: this.config.wqCookieStr,
329
328
  });
330
329
  } else {
331
330
  if (isPublishToWxapp) {
332
331
  const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null;
333
332
  if (getWxappCookieObj) {
334
333
  const getCookieObj = getWxappCookieObj['_data'];
335
334
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
336
335
  const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie;
337
336
  this.info.loginState = true;
338
337
  this.info.userInfo.wqCookie = wqCookieStr;
339
338
  this.info.userInfo.wqVisitkey = visitkey;
340
339
  console.log('获取用户完整cookie信息', getCookieObj);
341
340
  if (this.miniAppLogInstance) {
342
341
  this.miniAppLogInstance.set({
343
342
  account: pin,
344
343
  unionid: wq_unionid,
345
344
  openid: wxapp_openid,
346
345
  });
347
346
  }
348
347
  this.config.wqCookie = wqCookie;
349
348
  this.config.wqCookieStr = wqCookieStr;
350
349
  this.config.getWqCookieKey = updateKey;
351
350
  console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
352
351
  resolve({
353
352
  wqCookie,
354
353
  wqCookieStr,
355
354
  });
356
355
  } else {
357
356
  console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
358
357
  resolve({
359
358
  wqCookie: false,
360
359
  wqCookieStr: false,
361
360
  });
362
361
  }
363
362
  } else {
364
363
  resolve({
365
364
  wqCookie: false,
366
365
  wqCookieStr: false,
367
366
  });
368
367
  }
369
368
  }
370
369
  });
371
370
  }
372
371
 
373
372
 
374
373
  checkLoginStatus() {
375
374
  return this.getLoginCookie();
376
375
  }
377
376
 
378
377
  getAddressCachePromise = () => {
379
378
  return new Promise((resolve) => {
380
379
  if (this.info.sysInfo?.area) {
381
380
  resolve({
382
381
  lat: this.info.sysInfo?.lat,
383
382
  lng: this.info.sysInfo?.lng,
384
383
  area: this.info.sysInfo?.area,
385
384
  });
386
385
  } else {
387
386
  const getUserAddress = this.wxAppUserInfoInstance.getAddress();
388
387
  console.info('京购原生获取用户基地址信息', getUserAddress);
389
388
  if (getUserAddress) {
390
389
  const { areaId = '', latitude, longitude } = getUserAddress;
391
390
  this.info.sysInfo['lat'] = `${latitude || ''}`;
392
391
  this.info.sysInfo['lng'] = `${longitude || ''}`;
393
392
  if (areaId && areaId !== '') {
394
393
  this.info.pageInfo.address = areaId;
395
394
  this.info.pageInfo.addressCommaStr = areaId.replace(/_/g, ',');
396
395
  this.info.pageInfo.un_area = areaId;
397
396
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
398
397
  area: areaId,
399
398
  });
400
399
  this.info.sysInfo['area'] = areaId;
401
400
  }
402
401
  resolve({
403
402
  lat: this.info.sysInfo['lat'],
404
403
  lng: this.info.sysInfo['lng'],
405
404
  area: areaId,
406
405
  });
407
406
  } else {
408
407
  resolve({ lat: '', lng: '', area: '' });
409
408
  }
410
409
  }
411
410
  });
412
411
  };
413
412
 
414
413
  getLbsAddressCachePromise(): Promise<{
415
414
  ok: boolean;
416
415
  msg?: string;
417
416
  realTimeArea: string;
418
417
  data?: any;
419
418
  }> {
420
419
  if (!this.lbsAddressCachePromise) {
421
420
  this.lbsAddressCachePromise = new Promise((resolve) => {
422
421
  const getWxappLbsAddressInfo = this.wxAppUserInfoInstance.getLbsAddress();
423
422
  console.info('京购原生获取用户基于lbs的缓存地址信息', getWxappLbsAddressInfo);
424
423
  if (getWxappLbsAddressInfo && getWxappLbsAddressInfo?.areaId !== '') {
425
424
  this.info.pageInfo.userLbsAddress = getWxappLbsAddressInfo?.areaId;
426
425
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
427
426
  realTimeArea: this.info.pageInfo.userLbsAddress,
428
427
  });
429
428
  resolve({
430
429
  ok: true,
431
430
  realTimeArea: getWxappLbsAddressInfo?.areaId || '',
432
431
  });
433
432
  } else {
434
433
  this.wxAppAddressV2apiInstance
435
434
  .fetchLbsAddr({
436
435
  token: 'W23b9sUlcnhCPZxQ2daYMkDqrTL0TeDw9tbDm5lVMVA=',
437
436
  from: 'wxapp_shop_real_area',
438
437
  })
439
438
  .then((res) => {
440
439
  console.info('微信京购里面获取静默实时lbs地址信息结果', res);
441
440
  const { provinceId, cityId, countyId, townId } = res;
442
441
  let realTimeArea = '';
443
442
  if (provinceId) {
444
443
  realTimeArea = `${provinceId}_${cityId || 0}_${countyId || 0}_${townId || 0}`;
445
444
  this.info.pageInfo.userLbsAddress = realTimeArea;
446
445
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
447
446
  realTimeArea: realTimeArea,
448
447
  });
449
448
  } else {
450
449
  this.lbsAddressCachePromise = null;
451
450
  }
452
451
  const getValidRealTimeArea = realTimeArea !== '';
453
452
  resolve({
454
453
  ok: getValidRealTimeArea,
455
454
  msg: getValidRealTimeArea
456
455
  ? '成功'
457
456
  : '根据微信底层接口获取静默实时lbs地址信息异常,详情见data',
458
457
  data: getValidRealTimeArea ? null : res,
459
458
  realTimeArea: realTimeArea,
460
459
  });
461
460
  })
462
461
  .catch((err) => {
463
462
  console.warn('微信京购里面获取静默实时lbs地址信息异常', err);
464
463
  this.lbsAddressCachePromise = null;
465
464
  resolve({
466
465
  ok: false,
467
466
  msg: '微信京购里面获取静默实时lbs地址信息异常',
468
467
  realTimeArea: '',
469
468
  });
470
469
  });
471
470
  }
472
471
  });
473
472
  }
474
473
  return this.lbsAddressCachePromise;
475
474
  }
476
475
 
477
476
  updatePageAndLogInfo(updateQuery = {}) {
478
477
  const createUpdateQueryInfo: {
479
478
  query: {
480
479
  shopId?: string | number;
481
480
  venderId?: string | number;
482
481
  };
483
482
  updateShopInfoState: boolean;
484
483
  } = Object.assign(
485
484
  {},
486
485
  {
487
486
  query: {},
488
487
  updateShopInfoState: false,
489
488
  },
490
489
  updateQuery,
491
490
  );
492
491
  console.log(
493
492
  '获取当前下发的店铺查询参数',
494
493
  updateQuery,
495
494
  '获取之前保存的shopInfo店铺查询参数',
496
495
  this.info?.shopInfo,
497
496
  );
498
497
  const { query, updateShopInfoState } = createUpdateQueryInfo;
499
498
  const { shopId, venderId } = query;
500
499
  if (updateShopInfoState) {
501
500
  this.info.queryInfo = {
502
501
  ...this.info.queryInfo,
503
502
  ...query,
504
503
  };
505
504
  if (shopId && venderId) {
506
505
  this.info.shopInfo = {
507
506
  shopId: `${shopId}`,
508
507
  venderId: `${venderId}`,
509
508
  };
510
509
  }
511
510
  } else {
512
511
  this.info.queryInfo = {
513
512
  ...query,
514
513
  };
515
514
  this.info.originQueryInfo = {
516
515
  ...query,
517
516
  };
518
517
  if (
519
518
  this.info.shopInfo?.shopId &&
520
519
  this.info.shopInfo?.venderId &&
521
520
  (this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
522
521
  ) {
523
522
  this.info.queryInfo.shopId = this.info.shopInfo.shopId;
524
523
  this.info.queryInfo.venderId = this.info.shopInfo.venderId;
525
524
  console.log(
526
525
  '当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
527
526
  this.info.queryInfo,
528
527
  );
529
528
  }
530
529
  }
531
530
  this.info.queryInfo['shopId'] &&
532
531
  (this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
533
532
  this.info.queryInfo['venderId'] &&
534
533
  (this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
535
534
  console.log(
536
535
  'weapp===获取店铺下发查询参数\n',
537
536
  query,
538
537
  '\n获取店铺最后查询参数\n',
539
538
  this.info.queryInfo,
540
539
  '\n是否为更新店铺状态\n',
541
540
  updateShopInfoState,
542
541
  );
543
542
  }
544
543
 
545
544
  getDynamicConfig(key: string) {
546
545
  console.warn('调用微信小程序的 getDynamicConfig(),注意,此方法还未实现!');
547
546
  return null;
548
547
  }
549
548
  renderNextTickLoadSdk() {
550
549
  console.warn('暂未实现 index.weapp.ts');
551
550
  }
552
551
  loadOtherSdk() {
553
552
  console.warn('暂未实现 index.weapp.ts');
554
553
  }
555
554
  loadItemSdkPromise() {
556
555
  console.warn('暂未实现 index.weapp.ts');
557
556
  }
558
557
  createLanguageProimse() {
559
558
  return Promise.reject({
560
559
  msg: '暂未实现',
561
560
  });
562
561
  }
562
+ import Taro from '@tarojs/taro';
563
563
  WXAPP_LOGIN,
564
564
  WXAPP_BIZ,
565
565
  WXAPP_USER_INFO,
566
566
  WXAPP_NAVIGATOR,
567
567
  WXAPP_REPORT_GDT,
568
568
  WXAPP_PARAMS_SIGN,
569
569
  WXAPP_FINGER_REPORT,
570
570
  WXAPP_REPORT_MANAGE,
571
571
  WXAPP_SUBS_GUIDER,
572
572
  WXAPP_ADDRESS_V2_API,
573
573
  BUSINESS_TYPE,
574
574
  SHOP_MENU_ID_TYPE,
575
575
  SHOP_MENU_ID_NAME,
576
576
  SECTION_HOME_TAB_NAME_TYPE,
577
577
  SECTION_HOME_TAB_TYPE,
578
578
  TaroEventType,
579
579
  WX_BUSINESS_TYPE,
580
580
  WXAPP_BIZ_KEY,
581
581
  WXAPP_BIZ_SHOP_LIGHT_KEY,
582
582
  getSystemInfos,
583
583
  getTaroStorageKeyValue,
584
584
  getWxAppCookieStr,
585
585
  objectToUrlEncode,
586
586
  languageNowType,
587
587
  isAscfApp,
588
588
  abTestLabels: {},
589
589
  nonSellableSkuids: {},
590
590
  loginState: jdUserLoginState,
591
591
  cookiesStr: '',
592
592
  userInfo: userPinKey,
593
593
  isImmersive: false,
594
594
  baseAddCartSwitch: true,
595
595
  pageInfo: {
596
596
  wxBusinessType: WX_BUSINESS_TYPE.SHOP,
597
597
  address: '',
598
598
  addressCommaStr: '',
599
599
  un_area: '',
600
600
  userLbsAddress: '',
601
601
  vapptype: '1',
602
602
  pageType: 'home',
603
603
  dataType: BUSINESS_TYPE.ONLINE,
604
604
  floorExposureInfo: {},
605
605
  floorVideInfo: {},
606
606
  productVideInfo: {},
607
607
  tabsLoadAllDataInfo: {
608
608
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: false,
609
609
  [SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
610
610
  },
611
611
  updateShopInfosAllState: false,
612
612
  isVipShop: false,
613
613
  isJdShowNativeImmersivePlayer: false,
614
614
  isSuperBrandShop: false,
615
615
  ...shopConfig,
616
616
  pageScrollTop: 0,
617
617
  pageIdxHeightInfo: {
618
618
  list: [],
619
619
  },
620
620
  shopNavBarHeight: 0,
621
621
  },
622
622
  defaultQueryLogInfo: {
623
623
  sourceType: 'JDshop',
624
624
  sourceValue: '',
625
625
  moduleId: 'none',
626
626
  entrance: 'none',
627
627
  },
628
628
  originQueryInfo: {},
629
629
  sysInfo: {
630
630
  windowWidth: 0,
631
631
  windowHeight: 0,
632
632
  netWorkType: '4g',
633
633
  jdBottomBarHeight: 0,
634
634
  jdNativeHeaderHeight: 0,
635
635
  },
636
636
  queryInfo: {},
637
637
  shopInfo: {},
638
638
  openAppData: {},
639
639
  public info: CommonInterFace.BaseConfigInfo;
640
640
  public config: {
641
641
  [key: string]: any;
642
642
  };
643
643
  public lazyContainer: CommonInterFace.lazyContainer;
644
644
  public rootEleNode: HTMLElement | null;
645
645
  public miniApplogUtil: CommonInterFace.MiniApplogUtil;
646
646
  public miniAppLogInstance: CommonInterFace.MiniAppLog | null;
647
647
  public checkStatusAndLoginPromise: object | null;
648
648
  public wxAppLoginInstance: CommonInterFace.WxAppLogin;
649
649
  public wxAppBizInstance: CommonInterFace.WxAppUserInfo;
650
650
  public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo;
651
651
  public wxAppReportManageInstance: CommonInterFace.wxAppReportManage;
652
652
  public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT;
653
653
  public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator;
654
654
  public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign;
655
655
  public wxAppFingerReportInstance: CommonInterFace.wxAppParamsSign;
656
656
  public wxAppSubsGuider: CommonInterFace.wxAppParamsSign;
657
657
  public wxAppAddressV2apiInstance: CommonInterFace.wxAppAddressV2api;
658
658
  public loadJsSdkList: Array<any>;
659
659
  public loadJsSdkListCachePromise: any;
660
660
  public lbsAddressCachePromise: Promise<any> | null;
661
661
  public languageJsonData: any | null;
662
662
  public businessWorkerReady: boolean;
663
663
  public jdWorkerReadyPromise: any | null;
664
664
  constructor(opt) {
665
665
  this.info = this._getConfig(opt);
666
666
  this.config = {};
667
667
  this.lazyContainer = {
668
668
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
669
669
  appLazyContainerList: [],
670
670
  appLazyFinishContainerList: [],
671
671
  },
672
672
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
673
673
  appLazyContainerList: [],
674
674
  appLazyFinishContainerList: [],
675
675
  },
676
676
  };
677
677
  this.loadJsSdkList = [];
678
678
  this.loadJsSdkListCachePromise = {};
679
679
  this.rootEleNode = null;
680
680
  this.miniApplogUtil = MiniAppLogUtil;
681
681
  this.miniAppLogInstance = null;
682
682
  this.checkStatusAndLoginPromise = null;
683
683
  this.wxAppLoginInstance = WXAPP_LOGIN;
684
684
  this.wxAppBizInstance = WXAPP_BIZ;
685
685
  this.wxAppUserInfoInstance = WXAPP_USER_INFO;
686
686
  this.wxAppReportManageInstance = WXAPP_REPORT_MANAGE;
687
687
  this.wxAppReportGDTInstance = WXAPP_REPORT_GDT;
688
688
  this.wxAppNavigatorInstance = WXAPP_NAVIGATOR;
689
689
  this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN;
690
690
  this.wxAppFingerReportInstance = WXAPP_FINGER_REPORT ? new WXAPP_FINGER_REPORT() : {};
691
691
  this.wxAppSubsGuider = WXAPP_SUBS_GUIDER;
692
692
  this.wxAppAddressV2apiInstance = WXAPP_ADDRESS_V2_API;
693
693
  this.lbsAddressCachePromise = null;
694
694
  this.languageJsonData = langeJsonDataForCn;
695
695
  this.businessWorkerReady = false;
696
696
  this.jdWorkerReadyPromise = Promise.resolve(false);
697
697
  }
698
698
  _getConfig(opt) {
699
699
  return Object.assign({}, DefaultConfig, opt);
700
700
  }
701
701
  loadApiSafeSteadyReayPromise() {
702
702
  return Promise.resolve(true);
703
703
  }
704
704
  loadH5tagReayPromise() {
705
705
  return Promise.resolve(true);
706
706
  }
707
707
 
708
708
  jmfeReayPromise(): Promise<any> {
709
709
  return Promise.reject(false);
710
710
  }
711
711
 
712
712
  taskTimeoutPromise(callBack, timeout = 2000) {
713
713
  return new Promise((resolve) => {
714
714
  setTimeout(() => {
715
715
  const getCallBackRes = typeof callBack === 'function' && callBack();
716
716
  return resolve(getCallBackRes || false);
717
717
  }, timeout);
718
718
  });
719
719
  }
720
720
 
721
721
  updateBusinessDomainAndApi(domain, api) {
722
722
  console.log('=================>', 'updateBusinessDomainAndApi');
723
723
  }
724
724
 
725
725
  getFullScreenHeight(systemInfo) {
726
726
  const { screenHeight, statusBarHeight, isAndroid } = systemInfo;
727
727
  let result = screenHeight;
728
728
  if (statusBarHeight > 20 && isAndroid) {
729
729
  result = screenHeight + statusBarHeight;
730
730
  }
731
731
  return result;
732
732
  }
733
733
 
734
734
  getTabBarHeight(systemInfo) {
735
735
  const { statusBarHeight, isAndroid, isIOS } = systemInfo;
736
736
  let result = 50;
737
737
  if (statusBarHeight > 20) {
738
738
  if (isIOS) {
739
739
  result = 84;
740
740
  } else if (isAndroid) {
741
741
  result = 53;
742
742
  }
743
743
  }
744
744
  return result;
745
745
  }
746
746
 
747
747
  getSystemInfo() {
748
748
  const info: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfos() || {};
749
749
  const actualNavBarHeight = (info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0);
750
750
  const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0);
751
751
  const fullScreenHeight = this.getFullScreenHeight(info);
752
752
  const tabBarHeight = this.getTabBarHeight(info);
753
753
  const safeContentHeight = fullScreenHeight - headerHeight;
754
754
  this.info.sysInfo = {
755
755
  ...this.info.sysInfo,
756
756
  ...info,
757
757
  actualNavBarHeight,
758
758
  headerHeight,
759
759
  fullScreenHeight,
760
760
  tabBarHeight,
761
761
  safeContentHeight,
762
762
  languageType: languageNowType,
763
763
  };
764
764
  if (this.info.sysInfo['hostVersionName']) {
765
765
  this.info.sysInfo['hostAppVersion'] = Number(
766
766
  this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
767
767
  );
768
768
  }
769
769
  if (isPublishToWxapp) {
770
770
  this.getAddressCachePromise();
771
771
  this.getLbsAddressCachePromise();
772
772
  }
773
773
  this.info.sysInfo['wifiVideoAutoPlay'] = false;
774
774
  this.getNetWorkType();
775
775
  console.log('获取系统信息', this.info.sysInfo);
776
776
  }
777
777
  async updateMPaasConfig() {}
778
778
 
779
779
  getNetWorkType() {
780
780
  Taro.getNetworkType().then((getRes) => {
781
781
  getRes && getRes.networkType && (this.info.sysInfo['netWorkType'] = getRes.networkType);
782
782
  });
783
783
  }
784
784
  getAPPUseStraightCorner() {
785
785
  return Promise.resolve(false);
786
786
  }
787
787
 
788
788
  checkStatusAndLogin(options = {}) {
789
789
  this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
790
790
  console.log('微信小程序登录状态及获取cookie状态的promise,之前登录状态', this.info.loginState);
791
791
  this.toLogin(options)
792
792
  .then((res) => {
793
793
  console.log('微信小程序登录状态结果,成功', res);
794
794
  this.info.loginState = true;
795
795
  resolve(res);
796
796
  })
797
797
  .catch((err) => {
798
798
  console.log('微信小程序登录异常状态结果', err);
799
799
  this.doLogin(options)
800
800
  .then((res2) => {
801
801
  console.log('微信小程序wxDoLogin强制登陆成功:', res2);
802
802
  this.info.loginState = true;
803
803
  resolve(res2);
804
804
  })
805
805
  .catch((err2) => {
806
806
  console.log('微信小程序wxDoLogin强制登陆失败:', err2);
807
807
  this.checkStatusAndLoginPromise = null;
808
808
  reject(err2);
809
809
  });
810
810
  });
811
811
  });
812
812
  return this.checkStatusAndLoginPromise;
813
813
  }
814
814
 
815
815
  checkJdStatusAndLogin(
816
816
  options = {
817
817
  loginColor: {
818
818
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
819
819
  dpin: 0,
820
820
  },
821
821
  },
822
822
  ) {
823
823
  return this.checkStatusAndLogin(options);
824
824
  }
825
825
 
826
826
  toLogin(options = {}): Promise<any> {
827
827
  return this.wxAppLoginInstance
828
828
  .getLoginPromise({
829
829
  mode: 'common',
830
830
  loginColor: {
831
831
  biz: WXAPP_BIZ_KEY,
832
832
  dpin: 1,
833
833
  },
834
834
  ...options,
835
835
  })
836
836
  .then((res) => {
837
837
  console.log('微信app登录返回信息,微信侧返回code为0表示成功', res);
838
838
  setTimeout(() => {
839
839
  console.log(
840
840
  '微信app登录返回成功后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie',
841
841
  );
842
842
  this.getLoginCookie(`${Date.now()}`);
843
843
  }, 500);
844
844
  })
845
845
  .catch((err) => {
846
846
  console.log('微信app登录异常返回信息,也获取cookie', err);
847
847
  this.getLoginCookie(`${Date.now()}`);
848
848
  });
849
849
  }
850
850
 
851
851
  doLogin(options = {}) {
852
852
  const getParams = {
853
853
  loginColor: {
854
854
  biz: WXAPP_BIZ_KEY,
855
855
  dpin: 1,
856
856
  },
857
857
  ...options,
858
858
  };
859
859
  if (isPublishToWxapp) {
860
860
  getParams['returnUrl'] = `/pages/shopx/pages/index/index?${objectToUrlEncode({
861
861
  ...this.info.originQueryInfo,
862
862
  loadShopxType: 'redirect',
863
863
  })}`;
864
864
  }
865
865
  return this.wxAppLoginInstance.doLogin(getParams).then((res) => {
866
866
  console.log('微信小程序强制登录返回信息,微信侧返回code为0表示成功', res);
867
867
  setTimeout(() => {
868
868
  console.log('微信强制登录后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie');
869
869
  this.getLoginCookie(`${Date.now()}`);
870
870
  }, 500);
871
871
  return res;
872
872
  });
873
873
  }
874
874
 
875
875
  doLoginForJdPin(options = {}) {
876
876
  return this.doLogin({
877
877
  loginColor: {
878
878
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
879
879
  dpin: 0,
880
880
  },
881
881
  ...options,
882
882
  });
883
883
  }
884
884
 
885
885
  getLoginCookie(updateKey = 'wxapp') {
886
886
  return new Promise(async (resolve) => {
887
887
  console.log('开始获取更新wxapp中的cookie信息', updateKey);
888
888
  if (
889
889
  this.config.wqCookie &&
890
890
  this.config.wqCookieStr &&
891
891
  this.config.getWqCookieKey === updateKey
892
892
  ) {
893
893
  console.log('已有存储wxapp中的cookie信息,直接返回', this.config);
894
894
  resolve({
895
895
  wqCookie: this.config.wqCookie,
896
896
  wqCookieStr: this.config.wqCookieStr,
897
897
  });
898
898
  } else {
899
899
  if (isPublishToWxapp) {
900
900
  const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null;
901
901
  if (getWxappCookieObj) {
902
902
  const getCookieObj = getWxappCookieObj['_data'];
903
903
  if (isAscfApp) {
904
904
  const ptKey = this.wxAppLoginInstance.getPtKey();
905
905
  const ptPin = this.wxAppLoginInstance.getPtPin();
906
906
  getCookieObj.pt_key = { name: 'pt_key', value: ptKey };
907
907
  getCookieObj.pt_pin = { name: 'pt_pin', value: ptPin };
908
908
  }
909
909
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
910
910
  const {
911
911
  pin = '',
912
912
  pt_pin = '',
913
913
  visitkey = '-1',
914
914
  wq_unionid = '',
915
915
  wxapp_openid = '',
916
916
  } = wqCookie;
917
917
  this.info.loginState = true;
918
918
  this.info.userInfo.wqCookie = wqCookieStr;
919
919
  this.info.userInfo.wqVisitkey = visitkey;
920
920
  console.log('获取用户完整cookie信息', getCookieObj);
921
921
  if (this.miniAppLogInstance && this.miniAppLogInstance.setCommon) {
922
922
  this.miniAppLogInstance.setCommon({
923
923
  account: pin || pt_pin,
924
924
  unionid: wq_unionid,
925
925
  openid: wxapp_openid,
926
926
  });
927
927
  }
928
928
  this.config.wqCookie = wqCookie;
929
929
  this.config.wqCookieStr = wqCookieStr;
930
930
  this.config.getWqCookieKey = updateKey;
931
931
  console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
932
932
  resolve({
933
933
  wqCookie,
934
934
  wqCookieStr,
935
935
  });
936
936
  } else {
937
937
  console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
938
938
  resolve({
939
939
  wqCookie: false,
940
940
  wqCookieStr: false,
941
941
  });
942
942
  }
943
943
  } else {
944
944
  resolve({
945
945
  wqCookie: false,
946
946
  wqCookieStr: false,
947
947
  });
948
948
  }
949
949
  }
950
950
  });
951
951
  }
952
952
 
953
953
 
954
954
  checkLoginStatus() {
955
955
  return this.getLoginCookie();
956
956
  }
957
957
 
958
958
  getAddressCachePromise = () => {
959
959
  return new Promise((resolve) => {
960
960
  if (this.info.sysInfo?.area) {
961
961
  resolve({
962
962
  lat: this.info.sysInfo?.lat,
963
963
  lng: this.info.sysInfo?.lng,
964
964
  area: this.info.sysInfo?.area,
965
965
  });
966
966
  } else {
967
967
  const getUserAddress = this.wxAppUserInfoInstance.getAddress();
968
968
  console.info('京购原生获取用户基地址信息', getUserAddress);
969
969
  if (getUserAddress) {
970
970
  const { areaId = '', latitude, longitude } = getUserAddress;
971
971
  this.info.sysInfo['lat'] = `${latitude || ''}`;
972
972
  this.info.sysInfo['lng'] = `${longitude || ''}`;
973
973
  if (areaId && areaId !== '') {
974
974
  this.info.pageInfo.address = areaId;
975
975
  this.info.pageInfo.addressCommaStr = areaId.replace(/_/g, ',');
976
976
  this.info.pageInfo.un_area = areaId;
977
977
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
978
978
  area: areaId,
979
979
  });
980
980
  this.info.sysInfo['area'] = areaId;
981
981
  }
982
982
  resolve({
983
983
  lat: this.info.sysInfo['lat'],
984
984
  lng: this.info.sysInfo['lng'],
985
985
  area: areaId,
986
986
  });
987
987
  } else {
988
988
  resolve({ lat: '', lng: '', area: '' });
989
989
  }
990
990
  }
991
991
  });
992
992
  };
993
993
 
994
994
  getLbsAddressCachePromise(): Promise<{
995
995
  ok: boolean;
996
996
  msg?: string;
997
997
  realTimeArea: string;
998
998
  data?: any;
999
999
  }> {
1000
1000
  if (!this.lbsAddressCachePromise) {
1001
1001
  this.lbsAddressCachePromise = new Promise((resolve) => {
1002
1002
  const getWxappLbsAddressInfo = this.wxAppUserInfoInstance.getLbsAddress();
1003
1003
  console.info('京购原生获取用户基于lbs的缓存地址信息', getWxappLbsAddressInfo);
1004
1004
  if (getWxappLbsAddressInfo && getWxappLbsAddressInfo?.areaId !== '') {
1005
1005
  this.info.pageInfo.userLbsAddress = getWxappLbsAddressInfo?.areaId;
1006
1006
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
1007
1007
  realTimeArea: this.info.pageInfo.userLbsAddress,
1008
1008
  });
1009
1009
  resolve({
1010
1010
  ok: true,
1011
1011
  realTimeArea: getWxappLbsAddressInfo?.areaId || '',
1012
1012
  });
1013
1013
  } else {
1014
1014
  this.wxAppAddressV2apiInstance
1015
1015
  .fetchLbsAddr({
1016
1016
  token: 'W23b9sUlcnhCPZxQ2daYMkDqrTL0TeDw9tbDm5lVMVA=',
1017
1017
  from: 'wxapp_shop_real_area',
1018
1018
  })
1019
1019
  .then((res) => {
1020
1020
  console.info('微信京购里面获取静默实时lbs地址信息结果', res);
1021
1021
  const { provinceId, cityId, countyId, townId } = res;
1022
1022
  let realTimeArea = '';
1023
1023
  if (provinceId) {
1024
1024
  realTimeArea = `${provinceId}_${cityId || 0}_${countyId || 0}_${townId || 0}`;
1025
1025
  this.info.pageInfo.userLbsAddress = realTimeArea;
1026
1026
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
1027
1027
  realTimeArea: realTimeArea,
1028
1028
  });
1029
1029
  } else {
1030
1030
  this.lbsAddressCachePromise = null;
1031
1031
  }
1032
1032
  const getValidRealTimeArea = realTimeArea !== '';
1033
1033
  resolve({
1034
1034
  ok: getValidRealTimeArea,
1035
1035
  msg: getValidRealTimeArea
1036
1036
  ? '成功'
1037
1037
  : '根据微信底层接口获取静默实时lbs地址信息异常,详情见data',
1038
1038
  data: getValidRealTimeArea ? null : res,
1039
1039
  realTimeArea: realTimeArea,
1040
1040
  });
1041
1041
  })
1042
1042
  .catch((err) => {
1043
1043
  console.warn('微信京购里面获取静默实时lbs地址信息异常', err);
1044
1044
  this.lbsAddressCachePromise = null;
1045
1045
  resolve({
1046
1046
  ok: false,
1047
1047
  msg: '微信京购里面获取静默实时lbs地址信息异常',
1048
1048
  realTimeArea: '',
1049
1049
  });
1050
1050
  });
1051
1051
  }
1052
1052
  });
1053
1053
  }
1054
1054
  return this.lbsAddressCachePromise;
1055
1055
  }
1056
1056
 
1057
1057
  updatePageAndLogInfo(updateQuery = {}) {
1058
1058
  const createUpdateQueryInfo: {
1059
1059
  query: {
1060
1060
  shopId?: string | number;
1061
1061
  venderId?: string | number;
1062
1062
  };
1063
1063
  updateShopInfoState: boolean;
1064
1064
  } = Object.assign(
1065
1065
  {},
1066
1066
  {
1067
1067
  query: {},
1068
1068
  updateShopInfoState: false,
1069
1069
  },
1070
1070
  updateQuery,
1071
1071
  );
1072
1072
  console.log(
1073
1073
  '获取当前下发的店铺查询参数',
1074
1074
  updateQuery,
1075
1075
  '获取之前保存的shopInfo店铺查询参数',
1076
1076
  this.info?.shopInfo,
1077
1077
  );
1078
1078
  const { query, updateShopInfoState } = createUpdateQueryInfo;
1079
1079
  const { shopId, venderId } = query;
1080
1080
  if (updateShopInfoState) {
1081
1081
  this.info.queryInfo = {
1082
1082
  ...this.info.queryInfo,
1083
1083
  ...query,
1084
1084
  };
1085
1085
  if (shopId && venderId) {
1086
1086
  this.info.shopInfo = {
1087
1087
  shopId: `${shopId}`,
1088
1088
  venderId: `${venderId}`,
1089
1089
  };
1090
1090
  }
1091
1091
  } else {
1092
1092
  this.info.queryInfo = {
1093
1093
  ...query,
1094
1094
  };
1095
1095
  this.info.originQueryInfo = {
1096
1096
  ...query,
1097
1097
  };
1098
1098
  if (
1099
1099
  this.info.shopInfo?.shopId &&
1100
1100
  this.info.shopInfo?.venderId &&
1101
1101
  (this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
1102
1102
  ) {
1103
1103
  this.info.queryInfo.shopId = this.info.shopInfo.shopId;
1104
1104
  this.info.queryInfo.venderId = this.info.shopInfo.venderId;
1105
1105
  console.log(
1106
1106
  '当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
1107
1107
  this.info.queryInfo,
1108
1108
  );
1109
1109
  }
1110
1110
  }
1111
1111
  this.info.queryInfo['shopId'] &&
1112
1112
  (this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
1113
1113
  this.info.queryInfo['venderId'] &&
1114
1114
  (this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
1115
1115
  console.log(
1116
1116
  'weapp===获取店铺下发查询参数\n',
1117
1117
  query,
1118
1118
  '\n获取店铺最后查询参数\n',
1119
1119
  this.info.queryInfo,
1120
1120
  '\n是否为更新店铺状态\n',
1121
1121
  updateShopInfoState,
1122
1122
  );
1123
1123
  }
1124
1124
 
1125
1125
  getDynamicConfig(key: string) {
1126
1126
  console.warn('调用微信小程序的 getDynamicConfig(),注意,此方法还未实现!');
1127
1127
  return null;
1128
1128
  }
1129
1129
  renderNextTickLoadSdk() {
1130
1130
  console.warn('暂未实现 index.weapp.ts');
1131
1131
  }
1132
1132
  loadOtherSdk() {
1133
1133
  console.warn('暂未实现 index.weapp.ts');
1134
1134
  }
1135
1135
  loadItemSdkPromise() {
1136
1136
  console.warn('暂未实现 index.weapp.ts');
1137
1137
  }
1138
1138
  createLanguageProimse() {
1139
1139
  return Promise.reject({
1140
1140
  msg: '暂未实现',
1141
1141
  });
1142
1142
  }