@conecli/cone-render 0.10.1-shop3.1 → 0.10.1-shop3.100

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 (129) hide show
  1. package/README.md +1 -1
  2. package/dist/api/index.ts +1 -1
  3. package/dist/common/accessibility.h5.ts +1 -0
  4. package/dist/common/accessibility.ts +1 -0
  5. package/dist/common/const.ts +1 -1
  6. package/dist/common/index.h5.ts +1 -1
  7. package/dist/common/index.jd.ts +1 -1
  8. package/dist/common/index.ts +1 -1
  9. package/dist/common/index.weapp.ts +1 -1
  10. package/dist/common/jdplayerSdk.weapp.tsx +1 -0
  11. package/dist/common/jssdk.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.module.scss +126 -111
  20. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  21. package/dist/components/base/CountDown/index.module.scss +49 -44
  22. package/dist/components/base/CountDown/index.tsx +1 -1
  23. package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
  24. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  25. package/dist/components/base/CustomVideo/index.tsx +1 -1
  26. package/dist/components/base/CustomVideo/index.weapp.tsx +1 -0
  27. package/dist/components/base/Dialog/index.module.scss +11 -0
  28. package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
  29. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  30. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  31. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  32. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  33. package/dist/components/base/InViewRender/index.tsx +1 -1
  34. package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
  35. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  36. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  37. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  38. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  39. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  40. package/dist/components/base/NetworkDataError/const.ts +1 -1
  41. package/dist/components/base/NetworkDataError/index.module.scss +118 -72
  42. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  43. package/dist/components/base/Price/Base/index.module.scss +12 -0
  44. package/dist/components/base/Price/Base/index.tsx +1 -1
  45. package/dist/components/base/Price/Double/index.module.scss +33 -1
  46. package/dist/components/base/Price/Double/index.tsx +1 -1
  47. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  48. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  49. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  50. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  51. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  52. package/dist/components/floorItem.tsx +1 -1
  53. package/dist/components/floorItem.weapp.tsx +1 -1
  54. package/dist/components/isv/Floor/index.tsx +1 -1
  55. package/dist/components/remoteFloorItem.tsx +1 -1
  56. package/dist/config/env.ts +1 -1
  57. package/dist/interface/common.ts +1 -1
  58. package/dist/interface/component.ts +1 -1
  59. package/dist/interface/jumpEventReport.ts +1 -1
  60. package/dist/interface/service.ts +1 -1
  61. package/dist/jumpEventReport/base.ts +1 -1
  62. package/dist/jumpEventReport/const.ts +1 -1
  63. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  64. package/dist/jumpEventReport/index.h5.ts +1 -1
  65. package/dist/jumpEventReport/index.jd.ts +1 -1
  66. package/dist/jumpEventReport/index.weapp.ts +1 -1
  67. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  68. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  69. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  70. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  71. package/dist/jumpEventReport/web/report.ts +1 -1
  72. package/dist/jumpEventReport/web.base.ts +1 -1
  73. package/dist/jumpEventReport/web.jd.ts +1 -1
  74. package/dist/jumpEventReport/web.jdb.ts +1 -1
  75. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  76. package/dist/jumpEventReport/web.jxwxapp.ts +1 -1
  77. package/dist/jumpEventReport/web.pc.ts +1 -1
  78. package/dist/jumpEventReport/web.tjapp.ts +1 -1
  79. package/dist/jumpEventReport/web.tjm.ts +1 -1
  80. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  81. package/dist/language/en_US.json +395 -0
  82. package/dist/language/zh_CN.json +395 -0
  83. package/dist/language/zh_HK.json +395 -0
  84. package/dist/libs/openShopBridge.js +161 -0
  85. package/dist/libs/openShopBridge.min.js +1 -0
  86. package/dist/libs/taroAppReport.js +2 -2
  87. package/dist/modules/ContainerFloorList/index.h5.module.scss +80 -53
  88. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  89. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  90. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  91. package/dist/open/api/environment.ts +1 -1
  92. package/dist/open/api/shopMember.ts +1 -1
  93. package/dist/open/api/shopMember.weapp.ts +1 -0
  94. package/dist/open/api/track.ts +1 -1
  95. package/dist/open/api/util.ts +1 -1
  96. package/dist/open/components/index.ts +1 -1
  97. package/dist/open/index.ts +1 -1
  98. package/dist/sass/app.h5.scss +278 -224
  99. package/dist/sass/base.scss +150 -145
  100. package/dist/service/fetchGateway.ts +1 -1
  101. package/dist/service/fetchGateway.weapp.ts +1 -0
  102. package/dist/service/fetchJsonp.weapp.ts +1 -0
  103. package/dist/service/http/colorSign.ts +1 -1
  104. package/dist/service/http/const.ts +1 -1
  105. package/dist/service/http/h5Http.ts +1 -1
  106. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  107. package/dist/service/requestServer.h5.ts +1 -1
  108. package/dist/service/requestServer.ts +1 -1
  109. package/dist/service/requestServer.weapp.ts +1 -0
  110. package/dist/utils/connectNativeJsBridge.ts +1 -1
  111. package/dist/utils/h5Utils.ts +1 -1
  112. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  113. package/dist/utils/harmonyCallRouter.ts +0 -0
  114. package/dist/utils/index.h5.ts +1 -1
  115. package/dist/utils/index.ts +1 -1
  116. package/dist/utils/index.weapp.ts +1 -1
  117. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  118. package/dist/utils/jumpExtMapUtil.ts +1 -0
  119. package/dist/utils/jumpExtMapUtil.weapp.ts +1 -0
  120. package/dist/utils/log.ts +1 -0
  121. package/dist/utils/sColor.ts +1 -0
  122. package/dist/utils/sColor.weapp.ts +1 -0
  123. package/dist/utils/utils.ts +1 -1
  124. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  125. package/dist/wxapp/common/user_info.js +1 -1
  126. package/package.json +162 -141
  127. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  128. package/dist/utils/memberFormatUtils.js +0 -1
  129. package/dist/utils/priceUtils.js +0 -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
  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
  loginState: jdUserLoginState,
