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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) 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/index.h5.ts +1 -1
  13. package/dist/common/token/token.jd.ts +1 -1
  14. package/dist/common/wxappApi.ascf.ts +1 -0
  15. package/dist/components/ErrorBoundary.tsx +1 -1
  16. package/dist/components/base/CountDown/index.tsx +1 -1
  17. package/dist/components/base/CustomVideo/index.tsx +1 -1
  18. package/dist/components/base/CustomVideo/index.weapp.tsx +1 -0
  19. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  20. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  21. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  22. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  23. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  24. package/dist/components/base/JdLoading/index.module.scss +0 -2
  25. package/dist/components/base/JdLoading/index.tsx +1 -1
  26. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  27. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  28. package/dist/components/base/LazyLoadImage/index.tsx +1 -1
  29. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  30. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  31. package/dist/components/base/NetworkDataError/const.ts +1 -1
  32. package/dist/components/base/NetworkDataError/index.module.scss +1 -1
  33. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  34. package/dist/components/base/Price/Base/index.tsx +1 -1
  35. package/dist/components/base/Price/Double/index.module.scss +1 -1
  36. package/dist/components/base/Price/Double/index.tsx +1 -1
  37. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  38. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  39. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  40. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  41. package/dist/components/floorItem.tsx +1 -1
  42. package/dist/components/isv/Floor/index.tsx +1 -1
  43. package/dist/components/remoteFloorItem.tsx +1 -1
  44. package/dist/config/env.ts +1 -1
  45. package/dist/interface/common.ts +1 -1
  46. package/dist/interface/component.ts +1 -1
  47. package/dist/interface/jumpEventReport.ts +1 -1
  48. package/dist/interface/service.ts +1 -1
  49. package/dist/jumpEventReport/base.ts +1 -1
  50. package/dist/jumpEventReport/const.ts +1 -1
  51. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  52. package/dist/jumpEventReport/index.h5.ts +1 -1
  53. package/dist/jumpEventReport/index.ts +1 -1
  54. package/dist/jumpEventReport/index.weapp.ts +1 -1
  55. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  56. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  57. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  58. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  59. package/dist/jumpEventReport/web/report.ts +1 -1
  60. package/dist/jumpEventReport/web.base.ts +1 -1
  61. package/dist/jumpEventReport/web.jd.ts +1 -1
  62. package/dist/jumpEventReport/web.pc.ts +1 -1
  63. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  64. package/dist/language/en_US.json +233 -83
  65. package/dist/language/zh_CN.json +232 -82
  66. package/dist/language/zh_HK.json +232 -82
  67. package/dist/libs/openShopBridge.js +161 -0
  68. package/dist/libs/openShopBridge.min.js +1 -0
  69. package/dist/libs/taroAppReport.js +2 -2
  70. package/dist/modules/ContainerFloorList/index.h5.module.scss +16 -2
  71. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  72. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  73. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  74. package/dist/open/api/index.ts +1 -1
  75. package/dist/open/api/shopMember.ts +1 -1
  76. package/dist/open/api/shopMember.weapp.ts +1 -0
  77. package/dist/open/api/track.ts +1 -1
  78. package/dist/open/api/util.ts +1 -1
  79. package/dist/open/components/index.ts +1 -1
  80. package/dist/open/index.ts +1 -1
  81. package/dist/sass/app.h5.scss +6 -1
  82. package/dist/sass/base.scss +8 -4
  83. package/dist/service/fetchGateway.ts +1 -1
  84. package/dist/service/fetchGateway.weapp.ts +1 -1
  85. package/dist/service/fetchJsonp.ts +1 -1
  86. package/dist/service/fetchJsonp.weapp.ts +1 -0
  87. package/dist/service/http/h5Http.ts +1 -1
  88. package/dist/service/http/http.ts +1 -1
  89. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  90. package/dist/service/requestServer.h5.ts +1 -1
  91. package/dist/service/requestServer.ts +1 -1
  92. package/dist/service/requestServer.weapp.ts +1 -1
  93. package/dist/utils/connectNativeJsBridge.ts +1 -1
  94. package/dist/utils/h5Utils.ts +1 -1
  95. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  96. package/dist/utils/harmonyCallRouter.ts +0 -0
  97. package/dist/utils/index.h5.ts +1 -1
  98. package/dist/utils/index.ts +1 -1
  99. package/dist/utils/index.weapp.ts +1 -1
  100. package/dist/utils/intersectionObserver.ts +1 -1
  101. package/dist/utils/sColor.weapp.ts +1 -0
  102. package/dist/utils/utils.ts +1 -1
  103. package/package.json +36 -38
  104. package/dist/common/index.dynamic.ts +0 -1
  105. package/dist/components/base/Dialog/index.dynamic.module.scss +0 -126
  106. package/dist/components/base/Dialog/index.dynamic.tsx +0 -1
  107. package/dist/components/base/DynamicTest/index.dynamic.module.scss +0 -15
  108. package/dist/components/base/DynamicTest/index.module.scss +0 -16
  109. package/dist/components/base/DynamicTest/index.tsx +0 -1
  110. package/dist/components/base/LazyLoadImage/index.dynamic.module.scss +0 -40
  111. package/dist/components/base/LazyLoadImage/index.dynamic.tsx +0 -1
  112. package/dist/components/base/NetworkDataError/index.dynamic.module.scss +0 -95
  113. package/dist/components/base/NetworkDataError/index.dynamic.tsx +0 -1
  114. package/dist/components/base/Price/Base/index.dynamic.module.scss +0 -63
  115. package/dist/components/base/Price/Base/index.dynamic.tsx +0 -1
  116. package/dist/components/base/Price/Double/index.dynamic.module.scss +0 -172
  117. package/dist/components/base/Price/Double/index.dynamic.tsx +0 -1
  118. package/dist/jumpEventReport/index.dynamic.ts +0 -1
  119. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  120. package/dist/open/api/shopMember.dynamic.ts +0 -1
  121. package/dist/open/components/index.dynamic.ts +0 -1
  122. package/dist/sass/app.dynamic.scss +0 -306
  123. package/dist/service/fetchGateway.h5.ts +0 -1
  124. package/dist/service/fetchJsonp.h5.ts +0 -1
  125. package/dist/service/http/colorSign.dynamic.ts +0 -1
  126. package/dist/utils/connectNativeJsBridge.dynamic.ts +0 -1
  127. package/dist/utils/priceUtils.js +0 -1
  128. /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
  isAscfApp,
