@conecli/cone-render 0.10.1-shop3.9 → 0.10.1-shop3.91

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