25
24
  cookiesStr: "",
26
25
  userInfo: userPinKey,
27
26
  pageInfo: {
28
27
  wxBusinessType: WX_BUSINESS_TYPE.SHOP,
29
28
  address: "",
30
29
  addressCommaStr: "",
31
30
  un_area: "",
32
31
  vapptype: "1",
33
32
  pageType: "home",
34
33
  dataType: BUSINESS_TYPE.ONLINE,
35
34
  floorExposureInfo: {},
36
35
  floorVideInfo: {},
37
36
  productVideInfo: {},
38
37
  tabsLoadAllDataInfo: {
39
38
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]:
40
39
  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
  ...shopConfig,
47
46
  pageScrollTop: 0,
48
47
  pageIdxHeightInfo: {
49
48
  list: [],
50
49
  },
51
50
  shopNavBarHeight: 0,
52
51
  },
53
52
  defaultQueryLogInfo: {
54
53
  sourceType: "JDshop",
55
54
  sourceValue: "",
56
55
  moduleId: "none",
57
56
  entrance: "none",
58
57
  },
59
58
  originQueryInfo: {},
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 rootEleNode: HTMLElement | null;
76
75
  public miniApplogUtil: CommonInterFace.MiniApplogUtil;
77
76
  public miniAppLogInstance: CommonInterFace.MiniAppLog | null;
78
77
  public checkStatusAndLoginPromise: object | null;
79
78
  public wxAppLoginInstance: CommonInterFace.WxAppLogin;
80
79
  public wxAppBizInstance: CommonInterFace.WxAppUserInfo;
81
80
  public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo;
82
81
  public wxAppReportManageInstance: CommonInterFace.wxAppReportManage;
83
82
  public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT;
84
83
  public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator;
85
84
  public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign;
86
85
  public wxAppFingerReportInstance: CommonInterFace.wxAppParamsSign;
87
86
  public wxAppSubsGuider: CommonInterFace.wxAppParamsSign;
88
87
  public loadJsSdkList: Array<any>
89
88
  public loadJsSdkListCachePromise: any
90
89
  constructor(opt) {
91
90
  this.info = this._getConfig(opt);
92
91
  this.config = {};
93
92
  this.lazyContainer = {
94
93
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
95
94
  appLazyContainerList: [],
96
95
  appLazyFinishContainerList: [],
97
96
  },
98
97
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
99
98
  appLazyContainerList: [],
100
99
  appLazyFinishContainerList: [],
101
100
  },
102
101
  };
103
102
  this.loadJsSdkList = []
104
103
  this.loadJsSdkListCachePromise = {}
105
104
  this.rootEleNode = null;
106
105
  this.miniApplogUtil = MiniAppLogUtil;
107
106
  this.miniAppLogInstance = null;
108
107
  this.checkStatusAndLoginPromise = null;
109
108
  this.wxAppLoginInstance = WXAPP_LOGIN;
