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

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