578
578
  abTestLabels: {},
579
579
  nonSellableSkuids: {},
580
580
  loginState: jdUserLoginState,
581
581
  cookiesStr: '',
582
582
  userInfo: userPinKey,
583
583
  isImmersive: false,
584
584
  baseAddCartSwitch: true,
585
585
  pageInfo: {
586
586
  wxBusinessType: WX_BUSINESS_TYPE.SHOP,
587
587
  address: '',
588
588
  addressCommaStr: '',
589
589
  un_area: '',
590
590
  userLbsAddress: '',
591
591
  vapptype: '1',
592
592
  pageType: 'home',
593
593
  dataType: BUSINESS_TYPE.ONLINE,
594
594
  floorExposureInfo: {},
595
595
  floorVideInfo: {},
596
596
  productVideInfo: {},
597
597
  tabsLoadAllDataInfo: {
598
598
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: false,
599
599
  [SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
600
600
  },
601
601
  updateShopInfosAllState: false,
602
602
  isVipShop: false,
603
603
  isJdShowNativeImmersivePlayer: false,
604
604
  isSuperBrandShop: false,
605
605
  ...shopConfig,
606
606
  pageScrollTop: 0,
607
607
  pageIdxHeightInfo: {
608
608
  list: [],
609
609
  },
610
610
  shopNavBarHeight: 0,
611
611
  },
612
612
  defaultQueryLogInfo: {
613
613
  sourceType: 'JDshop',
614
614
  sourceValue: '',
615
615
  moduleId: 'none',
616
616
  entrance: 'none',
617
617
  },
618
618
  originQueryInfo: {},
619
619
  sysInfo: {
620
620
  windowWidth: 0,
621
621
  windowHeight: 0,
622
622
  netWorkType: '4g',
623
623
  jdBottomBarHeight: 0,
624
624
  jdNativeHeaderHeight: 0,
625
625
  },
626
626
  queryInfo: {},
627
627
  shopInfo: {},
628
628
  openAppData: {},
629
629
  public info: CommonInterFace.BaseConfigInfo;
630
630
  public config: {
631
631
  [key: string]: any;
632
632
  };
633
633
  public lazyContainer: CommonInterFace.lazyContainer;
634
634
  public rootEleNode: HTMLElement | null;
635
635
  public miniApplogUtil: CommonInterFace.MiniApplogUtil;
636
636
  public miniAppLogInstance: CommonInterFace.MiniAppLog | null;
637
637
  public checkStatusAndLoginPromise: object | null;
638
638
  public wxAppLoginInstance: CommonInterFace.WxAppLogin;
639
639
  public wxAppBizInstance: CommonInterFace.WxAppUserInfo;
640
640
  public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo;
641
641
  public wxAppReportManageInstance: CommonInterFace.wxAppReportManage;
642
642
  public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT;
643
643
  public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator;
644
644
  public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign;
645
645
  public wxAppFingerReportInstance: CommonInterFace.wxAppParamsSign;
646
646
  public wxAppSubsGuider: CommonInterFace.wxAppParamsSign;
647
647
  public wxAppAddressV2apiInstance: CommonInterFace.wxAppAddressV2api;
648
648
  public loadJsSdkList: Array<any>;
649
649
  public loadJsSdkListCachePromise: any;
650
650
  public lbsAddressCachePromise: Promise<any> | null;
651
651
  public languageJsonData: any | null;
652
652
  public businessWorkerReady: boolean;
653
653
  public jdWorkerReadyPromise: any | null;
654
654
  constructor(opt) {
655
655
  this.info = this._getConfig(opt);
656
656
  this.config = {};
657
657
  this.lazyContainer = {
658
658
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
659
659
  appLazyContainerList: [],
660
660
  appLazyFinishContainerList: [],
661
661
  },
662
662
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
663
663
  appLazyContainerList: [],
664
664
  appLazyFinishContainerList: [],
665
665
  },
666
666
  };