110
109
  this.wxAppBizInstance = WXAPP_BIZ;
111
110
  this.wxAppUserInfoInstance = WXAPP_USER_INFO;
112
111
  this.wxAppReportManageInstance = WXAPP_REPORT_MANAGE;
113
112
  this.wxAppReportGDTInstance = WXAPP_REPORT_GDT;
114
113
  this.wxAppNavigatorInstance = WXAPP_NAVIGATOR;
115
114
  this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN;
116
115
  this.wxAppFingerReportInstance = WXAPP_FINGER_REPORT
117
116
  ? new WXAPP_FINGER_REPORT()
118
117
  : {};
119
118
  this.wxAppSubsGuider = WXAPP_SUBS_GUIDER;
120
119
  }
121
120
  _getConfig(opt) {
122
121
  return Object.assign({}, DefaultConfig, opt);
123
122
  }
124
123
 
125
124
  taskTimeoutPromise(callBack, timeout = 2000) {
126
125
  return new Promise((resolve) => {
127
126
  setTimeout(() => {
128
127
  const getCallBackRes = typeof callBack === "function" && callBack();
129
128
  return resolve(getCallBackRes || false);
130
129
  }, timeout);
131
130
  });
132
131
  }
133
132
 
134
133
  updateBusinessDomainAndApi(domain, api) {
135
134
  console.log("=================>", "updateBusinessDomainAndApi");
136
135
  }
137
136
 
138
137
  getFullScreenHeight(systemInfo) {
139
138
  const { screenHeight, statusBarHeight, isAndroid } = systemInfo;
140
139
  let result = screenHeight;
141
140
  if (statusBarHeight > 20 && isAndroid) {
142
141
  result = screenHeight + statusBarHeight;
143
142
  }
144
143
  return result;
145
144
  }
146
145
 
147
146
  getTabBarHeight(systemInfo) {
148
147
  const { statusBarHeight, isAndroid, isIOS } = systemInfo;
149
148
  let result = 50;
150
149
  if (statusBarHeight > 20) {
151
150
  if (isIOS) {
152
151
  result = 84;
153
152
  } else if (isAndroid) {
154
153
  result = 53;
155
154
  }
156
155
  }
157
156
  return result;
158
157
  }
159
158
 
160
159
  getSystemInfo() {
161
160
  const info: UtilsInterFace.taroGetSystemInfoSyncRes =
162
161
  getSystemInfos() || {};
163
162
  const actualNavBarHeight =
164
163
  (info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0);
165
164
  const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0);
166
165
  const fullScreenHeight = this.getFullScreenHeight(info);
167
166
  const tabBarHeight = this.getTabBarHeight(info);
168
167
  const safeContentHeight = fullScreenHeight - headerHeight;
169
168
  this.info.sysInfo = {
170
169
  ...this.info.sysInfo,
171
170
  ...info,
172
171
  actualNavBarHeight,
173
172
  headerHeight,
174
173
  fullScreenHeight,
175
174
  tabBarHeight,
176
175
  safeContentHeight,
177
176
  };
178
177
  if (this.info.sysInfo["hostVersionName"]) {
179
178
  this.info.sysInfo["hostAppVersion"] = Number(
180
179
  this.info.sysInfo["hostVersionName"].replace(/\./g, "")
181
180
  );
182
181
  }
183
182
  this.info.sysInfo["wifiVideoAutoPlay"] = false;
184
183
  this.getNetWorkType();
185
184
  console.log("获取系统信息", this.info.sysInfo);
186
185
  }
187
186
  async updateMPaasConfig() {}
188
187
 
189
188
  getNetWorkType() {
190
189
  Taro.getNetworkType().then((getRes) => {
191
190
  getRes &&
192
191
  getRes.networkType &&
193
192
  (this.info.sysInfo["netWorkType"] = getRes.networkType);
194
193
  });
195
194
  }
196
195
  getAPPUseStraightCorner () {
197
196
  return Promise.resolve(false)
198
197
  }
199
198
 
200
199
  checkStatusAndLogin(options = {}) {
201
200
  this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
202
201
  console.log(
203
202
  "微信小程序登录状态及获取cookie状态的promise,之前登录状态",
204
203
  this.info.loginState
205
204
  );
206
205
  this.toLogin(options)
207
206
  .then((res) => {
208
207
  console.log("微信小程序登录状态结果,成功", res);
209
208
  this.info.loginState = true;
210
209
  resolve(res);
211
210
  })
212
211
  .catch((err) => {
213
212
  console.log("微信小程序登录异常状态结果", err);
214
213
  this.doLogin(options)
215
214
  .then((res2) => {
216
215
  console.log("微信小程序wxDoLogin强制登陆成功:", res2);
217
216
  this.info.loginState = true;
218
217
  resolve(res2);
219
218
  })
220
219
  .catch((err2) => {
221
220
  console.log("微信小程序wxDoLogin强制登陆失败:", err2);
222
221
  this.checkStatusAndLoginPromise = null;
223
222
  reject(err2);
224
223
  });
225
224
  });
226
225
  });
227
226
  return this.checkStatusAndLoginPromise;
228
227
  }
229
228
 
230
229
  checkJdStatusAndLogin(
231
230
  options = {
232
231
  loginColor: {
233
232
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
234
233
  dpin: 0,
235
234
  },
236
235
  }
237
236
  ) {
238
237
  return this.checkStatusAndLogin(options);
239
238
  }
240
239
 
241
240
  toLogin(options = {}): Promise<any> {
242
241
  return this.wxAppLoginInstance
243
242
  .getLoginPromise({
244
243
  mode: "common",
245
244
  loginColor: {
246
245
  biz: WXAPP_BIZ_KEY,
247
246
  dpin: 1,
248
247
  },
249
248
  ...options,
250
249
  })
251
250
  .then((res) => {
252
251
  console.log("微信app登录返回信息,微信侧返回code为0表示成功", res);
253
252
  setTimeout(() => {
254
253
  console.log(
255
254
  "微信app登录返回成功后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie"
256
255
  );
257
256
  this.getLoginCookie(`${Date.now()}`);
258
257
  }, 500);
259
258
  })
260
259
  .catch((err) => {
261
260
  console.log("微信app登录异常返回信息,也获取cookie", err);
262
261
  this.getLoginCookie(`${Date.now()}`);
263
262
  });
264
263
  }
265
264
 
266
265
  doLogin(options = {}) {
267
266
  const getParams = {
268
267
  loginColor: {
269
268
  biz: WXAPP_BIZ_KEY,
270
269
  dpin: 1,
271
270
  },
272
271
  ...options,
273
272
  };
274
273
  if (isPublishToWxapp) {
275
274
  getParams[
276
275
  "returnUrl"
277
276
  ] = `/pages/shopx/pages/index/index?${objectToUrlEncode({
278
277
  ...this.info.originQueryInfo,
279
278
  loadShopxType: "redirect",
280
279
  })}`;
281
280
  }
282
281
  return this.wxAppLoginInstance.doLogin(getParams).then((res) => {
283
282
  console.log("微信小程序强制登录返回信息,微信侧返回code为0表示成功", res);
284
283
  setTimeout(() => {
285
284
  console.log(
286
285
  "微信强制登录后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie"
287
286
  );
288
287
  this.getLoginCookie(`${Date.now()}`);
289
288
  }, 500);
290
289
  return res;
291
290
  });
292
291
  }
293
292
 
294
293
  doLoginForJdPin(options = {}) {
295
294
  return this.doLogin({
296
295
  loginColor: {
297
296
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
298
297
  dpin: 0,
299
298
  },
300
299
  ...options,
301
300
  });
302
301
  }
303
302
 