667
667
  this.loadJsSdkList = [];
668
668
  this.loadJsSdkListCachePromise = {};
669
669
  this.rootEleNode = null;
670
670
  this.miniApplogUtil = MiniAppLogUtil;
671
671
  this.miniAppLogInstance = null;
672
672
  this.checkStatusAndLoginPromise = null;
673
673
  this.wxAppLoginInstance = WXAPP_LOGIN;
674
674
  this.wxAppBizInstance = WXAPP_BIZ;
675
675
  this.wxAppUserInfoInstance = WXAPP_USER_INFO;
676
676
  this.wxAppReportManageInstance = WXAPP_REPORT_MANAGE;
677
677
  this.wxAppReportGDTInstance = WXAPP_REPORT_GDT;
678
678
  this.wxAppNavigatorInstance = WXAPP_NAVIGATOR;
679
679
  this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN;
680
680
  this.wxAppFingerReportInstance = WXAPP_FINGER_REPORT ? new WXAPP_FINGER_REPORT() : {};
681
681
  this.wxAppSubsGuider = WXAPP_SUBS_GUIDER;
682
682
  this.wxAppAddressV2apiInstance = WXAPP_ADDRESS_V2_API;
683
683
  this.lbsAddressCachePromise = null;
684
684
  this.languageJsonData = langeJsonDataForCn;
685
685
  this.businessWorkerReady = false;
686
686
  this.jdWorkerReadyPromise = Promise.resolve(false);
687
687
  }
688
688
  _getConfig(opt) {
689
689
  return Object.assign({}, DefaultConfig, opt);
690
690
  }
691
691
  loadApiSafeSteadyReayPromise() {
692
692
  return Promise.resolve(true);
693
693
  }
694
694
  loadH5tagReayPromise() {
695
695
  return Promise.resolve(true);
696
696
  }
697
697
 
698
698
  jmfeReayPromise(): Promise<any> {
699
699
  return Promise.reject(false);
700
700
  }
701
701
 
702
702
  taskTimeoutPromise(callBack, timeout = 2000) {
703
703
  return new Promise((resolve) => {
704
704
  setTimeout(() => {
705
705
  const getCallBackRes = typeof callBack === 'function' && callBack();
706
706
  return resolve(getCallBackRes || false);
707
707
  }, timeout);
708
708
  });
709
709
  }
710
710
 
711
711
  updateBusinessDomainAndApi(domain, api) {
712
712
  console.log('=================>', 'updateBusinessDomainAndApi');
713
713
  }
714
714
 
715
715
  getFullScreenHeight(systemInfo) {
716
716
  const { screenHeight, statusBarHeight, isAndroid } = systemInfo;
717
717
  let result = screenHeight;
718
718
  if (statusBarHeight > 20 && isAndroid) {
719
719
  result = screenHeight + statusBarHeight;
720
720
  }
721
721
  return result;
722
722
  }
723
723
 
724
724
  getTabBarHeight(systemInfo) {
725
725
  const { statusBarHeight, isAndroid, isIOS } = systemInfo;
726
726
  let result = 50;
727
727
  if (statusBarHeight > 20) {
728
728
  if (isIOS) {
729
729
  result = 84;
730
730
  } else if (isAndroid) {
731
731
  result = 53;
732
732
  }
733
733
  }
734
734
  return result;
735
735
  }
736
736
 
737
737
  getSystemInfo() {
738
738
  const info: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfos() || {};
739
739
  const actualNavBarHeight = (info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0);
740
740
  const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0);
741
741
  const fullScreenHeight = this.getFullScreenHeight(info);
742
742
  const tabBarHeight = this.getTabBarHeight(info);
743
743
  const safeContentHeight = fullScreenHeight - headerHeight;
744
744
  this.info.sysInfo = {
745
745
  ...this.info.sysInfo,
746
746
  ...info,
747
747
  actualNavBarHeight,
748
748
  headerHeight,
749
749
  fullScreenHeight,
750
750
  tabBarHeight,
751
751
  safeContentHeight,
752
752
  languageType: languageNowType,
753
753
  };
754
754
  if (this.info.sysInfo['hostVersionName']) {
755
755
  this.info.sysInfo['hostAppVersion'] = Number(
756
756
  this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
757
757
  );
758
758
  }
759
759
  if (isPublishToWxapp) {
760
760
  this.getAddressCachePromise();
761
761
  this.getLbsAddressCachePromise();
762
762
  }
763
763
  this.info.sysInfo['wifiVideoAutoPlay'] = false;
764
764
  this.getNetWorkType();
765
765
  console.log('获取系统信息', this.info.sysInfo);
766
766
  }
767
767
  async updateMPaasConfig() {}
768
768
 
769
769
  getNetWorkType() {
770
770
  Taro.getNetworkType().then((getRes) => {
771
771
  getRes && getRes.networkType && (this.info.sysInfo['netWorkType'] = getRes.networkType);
772
772
  });
773
773
  }
774
774
  getAPPUseStraightCorner() {
775
775
  return Promise.resolve(false);
776
776
  }
777
777
 
778
778
  checkStatusAndLogin(options = {}) {
779
779
  this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
780
780
  console.log('微信小程序登录状态及获取cookie状态的promise,之前登录状态', this.info.loginState);
781
781
  this.toLogin(options)
782
782
  .then((res) => {
783
783
  console.log('微信小程序登录状态结果,成功', res);
784
784
  this.info.loginState = true;
785
785
  resolve(res);
786
786
  })
787
787
  .catch((err) => {
788
788
  console.log('微信小程序登录异常状态结果', err);
789
789
  this.doLogin(options)
790
790
  .then((res2) => {
791
791
  console.log('微信小程序wxDoLogin强制登陆成功:', res2);
792
792
  this.info.loginState = true;
793
793
  resolve(res2);
794
794
  })
795
795
  .catch((err2) => {
796
796
  console.log('微信小程序wxDoLogin强制登陆失败:', err2);
797
797
  this.checkStatusAndLoginPromise = null;
798
798
  reject(err2);
799
799
  });
800
800
  });
801
801
  });
802
802
  return this.checkStatusAndLoginPromise;
803
803
  }
804
804
 
805
805
  checkJdStatusAndLogin(
806
806
  options = {
807
807
  loginColor: {
808
808
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
809
809
  dpin: 0,
810
810
  },
811
811
  },
812
812
  ) {
813
813
  return this.checkStatusAndLogin(options);
814
814
  }
815
815
 
816
816
  toLogin(options = {}): Promise<any> {
817
817
  return this.wxAppLoginInstance
818
818
  .getLoginPromise({
819
819
  mode: 'common',
820
820
  loginColor: {
821
821
  biz: WXAPP_BIZ_KEY,
822
822
  dpin: 1,
823
823
  },
824
824
  ...options,
825
825
  })
826
826
  .then((res) => {
827
827
  console.log('微信app登录返回信息,微信侧返回code为0表示成功', res);
828
828
  setTimeout(() => {
829
829
  console.log(
830
830
  '微信app登录返回成功后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie',
831
831
  );
832
832
  this.getLoginCookie(`${Date.now()}`);
833
833
  }, 500);
834
834
  })
835
835
  .catch((err) => {
836
836
  console.log('微信app登录异常返回信息,也获取cookie', err);
837
837
  this.getLoginCookie(`${Date.now()}`);
838
838
  });
839
839
  }