304
303
  getLoginCookie(updateKey = "wxapp") {
305
304
  return new Promise((resolve) => {
306
305
  console.log("开始获取更新wxapp中的cookie信息", updateKey);
307
306
  if (
308
307
  this.config.wqCookie &&
309
308
  this.config.wqCookieStr &&
310
309
  this.config.getWqCookieKey === updateKey
311
310
  ) {
312
311
  console.log("已有存储wxapp中的cookie信息,直接返回", this.config);
313
312
  resolve({
314
313
  wqCookie: this.config.wqCookie,
315
314
  wqCookieStr: this.config.wqCookieStr,
316
315
  });
317
316
  } else {
318
317
  if (isPublishToWxapp) {
319
318
  const getWxappCookieObj = getTaroStorageKeyValue("cookies") || null;
320
319
  if (getWxappCookieObj) {
321
320
  const getCookieObj = getWxappCookieObj["_data"];
322
321
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
323
322
  const {
324
323
  pin = "",
325
324
  visitkey = "-1",
326
325
  wq_unionid = "",
327
326
  wxapp_openid = "",
328
327
  } = wqCookie;
329
328
  this.info.loginState = true;
330
329
  this.info.userInfo.wqCookie = wqCookieStr;
331
330
  this.info.userInfo.wqVisitkey = visitkey;
332
331
  console.log("获取用户完整cookie信息", getCookieObj);
333
332
  const getUserAddress = this.wxAppUserInfoInstance.getAddress();
334
333
  console.log("获取微信用户地址信息", getUserAddress);
335
334
  if (getUserAddress) {
336
335
  this.info.pageInfo.address = getUserAddress?.areaId;
337
336
  this.info.pageInfo.addressCommaStr = this.info.pageInfo.address
338
337
  ? this.info.pageInfo.address.replace(/_/g, ",")
339
338
  : "";
340
339
  this.info.pageInfo.un_area = this.info.pageInfo.address;
341
340
  Taro.eventCenter.trigger(
342
341
  TaroEventType.USER_AREA_UPDATE,
343
342
  this.info.pageInfo.address
344
343
  );
345
344
  }
346
345
  if (this.miniAppLogInstance) {
347
346
  this.miniAppLogInstance.set({
348
347
  account: pin,
349
348
  unionid: wq_unionid,
350
349
  openid: wxapp_openid,
351
350
  });
352
351
  }
353
352
  this.config.wqCookie = wqCookie;
354
353
  this.config.wqCookieStr = wqCookieStr;
355
354
  this.config.getWqCookieKey = updateKey;
356
355
  console.log("解析wxapp中的cookie信息成功,返回后存储", this.config);
357
356
  resolve({
358
357
  wqCookie,
359
358
  wqCookieStr,
360
359
  });
361
360
  } else {
362
361
  console.log(
363
362
  "解析wxapp中的cookie信息异常,返回异常结果",
364
363
  this.config
365
364
  );
366
365
  resolve({
367
366
  wqCookie: false,
368
367
  wqCookieStr: false,
369
368
  });
370
369
  }
371
370
  } else {
372
371
  resolve({
373
372
  wqCookie: false,
374
373
  wqCookieStr: false,
375
374
  });
376
375
  }
377
376
  }
378
377
  });
379
378
  }
380
379
 
381
380
 
382
381
  checkLoginStatus() {
383
382
  return this.getLoginCookie();
384
383
  }
385
384
 
386
385
  getAddressCachePromise = () => {
387
386
  return Promise.reject("该方法只在APP内适用");
388
387
  };
389
388
 
390
389
  updatePageAndLogInfo(updateQuery = {}) {
391
390
  const createUpdateQueryInfo: {
392
391
  query: {
393
392
  shopId?: string | number;
394
393
  venderId?: string | number;
395
394
  };
396
395
  updateShopInfoState: boolean;
397
396
  } = Object.assign(
398
397
  {},
399
398
  {
400
399
  query: {},
401
400
  updateShopInfoState: false,
402
401
  },
403
402
  updateQuery
404
403
  );
405
404
  console.log(
406
405
  "获取当前下发的店铺查询参数",
407
406
  updateQuery,
408
407
  "获取之前保存的shopInfo店铺查询参数",
409
408
  this.info?.shopInfo
410
409
  );
411
410
  const { query, updateShopInfoState } = createUpdateQueryInfo;
412
411
  const { shopId, venderId } = query;
413
412
  if (updateShopInfoState) {
414
413
  this.info.queryInfo = {
415
414
  ...this.info.queryInfo,
416
415
  ...query,
417
416
  };
418
417
  if (shopId && venderId) {
419
418
  this.info.shopInfo = {
420
419
  shopId: `${shopId}`,
421
420
  venderId: `${venderId}`,
422
421
  };
423
422
  }
424
423
  } else {
425
424
  this.info.queryInfo = {
426
425
  ...query,
427
426
  };
428
427
  this.info.originQueryInfo = {
429
428
  ...query,
430
429
  };
431
430
  if (
432
431
  this.info.shopInfo?.shopId &&
433
432
  this.info.shopInfo?.venderId &&
434
433
  (this.info.shopInfo.shopId == shopId ||
435
434
  this.info.shopInfo.venderId == venderId)
436
435
  ) {
437
436
  this.info.queryInfo.shopId = this.info.shopInfo.shopId;
438
437
  this.info.queryInfo.venderId = this.info.shopInfo.venderId;
439
438
  console.log(
440
439
  "当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数",
441
440
  this.info.queryInfo
442
441
  );
443
442
  }
444
443
  }
445
444
  this.info.queryInfo["shopId"] &&
446
445
  (this.info.queryInfo["shopId"] = `${this.info.queryInfo["shopId"]}`);
447
446
  this.info.queryInfo["venderId"] &&
448
447
  (this.info.queryInfo["venderId"] = `${this.info.queryInfo["venderId"]}`);
449
448
  console.log(
450
449
  "weapp===获取店铺下发查询参数\n",
451
450
  query,
452
451
  "\n获取店铺最后查询参数\n",
453
452
  this.info.queryInfo,
454
453
  "\n是否为更新店铺状态\n",
455
454
  updateShopInfoState
456
455
  );
457
456
  }