840
840
 
841
841
  doLogin(options = {}) {
842
842
  const getParams = {
843
843
  loginColor: {
844
844
  biz: WXAPP_BIZ_KEY,
845
845
  dpin: 1,
846
846
  },
847
847
  ...options,
848
848
  };
849
849
  if (isPublishToWxapp) {
850
850
  getParams['returnUrl'] = `/pages/shopx/pages/index/index?${objectToUrlEncode({
851
851
  ...this.info.originQueryInfo,
852
852
  loadShopxType: 'redirect',
853
853
  })}`;
854
854
  }
855
855
  return this.wxAppLoginInstance.doLogin(getParams).then((res) => {
856
856
  console.log('微信小程序强制登录返回信息,微信侧返回code为0表示成功', res);
857
857
  setTimeout(() => {
858
858
  console.log('微信强制登录后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie');
859
859
  this.getLoginCookie(`${Date.now()}`);
860
860
  }, 500);
861
861
  return res;
862
862
  });
863
863
  }
864
864
 
865
865
  doLoginForJdPin(options = {}) {
866
866
  return this.doLogin({
867
867
  loginColor: {
868
868
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
869
869
  dpin: 0,
870
870
  },
871
871
  ...options,
872
872
  });
873
873
  }
874
874
 
875
875
  getLoginCookie(updateKey = 'wxapp') {
876
876
  return new Promise(async (resolve) => {
877
877
  console.log('开始获取更新wxapp中的cookie信息', updateKey);
878
878
  if (
879
879
  this.config.wqCookie &&
880
880
  this.config.wqCookieStr &&
881
881
  this.config.getWqCookieKey === updateKey
882
882
  ) {
883
883
  console.log('已有存储wxapp中的cookie信息,直接返回', this.config);
884
884
  resolve({
885
885
  wqCookie: this.config.wqCookie,
886
886
  wqCookieStr: this.config.wqCookieStr,
887
887
  });
888
888
  } else {
889
889
  if (isPublishToWxapp) {
890
890
  const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null;
891
891
  if (getWxappCookieObj) {
892
892
  const getCookieObj = getWxappCookieObj['_data'];
893
893
  if (isAscfApp) {
894
894
  const ptKey = this.wxAppLoginInstance.getPtKey();
895
895
  const ptPin = this.wxAppLoginInstance.getPtPin();
896
896
  getCookieObj.pt_key = { name: 'pt_key', value: ptKey };
897
897
  getCookieObj.pt_pin = { name: 'pt_pin', value: ptPin };
898
898
  }
899
899
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
900
900
  const {
901
901
  pin = '',
902
902
  pt_pin = '',
903
903
  visitkey = '-1',
904
904
  wq_unionid = '',
905
905
  wxapp_openid = '',
906
906
  } = wqCookie;
907
907
  this.info.loginState = true;
908
908
  this.info.userInfo.wqCookie = wqCookieStr;
909
909
  this.info.userInfo.wqVisitkey = visitkey;
910
910
  console.log('获取用户完整cookie信息', getCookieObj);
911
911
  if (this.miniAppLogInstance && this.miniAppLogInstance.setCommon) {
912
912
  this.miniAppLogInstance.setCommon({
913
913
  account: pin || pt_pin,
914
914
  unionid: wq_unionid,
915
915
  openid: wxapp_openid,
916
916
  });
917
917
  }
918
918
  this.config.wqCookie = wqCookie;
919
919
  this.config.wqCookieStr = wqCookieStr;
920
920
  this.config.getWqCookieKey = updateKey;
921
921
  console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
922
922
  resolve({
923
923
  wqCookie,
924
924
  wqCookieStr,
925
925
  });
926
926
  } else {
927
927
  console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
928
928
  resolve({
929
929
  wqCookie: false,
930
930
  wqCookieStr: false,
931
931
  });
932
932
  }
933
933
  } else {
934
934
  resolve({
935
935
  wqCookie: false,
936
936
  wqCookieStr: false,
937
937
  });
938
938
  }
939
939
  }
940
940
  });
941
941
  }