458
457
 
459
458
  getDynamicConfig(key: string) {
460
459
  console.warn(
461
460
  "调用微信小程序的 getDynamicConfig(),注意,此方法还未实现!"
462
461
  );
463
462
  return null;
464
463
  }
465
464
  renderNextTickLoadSdk(){
466
465
  console.warn("暂未实现 index.weapp.ts")
467
466
  }
468
467
  loadOtherSdk(){
469
468
  console.warn('暂未实现 index.weapp.ts')
470
469
  }
471
470
  loadItemSdkPromise() {
472
471
  console.warn('暂未实现 index.weapp.ts')
473
472
  }
473
+ import Taro from '@tarojs/taro';
474
474
  WXAPP_LOGIN,
475
475
  WXAPP_BIZ,
476
476
  WXAPP_USER_INFO,
477
477
  WXAPP_NAVIGATOR,
478
478
  WXAPP_REPORT_GDT,
479
479
  WXAPP_PARAMS_SIGN,
480
480
  WXAPP_FINGER_REPORT,
481
481
  WXAPP_REPORT_MANAGE,
482
482
  WXAPP_SUBS_GUIDER,
483
483
  WXAPP_ADDRESS_V2_API,
484
484
  BUSINESS_TYPE,
485
485
  SHOP_MENU_ID_TYPE,
486
486
  SHOP_MENU_ID_NAME,
487
487
  SECTION_HOME_TAB_NAME_TYPE,
488
488
  SECTION_HOME_TAB_TYPE,
489
489
  TaroEventType,
490
490
  WX_BUSINESS_TYPE,
491
491
  WXAPP_BIZ_KEY,
492
492
  WXAPP_BIZ_SHOP_LIGHT_KEY,
493
493
  getSystemInfos,
494
494
  getTaroStorageKeyValue,
495
495
  getWxAppCookieStr,
496
496
  objectToUrlEncode,
497
497
  languageNowType,
498
498
  isAscfApp,
499
499
  abTestLabels: {},
500
500
  nonSellableSkuids: {},
501
501
  loginState: jdUserLoginState,
502
502
  cookiesStr: '',
503
503
  userInfo: userPinKey,
504
504
  isImmersive: false,
505
505
  baseAddCartSwitch: true,
506
506
  pageInfo: {
507
507
  wxBusinessType: WX_BUSINESS_TYPE.SHOP,
508
508
  address: '',
509
509
  addressCommaStr: '',
510
510
  un_area: '',
511
511
  fullAddress: '',
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
  const ptPin = this.wxAppLoginInstance.getPtPin();
818
818
  getCookieObj.pt_key = { name: 'pt_key', value: ptKey };
819
819
  getCookieObj.pt_pin = { name: 'pt_pin', value: ptPin };
820
820
  }
821
821
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
822
822
  const {
823
823
  pin = '',
824
824
  pt_pin = '',
825
825
  visitkey = '-1',
826
826
  wq_unionid = '',
827
827
  wxapp_openid = '',
828
828
  } = wqCookie;
829
829
  this.info.loginState = true;
830
830
  this.info.userInfo.wqCookie = wqCookieStr;
831
831
  this.info.userInfo.wqVisitkey = visitkey;
832
832
  console.log('获取用户完整cookie信息', getCookieObj);
833
833
  if (this.miniAppLogInstance && this.miniAppLogInstance.setCommon) {
834
834
  this.miniAppLogInstance.setCommon({
835
835
  account: pin || pt_pin,
836
836
  unionid: wq_unionid,
837
837
  openid: wxapp_openid,
838
838
  });
839
839
  }
840
840
  this.config.wqCookie = wqCookie;
841
841
  this.config.wqCookieStr = wqCookieStr;
842
842
  this.config.getWqCookieKey = updateKey;
843
843
  console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
844
844
  resolve({
845
845
  wqCookie,
846
846
  wqCookieStr,
847
847
  });
848
848
  } else {
849
849
  console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
850
850
  resolve({
851
851
  wqCookie: false,
852
852
  wqCookieStr: false,
853
853
  });
854
854
  }
855
855
  } else {
856
856
  resolve({
857
857
  wqCookie: false,
858
858
  wqCookieStr: false,
859
859
  });
860
860
  }
861
861
  }
862
862
  });
863
863
  }
864
864
 
865
865
 
866
866
  checkLoginStatus() {
867
867
  return this.getLoginCookie();
868
868
  }
869
869
 
870
870
  getAddressCachePromise = () => {
871
871
  return new Promise((resolve) => {
872
872
  if (this.info.sysInfo?.area) {
873
873
  resolve({
874
874
  lat: this.info.sysInfo?.lat,
875
875
  lng: this.info.sysInfo?.lng,
876
876
  area: this.info.sysInfo?.area,
877
877
  fullAddress: this?.info?.pageInfo?.fullAddress,
878
878
  });
879
879
  } else {
880
880
  const getUserAddress = this.wxAppUserInfoInstance.getAddress();
881
881
  if (getUserAddress) {
882
882
  const { areaId = '', addressName, latitude, longitude } = getUserAddress;
883
883
  this.info.sysInfo['lat'] = `${latitude || ''}`;
884
884
  this.info.sysInfo['lng'] = `${longitude || ''}`;
885
885
  const getEncodeFullAddress = addressName ? encodeURIComponent(addressName) : "";
886
886
  if (areaId && areaId !== '') {
887
887
  this.info.pageInfo.address = areaId;
888
888
  this.info.pageInfo.addressCommaStr = areaId.replace(/_/g, ',');
889
889
  this.info.pageInfo.un_area = areaId;
890
890
  const getUpdateData = {
891
891
  area: areaId,
892
892
  }
893
893
  if(addressName && addressName.length > 0) {
894
894
  getUpdateData.fullAddress = getEncodeFullAddress;
895
895
  this.info.pageInfo.fullAddress = getEncodeFullAddress;
896
896
  }
897
897
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, getUpdateData);
898
898
  this.info.sysInfo['area'] = areaId;
899
899
  }
900
900
  resolve({
901
901
  lat: this.info.sysInfo['lat'],
902
902
  lng: this.info.sysInfo['lng'],
903
903
  fullAddress: getEncodeFullAddress,
904
904
  area: areaId,
905
905
  });
906
906
  } else {
907
907
  resolve({ lat: '', lng: '', area: '', fullAddress: "" });
908
908
  }
909
909
  }
910
910
  });
911
911
  };
912
912
 
913
913
  getLbsAddressCachePromise(): Promise<{
914
914
  ok: boolean;
915
915
  msg?: string;
916
916
  realTimeArea: string;
917
917
  data?: any;
918
918
  }> {
919
919
  if (!this.lbsAddressCachePromise) {
920
920
  this.lbsAddressCachePromise = new Promise((resolve) => {
921
921
  const getWxappLbsAddressInfo = this.wxAppUserInfoInstance.getLbsAddress();
922
922
  console.info('京购原生获取用户基于lbs的缓存地址信息', getWxappLbsAddressInfo);
923
923
  if (getWxappLbsAddressInfo && getWxappLbsAddressInfo?.areaId !== '') {
924
924
  this.info.pageInfo.userLbsAddress = getWxappLbsAddressInfo?.areaId;
925
925
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
926
926
  realTimeArea: this.info.pageInfo.userLbsAddress,
927
927
  });
928
928
  resolve({
929
929
  ok: true,
930
930
  realTimeArea: getWxappLbsAddressInfo?.areaId || '',
931
931
  });
932
932
  } else {
933
933
  this.wxAppAddressV2apiInstance
934
934
  .fetchLbsAddr({
935
935
  token: 'W23b9sUlcnhCPZxQ2daYMkDqrTL0TeDw9tbDm5lVMVA=',
936
936
  from: 'wxapp_shop_real_area',
937
937
  })
938
938
  .then((res) => {
939
939
  console.info('微信京购里面获取静默实时lbs地址信息结果', res);
940
940
  const { provinceId, cityId, countyId, townId } = res;
941
941
  let realTimeArea = '';
942
942
  if (provinceId) {
943
943
  realTimeArea = `${provinceId}_${cityId || 0}_${countyId || 0}_${townId || 0}`;
944
944
  this.info.pageInfo.userLbsAddress = realTimeArea;
945
945
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
946
946
  realTimeArea: realTimeArea,
947
947
  });
948
948
  } else {
949
949
  this.lbsAddressCachePromise = null;
950
950
  }
951
951
  const getValidRealTimeArea = realTimeArea !== '';
952
952
  resolve({
953
953
  ok: getValidRealTimeArea,
954
954
  msg: getValidRealTimeArea
955
955
  ? '成功'
956
956
  : '根据微信底层接口获取静默实时lbs地址信息异常,详情见data',
957
957
  data: getValidRealTimeArea ? null : res,
958
958
  realTimeArea: realTimeArea,
959
959
  });
960
960
  })
961
961
  .catch((err) => {
962
962
  console.warn('微信京购里面获取静默实时lbs地址信息异常', err);
963
963
  this.lbsAddressCachePromise = null;
964
964
  resolve({
965
965
  ok: false,
966
966
  msg: '微信京购里面获取静默实时lbs地址信息异常',
967
967
  realTimeArea: '',
968
968
  });
969
969
  });
970
970
  }