942
942
 
943
943
 
944
944
  checkLoginStatus() {
945
945
  return this.getLoginCookie();
946
946
  }
947
947
 
948
948
  getAddressCachePromise = () => {
949
949
  return new Promise((resolve) => {
950
950
  if (this.info.sysInfo?.area) {
951
951
  resolve({
952
952
  lat: this.info.sysInfo?.lat,
953
953
  lng: this.info.sysInfo?.lng,
954
954
  area: this.info.sysInfo?.area,
955
955
  });
956
956
  } else {
957
957
  const getUserAddress = this.wxAppUserInfoInstance.getAddress();
958
958
  console.info('京购原生获取用户基地址信息', getUserAddress);
959
959
  if (getUserAddress) {
960
960
  const { areaId = '', latitude, longitude } = getUserAddress;
961
961
  this.info.sysInfo['lat'] = `${latitude || ''}`;
962
962
  this.info.sysInfo['lng'] = `${longitude || ''}`;
963
963
  if (areaId && areaId !== '') {
964
964
  this.info.pageInfo.address = areaId;
965
965
  this.info.pageInfo.addressCommaStr = areaId.replace(/_/g, ',');
966
966
  this.info.pageInfo.un_area = areaId;
967
967
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
968
968
  area: areaId,
969
969
  });
970
970
  this.info.sysInfo['area'] = areaId;
971
971
  }
972
972
  resolve({
973
973
  lat: this.info.sysInfo['lat'],
974
974
  lng: this.info.sysInfo['lng'],
975
975
  area: areaId,
976
976
  });
977
977
  } else {
978
978
  resolve({ lat: '', lng: '', area: '' });
979
979
  }
980
980
  }
981
981
  });
982
982
  };
983
983
 
984
984
  getLbsAddressCachePromise(): Promise<{
985
985
  ok: boolean;
986
986
  msg?: string;
987
987
  realTimeArea: string;
988
988
  data?: any;
989
989
  }> {
990
990
  if (!this.lbsAddressCachePromise) {
991
991
  this.lbsAddressCachePromise = new Promise((resolve) => {
992
992
  const getWxappLbsAddressInfo = this.wxAppUserInfoInstance.getLbsAddress();
993
993
  console.info('京购原生获取用户基于lbs的缓存地址信息', getWxappLbsAddressInfo);
994
994
  if (getWxappLbsAddressInfo && getWxappLbsAddressInfo?.areaId !== '') {
995
995
  this.info.pageInfo.userLbsAddress = getWxappLbsAddressInfo?.areaId;
996
996
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
997
997
  realTimeArea: this.info.pageInfo.userLbsAddress,
998
998
  });
999
999
  resolve({
1000
1000
  ok: true,
1001
1001
  realTimeArea: getWxappLbsAddressInfo?.areaId || '',
1002
1002
  });
1003
1003
  } else {
1004
1004
  this.wxAppAddressV2apiInstance
1005
1005
  .fetchLbsAddr({
1006
1006
  token: 'W23b9sUlcnhCPZxQ2daYMkDqrTL0TeDw9tbDm5lVMVA=',
1007
1007
  from: 'wxapp_shop_real_area',
1008
1008
  })
1009
1009
  .then((res) => {
1010
1010
  console.info('微信京购里面获取静默实时lbs地址信息结果', res);
1011
1011
  const { provinceId, cityId, countyId, townId } = res;
1012
1012
  let realTimeArea = '';
1013
1013
  if (provinceId) {
1014
1014
  realTimeArea = `${provinceId}_${cityId || 0}_${countyId || 0}_${townId || 0}`;
1015
1015
  this.info.pageInfo.userLbsAddress = realTimeArea;
1016
1016
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
1017
1017
  realTimeArea: realTimeArea,
1018
1018
  });
1019
1019
  } else {
1020
1020
  this.lbsAddressCachePromise = null;
1021
1021
  }
1022
1022
  const getValidRealTimeArea = realTimeArea !== '';
1023
1023
  resolve({
1024
1024
  ok: getValidRealTimeArea,
1025
1025
  msg: getValidRealTimeArea
1026
1026
  ? '成功'
1027
1027
  : '根据微信底层接口获取静默实时lbs地址信息异常,详情见data',
1028
1028
  data: getValidRealTimeArea ? null : res,
1029
1029
  realTimeArea: realTimeArea,
1030
1030
  });
1031
1031
  })
1032
1032
  .catch((err) => {
1033
1033
  console.warn('微信京购里面获取静默实时lbs地址信息异常', err);
1034
1034
  this.lbsAddressCachePromise = null;
1035
1035
  resolve({
1036
1036
  ok: false,
1037
1037
  msg: '微信京购里面获取静默实时lbs地址信息异常',
1038
1038
  realTimeArea: '',
1039
1039
  });
1040
1040
  });
1041
1041
  }