971
971
  });
972
972
  }
973
973
  return this.lbsAddressCachePromise;
974
974
  }
975
975
 
976
976
  updatePageAndLogInfo(updateQuery = {}) {
977
977
  const createUpdateQueryInfo: {
978
978
  query: {
979
979
  shopId?: string | number;
980
980
  venderId?: string | number;
981
981
  };
982
982
  updateShopInfoState: boolean;
983
983
  } = Object.assign(
984
984
  {},
985
985
  {
986
986
  query: {},
987
987
  updateShopInfoState: false,
988
988
  },
989
989
  updateQuery,
990
990
  );
991
991
  console.log(
992
992
  '获取当前下发的店铺查询参数',
993
993
  updateQuery,
994
994
  '获取之前保存的shopInfo店铺查询参数',
995
995
  this.info?.shopInfo,
996
996
  );
997
997
  const { query, updateShopInfoState } = createUpdateQueryInfo;
998
998
  const { shopId, venderId } = query;
999
999
  if (updateShopInfoState) {
1000
1000
  this.info.queryInfo = {
1001
1001
  ...this.info.queryInfo,
1002
1002
  ...query,
1003
1003
  };
1004
1004
  if (shopId && venderId) {
1005
1005
  this.info.shopInfo = {
1006
1006
  shopId: `${shopId}`,
1007
1007
  venderId: `${venderId}`,
1008
1008
  };
1009
1009
  }
1010
1010
  } else {
1011
1011
  this.info.queryInfo = {
1012
1012
  ...query,
1013
1013
  };
1014
1014
  this.info.originQueryInfo = {
1015
1015
  ...query,
1016
1016
  };
1017
1017
  if (
1018
1018
  this.info.shopInfo?.shopId &&
1019
1019
  this.info.shopInfo?.venderId &&
1020
1020
  (this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
1021
1021
  ) {
1022
1022
  this.info.queryInfo.shopId = this.info.shopInfo.shopId;
1023
1023
  this.info.queryInfo.venderId = this.info.shopInfo.venderId;
1024
1024
  console.log(
1025
1025
  '当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
1026
1026
  this.info.queryInfo,
1027
1027
  );
1028
1028
  }
1029
1029
  }
1030
1030
  this.info.queryInfo['shopId'] &&
1031
1031
  (this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
1032
1032
  this.info.queryInfo['venderId'] &&
1033
1033
  (this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
1034
1034
  console.log(
1035
1035
  'weapp===获取店铺下发查询参数\n',
1036
1036
  query,
1037
1037
  '\n获取店铺最后查询参数\n',
1038
1038
  this.info.queryInfo,
1039
1039
  '\n是否为更新店铺状态\n',
1040
1040
  updateShopInfoState,
1041
1041
  );
1042
1042
  }
1043
1043
 
1044
1044
  getDynamicConfig(key: string) {
1045
1045
  console.warn('调用微信小程序的 getDynamicConfig(),注意,此方法还未实现!');
1046
1046
  return null;
1047
1047
  }
1048
1048
  renderNextTickLoadSdk() {
1049
1049
  console.warn('暂未实现 index.weapp.ts');
1050
1050
  }
1051
1051
  loadOtherSdk() {
1052
1052
  console.warn('暂未实现 index.weapp.ts');
1053
1053
  }
1054
1054
  loadItemSdkPromise() {
1055
1055
  console.warn('暂未实现 index.weapp.ts');
1056
1056
  }
1057
1057
  createLanguageProimse() {
1058
1058
  return Promise.reject({
1059
1059
  msg: '暂未实现',
1060
1060
  });
1061
1061
  }