1042
1042
  });
1043
1043
  }
1044
1044
  return this.lbsAddressCachePromise;
1045
1045
  }
1046
1046
 
1047
1047
  updatePageAndLogInfo(updateQuery = {}) {
1048
1048
  const createUpdateQueryInfo: {
1049
1049
  query: {
1050
1050
  shopId?: string | number;
1051
1051
  venderId?: string | number;
1052
1052
  };
1053
1053
  updateShopInfoState: boolean;
1054
1054
  } = Object.assign(
1055
1055
  {},
1056
1056
  {
1057
1057
  query: {},
1058
1058
  updateShopInfoState: false,
1059
1059
  },
1060
1060
  updateQuery,
1061
1061
  );
1062
1062
  console.log(
1063
1063
  '获取当前下发的店铺查询参数',
1064
1064
  updateQuery,
1065
1065
  '获取之前保存的shopInfo店铺查询参数',
1066
1066
  this.info?.shopInfo,
1067
1067
  );
1068
1068
  const { query, updateShopInfoState } = createUpdateQueryInfo;
1069
1069
  const { shopId, venderId } = query;
1070
1070
  if (updateShopInfoState) {
1071
1071
  this.info.queryInfo = {
1072
1072
  ...this.info.queryInfo,
1073
1073
  ...query,
1074
1074
  };
1075
1075
  if (shopId && venderId) {
1076
1076
  this.info.shopInfo = {
1077
1077
  shopId: `${shopId}`,
1078
1078
  venderId: `${venderId}`,
1079
1079
  };
1080
1080
  }
1081
1081
  } else {
1082
1082
  this.info.queryInfo = {
1083
1083
  ...query,
1084
1084
  };
1085
1085
  this.info.originQueryInfo = {
1086
1086
  ...query,
1087
1087
  };
1088
1088
  if (
1089
1089
  this.info.shopInfo?.shopId &&
1090
1090
  this.info.shopInfo?.venderId &&
1091
1091
  (this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
1092
1092
  ) {
1093
1093
  this.info.queryInfo.shopId = this.info.shopInfo.shopId;
1094
1094
  this.info.queryInfo.venderId = this.info.shopInfo.venderId;
1095
1095
  console.log(
1096
1096
  '当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
1097
1097
  this.info.queryInfo,
1098
1098
  );
1099
1099
  }
1100
1100
  }
1101
1101
  this.info.queryInfo['shopId'] &&
1102
1102
  (this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
1103
1103
  this.info.queryInfo['venderId'] &&
1104
1104
  (this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
1105
1105
  console.log(
1106
1106
  'weapp===获取店铺下发查询参数\n',
1107
1107
  query,
1108
1108
  '\n获取店铺最后查询参数\n',
1109
1109
  this.info.queryInfo,
1110
1110
  '\n是否为更新店铺状态\n',
1111
1111
  updateShopInfoState,
1112
1112
  );
1113
1113
  }
1114
1114
 
1115
1115
  getDynamicConfig(key: string) {
1116
1116
  console.warn('调用微信小程序的 getDynamicConfig(),注意,此方法还未实现!');
1117
1117
  return null;
1118
1118
  }
1119
1119
  renderNextTickLoadSdk() {
1120
1120
  console.warn('暂未实现 index.weapp.ts');
1121
1121
  }
1122
1122
  loadOtherSdk() {
1123
1123
  console.warn('暂未实现 index.weapp.ts');
1124
1124
  }
1125
1125
  loadItemSdkPromise() {
1126
1126
  console.warn('暂未实现 index.weapp.ts');
1127
1127
  }
1128
1128
  createLanguageProimse() {
1129
1129
  return Promise.reject({
1130
1130
  msg: '暂未实现',
1131
1131
  });
1132
1132
  }